Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/case/containers/internal_link/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"""

import infamy
from infamy.util import until
from infamy.util import parallel, until

# Regression test for #941: previously, when both ends of a pair were
# assigned to a container, neither side created the pair.
Expand All @@ -30,8 +30,8 @@

with test.step("Set up topology and attach to target DUT"):
env = infamy.Env()
target = env.attach("target", "mgmt")
tgtssh = env.attach("target", "mgmt", "ssh")
target, tgtssh = parallel(lambda: env.attach("target", "mgmt"),
lambda: env.attach("target", "mgmt", "ssh"))

if not target.has_model("infix-containers"):
test.skip()
Expand Down
6 changes: 3 additions & 3 deletions test/case/containers/upgrade/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import time
import infamy
import infamy.file_server as srv
from infamy.util import until
from infamy.util import parallel, until

SRVPORT = 8008
SRVDIR = "/srv"
Expand All @@ -24,8 +24,8 @@

with test.step("Set up topology and attach to target DUT"):
env = infamy.Env()
target = env.attach("target", "mgmt")
tgtssh = env.attach("target", "mgmt", "ssh")
target, tgtssh = parallel(lambda: env.attach("target", "mgmt"),
lambda: env.attach("target", "mgmt", "ssh"))

if not target.has_model("infix-containers"):
test.skip()
Expand Down
6 changes: 3 additions & 3 deletions test/case/containers/volume/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

"""
import infamy
from infamy.util import until, curl
from infamy.util import curl, parallel, until

with infamy.Test() as test:
NAME = "web-volume"
Expand All @@ -16,8 +16,8 @@

with test.step("Set up topology and attach to target DUT"):
env = infamy.Env()
target = env.attach("target", "mgmt")
tgtssh = env.attach("target", "mgmt", "ssh")
target, tgtssh = parallel(lambda: env.attach("target", "mgmt"),
lambda: env.attach("target", "mgmt", "ssh"))
addr = target.get_mgmt_ip()
URL = f"http://[{addr}]:{PORT}/index.html"

Expand Down
5 changes: 3 additions & 2 deletions test/case/dhcp/client6_basic/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"""

import infamy
from infamy.util import parallel
import infamy.dhcp
import infamy.iface as iface
import infamy.route as route
Expand All @@ -33,8 +34,8 @@ def check_dns_resolution():

with test.step("Set up topology and attach to target DUT"):
env = infamy.Env()
client = env.attach("client", "mgmt")
tgtssh = env.attach("client", "mgmt", "ssh")
client, tgtssh = parallel(lambda: env.attach("client", "mgmt"),
lambda: env.attach("client", "mgmt", "ssh"))
_, host = env.ltop.xlate("host", "data")
_, port = env.ltop.xlate("client", "data")

Expand Down
6 changes: 3 additions & 3 deletions test/case/dhcp/client6_prefix_delegation/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import infamy, infamy.dhcp
import infamy.iface as iface
from infamy.util import until
from infamy.util import parallel, until
import time


Expand Down Expand Up @@ -38,8 +38,8 @@ def checklog(dut):

with test.step("Set up topology and attach to target DUT"):
env = infamy.Env()
client = env.attach("client", "mgmt")
tgtssh = env.attach("client", "mgmt", "ssh")
client, tgtssh = parallel(lambda: env.attach("client", "mgmt"),
lambda: env.attach("client", "mgmt", "ssh"))
_, host = env.ltop.xlate("host", "data")
_, port = env.ltop.xlate("client", "data")

Expand Down
6 changes: 3 additions & 3 deletions test/case/dhcp/client6_slaac_ra/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import infamy
import infamy.dhcp
import infamy.iface as iface
from infamy.util import until
from infamy.util import parallel, until


def checkrun(dut):
Expand Down Expand Up @@ -47,8 +47,8 @@ def check_slaac_address():

with test.step("Set up topology and attach to target DUT"):
env = infamy.Env()
client = env.attach("client", "mgmt")
tgtssh = env.attach("client", "mgmt", "ssh")
client, tgtssh = parallel(lambda: env.attach("client", "mgmt"),
lambda: env.attach("client", "mgmt", "ssh"))
_, host = env.ltop.xlate("host", "data")
_, port = env.ltop.xlate("client", "data")

Expand Down
6 changes: 3 additions & 3 deletions test/case/dhcp/client_hostname_resend/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"""

