LFUtils: Replace nc_show_ports with show_ports in wait_until_ports_appear to enable caching

Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
This commit is contained in:
Matthew Stidham
2022-01-18 12:15:03 -08:00
committed by shivam
parent e709fd711c
commit 4e4276002f

View File

@@ -690,10 +690,10 @@ def wait_until_ports_appear(base_url="http://localhost:8080", port_list=(), debu
pprint.pprint(existing_stations) pprint.pprint(existing_stations)
found_stations = [] found_stations = []
port_url = "/port/1" port_url = "/port/1"
ncshow_url = "/cli-json/nc_show_ports" show_url = "/cli-json/show_ports"
if base_url.endswith('/'): if base_url.endswith('/'):
port_url = port_url[1:] port_url = port_url[1:]
ncshow_url = ncshow_url[1:] show_url = show_url[1:]
sec_elapsed = 0 sec_elapsed = 0
attempts = 0 attempts = 0
while len(found_stations) < len(port_list) and sec_elapsed < timeout: while len(found_stations) < len(port_list) and sec_elapsed < timeout:
@@ -710,7 +710,7 @@ def wait_until_ports_appear(base_url="http://localhost:8080", port_list=(), debu
if json_response is not None: if json_response is not None:
found_stations.append(port_name) found_stations.append(port_name)
else: else:
lf_r = LFRequest.LFRequest(base_url, ncshow_url, debug_=debug) lf_r = LFRequest.LFRequest(base_url, show_url, debug_=debug)
lf_r.addPostData({"shelf": shelf, "resource": resource_id, "port": port_name, "probe_flags": 5}) lf_r.addPostData({"shelf": shelf, "resource": resource_id, "port": port_name, "probe_flags": 5})
lf_r.jsonPost() lf_r.jsonPost()
if len(found_stations) < len(port_list): if len(found_stations) < len(port_list):