def net_ip(ctl, keys, minor, prefix): base4 = ctl.get_alias(keys[0]) base6 = ctl.get_alias(keys[1]) if len(keys) > 1 else None assert base4 is not None ip4 = ["%s.%d%s" % (base4, minor, "/" + str(prefix[0]) if len(prefix) > 0 else "")] ip6 = ["%s::%d%s" % (base6, minor, "/" + str(prefix[1]) if len(prefix) > 1 else "")] \ if base6 is not None else [] return ip4 + ip6
def get_vxlan_dev(host): vxlan_port = ctl.get_alias("vxlan_port") vxlan_dev = "vxlan_sys_%s" % vxlan_port # In asap mlnx ofed the interface name is dummy_port. vxlan_dummy = "dummy_%s" % vxlan_port cmd = host.run("ls /sys/class/net") out = cmd.out().strip().split() if vxlan_dev in out: return vxlan_dev elif vxlan_dummy in out: return vxlan_dummy else: raise RuntimeError("Cannot find vxlan device")
def do_task(ctl, hosts, ifaces, aliases): m1, m2, sw = hosts m1_if1, m2_if1, sw_if1, sw_if2 = ifaces tl = TestLib(ctl, aliases) red_test = RedTestLib(tl, sw, {sw_if1:m1_if1, sw_if2:m2_if1}) red_test.create_bottleneck(aliases) if ctl.get_alias("use_prio_as_root"): red_test.set_prio() sleep(30) try: run_actual_test(red_test) except Exception as e: logging.error("Test run failed") tl.custom(sw, "Basic RED test", "Failed because of %s" % e)
import logging from lnst.Controller.Task import ctl from lnst.Controller.PerfRepoUtils import netperf_baseline_template from lnst.Controller.PerfRepoUtils import netperf_result_template # ------ # 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 # ------ offloads = ["gro", "gso", "tso", "tx"] offload_settings = [[("gro", "on"), ("gso", "on"), ("tso", "on"), ("tx", "on")], [("gro", "off"), ("gso", "on"), ("tso", "on"), ("tx", "on")], [("gro", "on"), ("gso", "off"), ("tso", "off"), ("tx", "on")],
from lnst.Controller.Task import ctl 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") 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 = ["gro", "gso", "tso", "rx", "tx"] offload_settings = [[("gro", "on"), ("gso", "on"), ("tso", "on"), ("tx", "on"), ("rx", "on")],
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"))
hostB = ctl.get_host("machine2") hostA.sync_resources(modules=["Icmp6Ping", "IcmpPing"]) hostB.sync_resources(modules=["Icmp6Ping", "IcmpPing"]) ping_mod = ctl.get_module("IcmpPing", options={ "addr": hostB.get_ip("testiface", 0), "count": 100, "interval": 0.2, "iface" : hostA.get_devname("testiface"), "limit_rate": 90}) ping_mod6 = ctl.get_module("Icmp6Ping", options={ "addr": hostB.get_ip("testiface", 1), "count": 100, "interval": 0.2, "iface" : hostA.get_ip("testiface", 1), "limit_rate": 90}) if ctl.get_alias('ipv') == 'ipv6': hostA.run(ping_mod6) elif ctl.get_alias('ipv') == 'ipv4': hostA.run(ping_mod) else: hostA.run(ping_mod) hostA.run(ping_mod6)
from lnst.Common.Utils import bool_it from lnst.Controller.Task import ctl 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 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")
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", options={ "addr" : h2.get_ip("vlan10", 1), "count" : 100, "iface" : g1.get_ip("vlan10", 1), "interval" : 0.1
"deviation than allowed (+-{} pps)". format(avg, dev, max_dev)) fail = True elif max_dev == None: pass else: 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)
import logging from lnst.Controller.Task import ctl from lnst.Controller.PerfRepoUtils import netperf_baseline_template from lnst.Controller.PerfRepoUtils import netperf_result_template # ------ # 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"] offloads = ["gro", "gso", "tso", "tx"] offload_settings = [ [("gro", "on"), ("gso", "on"), ("tso", "on"), ("tx", "on")], [("gro", "off"), ("gso", "on"), ("tso", "on"), ("tx", "on")], [("gro", "on"), ("gso", "off"), ("tso", "off"), ("tx", "on")], [("gro", "on"), ("gso", "on"), ("tso", "off"), ("tx", "off")]]
# ------ # SETUP # ------ h1 = ctl.get_host("host1") g1 = ctl.get_host("guest1") h2 = ctl.get_host("host2") g1.sync_resources(modules=["IcmpPing", "Icmp6Ping"]) h2.sync_resources(modules=["IcmpPing", "Icmp6Ping"]) # ------ # TESTS # ------ ipv = ctl.get_alias("ipv") h2_vlan10 = h2.get_interface("vlan10") g1_vlan10 = g1.get_interface("vlan10") ping_count = 100 ping_interval = 0.2 ping_mod = ctl.get_module("IcmpPing", options={ "addr": h2_vlan10.get_ip(0), "count": ping_count, "iface": g1_vlan10.get_devname(), "interval": ping_interval }) ping_mod6 = ctl.get_module("Icmp6Ping",
options={ "addr": hostB_testiface.get_ip(0), "count": 100, "interval": 0.2, "iface" : hostA_testiface.get_devname(), "limit_rate": 90}) ping_mod6 = ctl.get_module("Icmp6Ping", options={ "addr": hostB_testiface.get_ip(1), "count": 100, "interval": 0.2, "iface" : hostA_testiface.get_ip(1), "limit_rate": 90}) ipv = ctl.get_alias("ipv") mtu = ctl.get_alias("mtu") test_if1 = hostA.get_interface("testiface") test_if1.set_mtu(mtu) test_if2 = hostB.get_interface("testiface") test_if2.set_mtu(mtu) ctl.wait(15) if ipv in [ 'ipv6', 'both' ]: hostA.run(ping_mod6) if ipv in [ 'ipv4', 'both' ]: hostA.run(ping_mod)
# ------ tl = Testlib(ctl) h1 = ctl.get_host("host1") g1 = ctl.get_host("guest1") g2 = ctl.get_host("guest2") g1.sync_resources(modules=["IcmpPing", "Icmp6Ping", "Iperf"]) g2.sync_resources(modules=["Iperf"]) # ------ # TESTS # ------ ipv = ctl.get_alias("ipv") do_iperf = ctl.get_alias("iperf") g1_guestnic = g1.get_interface("if1") g1_mac = g1_guestnic.get_hwaddr() g2_guestnic = g2.get_interface("if1") g2_mac = g2_guestnic.get_hwaddr() ping_count = 30 ping_interval = 0.2 ping_timeout = 10 def ping(options={}): options = dict(options) options.update({ "addr": g2_guestnic.get_ip(0),
import sys from lnst.Controller.Task import ctl m1 = ctl.get_host("m1") # this should fail m1.run("[ \"%s\" == \"value1\" ]" % ctl.get_alias("foo"))
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"])
# ------ # test hosts h1 = ctl.get_host("test_host1") h2 = ctl.get_host("test_host2") for h in [h1, h2]: h.sync_resources(modules=["Netperf", "Custom"]) TUNNEL_COUNT = 16 # ------ # 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")) nperf_cpupin = ctl.get_alias("nperf_cpupin") nperf_cpu_util = ctl.get_alias("nperf_cpu_util") nperf_num_parallel = int(ctl.get_alias("nperf_num_parallel")) nperf_debug = ctl.get_alias("nperf_debug") nperf_max_dev = ctl.get_alias("nperf_max_dev") nperf_msg_size = ctl.get_alias("nperf_msg_size") nperf_protocols = ctl.get_alias("nperf_protocols") devices = []
# ------ tl = Testlib(ctl) h1 = ctl.get_host("host1") g1 = ctl.get_host("guest1") g2 = ctl.get_host("guest2") g1.sync_resources(modules=["IcmpPing", "Icmp6Ping", "Iperf", "Iperf3"]) g2.sync_resources(modules=["Iperf", "Iperf3"]) # ------ # TESTS # ------ ipv = ctl.get_alias("ipv") do_iperf = ctl.get_alias("iperf") g1_guestnic = g1.get_interface("if1") g1_mac = g1_guestnic.get_hwaddr() g2_guestnic = g2.get_interface("if1") g2_mac = g2_guestnic.get_hwaddr() ping_count = 30 ping_interval = 0.2 ping_timeout = 10 def ping(options={}): options = dict(options) options.update({
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") vxlan_dev = "vxlan_sys_%s" % vxlan_port def do_pings(): ping_opts = {"count": 100, "interval": 0.2} if ipv in ['ipv4', 'both']: ping((guest1, g1_nic, 0, { "scope": 0 }), (host2, h2_nic, 0, {
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: h2_nic = host2.get_interface("if1") except KeyError: h2_nic = host2.get_device("int0") def do_pings(warmup=False): if warmup: ping_opts = {"count": 1} else:
# ------ 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"] offloads = ["gso", "gro", "tso"] ipv = ctl.get_alias('ipv') for vlan1 in vlans: for vlan2 in vlans: ping_mod = ctl.get_module("IcmpPing", options={ "addr" : m2.get_ip(vlan2, 0), "count" : 100, "iface" : m1.get_devname(vlan1), "interval" : 0.1 }) ping_mod6 = ctl.get_module("Icmp6Ping", options={ "addr" : m2.get_ip(vlan2, 1), "count" : 100,
from lnst.Common.Utils import bool_it from lnst.Controller.Task import ctl 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")
from lnst.Controller.Task import ctl 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") # 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"]) # ------
return key ciphers.append(('aes', 128)) ciphers.append(('aes', 256)) 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")
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") vxlan_dev = "vxlan_sys_%s" % vxlan_port def do_pings(): ping_opts = {"count": 100, "interval": 0.2} if ipv in ['ipv4', 'both']: ping((guest1, g1_nic, 0, {"scope": 0}), (host2, h2_nic, 0, {"scope": 0}), options=ping_opts, expect="pass")