from lnst.Controller.PerfRepoUtils import netperf_result_template from lnst.RecipeCommon.IRQ import pin_dev_irqs from lnst.RecipeCommon.PerfRepo import generate_perfrepo_comment # ------ # SETUP # ------ mapping_file = ctl.get_alias("mapping_file") perf_api = ctl.connect_PerfRepo(mapping_file) product_name = ctl.get_alias("product_name") # Host 1 + guests 1 and 2 h1 = ctl.get_host("host1") g1 = ctl.get_host("guest1") g1.sync_resources(modules=["IcmpPing", "Icmp6Ping", "Netperf"]) g2 = ctl.get_host("guest2") g2.sync_resources(modules=["IcmpPing", "Icmp6Ping", "Netperf"]) # Host 2 + guests 3 and 4 h2 = ctl.get_host("host2") g3 = ctl.get_host("guest3") g3.sync_resources(modules=["IcmpPing", "Icmp6Ping", "Netperf"]) g4 = ctl.get_host("guest4") g4.sync_resources(modules=["IcmpPing", "Icmp6Ping", "Netperf"]) # ------ # TESTS # ------
from lnst.Controller.Task import ctl # ------ # SETUP # ------ h1 = ctl.get_host("host1") g1 = ctl.get_host("guest1") h2 = ctl.get_host("host2") g1.sync_resources(modules=["IcmpPing", "Icmp6Ping", "Netperf"]) h2.sync_resources(modules=["IcmpPing", "Icmp6Ping", "Netperf"]) # ------ # TESTS # ------ offloads = ["gso", "gro", "tso"] ipv = ctl.get_alias("ipv") ping_mod = ctl.get_module("IcmpPing", options={ "addr" : h2.get_ip("vlan10"), "count" : 100, "iface" : g1.get_devname("vlan10"), "interval" : 0.1 }) ping_mod6 = ctl.get_module("Icmp6Ping",
from lnst.Controller.PerfRepoUtils import netperf_baseline_template from lnst.Controller.PerfRepoUtils import netperf_result_template from lnst.RecipeCommon.IRQ import pin_dev_irqs from lnst.RecipeCommon.PerfRepo import generate_perfrepo_comment # ------ # SETUP # ------ mapping_file = ctl.get_alias("mapping_file") perf_api = ctl.connect_PerfRepo(mapping_file) product_name = ctl.get_alias("product_name") m1 = ctl.get_host("machine1") m2 = ctl.get_host("machine2") m1.sync_resources(modules=["Netperf"]) m2.sync_resources(modules=["Netperf"]) # ------ # TESTS # ------ mtu = ctl.get_alias("mtu") netperf_duration = int(ctl.get_alias("netperf_duration")) nperf_reserve = int(ctl.get_alias("nperf_reserve")) nperf_confidence = ctl.get_alias("nperf_confidence") nperf_max_runs = int(ctl.get_alias("nperf_max_runs")) nperf_cpupin = ctl.get_alias("nperf_cpupin")
raise Exception("Unsupported format for max_dev argument.") custom_mod = ctl.get_module("Custom", options={"fail": fail}) host.run(custom_mod, desc=desc) # ------ # SETUP # ------ mapping_file = ctl.get_alias("mapping_file") perf_api = ctl.connect_PerfRepo(mapping_file) product_name = ctl.get_alias("product_name") # test hosts h1 = ctl.get_host("host1") h2 = ctl.get_host("host2") h1.sync_resources(modules=["IcmpPing", "TRexClient", "TRexServer", "Custom"]) h2.sync_resources(modules=["IcmpPing", "Custom"]) dpdk_version = h1.run("testpmd -v --help 2>&1").get_result()["res_data"]["stdout"] tmp = re.search(r"^.*RTE Version: '(.*)'$", dpdk_version, flags=re.MULTILINE) if tmp: dpdk_version = tmp.group(1) else: dpdk_version = "unknown" ovs_rpm_version = h2.run("rpm -qf `which ovs-vswitchd` || true").get_result()["res_data"]["stdout"] # ------
from lnst.Controller.PerfRepoUtils import netperf_result_template from lnst.RecipeCommon.IRQ import pin_dev_irqs from lnst.RecipeCommon.PerfRepo import generate_perfrepo_comment from lnst.RecipeCommon.Offloads import parse_offloads # ------ # SETUP # ------ mapping_file = ctl.get_alias("mapping_file") perf_api = ctl.connect_PerfRepo(mapping_file) product_name = ctl.get_alias("product_name") h1 = ctl.get_host("host1") g1 = ctl.get_host("guest1") h2 = ctl.get_host("host2") g1.sync_resources(modules=["IcmpPing", "Icmp6Ping", "Netperf"]) h2.sync_resources(modules=["IcmpPing", "Icmp6Ping", "Netperf"]) # ------ # TESTS # ------ ipv = ctl.get_alias("ipv") netperf_duration = int(ctl.get_alias("netperf_duration")) nperf_reserve = int(ctl.get_alias("nperf_reserve")) nperf_confidence = ctl.get_alias("nperf_confidence")
from lnst.RecipeCommon.ModuleWrap import ping, ping6, netperf from lnst.RecipeCommon.IRQ import pin_dev_irqs from lnst.RecipeCommon.PerfRepo import generate_perfrepo_comment # ------ # SETUP # ------ mapping_file = ctl.get_alias("mapping_file") perf_api = ctl.connect_PerfRepo(mapping_file) product_name = ctl.get_alias("product_name") # test hosts h1 = ctl.get_host("test_host1") h2 = ctl.get_host("test_host2") for h in [h1, h2]: h.sync_resources(modules=["IcmpPing", "Icmp6Ping", "Netperf"]) # ------ # TESTS # ------ ipv = ctl.get_alias("ipv") mtu = ctl.get_alias("mtu") netperf_duration = int(ctl.get_alias("netperf_duration")) nperf_reserve = int(ctl.get_alias("nperf_reserve")) nperf_confidence = ctl.get_alias("nperf_confidence") nperf_max_runs = int(ctl.get_alias("nperf_max_runs"))
from lnst.Controller.Task import ctl hostA = ctl.get_host("machine1") hostB = ctl.get_host("machine2") hostA.sync_resources(modules=["IcmpPing", "Netperf"]) hostB.sync_resources(modules=["IcmpPing", "Netperf"]) ping_mod = ctl.get_module("IcmpPing", options={ "addr": hostB.get_ip("testiface", 0), "count": 1000, "interval": 0.1, "iface": hostA.get_devname("testiface") }) netserver = ctl.get_module("Netperf", options={ "role": "server", "bind": hostA.get_ip("testiface") }) netperf_tcp = ctl.get_module("Netperf", options={ "role": "client", "netperf_server": hostA.get_ip("testiface"), "duration": 60, "testname":
from lnst.Controller.Task import ctl m1 = ctl.get_host("1") m2 = ctl.get_host("2") ping_mod = ctl.get_module("IcmpPing", options={ "addr": m2.get_ip("testiface", 0), "count": 40, "interval": 0.2, "limit_rate": 95 }) ping_test = m1.run(ping_mod, timeout=30)
import sys from lnst.Controller.Task import ctl m1 = ctl.get_host("m1") # this should fail m1.run("[ \"%s\" == \"value1\" ]" % ctl.get_alias("foo"))
msg = "Setting RED on %s with very high max failed" % \ iface.get_devname() elif red_stats["offload"]: msg = "RED on %s appears as offloaded even though max is not " \ "possible" % iface.get_devname() tl.custom(sw, desc, msg) desc = "RED re-setting with legal max" msg = "" iface.set_qdisc_red(10**7, 10**3, 2*10**6, 3*10**6, change = True, burst = 2*10**3) red_stats = iface.qdisc_red_stats() if red_stats == {}: msg = "Setting RED on %s with legal max failed" % iface.get_devname() elif not red_stats["offload"]: msg = "RED on %s appears as not offloaded even though max is legal" % \ iface.get_devname() tl.custom(sw, desc, msg) do_task(ctl, [ctl.get_host("machine1"), ctl.get_host("machine2"), ctl.get_host("switch")], [ctl.get_host("switch").get_interface("if1"), ctl.get_host("switch").get_interface("if2"), ctl.get_host("switch").get_interface("if3"), ctl.get_host("switch").get_interface("if4")], [ctl.get_host("switch").get_interface("bond1"), ctl.get_host("switch").get_interface("br1"), ctl.get_host("switch").get_interface("if4.10")], ctl.get_aliases())
from lnst.Controller.Task import ctl from Testlib import Testlib # ------ # SETUP # ------ tl = Testlib(ctl) # ------ # TESTS # ------ hv = ctl.get_host("host1") test_with_veth = ctl.get_alias("test_with_veth") if test_with_veth == 'yes': g1 = hv g2 = hv nic1 = hv.get_interface("vm1") nic2 = hv.get_interface("vm2") else: g1 = ctl.get_host("guest1") g2 = ctl.get_host("guest2") nic1 = g1.get_interface("if1") nic2 = g2.get_interface("if2") g1.sync_resources(modules=["IcmpPing", "Icmp6Ping", "Iperf"]) if g1 != g2: g2.sync_resources(modules=["Iperf"])
tl.check_cpu_traffic(sw_ports) result = tl.iperf_mc(m2_if, mcast_iface, mcgrp(2)) tl.mc_ipref_compare_result(mcast_iface, result, [True, False, False]) tl.check_cpu_traffic(sw_ports) for iface in sw_ports: iface.set_mcast_router(MCAST_ROUTER_PORT.LEARNING) s_procs.intr() for iface in mcast_iface: iface.disable_multicast() m2_if.disable_multicast() do_task(ctl, [ ctl.get_host("machine1"), ctl.get_host("machine2"), ctl.get_host("switch") ], [ ctl.get_host("machine1").get_interface("if1"), ctl.get_host("machine1").get_interface("veth3"), ctl.get_host("machine2").get_interface("veth1"), ctl.get_host("machine2").get_interface("veth3"), ctl.get_host("switch").get_interface("if1"), ctl.get_host("switch").get_interface("if2"), ctl.get_host("switch").get_interface("if3"), ctl.get_host("switch").get_interface("if4") ], ctl.get_host("machine1").get_interface("brif1"), ctl.get_aliases())
from lnst.RecipeCommon.ModuleWrap import ping, ping6, netperf from lnst.RecipeCommon.IRQ import pin_dev_irqs from lnst.RecipeCommon.PerfRepo import generate_perfrepo_comment # ------ # SETUP # ------ mapping_file = ctl.get_alias("mapping_file") perf_api = ctl.connect_PerfRepo(mapping_file) product_name = ctl.get_alias("product_name") # hosts host1 = ctl.get_host("h1") host2 = ctl.get_host("h2") # guest machines guest1 = ctl.get_host("test_host1") guest2 = ctl.get_host("test_host2") guest3 = ctl.get_host("test_host3") guest4 = ctl.get_host("test_host4") for h in [guest1, guest2, guest3, guest4]: h.sync_resources(modules=["IcmpPing", "Icmp6Ping", "Netperf"]) # ------ # TESTS # ------
from lnst.Controller.Task import ctl from lnst.RecipeCommon.ModuleWrap import ping, ping6 from Testlib import Testlib import logging # ------ # SETUP # ------ tl = Testlib(ctl) # hosts host1 = ctl.get_host("h1") host2 = ctl.get_host("h2") # guest machines guest1 = ctl.get_host("test_host1") guest1.sync_resources(modules=["IcmpPing", "Icmp6Ping"]) # ------ # TESTS # ------ ipv = ctl.get_alias("ipv") mtu = ctl.get_alias("mtu") g1_nic = guest1.get_interface("if1") h2_nic = host2.get_device("int0") vxlan_port = ctl.get_alias("vxlan_port")
hashes = [] hashes.append(('hmac(md5)', 128)) hashes.append(('sha256', 256)) # ------ # SETUP # ------ mapping_file = ctl.get_alias("mapping_file") perf_api = ctl.connect_PerfRepo(mapping_file) product_name = ctl.get_alias("product_name") m1 = ctl.get_host("machine1") m2 = ctl.get_host("machine2") m1.sync_resources(modules=["IcmpPing", "Icmp6Ping", "Netperf", "Custom"]) m2.sync_resources(modules=["PacketAssert", "IcmpPing", "Icmp6Ping", "Netperf"]) # ------ # TESTS # ------ ipv = ctl.get_alias("ipv") mtu = ctl.get_alias("mtu") netperf_duration = int(ctl.get_alias("netperf_duration")) nperf_reserve = int(ctl.get_alias("nperf_reserve")) nperf_confidence = ctl.get_alias("nperf_confidence") nperf_max_runs = int(ctl.get_alias("nperf_max_runs"))
from lnst.Controller.Task import ctl m = ctl.get_host("lb") addr1 = m.get_ip("nic1") addr2 = m.get_ip("nic2") pfx1 = m.get_prefix("nic1") pfx2 = m.get_prefix("nic2") m.run("echo %s" % addr1) m.run("echo %s" % addr2) m.run("echo %s" % pfx1) m.run("echo %s" % pfx2)
tl = TestLib(ctl, aliases) sw = hosts sw_if1, sw_if2, = ifaces sw_if1_mac = sw_if1.get_hwaddr() sw_if2_mac = sw_if2.get_hwaddr() sw_if1_devname = str(sw_if1.get_devname()) sw_if2_devname = str(sw_if2.get_devname()) dbm = DBManager() current_distro = sw.run("cat /etc/redhat-release | grep -o [0-9].[0-9]").out().strip() pre_distro = str(float(current_distro) - 0.1) hostname = sw.run("hostname|head -n 1").out().strip() sw_if1_devname_old = dbm.get_devname(pre_distro,sw_if1.get_driver(),hostname,sw_if1_mac) sw_if2_devname_old = dbm.get_devname(pre_distro,sw_if2.get_driver(),hostname,sw_if2_mac) if sw_if1_devname_old != "null" and sw_if1_devname_old != sw_if1_devname: failMod = ctl.get_module("DummyFailing") print "devname check failed, %s vs %s" %(sw_if1_devname,sw_if1_devname_old) sw.run(failMod) dbm.new_devname(current_distro,sw_if1.get_driver(),hostname,sw_if1_mac,sw_if1_devname) do_task(ctl, ctl.get_host("switch"), [ctl.get_host("switch").get_interface("if1"), ctl.get_host("switch").get_interface("if2")], ctl.get_aliases())
ping_test(tl, m2, sw, ipv6(test_ip(1, 33, [])), m2_if1_10, g, ipv6=True) ping_test(tl, m2, sw, ipv4(test_ip(1, 33, [])), m2_if1_10, g) # Make sure that when a newly-created tunnel has a down underlay, decap # still works. There's a complementary test in ipip-010 to test that # encap doesn't work in that scenario. logging.info("--- create tunnel with a down underlay") d.set_link_down() # Should be down already, but make this robust against # later coding changes. with gre(sw, d, vrf_o, tos="inherit", local_ip="1.2.3.4", remote_ip="1.2.3.5") as g: ping_test(tl, m2, sw, ipv6(test_ip(1, 33, [])), m2_if1_10, g, ipv6=True) ping_test(tl, m2, sw, ipv4(test_ip(1, 33, [])), m2_if1_10, g) do_task(ctl, [ctl.get_host("machine1"), ctl.get_host("machine2"), ctl.get_host("switch")], [ctl.get_host("machine1").get_interface("if1.10"), ctl.get_host("machine1").get_interface("if1.20"), ctl.get_host("machine2").get_interface("if1.10"), ctl.get_host("machine2").get_interface("if1.20"), ctl.get_host("switch").get_interface("if1.10"), ctl.get_host("switch").get_interface("if1.20"), ctl.get_host("switch").get_interface("if2.10"), ctl.get_host("switch").get_interface("if2.20")], ctl.get_aliases())
from lnst.Controller.Task import ctl hostA = ctl.get_host("machine1") hostB = ctl.get_host("machine2") hostA.sync_resources(modules=["IcmpPing"]) hostB.sync_resources(modules=["IcmpPing"]) hostA_devices = hostA.get_interface("testiface") hostB_devices = hostB.get_interface("testiface") ping_mod = ctl.get_module("IcmpPing", options={ "addr": hostB.get_ip("testiface", 0), "count": 100, "interval": 0.2, "limit_rate": 95}) hostA.run(ping_mod)
tl = TestLib(ctl, aliases) tl.wait_for_if(ifaces) tl.check_cpu_traffic(sw_ports, test=False) for iface in [m1_if, m2_if, m3_if, m4_if]: iface.enable_multicast() test_standard_multicast(tl, m1_if, [m2_if, m4_if], mcgrp(3), sw_br, peers) test_standard_multicast(tl, m1_if, [m4_if], mcgrp(4), sw_br, peers) test_standard_multicast(tl, m2_if, [m1_if, m2_if, m4_if], mcgrp(5), sw_br, peers) for iface in [m1_if, m2_if, m3_if, m4_if]: iface.disable_multicast() tl.check_cpu_traffic(sw_ports) do_task(ctl, [ctl.get_host("machine1"), ctl.get_host("machine2"), ctl.get_host("switch")], [ctl.get_host("machine1").get_interface("veth1"), ctl.get_host("machine1").get_interface("veth3"), ctl.get_host("machine2").get_interface("veth1"), ctl.get_host("machine2").get_interface("veth3"), ctl.get_host("switch").get_interface("if1"), ctl.get_host("switch").get_interface("if2"), ctl.get_host("switch").get_interface("if3"), ctl.get_host("switch").get_interface("if4")], [ctl.get_host("machine1").get_interface("brif1"), ctl.get_host("machine1").get_interface("brif2"), ctl.get_host("machine2").get_interface("brif1"), ctl.get_host("machine2").get_interface("brif2")], ctl.get_aliases())
sleep(1) tl.ping_simple(m1_if1, m2_if1) sw_if2.add_br_vlan(500, pvid=False, untagged=True) sleep(1) tl.ping_simple(m1_if1, m2_if1, fail_expected=True) sw_if2.add_br_vlan(500, pvid=True, untagged=True) sleep(1) tl.ping_simple(m1_if1, m2_if1) sw_br.slave_del(sw_if1.get_id()) sw_if1.reset(ip=test_ip(1, 3)) sleep(15) tl.ping_simple(sw_if1, m1_if1) do_task( ctl, [ctl.get_host("machine1"), ctl.get_host("machine2"), ctl.get_host("switch")], [ ctl.get_host("machine1").get_interface("if1"), ctl.get_host("machine2").get_interface("if1"), ctl.get_host("switch").get_interface("if1"), ctl.get_host("switch").get_interface("if2"), ], ctl.get_aliases(), )
starg = mt.mroute_create("0.0.0.0", mcgrp(1), 0, [0, 1, 3]) # add a more specific (S,G) route with the same group sg = mt.mroute_create(ipv4(test_ip(1, 1)), mcgrp(1), 0, [2, 3, 4]) # remove the (S,G) route and see that the (*,G) is still functional mt.mroute_remove(sg, test=False) mt.mroute_test(starg) # clean mt.mroute_remove(starg) mt.fini() do_task(ctl, [ ctl.get_host("machine1"), ctl.get_host("machine2"), ctl.get_host("switch") ], [ ctl.get_host("machine1").get_interface("if1"), ctl.get_host("machine1").get_interface("if2"), ctl.get_host("machine2").get_interface("if1"), ctl.get_host("machine2").get_interface("if2"), ctl.get_host("machine2").get_interface("if3"), ctl.get_host("machine2").get_interface("if4"), ctl.get_host("switch").get_interface("if1"), ctl.get_host("switch").get_interface("if2"), ctl.get_host("switch").get_interface("if3"), ctl.get_host("switch").get_interface("if4"), ctl.get_host("switch").get_interface("if5"), ctl.get_host("switch").get_interface("if6"),
from lnst.Controller.Task import ctl from lnst.RecipeCommon.ModuleWrap import ping, ping6 from Testlib import Testlib import logging # ------ # SETUP # ------ tl = Testlib(ctl) # hosts host1 = ctl.get_host("host1") host2 = ctl.get_host("host2") # guest machines guest1 = ctl.get_host("guest1") guest1.sync_resources(modules=["IcmpPing", "Icmp6Ping"]) # ------ # TESTS # ------ ipv = ctl.get_alias("ipv") mtu = ctl.get_alias("mtu") turn_off_sriov = ctl.get_alias("turn_off_sriov") skip_tc_verify = ctl.get_alias("skip_tc_verify") g1_nic = guest1.get_interface("if1") try:
__author__ = """ [email protected] (Ido Schimmel) """ from lnst.Controller.Task import ctl from TestLib import TestLib from time import sleep def do_task(ctl, hosts, ifaces, aliases): m1, sw = hosts m1_if1, sw_if1 = ifaces m1_if1_10 = m1.create_vlan(m1_if1, 10, ip=["192.168.101.10/24", "2002::1/64"]) sw_if1_10 = sw.create_vlan(sw_if1, 10, ip=["192.168.101.11/24", "2002::2/64"]) sleep(15) tl = TestLib(ctl, aliases) tl.ping_simple(m1_if1_10, sw_if1_10) tl.netperf_tcp(m1_if1_10, sw_if1_10) tl.netperf_udp(m1_if1_10, sw_if1_10) do_task(ctl, [ctl.get_host("machine1"), ctl.get_host("switch")], [ctl.get_host("machine1").get_interface("if1"), ctl.get_host("switch").get_interface("if1")], ctl.get_aliases())
from lnst.RecipeCommon.IRQ import pin_dev_irqs from lnst.RecipeCommon.PerfRepo import generate_perfrepo_comment from lnst.RecipeCommon.Offloads import parse_offloads # ------ # SETUP # ------ mapping_file = ctl.get_alias("mapping_file") perf_api = ctl.connect_PerfRepo(mapping_file) product_name = ctl.get_alias("product_name") # Host 1 + guests 1 and 2 h1 = ctl.get_host("host1") g1 = ctl.get_host("guest1") g1.sync_resources(modules=["IcmpPing", "Icmp6Ping", "Netperf"]) g2 = ctl.get_host("guest2") g2.sync_resources(modules=["IcmpPing", "Icmp6Ping", "Netperf"]) # Host 2 + guests 3 and 4 h2 = ctl.get_host("host2") g3 = ctl.get_host("guest3") g3.sync_resources(modules=["IcmpPing", "Icmp6Ping", "Netperf"]) g4 = ctl.get_host("guest4") g4.sync_resources(modules=["IcmpPing", "Icmp6Ping", "Netperf"]) # ------ # TESTS # ------
bond_options = {"mode": "802.3ad", "miimon": "100"} m1_lag1 = m1.create_bond(slaves=[m1_if1, m1_if2], options=bond_options, ip=["192.168.101.10/24", "2002::1/64"]) m2_lag1 = m2.create_bond(slaves=[m2_if1, m2_if2], options=bond_options, ip=["192.168.101.11/24", "2002::2/64"]) sw_lag1 = sw.create_bond(slaves=[sw_if1, sw_if2], options=bond_options) sw_lag2 = sw.create_bond(slaves=[sw_if3, sw_if4], options=bond_options) sw.create_bridge(slaves=[sw_lag1, sw_lag2], options={"vlan_filtering": 1}) sleep(15) tl = TestLib(ctl, aliases) tl.ping_simple(m1_lag1, m2_lag1) tl.netperf_tcp(m1_lag1, m2_lag1) tl.netperf_udp(m1_lag1, m2_lag1) do_task(ctl, [ctl.get_host("machine1"), ctl.get_host("machine2"), ctl.get_host("switch")], [ctl.get_host("machine1").get_interface("if1"), ctl.get_host("machine1").get_interface("if2"), ctl.get_host("machine2").get_interface("if1"), ctl.get_host("machine2").get_interface("if2"), ctl.get_host("switch").get_interface("if1"), ctl.get_host("switch").get_interface("if2"), ctl.get_host("switch").get_interface("if3"), ctl.get_host("switch").get_interface("if4")], ctl.get_aliases())
import sys from lnst.Controller.Task import ctl m1 = ctl.get_host("m1") m2 = ctl.get_host("m2") m1.run("[ \"%s\" == \"value1\" ]" % ctl.get_alias("alias1")) m2.run("[ \"%s\" == \"value2\" ]" % ctl.get_alias("alias2"))
from lnst.Controller.PerfRepoUtils import netperf_result_template from lnst.RecipeCommon.IRQ import pin_dev_irqs from lnst.RecipeCommon.PerfRepo import generate_perfrepo_comment from lnst.RecipeCommon.Offloads import parse_offloads # ------ # SETUP # ------ mapping_file = ctl.get_alias("mapping_file") perf_api = ctl.connect_PerfRepo(mapping_file) product_name = ctl.get_alias("product_name") m1 = ctl.get_host("testmachine1") m2 = ctl.get_host("testmachine2") m1.sync_resources(modules=["IcmpPing", "Icmp6Ping", "Netperf"]) m2.sync_resources(modules=["IcmpPing", "Icmp6Ping", "Netperf"]) # ------ # TESTS # ------ vlans = ["vlan10", "vlan20", "vlan30"] ipv = ctl.get_alias("ipv") mtu = ctl.get_alias("mtu") netperf_duration = int(ctl.get_alias("netperf_duration")) nperf_reserve = int(ctl.get_alias("nperf_reserve"))
from lnst.Controller.PerfRepoUtils import netperf_result_template from lnst.RecipeCommon.IRQ import pin_dev_irqs from lnst.RecipeCommon.PerfRepo import generate_perfrepo_comment from lnst.RecipeCommon.Offloads import parse_offloads # ------ # SETUP # ------ mapping_file = ctl.get_alias("mapping_file") perf_api = ctl.connect_PerfRepo(mapping_file) product_name = ctl.get_alias("product_name") m1 = ctl.get_host("testmachine1") m2 = ctl.get_host("testmachine2") m1.sync_resources(modules=["IcmpPing", "Icmp6Ping", "Netperf", "Custom"]) m2.sync_resources(modules=["IcmpPing", "Icmp6Ping", "Netperf", "Custom"]) # ------ # TESTS # ------ ipv = ctl.get_alias("ipv") mtu = ctl.get_alias("mtu") netperf_duration = int(ctl.get_alias("netperf_duration")) nperf_reserve = int(ctl.get_alias("nperf_reserve")) nperf_confidence = ctl.get_alias("nperf_confidence")
m1_if1.reset() m2_if1.reset() m1_if1_10 = m1.create_vlan(m1_if1, 10, ip=test_ip(1, 1)) m2_if1_10 = m2.create_vlan(m2_if1, 10, ip=test_ip(2, 1)) sw_if1_10 = sw.create_vlan(sw_if1, 10, ip=test_ip(1, 2)) sw_if2_10 = sw.create_vlan(sw_if2, 10, ip=test_ip(2, 2)) m1_if1_10.add_nhs_route(ipv4(test_ip(2, 0)), [ipv4(test_ip(1, 2, []))]) m2_if1_10.add_nhs_route(ipv4(test_ip(1, 0)), [ipv4(test_ip(2, 2, []))]) sleep(30) tl = TestLib(ctl, aliases) tl.ping_simple(m1_if1_10, m2_if1_10) tl.netperf_tcp(m1_if1_10, m2_if1_10) tl.netperf_udp(m1_if1_10, m2_if1_10) do_task(ctl, [ ctl.get_host("machine1"), ctl.get_host("machine2"), ctl.get_host("switch") ], [ ctl.get_host("machine1").get_interface("if1"), ctl.get_host("machine2").get_interface("if1"), ctl.get_host("switch").get_interface("if1"), ctl.get_host("switch").get_interface("if2") ], ctl.get_aliases())
from lnst.Controller.Task import ctl m1 = ctl.get_host("1") m2 = ctl.get_host("2") devname = m1.get_devname("testiface") hwaddr = m1.get_hwaddr("testiface") m1.run("echo 1_%s_" % hwaddr) m1.run("echo `ip link show %s | grep -o ' link/ether \([0-9a-fA-F]\{2\}:\?\)\{6\}' | cut -c 16-` >/tmp/lnst-hwaddr" % devname) m1.run("ip l set %s address 52:54:00:12:34:56" % devname) ctl.wait(2) m1.run("echo 2_%s_" % hwaddr) m1.run("ip l set %s address `cat /tmp/lnst-hwaddr`" % devname) ctl.wait(2) m1.run("echo 3_%s_`cat /tmp/lnst-hwaddr | tr '[:lower:]' '[:upper:]'`_" % hwaddr) m1.run("rm -f /tmp/lnst-hwaddr")