Skip to content

lf_interop_real_browser.py: Add API retries, endpoint monitoring, and fix CLI examples - #82

Open
GSMPraneeth-candela wants to merge 4 commits into
masterfrom
real_browser_api_logs
Open

lf_interop_real_browser.py: Add API retries, endpoint monitoring, and fix CLI examples#82
GSMPraneeth-candela wants to merge 4 commits into
masterfrom
real_browser_api_logs

Conversation

@GSMPraneeth-candela

Copy link
Copy Markdown
Collaborator

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.

…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant