diff --git a/test/infamy/env.py b/test/infamy/env.py index 59950012..a36d63d2 100644 --- a/test/infamy/env.py +++ b/test/infamy/env.py @@ -6,7 +6,7 @@ import sys import random import inspect -from . import neigh, netconf, restconf, ssh, tap, topology +from . import neigh, netconf, restconf, ssh, tap, topology, util class NullEnv: @@ -116,6 +116,13 @@ class Env(object): def get_password(self, node): return self.ptop.get_password(node) + def is_reachable(self, node, port): + ip = neigh.ll6ping(port) + if not ip: + return False + + return util.is_reachable(ip, self, self.get_password(node)) + def attach(self, node, port="mgmt", protocol=None, test_reset=True, username = None, password = None): """Attach to node on port using protocol.""" @@ -126,6 +133,7 @@ class Env(object): else: mapping = None + # Precedence: # 1. Caller specifies `protocol` # 2. User specifies `-t` when executing test @@ -141,6 +149,9 @@ class Env(object): ctrl = self.ptop.get_ctrl() cport, _ = self.ptop.get_mgmt_link(ctrl, node) + print("Waiting for DUTs to become reachable...") + util.parallel(util.until(lambda: self.is_reachable(node, cport), 300)) + print(f"Probing {node} on port {cport} for IPv6LL mgmt address ...") mgmtip = neigh.ll6ping(cport) if not mgmtip: