lf_interop_real_browser.py: Add API retries, endpoint monitoring, and fix CLI examples - #82
Open
GSMPraneeth-candela wants to merge 4 commits into
Open
lf_interop_real_browser.py: Add API retries, endpoint monitoring, and fix CLI examples#82GSMPraneeth-candela wants to merge 4 commits into
GSMPraneeth-candela wants to merge 4 commits into
Conversation
…ting test
- Add `json_get_with_retry()` helper method to retry GET requests every 5 seconds for up to 40
seconds if LANforge returns `None`.
- Replace direct `json_get()` calls with `json_get_with_retry()` across critical endpoints
(`/ports`, `/resource`, `/adb`, `/port/{shelf}/{resource}/{port}`).
- Add robust error handling (`KeyError` and `Exception` checks) around accessing `interfaces`,
`devices`, and port data to log detailed JSON responses and exit cleanly on malformed or missing data.
VERIFIED CLI: python3 lf_interop_real_browser_test.py --mgr 192.168.245.117
--url "https://google.com" --duration 1m --debug
--upstream_port 1.1.eth1 --device_list 1.113
Signed-off-by: GSMPraneeth-candela <praneeth.gude@candelatech.com>
…onitoring - Add monitor_endpoint_status_changes() to track status transitions across created generic endpoints. - Log status changes and append timestamped rows (timestamp, endpoint_name, status) to endpoint_status_changes.csv only when an endpoint's status changes. - Call monitor_endpoint_status_changes() during test execution and statistics collection loops. - Ensure endpoint_status_changes.csv is tracked and copied into final report directories. Signed-off-by: GSMPraneeth-candela <praneeth.gude@candelatech.com>
- The url's in few example cli's, are not working, the correct url should be starting with https:// and not www. VERIFIED CLI: python3 lf_interop_real_browser_test.py --mgr 192.168.245.117 --url "https://google.com" --duration 1m --debug --upstream_port 1.1.eth1 --device_list 1.113 Signed-off-by: GSMPraneeth-candela <praneeth.gude@candelatech.com>
…tries - After monitor_endpoint_status_changes() exits when no endpoint data is recieved, finally block executes, but iot_summary is not defined yet which throws undefined error and no report is generated - To fix this, iot_summary is defined in main() before try VERIFIED CLI: python3 lf_interop_real_browser_test.py --mgr 192.168.245.117 --url "https://google.com" --duration 1m --debug --upstream_port 1.1.eth1 Signed-off-by: GSMPraneeth-candela <praneeth.gude@candelatech.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR improves the stability and debugging capabilities of the lf_interop_real_browser_test.py script.
Key Changes:
• API Retries & Error Handling: Added a retry mechanism (json_get_with_retry) for LANforge API calls. It retries GET requests for up to 40 seconds to prevent the test from aborting early due to temporary API failures, and adds better
error
logging for malformed data.
• Endpoint Status Monitoring: Added a feature to track generic endpoint status changes. Transitions are now logged to an endpoint_status_changes.csv file, which is saved in the final report directory.
• Documentation Fix: Corrected the URLs in the example CLI commands to start with https:// instead of www. so they work out of the box.