Exemple #1
0
def do_task(ctl, hosts, ifaces, aliases):
    m1, sw, m2 = hosts
    m1_if1, sw_if1, sw_if2, sw_if3, m2_if1, m2_if2, m2_if3, m3_if1 = ifaces

    ecmp_sw_ifaces = [sw_if2, sw_if3]
    ecmp_m_ifaces = [m2_if1, m2_if2]

    m2.config("/proc/sys/net/ipv4/ip_forward", "1")
    m2.config("/proc/sys/net/ipv6/conf/all/forwarding", "1")

    ecmp_common.create_topology(m1_if1,
                                sw_if1,
                                ecmp_sw_ifaces,
                                ecmp_m_ifaces,
                                m2_if3,
                                m3_if1,
                                num_nexthops=MAX_NEXTHOPS)

    tl = TestLib(ctl, aliases)
    tl.wait_for_if(ifaces)
    tl.ping_simple(m1_if1, m3_if1)
    tl.netperf_udp(m1_if1, m3_if1)
    ecmp_common.test_traffic(tl, m1_if1, m3_if1, sw_if1, ecmp_sw_ifaces)

    routes_filter = "to match %s" % m3_if1.get_ip()
    dc_routes, nh_routes = sw.get_routes(routes_filter=routes_filter)
    if len(nh_routes) != 1:
        tl.custom(sw, "route", "could not find the ecmp route")

    for nh in nh_routes[0]["nexthops"]:
        if "offload" not in nh["flags"]:
            tl.custom(sw, "route", "ecmp route is not offloaded")
Exemple #2
0
def do_task(ctl, hosts, ifaces, aliases):
    m1, sw, m2 = hosts
    m1_if1, sw_if1, sw_if2, sw_if3, m2_if1, m2_if2, m2_if3, m3_if1 = ifaces

    ecmp_sw_ifaces = [sw_if2, sw_if3]
    ecmp_m_ifaces = [m2_if1, m2_if2]

    m2.config("/proc/sys/net/ipv4/ip_forward", "1")
    m2.config("/proc/sys/net/ipv6/conf/all/forwarding", "1")

    ecmp_common.create_topology(m1_if1, sw_if1, ecmp_sw_ifaces, ecmp_m_ifaces,
                                m2_if3, m3_if1)
    sleep(30)

    tl = TestLib(ctl, aliases)
    tl.ping_simple(m1_if1, m3_if1)
    tl.netperf_udp(m1_if1, m3_if1)
    ecmp_common.test_traffic(tl, m1_if1, m3_if1, sw_if1, ecmp_sw_ifaces)
Exemple #3
0
def do_task(ctl, hosts, ifaces, aliases):
    m1, sw, m2 = hosts
    m1_if1, sw_if1, sw_if2, sw_if3, m2_if1, m2_if2, m2_if3, m3_if1 = ifaces

    ecmp_sw_ifaces = [sw_if2, sw_if3]
    ecmp_m_ifaces = [m2_if1, m2_if2]

    m2.config("/proc/sys/net/ipv4/ip_forward", "1")
    m2.config("/proc/sys/net/ipv6/conf/all/forwarding", "1")

    ecmp_common.create_topology(m1_if1, sw_if1, ecmp_sw_ifaces, ecmp_m_ifaces,
                                m2_if3, m3_if1)

    tl = TestLib(ctl, aliases)
    tl.wait_for_if(ifaces)
    tl.ping_simple(m1_if1, m3_if1)
    tl.netperf_udp(m1_if1, m3_if1)
    ecmp_common.test_traffic(tl, m1_if1, m3_if1, sw_if1, ecmp_sw_ifaces)
