Example #1
0
def compare_results(host, result, baseline, max_dev):
    avg1 = result.get_value("rx_rate").get_result()
    dev1 = result.get_value("rx_rate_deviation").get_result()
    interval1 = (avg1 - dev1, avg1 + dev1)

    avg2 = baseline.get_value("rx_rate").get_result()
    dev2 = baseline.get_value("rx_rate_deviation").get_result()
    interval2 = (avg2 - dev2, avg2 + dev2)

    if interval1[1] < interval2[0]:
        desc = (
            "Measured rate {:.2f} +-{:.2f} pps is lower than threshold {:.2f} +-{:.2f} pps"
            .format(avg1, dev1, avg2, dev2))
        custom_mod = ctl.get_module("Custom", options={"fail": True})
    elif interval1[0] > interval2[1]:
        desc = (
            "Measured rate {:.2f} +-{:.2f} pps is much higher than threshold {:.2f} +-{:.2f} pps\n"
            "This could indicate a low baseline or a problem with the setup".
            format(avg1, dev1, avg2, dev2))
        custom_mod = ctl.get_module("Custom", options={"fail": True})
    else:
        desc = (
            "Measured rate {:.2f} +-{:.2f} pps matches the threshold {:.2f} +-{:.2f} pps"
            .format(avg1, dev1, avg2, dev2))
        custom_mod = ctl.get_module("Custom")

    host.run(custom_mod, desc=desc)
Example #2
0
def run_ssh_command_on_guest(command, guest, host, guest_name=""):
    stdin, stdout, stderr = guest.exec_command(command)
    if stdout.channel.recv_exit_status() > 0:
        custom_mod = ctl.get_module("Custom", options = {"fail": True})
    else:
        custom_mod = ctl.get_module("Custom")
    desc = "%s: %s" % (guest_name, command)
    host.run(custom_mod, desc=desc)
    stdout = "".join(stdout)
    return stdout
Example #3
0
def run_netperf(netperf_servers, netperf_clients, testname):
    netperf_cli_procs = []
    netperf_srv_procs = []

    timeout = (netperf_duration + nperf_reserve) * nperf_max_runs

    for i in range(0, TUNNEL_COUNT):
        netperf_clients[i].update_options({"testname" : testname})

        netperf_srv_procs.append(h2.run(netperf_servers[i], bg=True, timeout=timeout))
        netperf_cli_procs.append(h1.run(netperf_clients[i], bg=True, timeout=timeout))

    for i in range(0, TUNNEL_COUNT):
        netperf_cli_procs[i].wait()
        netperf_srv_procs[i].intr()

    sum = 0

    for i in range(0, TUNNEL_COUNT):
        sum += netperf_cli_procs[i].get_result()['res_data']['rate']

    res = ctl.get_module("Custom",
                          options={
                              "rate" : sum,
                              "unit" : "bps",
                              "testname" : testname
                              })

    return res
Example #4
0
def ping_test(tl, m1, sw, addr, m1_if1, gre,
              require_fastpath=True, fail_expected=False, count=100,
              ipv6=False):
    limit = int(0.9 * count)
    if gre is not None:
        before_stats = gre.link_stats()["rx_packets"]
    ping_mod = ctl.get_module("IcmpPing" if not ipv6 else "Icmp6Ping",
                                options={
                                    "addr": addr,
                                    "count": count,
                                    "interval": 0.2,
                                    "iface" : m1_if1.get_devname(),
                                    "limit_rate": limit,
                                })
    m1.run(ping_mod, fail_expected=fail_expected)

    if not fail_expected and gre is not None:
        after_stats = gre.link_stats()["rx_packets"]

        delta = after_stats - before_stats
        if require_fastpath and delta > 10:
            # Allow a few packets of control plane traffic to go through slow
            # path. All the data plane traffic should go through fast path.
            tl.custom(sw, "ipip",
                      "Too many packets (%d) observed at GRE netdevice" % delta)
Example #5
0
def ping_test(tl,
              m1,
              sw,
              addr,
              m1_if1,
              gre,
              require_fastpath=True,
              fail_expected=False,
              count=100,
              ipv6=False):
    limit = int(0.9 * count)
    if gre is not None:
        before_stats = gre.link_stats()["rx_packets"]
    ping_mod = ctl.get_module("IcmpPing" if not ipv6 else "Icmp6Ping",
                              options={
                                  "addr": addr,
                                  "count": count,
                                  "interval": 0.2,
                                  "iface": m1_if1.get_devname(),
                                  "limit_rate": limit,
                              })
    m1.run(ping_mod, fail_expected=fail_expected)

    if not fail_expected and gre is not None:
        after_stats = gre.link_stats()["rx_packets"]

        delta = after_stats - before_stats
        if require_fastpath and delta > 10:
            # Allow a few packets of control plane traffic to go through slow
            # path. All the data plane traffic should go through fast path.
            tl.custom(
                sw, "ipip",
                "Too many packets (%d) observed at GRE netdevice" % delta)
Example #6
0
def _run_packet_assert(num,
                       main_if,
                       from_addr,
                       to_addr,
                       proto="icmp",
                       src_port=0,
                       dst_port=0):
    mach = main_if.get_host()

    if proto == "icmp":
        # filter only icmp/icmpv6 ping, and the reuqested addresses
        filter_str = "(icmp && (icmp[icmptype] == icmp-echo || \
                                icmp[icmptype] == icmp-echoreply) \
                       || (icmp6 && (ip6[40] == 128 || \
                                     ip6[40] == 129))) \
                    && src %s && dst %s" % (from_addr, to_addr)
    else:
        filter_str = proto
        if src_port > 0:
            filter_str += " && src port %d" % src_port
        if dst_port > 0:
            filter_str += " && dst port %d" % dst_port

    packet_assert_mod = ctl.get_module("PacketAssert",
                                       options={
                                           "min": num,
                                           "max": num,
                                           "promiscuous": True,
                                           "filter": filter_str,
                                           "interface": main_if.get_devname()
                                       })
    return mach.run(packet_assert_mod, bg=True)
Example #7
0
def do_task(ctl, hosts, ifaces, aliases):
    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)
