Example #1
0
def verify_route_count_bcmshell(dut, route_count, af='ipv4', itter=30, delay=1, flag='ge', timeout=120):
    """
    Poll and verify the route count using asic api
    Author : Prudvi Mangadu ([email protected])
    :param dut:
    :param route_count:
    :param af:
    :param itter:
    :param delay:
    :param flag:
    :param timeout:
    :return:
    """
    i = 1
    while True:
        if af == 'ipv4':
            curr_count = asicapi.get_ipv4_route_count(dut, timeout=timeout)
        if af == 'ipv6':
            curr_count = asicapi.get_ipv6_route_count(dut, timeout=timeout)

        if flag == 'ge' and int(curr_count) >= int(route_count):
            st.log("Route count matched Provided {}, Detected {} - flag = {}".format(route_count, curr_count, flag))
            return True
        if flag == 'e' and int(curr_count) == int(route_count):
            st.log("Route count matched Provided {}, Detected {} - flag = {}".format(route_count, curr_count, flag))
            return True
        if flag == 'le' and int(curr_count) <= int(route_count):
            st.log("Route count matched Provided {}, Detected {} - flag = {}".format(route_count, curr_count, flag))
            return True
        if i > itter:
            st.log("Max {} tries Exceeded. Exiting..".format(i))
            return False
        i += 1
        st.log("Route count NOT matched Provided {}, Detected {} - flag = {}".format(route_count, curr_count, flag))
        st.wait(delay)
Example #2
0
def verify_ipv6_route_count_hardware(dut,exp_num_of_routes=data.num_of_routes2):

    n = asicapi.get_ipv6_route_count(dut)
    if int(n) > exp_num_of_routes:
        st.log('PASS - Expected number of IPv6 routes present in the hardware')
        return True
    else:
        st.log('FAIL - Expected number of IPv6 routes not present in the hardware')
        return False
Example #3
0
def check_bcmcmd_route_count(dut, loopCnt, ipType, defcount, expcount):
    flag = 0
    iter = 1
    while iter <= loopCnt:
        if ipType == "ipv4":
            curr_count = asicapi.get_ipv4_route_count(dut)
        elif ipType == "ipv6":
            curr_count = asicapi.get_ipv6_route_count(dut)

        route_cnt = int(curr_count) - int(defcount)

        st.log("Learnt route count after iteration {} : {}".format(
            iter, route_cnt))

        if int(route_cnt) == int(expcount):
            flag = 1
            break
        iter = iter + 1

    if flag:
        return True
    else:
        return False
Example #4
0
def l3_performance_enhancements_module_hooks(request):
    global vars, tg_handler, tg, dut, dut_to_tg_port_1, dut_to_tg_port_2, cli_type
    global hwsku_under_test, def_v4_route_count, def_v6_route_count

    vars = st.ensure_min_topology("D1T1:2")

    # Initialize TG and TG port handlers
    tg_handler = tgapi.get_handles(vars, [vars.T1D1P1, vars.T1D1P2])
    tg = tg_handler["tg"]

    if tgapi.is_soft_tgen(vars):
        data.test_bgp_route_count = 200

    # Test setup details
    dut = vars.D1
    dut_to_tg_port_1 = vars.D1T1P1
    dut_to_tg_port_2 = vars.D1T1P2
    hwsku_under_test = basic_obj.get_hwsku(dut)
    cli_type = st.get_ui_type(dut)

    # Module Configuration
    st.log("L3 Performance Enhancements Module Configuration.")
    # Configuring v4/v6 routing interfaces on the DUT.
    ipfeature.config_ipv6(dut, action='enable')
    ipfeature.config_ip_addr_interface(dut,
                                       dut_to_tg_port_1,
                                       data.my_ip_addr,
                                       data.ip_prefixlen,
                                       family="ipv4")
    ipfeature.config_ip_addr_interface(dut,
                                       dut_to_tg_port_1,
                                       data.my_ipv6_addr,
                                       data.ipv6_prefixlen,
                                       family="ipv6")
    ipfeature.config_ip_addr_interface(dut,
                                       dut_to_tg_port_2,
                                       data.intf_ip_addr,
                                       data.ip_prefixlen,
                                       family="ipv4")
    ipfeature.config_ip_addr_interface(dut,
                                       dut_to_tg_port_2,
                                       data.intf_ipv6_addr,
                                       data.ipv6_prefixlen,
                                       family="ipv6")

    # Configuring BGP router and v4/v6 neighbors on the DUT.
    bgpfeature.create_bgp_router(dut, data.as_num, '')
    bgpfeature.create_bgp_neighbor(dut, data.as_num, data.neigh_ip_addr,
                                   data.remote_as_num)
    bgpfeature.create_bgp_neighbor(dut,
                                   data.as_num,
                                   data.neigh_ipv6_addr,
                                   data.remote_as_num,
                                   family="ipv6")

    # Get the default route count from DUT
    def_v4_route_count = asicapi.get_ipv4_route_count(dut)
    def_v6_route_count = asicapi.get_ipv6_route_count(dut)

    yield
    # Module Cleanup
    st.log("L3 Performance Enhancements Module Cleanup.")
    ipfeature.delete_ip_interface(dut,
                                  dut_to_tg_port_1,
                                  data.my_ip_addr,
                                  data.ip_prefixlen,
                                  family="ipv4")
    ipfeature.delete_ip_interface(dut,
                                  dut_to_tg_port_1,
                                  data.my_ipv6_addr,
                                  data.ipv6_prefixlen,
                                  family="ipv6")
    ipfeature.delete_ip_interface(dut,
                                  dut_to_tg_port_2,
                                  data.intf_ip_addr,
                                  data.ip_prefixlen,
                                  family="ipv4")
    ipfeature.delete_ip_interface(dut,
                                  dut_to_tg_port_2,
                                  data.intf_ipv6_addr,
                                  data.ipv6_prefixlen,
                                  family="ipv6")
    bgpfeature.delete_bgp_neighbor(dut, data.as_num, data.neigh_ip_addr,
                                   data.remote_as_num)
    bgpfeature.delete_bgp_neighbor(dut, data.as_num, data.neigh_ipv6_addr,
                                   data.remote_as_num)
    bgpfeature.cleanup_router_bgp(dut)