Exemple #4
0
def do_task(ctl, hosts, ifaces, aliases):
    m1, sw, m2 = hosts
    m1_if1, sw_if1, sw_if2, sw_if3, sw_if4, sw_if5, m2_if1, m2_if2, m2_if3, \
        m2_if4, m2_if5, m3_if1 = ifaces

    ecmp_sw_ifaces = [sw_if2, sw_if3, sw_if4, sw_if5]
    ecmp_m_ifaces = [m2_if1, m2_if2, m2_if3, m2_if4]

    m2.config("/proc/sys/net/ipv4/ip_forward", "1")

    ecmp_common.create_topology(m1_if1, sw_if1, ecmp_sw_ifaces, ecmp_m_ifaces,
                                m2_if5, m3_if1)
    sleep(30)

    tl = TestLib(ctl, aliases)
    tl.ping_simple(m1_if1, m3_if1)
    tl.netperf_udp(m1_if1, m3_if1)
    ecmp_common.test_traffic(tl, m1_if1, m3_if1, sw_if1, ecmp_sw_ifaces)
Exemple #5
0
def do_task(ctl, hosts, ifaces, aliases):
    m1, sw, m2 = hosts
    m1_if1, sw_if1, sw_if2, sw_if3, m2_if1, m2_if2, m2_if3, m3_if1 = ifaces

    ecmp_sw_ifaces = [sw_if2, sw_if3]
    ecmp_m_ifaces = [m2_if1, m2_if2]

    m2.config("/proc/sys/net/ipv4/ip_forward", "1")

    ecmp_common.create_topology(m1_if1, sw_if1, ecmp_sw_ifaces, ecmp_m_ifaces,
                                m2_if3, m3_if1)
    sleep(30)

    tl = TestLib(ctl, aliases)
    tl.ping_simple(m1_if1, m3_if1)
    tl.netperf_udp(m1_if1, m3_if1)

    msg = "Running with all nexthops active"
    ecmp_common.test_traffic(tl,
                             m1_if1,
                             m3_if1,
                             sw_if1,
                             ecmp_sw_ifaces,
                             expected=1.,
                             errmsg=msg)

    # run once with ignore_routes_with_linkdown and expect no traffic loss
    for iface in ecmp_sw_ifaces:
        sw.config(
            "/proc/sys/net/ipv4/conf/%s/ignore_routes_with_linkdown" %
            iface.get_devname(), "1")

    curr_ecmp_m_ifaces = copy.copy(ecmp_m_ifaces)
    curr_ecmp_sw_ifaces = copy.copy(ecmp_sw_ifaces)
    while len(curr_ecmp_m_ifaces) > 1:
        sw_iface, m_iface = curr_ecmp_sw_ifaces.pop(), curr_ecmp_m_ifaces.pop()
        m_iface.set_link_down()

        msg = "Running with %d failed nexthops" % (len(ecmp_sw_ifaces) -
                                                   len(curr_ecmp_sw_ifaces))
        ecmp_common.test_traffic(tl,
                                 m1_if1,
                                 m3_if1,
                                 sw_if1,
                                 curr_ecmp_sw_ifaces,
                                 expected=1.0,
                                 errmsg=msg)
    for iface in ecmp_m_ifaces:
        iface.set_link_up()
    sleep(30)

    # run once without ignore_routes_with_linkdown and expect traffic loss
    for iface in ecmp_sw_ifaces:
        sw.config(
            "/proc/sys/net/ipv4/conf/%s/ignore_routes_with_linkdown" %
            iface.get_devname(), "0")

    curr_ecmp_m_ifaces = copy.copy(ecmp_m_ifaces)
    curr_ecmp_sw_ifaces = copy.copy(ecmp_sw_ifaces)
    while len(curr_ecmp_m_ifaces) > 1:
        sw_iface, m_iface = curr_ecmp_sw_ifaces.pop(), curr_ecmp_m_ifaces.pop()
        m_iface.set_link_down()

        msg = "Running with %d failed nexthops" % (len(ecmp_sw_ifaces) -
                                                   len(curr_ecmp_sw_ifaces))
        expected = float(len(curr_ecmp_m_ifaces)) / len(ecmp_m_ifaces)
        ecmp_common.test_traffic(tl,
                                 m1_if1,
                                 m3_if1,
                                 sw_if1,
                                 curr_ecmp_sw_ifaces,
                                 expected=expected,
                                 errmsg=msg)