Example #8
0
def run_netperf(netperf_servers, netperf_clients, testname):
    netperf_cli_procs = []
    netperf_srv_procs = []

    timeout = (netperf_duration + nperf_reserve) * nperf_max_runs

    for i in range(0, TUNNEL_COUNT):
        netperf_clients[i].update_options({"testname": testname})

        netperf_srv_procs.append(
            h2.run(netperf_servers[i], bg=True, timeout=timeout))
        netperf_cli_procs.append(
            h1.run(netperf_clients[i], bg=True, timeout=timeout))

    for i in range(0, TUNNEL_COUNT):
        netperf_cli_procs[i].wait()
        netperf_srv_procs[i].intr()

    sum = 0

    for i in range(0, TUNNEL_COUNT):
        sum += netperf_cli_procs[i].get_result()['res_data']['rate']

    res = ctl.get_module("Custom",
                         options={
                             "rate": sum,
                             "unit": "bps",
                             "testname": testname
                         })

    return res
Example #9
0
def report_result(host, result, max_dev):
    avg = result.get_value("rx_rate").get_result()
    dev = result.get_value("rx_rate_deviation").get_result()

    desc = "Measured rate is {:.2f} +-{:.2f} pps".format(avg, dev)
    fail = False
    if re.match("\d+%", max_dev):
        if ((float(dev) / avg) * 100)  > int(max_dev[:-1]):
            desc = ("Measured rate {:.2f} +-{:.2f} pps has bigger "
                    "deviation than allowed (+-{})".
                    format(avg, dev, max_dev))
            fail = True
    elif re.match("\d+", max_dev):
        if dev > int(max_dev):
            desc = ("Measured rate {:.2f} +-{:.2f} pps has bigger "
                    "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)
Example #10
0
def ping6(options={}):
    options = dict(options)
    options.update({
        "addr": g2_guestnic.get_ip(1),
        "count": ping_count,
        "iface": g1_guestnic.get_ip(1),
        "interval": ping_interval
    })
    ping_mod6 = ctl.get_module("Icmp6Ping", options=options)
    g1.run(ping_mod6, timeout=ping_timeout)
Example #11
0
def ping6(options={}):
    options = dict(options)
    options.update({
        "addr": g2_guestnic.get_ip(1),
        "count": ping_count,
        "iface": g1_guestnic.get_ip(1),
        "interval": ping_interval
    })
    ping_mod6 = ctl.get_module("Icmp6Ping", options=options)
    g1.run(ping_mod6, timeout=ping_timeout)
Example #12
0
def compare_results(host, result, baseline):
    avg1 = result.get_value("rx_rate").get_result()
    dev1 = result.get_value("rx_rate_deviation").get_result()
    interval1 = (avg1 - dev1, avg1 + dev1)

    avg2 = baseline.get_value("rx_rate").get_result()
    dev2 = baseline.get_value("rx_rate_deviation").get_result()
    interval2 = (avg2 - dev2, avg2 + dev2)

    if interval1[1] < interval2[0]:
        desc = "Measured rate %.2f +-%.2f pps is lower "\
                "than threshold %.2f +-%.2f pps"% (avg1, dev1, avg2, dev2)
        custom_mod = ctl.get_module("Custom", options = {"fail": True})
    else:
        desc = "Measured rate %.2f +-%.2f pps is higher "\
                "than threshold %.2f +-%.2f pps"% (avg1, dev1, avg2, dev2)
        custom_mod = ctl.get_module("Custom")

    host.run(custom_mod, desc=desc)
Example #13
0
    def start_collect_packets(self, tos, min, max):
        filter_str = "icmp && (ip[1] == %d) && dst %s" % (tos, test_ip(2,1,0))
        packet_assert_options = {"min": min, "max": max, "promiscuous" : True,
                                 "filter" : filter_str,
                                 "interface": self.recieving_agent.get_devname()}

        packet_assert_mod = ctl.get_module("PacketAssert",
                                           options = packet_assert_options)
        host = self.recieving_agent.get_host()
        return host.run(packet_assert_mod, bg=True)
Example #14
0
def run_packet_assert(num, main_if, from_if=None, to_if=None):
    mach = main_if.get_host()
    filter_str = "icmp"
    filter_str += " && src %s" % from_if.get_ip() if from_if else ""
    filter_str += " && dst %s" % to_if.get_ip() if to_if else ""

    packet_assert_mod = ctl.get_module(
        "PacketAssert",
        options={"min": num, "max": num, "promiscuous": True, "filter": filter_str, "interface": main_if.get_devname()},
    )
    return mach.run(packet_assert_mod, bg=True)
def ping(ctl, if1, dst):
        m1 = if1.get_host()
        m1.sync_resources(modules=["IcmpPing"])

        ping_mod = ctl.get_module("IcmpPing",
                                  options={
                                  "addr": dst,
                                  "count": 100,
                                  "interval": 0.2,
                                  "iface" : if1.get_devname(),
                                  "limit_rate": 90})
        m1.run(ping_mod)
Example #16
0
def ping(ctl, if1, dst):
        m1 = if1.get_host()
        m1.sync_resources(modules=["Icmp6Ping"])

        ping_mod = ctl.get_module("Icmp6Ping",
                                  options={
                                  "addr": dst,
                                  "count": 100,
                                  "interval": 0.2,
                                  "iface" : if1.get_devname(),
                                  "limit_rate": 90})
        m1.run(ping_mod)
Example #17
0
def compare_results(host, result, baseline, max_dev):
    avg1 = result.get_value("rx_rate").get_result()
    dev1 = result.get_value("rx_rate_deviation").get_result()
    interval1 = (avg1 - dev1, avg1 + dev1)

    avg2 = baseline.get_value("rx_rate").get_result()
    dev2 = baseline.get_value("rx_rate_deviation").get_result()
    interval2 = (avg2 - dev2, avg2 + dev2)

    if interval1[1] < interval2[0]:
        desc = ("Measured rate {:.2f} +-{:.2f} pps is lower "
                "than threshold {:.2f} +-{:.2f} pps".
                format(avg1, dev1, avg2, dev2))
        custom_mod = ctl.get_module("Custom", options = {"fail": True})
    else:
        desc = ("Measured rate {:.2f} +-{:.2f} pps is higher "
                "than threshold {:.2f} +-{:.2f} pps".
                format(avg1, dev1, avg2, dev2))
        custom_mod = ctl.get_module("Custom")

    host.run(custom_mod, desc=desc)
Example #18
0
def compare_results(host, result, baseline, max_dev):
    avg1 = result.get_value("rx_rate").get_result()
    dev1 = result.get_value("rx_rate_deviation").get_result()
    interval1 = (avg1 - dev1, avg1 + dev1)

    avg2 = baseline.get_value("rx_rate").get_result()
    dev2 = baseline.get_value("rx_rate_deviation").get_result()
    interval2 = (avg2 - dev2, avg2 + dev2)

    if interval1[1] < interval2[0]:
        desc = ("Measured rate {:.2f} +-{:.2f} pps is lower than threshold {:.2f} +-{:.2f} pps".
                format(avg1, dev1, avg2, dev2))
        custom_mod = ctl.get_module("Custom", options = {"fail": True})
    elif interval1[0] > interval2[1]:
        desc = ("Measured rate {:.2f} +-{:.2f} pps is much higher than threshold {:.2f} +-{:.2f} pps\n"
                "This could indicate a low baseline or a problem with the setup".
                format(avg1, dev1, avg2, dev2))
        custom_mod = ctl.get_module("Custom", options = {"fail": True})
    else:
        desc = ("Measured rate {:.2f} +-{:.2f} pps matches the threshold {:.2f} +-{:.2f} pps".
                format(avg1, dev1, avg2, dev2))
        custom_mod = ctl.get_module("Custom")

    host.run(custom_mod, desc=desc)
def run_packet_assert(num, main_if, from_if=None, to_if=None):
    mach = main_if.get_host()
    filter_str = "icmp"
    filter_str += " && src %s" % from_if.get_ip() if from_if else ""
    filter_str += " && dst %s" % to_if.get_ip() if to_if else ""

    packet_assert_mod = ctl.get_module("PacketAssert",
                                       options={
                                           "min": num,
                                           "max": num,
                                           "promiscuous": True,
                                           "filter": filter_str,
                                           "interface": main_if.get_devname()
                                       })
    return mach.run(packet_assert_mod, bg=True)
Example #20
0
def ping_test(tl,
              m1,
              sw,
              addr,
              m1_if1,
              gre,
              require_fastpath=True,
              require_slowpath=False,
              fail_expected=False,
              count=100,
              ipv6=False,
              ttl=None):
    limit = int(0.9 * count)
    if gre is not None:
        before_stats = gre.link_stats()
    options = {
        "addr": addr,
        "count": count,
        "interval": 0.2,
        "iface": m1_if1.get_devname(),
        "limit_rate": limit,
    }
    if ttl is not None:
        options["ttl"] = ttl
    ping_mod = ctl.get_module("IcmpPing" if not ipv6 else "Icmp6Ping", options)
    m1.run(ping_mod, fail_expected=fail_expected)

    if not fail_expected and gre is not None:
        after_stats = gre.link_stats()

        def checkstat(key):
            delta = after_stats[key] - before_stats[key]
            if require_fastpath and delta > 10:
                # Allow a few packets of control plane traffic to go through
                # slow path. All the data plane traffic should go through fast
                # path.
                tl.custom(
                    sw, "ipip",
                    "Too many %s (%d) observed at tunnel netdevice" %
                    (key, delta))
            if require_slowpath and delta < count:
                tl.custom(
                    sw, "ipip",
                    "Too few %s (%d) observed at tunnel netdevice" %
                    (key, delta))

        checkstat("rx_packets")
        checkstat("tx_packets")
Example #21
0
 def check_no_ecn(self):
     logging.info("No ECN check: run traffic and see check on the "
                  "receiving host that it was not marked")
     receiving_port = self.links[self.egress_port]
     host = receiving_port.get_host()
     host.sync_resources(modules=["PacketAssert"])
     options = {"min":0, "max" :0, "promiscuous" :True,
                "filter" :'ip[1]&3=3',
                "interface": receiving_port.get_devname()}
     packet_assert_mod = ctl.get_module("PacketAssert", options=options)
     proc = host.run(packet_assert_mod, bg=True)
     pkt_size = self.links[self.ingress_port].get_mtu()
     self.tl.pktgen(self.links[self.ingress_port],
                    self.links[self.egress_port], pkt_size, count=10**6,
                    tos=self.tos, rate=str(self.rate)+"M")
     proc.intr()
Example #22
0
def _run_packet_assert(num, main_if, from_addr, to_addr):
    mach = main_if.get_host()

    # filter only icmp/icmpv6 ping, and the reuqested addresses
    filter_str = "(icmp && (icmp[icmptype] == icmp-echo || \
                            icmp[icmptype] == icmp-echoreply) \
                   || (icmp6 && (ip6[40] == 128 || \
                                 ip6[40] == 129))) \
                  && src %s && dst %s" % (from_addr, to_addr)

    packet_assert_mod = ctl.get_module("PacketAssert", options = {
                                       "min" : num, "max" : num,
                                       "promiscuous" : True,
                                       "filter" : filter_str,
                                       "interface" : main_if.get_devname()})
    return mach.run(packet_assert_mod, bg=True)
Example #23
0
def pktgen(ctl, if1, if2, neigh_mac):
    m1 = if1.get_host()
    m1.sync_resources(modules=["PktgenTx"])

    pktgen_option = [
        "pkt_size {}".format(if1.get_mtu()), "clone_skb 0",
        "count {}".format(10 * 10**6), "dst_mac {}".format(neigh_mac),
        "dst {}".format(if2.get_ip(1)), "udp_src_min 1024", "udp_src_max 4096",
        "udp_dst_min 1024", "udp_dst_max 4096", "flag UDPSRC_RND",
        "flag UDPDST_RND"
    ]
    pktgen_mod = ctl.get_module("PktgenTx",
                                options={
                                    "netdev_name": if1.get_devname(),
                                    "pktgen_option": pktgen_option
                                })
    m1.run(pktgen_mod, timeout=600)
Example #24
0
def pktgen_l4(ctl, if1, dst, neigh_mac):
        m1 = if1.get_host()
        m1.sync_resources(modules=["PktgenTx"])

        pktgen_option = ["pkt_size {}".format(if1.get_mtu()),
                         "clone_skb 0",
                         "count {}".format(10 * 10 ** 6),
                         "dst_mac {}".format(neigh_mac),
                         "dst {}".format(dst),
                         "udp_src_min 1024", "udp_src_max 4096",
                         "udp_dst_min 1024", "udp_dst_max 4096",
                         "flag UDPSRC_RND", "flag UDPDST_RND"]
        pktgen_mod = ctl.get_module("PktgenTx",
                                    options={
                                    "netdev_name": if1.get_devname(),
                                    "pktgen_option": pktgen_option})
        m1.run(pktgen_mod, timeout=600)
Example #25
0
def ping6(src, dst, options={}, expect="pass", bg=False):
    """ Perform an Icmp6Ping from source to destination

    Keyword arguments:
    src -- tuple of (HostAPI, InterfaceAPI/DeviceAPI, ip address index, ip addr selector)
    dst -- tuple of (HostAPI, InterfaceAPI/DeviceAPI, ip address index, ip addr selector)
    options -- dictionary of options for the IcmpPing module, can't contain
        keys 'addr' and 'iface'
    """

    options = dict(options)
    if 'addr' in options or 'iface' in options:
        raise Exception("options can't contain keys 'addr' and 'iface'")

    if not isinstance(src, tuple) or len(src) < 2 or len(src) > 4:
        raise Exception('Invalid source specification')
    try:
        if len(src) == 2:
            h1, if1 = src
            options["iface"] = if1.get_devname()
        elif len(src) == 3:
            h1, if1, addr_index1 = src
            options["iface"] = if1.get_ip(addr_index1)
        elif len(src) == 4:
            h1, if1, addr_index1, addr_selector1 = src
            options["iface"] = if1.get_ip(addr_index1, selector=addr_selector1)
    except:
        raise Exception('Invalid source specification')

    if not isinstance(dst, tuple) or len(dst) < 3 or len(dst) > 4:
        raise Exception('Invalid destination specification')
    try:
        if len(dst) == 3:
            h2, if2, addr_index2 = dst
            options["addr"] = if2.get_ip(addr_index2)
        elif len(dst) == 4:
            h2, if2, addr_index2, addr_selector2 = dst
            options["addr"] = if2.get_ip(addr_index2, selector=addr_selector2)
    except:
        raise Exception('Invalid destination specification')

    ping_mod = ctl.get_module("Icmp6Ping",
                              options = options)

    return h1.run(ping_mod, expect=expect, bg=bg)
Example #26
0
def _run_packet_assert(num, main_if, from_addr, to_addr):
    mach = main_if.get_host()

    # filter only icmp/icmpv6 ping, and the reuqested addresses
    filter_str = "(icmp && (icmp[icmptype] == icmp-echo || \
                            icmp[icmptype] == icmp-echoreply) \
                   || (icmp6 && (ip6[40] == 128 || \
                                 ip6[40] == 129))) \
                  && src %s && dst %s" % (from_addr, to_addr)

    packet_assert_mod = ctl.get_module("PacketAssert",
                                       options={
                                           "min": num,
                                           "max": num,
                                           "promiscuous": True,
                                           "filter": filter_str,
                                           "interface": main_if.get_devname()
                                       })
    return mach.run(packet_assert_mod, bg=True)
Example #27
0
def pktgen_l3(ctl, if1, neigh_mac, dst_subnet):
        m1 = if1.get_host()
        m1.sync_resources(modules=["PktgenTx"])

        pktgen_option = ["pkt_size {}".format(if1.get_mtu()),
                         "clone_skb 0",
                         "count {}".format(10 * 10 ** 6),
                         "dst_mac {}".format(neigh_mac),
                         "dst6_min {}".format(dst_subnet + "::1"),
                         "dst6_max {}".format(dst_subnet + "::cafe"),
                         "src6 {}".format(if1.get_ip(0)),
                         "udp_src_min 1024", "udp_src_max 1024",
                         "udp_dst_min 1024", "udp_dst_max 1024",
                         "flag IPDST_RND", "flag IPV6"]
        pktgen_mod = ctl.get_module("PktgenTx",
                                    options={
                                    "netdev_name": if1.get_devname(),
                                    "pktgen_option": pktgen_option})
        m1.run(pktgen_mod, timeout=600)
def pktgen_l3(ctl, if1, neigh_mac, src_subnet, dst_subnet):
        m1 = if1.get_host()
        m1.sync_resources(modules=["PktgenTx"])

        pktgen_option = ["pkt_size {}".format(if1.get_mtu()),
                         "clone_skb 0",
                         "count {}".format(10 * 10 ** 6),
                         "dst_mac {}".format(neigh_mac),
                         "dst_min {}".format(dst_subnet + ".1"),
                         "dst_max {}".format(dst_subnet + ".254"),
                         "src_min {}".format(src_subnet + ".1"),
                         "src_max {}".format(src_subnet + ".254"),
                         "udp_src_min 1024", "udp_src_max 1024",
                         "udp_dst_min 1024", "udp_dst_max 1024",
                         "flag IPSRC_RND", "flag IPDST_RND"]
        pktgen_mod = ctl.get_module("PktgenTx",
                                    options={
                                    "netdev_name": if1.get_devname(),
                                    "pktgen_option": pktgen_option})
        m1.run(pktgen_mod, timeout=600)
Example #29
0
def ping_test(tl, m1, sw, addr, m1_if1, gre,
              require_fastpath=True, require_slowpath=False,
              fail_expected=False, count=100,
              ipv6=False, ttl=None):
    limit = int(0.9 * count)
    if gre is not None:
        before_stats = gre.link_stats()
    options = {
        "addr": addr,
        "count": count,
        "interval": 0.2,
        "iface" : m1_if1.get_devname(),
        "limit_rate": limit,
    }
    if ttl is not None:
        options["ttl"] = ttl
    ping_mod = ctl.get_module("IcmpPing" if not ipv6 else "Icmp6Ping",
                              options)
    m1.run(ping_mod, fail_expected=fail_expected)

    if not fail_expected and gre is not None:
        after_stats = gre.link_stats()

        def checkstat(key):
            delta = after_stats[key] - before_stats[key]
            if require_fastpath and delta > 10:
                # Allow a few packets of control plane traffic to go through
                # slow path. All the data plane traffic should go through fast
                # path.
                tl.custom(sw, "ipip",
                          "Too many %s (%d) observed at tunnel netdevice"
                          % (key, delta))
            if require_slowpath and delta < count:
                tl.custom(sw, "ipip",
                          "Too few %s (%d) observed at tunnel netdevice"
                          % (key, delta))

        checkstat("rx_packets")
        checkstat("tx_packets")
Example #30
0
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":
g3 = ctl.get_host("guest3")
g3.sync_resources(modules=["IcmpPing", "Netperf"])
g4 = ctl.get_host("guest4")
g4.sync_resources(modules=["IcmpPing", "Netperf"])

# ------
# TESTS
# ------

#vlans = ["vlan10", "vlan20"]
offloads = ["gso", "gro", "tso"]

ping_mod = ctl.get_module("IcmpPing",
                           options={
                               "addr" : g3.get_ip("guestnic"),
                               "count" : 100,
                               "iface" : g1.get_devname("guestnic"),
                               "interval" : 0.1
                           })
ping_mod2 = ctl.get_module("IcmpPing",
                           options={
                               "addr" : g2.get_ip("guestnic"),
                               "count" : 100,
                               "iface" : g4.get_devname("guestnic"),
                               "interval" : 0.1
                           })
netperf_srv = ctl.get_module("Netperf",
                              options={
                                  "role": "server",
                                  "bind" : g1.get_ip("guestnic")
                              })
Example #32
0
    offload_settings = [ [("gro", "on"), ("gso", "on"), ("tso", "on"), ("tx", "on"), ("rx", "on")],
                         [("gro", "off"), ("gso", "on"), ("tso", "on"), ("tx", "on"), ("rx", "on")],
                         [("gro", "on"), ("gso", "off"),  ("tso", "off"), ("tx", "on"), ("rx", "on")],
                         [("gro", "on"), ("gso", "on"), ("tso", "off"), ("tx", "off"), ("rx", "on")],
                         [("gro", "on"), ("gso", "on"), ("tso", "on"), ("tx", "on"), ("rx", "off")]]

pr_comment = generate_perfrepo_comment([m1, m2], pr_user_comment)

m1_testiface = m1.get_interface("testiface")
m2_testiface = m2.get_interface("testiface")

m1_testiface.set_mtu(mtu)
m2_testiface.set_mtu(mtu)

if adaptive_coalescing_off:
    coalesce_status = ctl.get_module('Custom')

    for d in [ m1_testiface, m2_testiface ]:
        # disable any interrupt coalescing settings
        cdata = d.save_coalesce()
        cdata['use_adaptive_tx_coalesce'] = 0
        cdata['use_adaptive_rx_coalesce'] = 0
        if not d.set_coalesce(cdata):
            coalesce_status.set_options({'fail': True,
                                         'msg': "Failed to set coalesce options"\
                                                " on device %s" % d.get_devname()})
            d.get_host().run(coalesce_status)

if netdev_cpupin:
    m1.run("service irqbalance stop")
    m2.run("service irqbalance stop")
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)
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
                           })

