66import random
77import inspect
88
9- from . import neigh , netconf , restconf , ssh , tap , topology
9+ from . import neigh , netconf , restconf , ssh , tap , topology , util
1010
1111
1212class NullEnv :
@@ -116,6 +116,13 @@ def attr(self, name, default=None):
116116 def get_password (self , node ):
117117 return self .ptop .get_password (node )
118118
119+ def is_reachable (self , node , port ):
120+ ip = neigh .ll6ping (port )
121+ if not ip :
122+ return False
123+
124+ return util .is_reachable (ip , self , self .get_password (node ))
125+
119126 def attach (self , node , port = "mgmt" , protocol = None , test_reset = True , username = None , password = None ):
120127 """Attach to node on port using protocol."""
121128
@@ -126,6 +133,7 @@ def attach(self, node, port="mgmt", protocol=None, test_reset=True, username = N
126133 else :
127134 mapping = None
128135
136+
129137 # Precedence:
130138 # 1. Caller specifies `protocol`
131139 # 2. User specifies `-t` when executing test
@@ -141,6 +149,9 @@ def attach(self, node, port="mgmt", protocol=None, test_reset=True, username = N
141149 ctrl = self .ptop .get_ctrl ()
142150 cport , _ = self .ptop .get_mgmt_link (ctrl , node )
143151
152+ print ("Waiting for DUTs to become reachable..." )
153+ util .parallel (util .until (lambda : self .is_reachable (node , cport ), 300 ))
154+
144155 print (f"Probing { node } on port { cport } for IPv6LL mgmt address ..." )
145156 mgmtip = neigh .ll6ping (cport )
146157 if not mgmtip :
0 commit comments