import infamy
from infamy.util import until
from infamy.util import parallel, until


def udhcpc_cmdline(ssh, ifname):
Expand All @@ -40,8 +40,8 @@ def running_hostname(ssh, ifname):

with test.step("Set up topology and attach to target DUT"):
env = infamy.Env()
client = env.attach("client", "mgmt")
clissh = env.attach("client", "mgmt", "ssh")
client, clissh = parallel(lambda: env.attach("client", "mgmt"),
lambda: env.attach("client", "mgmt", "ssh"))
_, port = env.ltop.xlate("client", "mgmt")

with test.step(f"Configure initial hostname '{HOSTNM_A}'"):
Expand Down
6 changes: 3 additions & 3 deletions test/case/dhcp/server_basic/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import infamy
import infamy.iface as iface
import infamy.route as route
from infamy.util import until
from infamy.util import parallel, until


def verify_hostname(dut, hostname):
Expand All @@ -30,8 +30,8 @@ def verify_hostname(dut, hostname):
HOSTNM2 = 'client'
with test.step("Set up topology and attach to client and server DUTs"):
env = infamy.Env()
client = env.attach("client", "mgmt")
server = env.attach("server", "mgmt")
client, server = parallel(lambda: env.attach("client", "mgmt"),
lambda: env.attach("server", "mgmt"))