netperf_srv = ctl.get_module("Netperf",
                              options={
                                  "role" : "server",
Example #35
0
test_if2 = m2.get_interface("test_if")
test_if2.set_mtu(mtu)

m1_phy1 = m1.get_interface("eth1")
m1_phy2 = m1.get_interface("eth2")
dev_list = [(m1, m1_phy1), (m1, m1_phy2)]

if test_if2.get_type() == "bond":
    m2_phy1 = m2.get_interface("eth1")
    m2_phy2 = m2.get_interface("eth2")
    dev_list.extend([(m2, m2_phy1), (m2, m2_phy2)])
else:
    dev_list.append((m2, test_if2))

if adaptive_coalescing_off:
    coalesce_status = ctl.get_module('Custom')

    for _, d in dev_list:
        # disable any interrupt coalescing settings
        cdata = d.save_coalesce()
        cdata['use_adaptive_tx_coalesce'] = 0
        cdata['use_adaptive_rx_coalesce'] = 0
        if not d.set_coalesce(cdata):
            coalesce_status.set_options({'fail': True,
                                         'msg': "Failed to set coalesce options"\
                                                " on device %s" % d.get_devname()})
            d.get_host().run(coalesce_status)

if nperf_cpupin:
    m1.run("service irqbalance stop")
    m2.run("service irqbalance stop")
Example #36
0
ctl.wait(15)

netperf_clients = []
netperf_servers = []
netperf_clients6 = []
netperf_servers6 = []


for h1_dev, h2_dev in devices:
    netperf_clients.append(ctl.get_module("Netperf",
                                      options={
                                          "role" : "client",
                                          "netperf_server": h2_dev.get_ip(0),
                                          "bind": h1_dev.get_ip(0),
                                          "duration" : netperf_duration,
                                          "testname" : "TCP_STREAM",
                                          "confidence" : nperf_confidence,
                                          "cpu_util" : nperf_cpu_util,
                                          "runs": nperf_max_runs,
                                          "debug" : nperf_debug,
                                          "num_parallel" : nperf_num_parallel,
                                          "max_deviation" : nperf_max_dev}))

    netperf_clients6.append(ctl.get_module("Netperf",
                                      options={
                                          "role" : "client",
                                          "netperf_server": h2_dev.get_ip(1),
                                          "bind": h1_dev.get_ip(1),
                                          "duration" : netperf_duration,
                                          "testname" : "TCP_STREAM",
                                          "confidence" : nperf_confidence,
Example #37
0
g1_guestnic = g1.get_interface("guestnic")
g2_guestnic = g2.get_interface("guestnic")
g3_guestnic = g3.get_interface("guestnic")
g4_guestnic = g4.get_interface("guestnic")

h1.run("service irqbalance stop")
h2.run("service irqbalance stop")

# this will pin devices irqs to cpu #0
for m, d in [(h1, h1_nic1), (h2, h2_nic1), (h1, h1_nic2), (h2, h2_nic2)]:
    pin_dev_irqs(m, d, 0)

ping_mod = ctl.get_module("IcmpPing",
                          options={
                              "addr": g3_guestnic.get_ip(0),
                              "count": 100,
                              "iface": g1_guestnic.get_devname(),
                              "interval": 0.1
                          })

ping_mod2 = ctl.get_module("IcmpPing",
                           options={
                               "addr": g2_guestnic.get_ip(0),
                               "count": 100,
                               "iface": g4_guestnic.get_ip(0),
                               "interval": 0.1
                           })

ping_mod6 = ctl.get_module("Icmp6Ping",
                           options={
                               "addr": g3_guestnic.get_ip(1),
Example #38
0
from lnst.Controller.Task import ctl

m1 = ctl.get_host("testmachine1")

m1.sync_resources(modules=["Custom"], tools=[])

test = m1.run("while true; do echo test; sleep 1; done", bg=True)

ctl.wait(5)

test.intr()

output = test.get_result()["res_data"]["stdout"]

custom = ctl.get_module("Custom", options={"fail": True})

if output.find("test") != -1:
    custom.update_options({"fail": False})

m1.run(custom)
Example #39
0
                               "pkt_size": pkt_size}}

#============================================
# Guest start testpmd for the DPDK vhostuser NICs
#============================================

run_ssh_command_on_guest("mkfifo /tmp/testpmd_stdio", guest, h2, guest_virtname)
run_ssh_command_on_bg_channel("tail -f /tmp/testpmd_stdio | {}".format(testpmd_cmd),
        testpmd_shell, h2, guest_virtname)

ctl.wait(20)
run_ssh_command_on_guest("echo \"start tx_first\" > /tmp/testpmd_stdio", guest, h2, guest_virtname)

ctl.wait(20)

trex_client_mod = ctl.get_module("TRexClient",
        options=trex_client_conf)

trex_server_mod = ctl.get_module("TRexServer",
        options={"trex_path": trex_dir,
                 "trex_config": [trex_server_conf]})

trex_server = h1.run(trex_server_mod, bg=True)

#wait for the server to start
ctl.wait(5)

results = h1.run(trex_client_mod, timeout=(test_duration+10)*test_runs)
trex_result = results.get_result()

trex_server.intr()
Example #40
0
    vlan_if2 = m2.get_interface(vlan)
    vlan_if2.set_mtu(mtu)

if nperf_cpupin:
    # this will pin devices irqs to cpu #0
    m1.run("service irqbalance stop")
    m2.run("service irqbalance stop")

    for m, d in [ (m1, m1_phy1), (m1, m1_phy2), (m2, m2_phy1) ]:
        pin_dev_irqs(m, d, 0)

ctl.wait(15)

ping_mod = ctl.get_module("IcmpPing",
                           options={
                               "count" : 100,
                               "interval" : 0.1
                           })
ping_mod6 = ctl.get_module("Icmp6Ping",
                           options={
                               "count" : 100,
                               "interval" : 0.1
                           })

m1_vlan1 = m1.get_interface(vlans[0])
m2_vlan1 = m2.get_interface(vlans[0])

p_opts = "-L %s" % (m2_vlan1.get_ip(0))
if nperf_cpupin and nperf_mode != "multi":
    p_opts += " -T%s,%s" % (nperf_cpupin, nperf_cpupin)
Example #41
0
def run_ssh_command_on_bg_channel(command, channel, host, guest_name=""):
    channel.exec_command(command)
    custom_mod = ctl.get_module("Custom")
    desc = "%s running in bg: %s" % (guest_name, command)
    host.run(custom_mod, desc=desc)
Example #42
0
nperf_debug = ctl.get_alias("nperf_debug")
nperf_max_dev = ctl.get_alias("nperf_max_dev")
pr_user_comment = ctl.get_alias("perfrepo_comment")
official_result = bool_it(ctl.get_alias("official_result"))
adaptive_coalescing_off = bool_it(ctl.get_alias("adaptive_coalescing_off"))

m1_testiface = m1.get_interface("testiface")
m2_testiface = m2.get_interface("testiface")

m1_testiface.set_mtu(mtu)
m2_testiface.set_mtu(mtu)

pr_comment = generate_perfrepo_comment([m1, m2], pr_user_comment)

if adaptive_coalescing_off:
    coalesce_status = ctl.get_module('Custom')

    for d in [ m1_testiface, m2_testiface ]:
        # disable any interrupt coalescing settings
        cdata = d.save_coalesce()
        cdata['use_adaptive_tx_coalesce'] = 0
        cdata['use_adaptive_rx_coalesce'] = 0
        if not d.set_coalesce(cdata):
            coalesce_status.set_options({'fail': True,
                                         'msg': "Failed to set coalesce options"\
                                                " on device %s" % d.get_devname()})
            d.get_host().run(coalesce_status)

if netdev_cpupin:
    m1.run("service irqbalance stop")
    m2.run("service irqbalance stop")
Example #43
0
from lnst.Controller.Task import ctl

hostA = ctl.get_host("machine1")
hostB = ctl.get_host("machine2")

hostA.sync_resources(modules=["Icmp6Ping", "IcmpPing"])
hostB.sync_resources(modules=["Icmp6Ping", "IcmpPing"])

hostA_testiface = hostA.get_interface("testiface")
hostB_testiface = hostB.get_interface("testiface")

ping_mod = ctl.get_module("IcmpPing",
                           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")
Example #44
0
        pin_dev_irqs(m, d, 0)

p_opts = "-L %s" % (m2_testiface.get_ip(0))
if nperf_cpupin and nperf_mode != "multi":
    p_opts += " -T%s,%s" % (nperf_cpupin, nperf_cpupin)

p_opts6 = "-L %s -6" % (m2_testiface.get_ip(1))
if nperf_cpupin and nperf_mode != "multi":
    p_opts6 += " -T%s,%s" % (nperf_cpupin, nperf_cpupin)

netperf_cli_tcp = ctl.get_module("Netperf",
                                  options={
                                      "role" : "client",
                                      "netperf_server" : m1_testiface.get_ip(0),
                                      "duration" : netperf_duration,
                                      "testname" : "TCP_STREAM",
                                      "confidence" : nperf_confidence,
                                      "cpu_util" : nperf_cpu_util,
                                      "runs" : nperf_max_runs,
                                      "netperf_opts" : p_opts
                                  })

netperf_cli_tcp6 = ctl.get_module("Netperf",
                                  options={
                                      "role" : "client",
                                      "netperf_server" : m1_testiface.get_ip(1),
                                      "duration" : netperf_duration,
                                      "testname" : "TCP_STREAM",
                                      "confidence" : nperf_confidence,
                                      "cpu_util" : nperf_cpu_util,
                                      "runs" : nperf_max_runs,
Example #45
0
    vlan_if2 = m2.get_interface(vlan)
    vlan_if2.set_mtu(mtu)

if nperf_cpupin:
    # this will pin devices irqs to cpu #0
    m1.run("service irqbalance stop")
    m2.run("service irqbalance stop")

    for m, d in [ (m1, m1_phy1), (m1, m1_phy2), (m2, m2_phy1) ]:
        pin_dev_irqs(m, d, 0)

ctl.wait(15)

ping_mod = ctl.get_module("IcmpPing",
                           options={
                               "count" : 100,
                               "interval" : 0.1
                           })
ping_mod6 = ctl.get_module("Icmp6Ping",
                           options={
                               "count" : 100,
                               "interval" : 0.1
                           })

m1_vlan1 = m1.get_interface(vlans[0])
m2_vlan1 = m2.get_interface(vlans[0])

p_opts = "-L %s" % (m2_vlan1.get_ip(0))
if nperf_cpupin and nperf_mode != "multi":
    p_opts += " -T%s,%s" % (nperf_cpupin, nperf_cpupin)
Example #46
0
           % (m2_addr, m1_addr,
              m2_addr, m1_addr, ipsec_mode))


for algo, key_len, icv_len in algorithm:
    # test: TCP netperf, UDP netperf
    if ipv in ['ipv4', 'both']:
        configure_ipsec(algo, generate_key(key_len), icv_len, "ipv4")

        dump = m1.run("tcpdump -i %s -nn -vv" % m1_if_name, bg=True)

        # ping + PacketAssert
        assert_mod = ctl.get_module("PacketAssert",
                                    options={
                                        "interface": m2_if_name,
                                        "filter": "esp",
                                        "grep_for": ["ESP\(spi=0x00001001"],
                                        "min": 10
                                    })

        assert_proc = m2.run(assert_mod, bg=True)

        ping_mod = ctl.get_module("IcmpPing",
                                  options={
                                      "addr": m2_if_addr,
                                      "count": 10,
                                      "interval": 0.1
                                  })

        ctl.wait(2)
Example #47
0
nperf_tests = ctl.get_alias("nperf_tests")
nperf_sizes = ctl.get_alias("nperf_sizes")
pr_user_comment = ctl.get_alias("perfrepo_comment")
official_result = bool_it(ctl.get_alias("official_result"))
adaptive_coalescing_off = bool_it(ctl.get_alias("adaptive_coalescing_off"))

m1_testiface = m1.get_interface("testiface")
m2_testiface = m2.get_interface("testiface")

m1_testiface.set_mtu(mtu)
m2_testiface.set_mtu(mtu)

pr_comment = generate_perfrepo_comment([m1, m2], pr_user_comment)

if adaptive_coalescing_off:
    coalesce_status = ctl.get_module('Custom')

    for d in [ m1_testiface, m2_testiface ]:
        # disable any interrupt coalescing settings
        cdata = d.save_coalesce()
        cdata['use_adaptive_tx_coalesce'] = 0
        cdata['use_adaptive_rx_coalesce'] = 0
        if not d.set_coalesce(cdata):
            coalesce_status.set_options({'fail': True,
                                         'msg': "Failed to set coalesce options"\
                                                " on device %s" % d.get_devname()})
            d.get_host().run(coalesce_status)

if netdev_cpupin:
    m1.run("service irqbalance stop")
    m2.run("service irqbalance stop")
Example #48
0
    for hash_alg, hash_len in hashes:
        # test: compressed check, TCP netperf, UDP netperf
        if ipv in [ 'ipv4', 'both']:
            configure_ipsec(ciph_alg,
                            generate_key(ciph_len),
                            hash_alg,
                            generate_key(hash_len),
                            "ipv4")

            dump = m1.run("tcpdump -i %s -nn -vv" % m1_if_name, bg=True)

            # ping + PacketAssert
            assert_mod = ctl.get_module("PacketAssert",
                                     options={
                                         "interface": m2_if_name,
                                         "filter": "ah",
                                         "grep_for": [ "AH\(spi=0x00000003",
                                                       "ESP\(spi=0x00000002" ],
                                         "min": 10
                                     })

            assert_proc = m2.run(assert_mod, bg=True)

            ping_mod = ctl.get_module("IcmpPing",
                                    options={
                                        "addr": m2_if_addr,
                                        "count": 10,
                                        "interval": 0.1})

            ctl.wait(2)

            m1.run(ping_mod)
g1_guestnic = g1.get_interface("guestnic")
g2_guestnic = g2.get_interface("guestnic")
g3_guestnic = g3.get_interface("guestnic")
g4_guestnic = g4.get_interface("guestnic")

h1.run("service irqbalance stop")
h2.run("service irqbalance stop")

# this will pin devices irqs to cpu #0
for m, d in [ (h1, h1_nic1), (h2, h2_nic1) ,  (h1, h1_nic2), (h2, h2_nic2) ]:
    pin_dev_irqs(m, d, 0)

ping_mod = ctl.get_module("IcmpPing",
                           options={
                               "addr" : g3_guestnic.get_ip(0),
                               "count" : 100,
                               "iface" : g1_guestnic.get_devname(),
                               "interval" : 0.1
                           })
ping_mod2 = ctl.get_module("IcmpPing",
                           options={
                               "addr" : g2_guestnic.get_ip(0),
                               "count" : 100,
                               "iface" : g4_guestnic.get_devname(),
                               "interval" : 0.1
                           })

ping_mod6 = ctl.get_module("Icmp6Ping",
                           options={
                               "addr" : g3_guestnic.get_ip(1),
                               "count" : 100,
Example #50
0
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_mode = ctl.get_alias("nperf_mode")
nperf_num_parallel = int(ctl.get_alias("nperf_num_parallel"))

test_if1 = m1.get_interface("test_if")
test_if1.set_mtu(mtu)
test_if2 = m2.get_interface("test_if")
test_if2.set_mtu(mtu)

ping_mod = ctl.get_module("IcmpPing",
                          options={
                              "addr": test_if2.get_ip(0),
                              "count": 100,
                              "iface": test_if1.get_devname(),
                              "interval": 0.1
                          })

ping_mod6 = ctl.get_module("Icmp6Ping",
                           options={
                               "addr": test_if2.get_ip(1),
                               "count": 100,
                               "iface": test_if1.get_ip(1),
                               "interval": 0.1
                           })

netperf_srv = ctl.get_module("Netperf",
                             options={
                                 "role": "server",
Example #51
0
def netperf(src, dst, server_opts={}, client_opts={}, baseline={}, timeout=60):
    """ Start a Netserver on the given machine and ip address

    Keyword arguments:
    src -- tuple of (HostAPI, InterfaceAPI/DeviceAPI, ip address index, ip addr selector)
    dst -- tuple of (HostAPI, InterfaceAPI/DeviceAPI, ip address index, ip addr selector)
    server_opts -- dictionary of additional options for the netperf server
        can't contain 'bind' or 'role'
    client_opts -- dictionary of additional options for the netperf client
        can't contain 'bind', 'role', 'netperf_server', 'threshold'
        or 'threshold_deviation'
    baseline -- optional dictionary with keys 'threshold' and 'threshold_deviation'
        that specifies the baseline of the netperf test
    timeout -- integer number of seconds specifing the maximum amount of time
        for the test, defaults to 60
    """

    server_opts = dict(server_opts)
    if 'bind' in server_opts or 'role' in server_opts:
        raise Exception("server_opts can't contain keys 'bind' and 'role'")

    client_opts = dict(client_opts)
    if 'bind' in client_opts or\
       'role' in client_opts or\
       'netperf_server' in client_opts:
        raise Exception("client_opts can't contain keys 'bind', 'role' "\
                        "and 'netperf_server'")

    if not isinstance(src, tuple) or len(src) < 2 or len(src) > 4:
        raise Exception('Invalid source specification')
    try:
        if len(src) == 3:
            h1, if1, addr_index1 = src
            client_ip = if1.get_ip(addr_index1)
        elif len(src) == 4:
            h1, if1, addr_index1, addr_selector1 = src
            client_ip = if1.get_ip(addr_index1, selector=addr_selector1)
    except:
        raise Exception('Invalid source specification')

    if not isinstance(dst, tuple) or len(dst) < 3 or len(dst) > 4:
        raise Exception('Invalid destination specification')
    try:
        if len(dst) == 3:
            h2, if2, addr_index2 = dst
            server_ip = if2.get_ip(addr_index2)
        elif len(dst) == 4:
            h2, if2, addr_index2, addr_selector2 = dst
            server_ip = if2.get_ip(addr_index2, addr_selector2)
    except:
        raise Exception('Invalid destination specification')

    server_opts["role"] = "server"
    server_opts["bind"] = server_ip

    client_opts["role"] = "client"
    client_opts["bind"] = client_ip
    client_opts["netperf_server"] = server_ip

    if "threshold" in baseline:
        client_opts["threshold"] = baseline["threshold"]
    if "threshold_deviation" in baseline:
        client_opts["threshold_deviation"] = baseline["threshold_deviation"]

    netserver_mod = ctl.get_module("Netperf", options=server_opts)
    netclient_mod = ctl.get_module("Netperf", options=client_opts)

    netserver = h2.run(netserver_mod, bg=True)
    ctl.wait(2)
    result = h1.run(netclient_mod, timeout=timeout)

    netserver.intr()
    return result
Example #52
0
g1_guestnic = g1.get_interface("guestnic")
h1_nic = h1.get_interface("nic")
h2_nic = h2.get_interface("nic")

if nperf_cpupin:
    h1.run("service irqbalance stop")
    h2.run("service irqbalance stop")

    # this will pin devices irqs to cpu #0
    for m, d in [(h1, h1_nic), (h2, h2_nic)]:
        pin_dev_irqs(m, d, 0)

ping_mod = ctl.get_module("IcmpPing",
                          options={
                              "addr": h2_vlan10.get_ip(0),
                              "count": 100,
                              "iface": g1_guestnic.get_devname(),
                              "interval": 0.1
                          })

ping_mod6 = ctl.get_module("Icmp6Ping",
                           options={
                               "addr": h2_vlan10.get_ip(1),
                               "count": 100,
                               "iface": g1_guestnic.get_ip(1),
                               "interval": 0.1
                           })

netperf_srv = ctl.get_module("Netperf",
                             options={
                                 "role": "server",
Example #53
0

for ciph_alg, ciph_len in ciphers:
    for hash_alg, hash_len in hashes:
        # test: compressed check, TCP netperf, UDP netperf
        if ipv in ['ipv4', 'both']:
            configure_ipsec(ciph_alg, generate_key(ciph_len), hash_alg,
                            generate_key(hash_len), "ipv4")

            dump = m1.run("tcpdump -i %s -nn -vv" % m1_if_name, bg=True)

            # ping + PacketAssert
            assert_mod = ctl.get_module(
                "PacketAssert",
                options={
                    "interface": m2_if_name,
                    "filter": "ah",
                    "grep_for": ["AH\(spi=0x00000003", "ESP\(spi=0x00000002"],
                    "min": 10
                })

            assert_proc = m2.run(assert_mod, bg=True)

            ping_mod = ctl.get_module("IcmpPing",
                                      options={
                                          "addr": m2_if_addr,
                                          "count": 10,
                                          "interval": 0.1
                                      })

            ctl.wait(2)
Example #54
0
m1.sync_resources(modules=["IcmpPing", "Netperf"])
m2.sync_resources(modules=["IcmpPing", "Netperf"])

# ------
# TESTS
# ------

vlans = ["vlan10", "vlan20", "vlan30"]
offloads = ["gso", "gro", "tso"]

for vlan1 in vlans:
    for vlan2 in vlans:
        ping_mod = ctl.get_module("IcmpPing",
                                   options={
                                       "addr" : m2.get_ip(vlan2),
                                       "count" : 100,
                                       "iface" : m1.get_devname(vlan1),
                                       "interval" : 0.1
                                   })
        netperf_srv = ctl.get_module("Netperf",
                                      options={
                                          "role" : "server",
                                          "bind" : m1.get_ip(vlan1),
                                      })
        netperf_cli_tcp = ctl.get_module("Netperf",
                                          options={
                                              "role" : "client",
                                              "netperf_server" :
                                                  m1.get_ip(vlan1),
                                              "duration" : 60,
                                              "testname" : "TCP_STREAM",