mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-15 17:45:07 +00:00
lfutils: wait_until_ports_disappear will return True or False
In all return paths. And remove redundant check for being done removing ports or not. Signed-off-by: Ben Greear <greearb@candelatech.com>
This commit is contained in:
@@ -526,15 +526,15 @@ def wait_until_ports_admin_up(resource_id=0, base_url="http://localhost:8080", p
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def waitUntilPortsDisappear(base_url="http://localhost:8080", port_list=(), debug=False):
|
def waitUntilPortsDisappear(base_url="http://localhost:8080", port_list=(), debug=False, timeout=360):
|
||||||
wait_until_ports_disappear(base_url, port_list, debug)
|
wait_until_ports_disappear(base_url, port_list, debug=debug, timeout_sec=timeout)
|
||||||
|
|
||||||
|
|
||||||
def wait_until_ports_disappear(base_url="http://localhost:8080", port_list=(), debug=False, timeout_sec=360):
|
def wait_until_ports_disappear(base_url="http://localhost:8080", port_list=(), debug=False, timeout_sec=360):
|
||||||
if (port_list is None) or (len(port_list) < 1):
|
if (port_list is None) or (len(port_list) < 1):
|
||||||
if debug:
|
if debug:
|
||||||
logger.debug("LFUtils: wait_until_ports_disappear: empty list, zipping back")
|
logger.debug("LFUtils: wait_until_ports_disappear: empty list, returning")
|
||||||
return
|
return True # no ports to remove, so we are done
|
||||||
|
|
||||||
logger.info("LFUtils: Waiting until {len_port_list} ports disappear...".format(len_port_list=len(port_list)))
|
logger.info("LFUtils: Waiting until {len_port_list} ports disappear...".format(len_port_list=len(port_list)))
|
||||||
url = "/port/1"
|
url = "/port/1"
|
||||||
@@ -596,11 +596,9 @@ def wait_until_ports_disappear(base_url="http://localhost:8080", port_list=(), d
|
|||||||
if debug:
|
if debug:
|
||||||
logger.debug('removing port %s' % '.'.join(port))
|
logger.debug('removing port %s' % '.'.join(port))
|
||||||
remove_port(port[1], port[2], base_url)
|
remove_port(port[1], port[2], base_url)
|
||||||
if len(found_stations) == 0:
|
|
||||||
return True
|
|
||||||
sleep(1) # check for ports once per second
|
sleep(1) # check for ports once per second
|
||||||
|
|
||||||
logger.info('%s stations were still found' % found_stations)
|
logger.critical('%s stations were still found' % found_stations)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user