test: infamy: Add a timeout when starting each test if the DUTs is not reachable

This to cover if you run one test, but the DUTs are still booting.
This commit is contained in:
Mattias Walström
2025-08-26 14:38:42 +02:00
parent edbc28a48b
commit 8740b2eb23
+12 -1
View File
@@ -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: