diff --git a/test/case/all.yaml b/test/case/all.yaml index 3db38337e..22cbecec0 100644 --- a/test/case/all.yaml +++ b/test/case/all.yaml @@ -2,12 +2,10 @@ - settings: test-spec: Readme.adoc -- case: meta/wait.py - infamy: - specification: False - case: meta/reproducible.py infamy: specification: False + - name: Misc tests suite: misc/misc.yaml diff --git a/test/case/infix_containers/container_host_commands/test.py b/test/case/infix_containers/container_host_commands/test.py index c7ee45df4..f2dbe9125 100755 --- a/test/case/infix_containers/container_host_commands/test.py +++ b/test/case/infix_containers/container_host_commands/test.py @@ -75,11 +75,5 @@ until(lambda: c.running(cont_name), attempts=10) with test.step("Verify the new hostname set by the container"): - oper = target.get_data("/ietf-system:system") - name = oper["system"]["hostname"] - - if name != hostname_new: - print(f"Expected hostname: {hostname_new}, actual hostname: {name}") - test.fail() - + until(lambda: c.running(cont_name) != target.get_data("/ietf-system:system")["system"]["hostname"], attempts=10) test.succeed() diff --git a/test/case/meta/wait.py b/test/case/meta/wait.py deleted file mode 100755 index 8d38c55c0..000000000 --- a/test/case/meta/wait.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python3 - -import time -import infamy -import infamy.neigh - - -TIMEOUT = 300 - - -def ll6ping(node): - cport, nport = env.ptop.get_mgmt_link(ctrl, node) - neigh = infamy.neigh.ll6ping(cport, flags=["-w1", "-c1", "-L", "-n"]) - if neigh: - print(f"Found {neigh} on {cport} (connected to {node}:{nport})") - return neigh - - return None - - -def is_reachable(node, env): - neigh = ll6ping(node) - if not neigh: - return False - - return infamy.util.is_reachable(neigh, env, env.ptop.get_password(node)) - - -with infamy.Test() as test: - with test.step("Initialize"): - # The test is designed to be run on a physical topology. - env = infamy.Env(ltop=False) - - ctrl = env.ptop.get_ctrl() - infixen = env.ptop.get_infixen() - - with test.step(f"Reach {infixen}"): - print(f"Waiting for {infixen} to come up, timeout: {TIMEOUT / 60} min") - timeout = time.time() + TIMEOUT - - while infixen and time.time() < timeout: - time.sleep(1) - infixen = [node for node in infixen if not is_reachable(node, env)] - - if infixen: - print(f"Unable to reach {infixen}") - test.fail() - - test.succeed() diff --git a/test/infamy/env.py b/test/infamy/env.py index 59950012f..a36d63d24 100644 --- a/test/infamy/env.py +++ b/test/infamy/env.py @@ -6,7 +6,7 @@ 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 @@ def attr(self, name, default=None): 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 @@ def attach(self, node, port="mgmt", protocol=None, test_reset=True, username = N else: mapping = None + # Precedence: # 1. Caller specifies `protocol` # 2. User specifies `-t` when executing test @@ -141,6 +149,9 @@ def attach(self, node, port="mgmt", protocol=None, test_reset=True, username = N 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: diff --git a/test/infamy/netconf.py b/test/infamy/netconf.py index 68eb22650..6fa084966 100644 --- a/test/infamy/netconf.py +++ b/test/infamy/netconf.py @@ -22,7 +22,6 @@ def netconf_syn(addr): if netutil.tcp_port_is_open(addr, 830): - print(f"{addr} answers to TCP connections on port 830 (NETCONF)") return True else: return False diff --git a/test/infamy/restconf.py b/test/infamy/restconf.py index 63775e39d..44d9de041 100644 --- a/test/infamy/restconf.py +++ b/test/infamy/restconf.py @@ -101,7 +101,6 @@ def restconf_reachable(neigh, password): response = requests_workaround_get(url, headers=headers, auth=auth, verify=False) if response.status_code == 200: - print(f"{neigh} answers to TCP connections on port 443 (RESTCONF)") return True except: return False