with test.step("Configure DHCP server and client's hostname"):
server.put_config_dicts({
Expand Down
8 changes: 4 additions & 4 deletions test/case/dhcp/server_host/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import infamy
import infamy.iface as iface
import infamy.route as route
from infamy.util import until
from infamy.util import parallel, until


with infamy.Test() as test:
Expand All @@ -28,9 +28,9 @@

with test.step("Set up topology and attach to client and server DUTs"):
env = infamy.Env()
server = env.attach("server", "mgmt")
client1 = env.attach("client1", "mgmt")
client2 = env.attach("client2", "mgmt")
server, client1, client2 = parallel(lambda: env.attach("server", "mgmt"),
lambda: env.attach("client1", "mgmt"),
lambda: env.attach("client2", "mgmt"))

with test.step("Configure DHCP client and server DUTs"):
server.put_config_dicts({
Expand Down
10 changes: 5 additions & 5 deletions test/case/dhcp/server_subnets/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import infamy
import infamy.iface as iface
import infamy.route as route
from infamy.util import until
from infamy.util import parallel, until


def has_dns_server(data, dns_servers):
Expand Down Expand Up @@ -83,10 +83,10 @@ def has_system_servers(dut, dns, ntp=None):

with test.step("Set up topology and attach to client and server DUTs"):
env = infamy.Env()
server = env.attach("server", "mgmt")
client1 = env.attach("client1", "mgmt")
client2 = env.attach("client2", "mgmt")
client3 = env.attach("client3", "mgmt")
server, client1, client2, client3 = parallel(lambda: env.attach("server", "mgmt"),
lambda: env.attach("client1", "mgmt"),
lambda: env.attach("client2", "mgmt"),
lambda: env.attach("client3", "mgmt"))

with test.step("Configure DHCP server"):
server.put_config_dicts({
Expand Down
5 changes: 3 additions & 2 deletions test/case/hardware/watchdog/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@
"""
import base64
import infamy
from infamy.util import parallel
import json
import subprocess
import time

with infamy.Test() as test:
with test.step("Set up topology and attach to target DUT"):
env = infamy.Env()
target = env.attach("target", "mgmt")
tgtssh = env.attach("target", "mgmt", "ssh")
target, tgtssh = parallel(lambda: env.attach("target", "mgmt"),
lambda: env.attach("target", "mgmt", "ssh"))

with test.step("Verify the presence of a watchdog device"):
wctl = tgtssh.run(["watchdogctl"], stdout=subprocess.PIPE)
Expand Down
5 changes: 3 additions & 2 deletions test/case/interfaces/bridge_fwd_dual_dut/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@
"""

import infamy
from infamy.util import parallel

with infamy.Test() as test:
with test.step("Set up topology and attach to target DUT"):
env = infamy.Env()
dut1 = env.attach("dut1", "mgmt")
dut2 = env.attach("dut2", "mgmt")
dut1, dut2 = parallel(lambda: env.attach("dut1", "mgmt"),
lambda: env.attach("dut2", "mgmt"))

with test.step("Configure a bridge with triple physical port"):
_, tport11 = env.ltop.xlate("dut1", "data1")
Expand Down
5 changes: 3 additions & 2 deletions test/case/interfaces/bridge_vlan/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@

"""
import infamy
from infamy.util import parallel

with infamy.Test() as test:
with test.step("Set up topology and attach to target DUT"):
env = infamy.Env()
dut1 = env.attach("dut1", "mgmt")
dut2 = env.attach("dut2", "mgmt")
dut1, dut2 = parallel(lambda: env.attach("dut1", "mgmt"),
lambda: env.attach("dut2", "mgmt"))

with test.step("Configure DUTs"):
dut1.put_config_dicts({"ietf-interfaces": {
Expand Down
5 changes: 3 additions & 2 deletions test/case/interfaces/bridge_vlan_separation/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@
....
"""
import infamy
from infamy.util import parallel
import subprocess

with infamy.Test() as test:
with test.step("Set up topology and attach to target DUT"):
env = infamy.Env()
dut1 = env.attach("dut1", "mgmt")
dut2 = env.attach("dut2", "mgmt")
dut1, dut2 = parallel(lambda: env.attach("dut1", "mgmt"),
lambda: env.attach("dut2", "mgmt"))

with test.step("Configure DUTs"):
_, tport10 = env.ltop.xlate("dut1", "data1")
Expand Down
6 changes: 3 additions & 3 deletions test/case/interfaces/iface_enable_disable/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"""

import infamy
from infamy.util import parallel, until
import infamy.iface as iface

from infamy import until

def print_error_message(iface, param, exp_val, act_val):
return f"'{param}' failure for interface '{iface}'. Expected '{exp_val}', Actual: '{act_val}'"
Expand Down Expand Up @@ -65,8 +65,8 @@ def configure_interface(target, iface_name, iface_type=None, enabled=True, ip_ad
with infamy.Test() as test:
with test.step("Set up topology and attach to target DUTs"):
env = infamy.Env()
target1 = env.attach("target1", "mgmt")
target2 = env.attach("target2", "mgmt")
target1, target2 = parallel(lambda: env.attach("target1", "mgmt"),
lambda: env.attach("target2", "mgmt"))

_, data1 = env.ltop.xlate("target1", "data")
_, link1 = env.ltop.xlate("target1", "link")
Expand Down
4 changes: 2 additions & 2 deletions test/case/interfaces/igmp_vlan/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
with infamy.Test() as test:
with test.step("Set up topology and attach to target DUT"):
env = infamy.Env()
dut1 = env.attach("dut1", "mgmt")
dut1, dut2 = parallel(lambda: env.attach("dut1", "mgmt"),
lambda: env.attach("dut2", "mgmt"))
_, d1send = env.ltop.xlate("dut1", "data1")
_, d1receiver = env.ltop.xlate("dut1", "data2")
_, d1trunk = env.ltop.xlate("dut1", "link")
dut2 = env.attach("dut2", "mgmt")
_, d2receive = env.ltop.xlate("dut2", "data1")
_, d2sender = env.ltop.xlate("dut2", "data2")
_, d2trunk = env.ltop.xlate("dut2", "link")
Expand Down
6 changes: 3 additions & 3 deletions test/case/interfaces/ipv6_address/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
See issue #473 for details.
"""
import infamy
from infamy.util import until
from infamy.util import parallel, until

with infamy.Test() as test:
with test.step("Set up topology and attach to target DUT"):
env = infamy.Env()
target = env.attach("target", "mgmt")
tgtssh = env.attach("target", "mgmt", "ssh")
target, tgtssh = parallel(lambda: env.attach("target", "mgmt"),
lambda: env.attach("target", "mgmt", "ssh"))

with test.step("Setting up bridge with IPv6 SLAAC for global prefix on target:data"):
_, tport = env.ltop.xlate("target", "data")
Expand Down
10 changes: 5 additions & 5 deletions test/case/interfaces/lag_basic/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ def __init__(self, sys, dut, netns):
self.env = sys
self.dut = dut
self.net = netns
self.tgt = {}
for i, (name, _) in dut.items():
self.tgt[i] = env.attach(name, "mgmt", "ssh")
self.tgt = dict(zip(dut.keys(),
parallel(*(lambda n=name: env.attach(n, "mgmt", "ssh")
for name, _ in dut.values()))))

def set_link(self, link, updown):
"""Set link up or down, verify before returning."""
Expand Down Expand Up @@ -136,8 +136,8 @@ def dut_init(dut, mode, addr):
with infamy.Test() as test:
with test.step("Set up topology and attach to target DUTs"):
env = infamy.Env(edge_mappings=infamy.lag.edge_mappings)
dut1 = env.attach("dut1", "mgmt")
dut2 = env.attach("dut2", "mgmt")
dut1, dut2 = parallel(lambda: env.attach("dut1", "mgmt"),
lambda: env.attach("dut2", "mgmt"))

_, mon = env.ltop.xlate("host", "mon")
with infamy.IsolatedMacVlan(mon) as ns:
Expand Down
4 changes: 2 additions & 2 deletions test/case/interfaces/lag_failure/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ def dut_init(dut, addr, peer):
with infamy.Test() as test:
with test.step("Set up topology and attach to target DUTs"):
env = infamy.Env(edge_mappings=infamy.lag.edge_mappings)
dut1 = env.attach("dut1")
dut2 = env.attach("dut2")
dut1, dut2 = parallel(lambda: env.attach("dut1"),
lambda: env.attach("dut2"))

_, mon = env.ltop.xlate("host", "mon")
with infamy.IsolatedMacVlan(mon) as ns:
Expand Down
5 changes: 3 additions & 2 deletions test/case/interfaces/tunnel_basic/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"""

import infamy
from infamy.util import parallel


class ArgumentParser(infamy.ArgumentParser):
Expand All @@ -25,8 +26,8 @@ def __init__(self):
arg = ArgumentParser()
env = infamy.Env(args=arg)
tunnel = env.args.tunnel
left = env.attach("left", "mgmt")
right = env.attach("right", "mgmt")
left, right = parallel(lambda: env.attach("left", "mgmt"),
lambda: env.attach("right", "mgmt"))

with test.step(f"Configure DUTs with tunnel {tunnel}"):
container_left4 = {
Expand Down
5 changes: 3 additions & 2 deletions test/case/interfaces/tunnel_bridged/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"""

import infamy
from infamy.util import parallel


class ArgumentParser(infamy.ArgumentParser):
Expand All @@ -23,8 +24,8 @@ def __init__(self):
with test.step("Set up topology and attach to target DUTs"):
arg = ArgumentParser()
env = infamy.Env(args=arg)
left = env.attach("left", "mgmt")
right = env.attach("right", "mgmt")
left, right = parallel(lambda: env.attach("left", "mgmt"),
lambda: env.attach("right", "mgmt"))
tunnel = env.args.tunnel

with test.step("Configure DUTs with tunnel {tunnel}"):
Expand Down
Loading
Loading