Issue Summary:
Improve the robustness and clarity of the FTP connection handling in test_meter_connection.sh to address issues with incorrect or unstable IP addresses.
Proposed Changes:
Validate IP Address Format:
Ensure the provided meter_ip is in a valid IPv4 format before attempting a connection.
Implement Retry Mechanism:
Add a retry mechanism to attempt connecting to the meter up to 3 times, with a 5-second delay between attempts.
Set Connection Timeout:
Use a 10-second timeout for each lftp command to prevent hanging indefinitely on connection attempts.
Detailed Logging:
Enhance logging to provide detailed output for each connection attempt, including lftp errors for diagnostic purposes.
Graceful Failure Handling:
If all connection attempts fail, log a detailed error and exit using the fail function with EXIT_LFTP_FAIL code.
Benefits:
Increases resilience to transient network issues.
Provides clear diagnostics and error messages.
Prevents the script from hanging indefinitely.
Catches and reports invalid IP addresses early.
Tasks:
[ ] Implement the changes in the script.
[ ] Test with various IP addresses to ensure robustness.
[ ] Update documentation to reflect new connection handling behavior.
Issue Summary: Improve the robustness and clarity of the FTP connection handling in
test_meter_connection.sh
to address issues with incorrect or unstable IP addresses.Proposed Changes:
Benefits:
Tasks: