Files
infix/test/infamy/util.py
T
Mattias Walström c6d9c68726 Add new function that only waits for boot (reboot) to complete
This since it can take an undefined time to reboot the DUT.
2024-02-28 13:18:51 +01:00

26 lines
689 B
Python

import time
import infamy.neigh
import infamy.netconf as netconf
def until(fn, attempts=10, interval=1):
for attempt in range(attempts):
if fn():
return
time.sleep(interval)
raise Exception("Expected condition did not materialize")
def wait_boot(target):
until(lambda: target.reachable() == False, attempts = 100)
print("Device is booting..")
until(lambda: target.reachable() == True, attempts = 300)
iface=target.get_mgmt_iface()
if not iface:
return False
neigh=infamy.neigh.ll6ping(iface)
if not neigh:
return False
until(lambda: netconf.netconf_syn(neigh) == True, attempts = 300)
return True