Ejemplo n.º 1
0
def check_intf_traffic_counters(dut1):
    papi.clear_interface_counters(dut1)
    st.wait(10)
    vars = st.get_testbed_vars()
    DUT_rx_value = papi.get_interface_counters(dut1, vars.D1T1P1, "rx_bps")
    DUT_tx_value = papi.get_interface_counters(dut1, vars.D1T1P2, "tx_bps")

    for i in DUT_rx_value:
        p1_rcvd = i['rx_bps']
        p1_rcvd = p1_rcvd.replace(" MB/s", "")
        p1_rcvd = p1_rcvd.replace(" B/s", "")

    for i in DUT_tx_value:
        p2_txmt = i['tx_bps']
        p2_txmt = p2_txmt.replace(" MB/s", "")
        p2_txmt = p2_txmt.replace(" B/s", "")

    st.log(
        "rx_ok counter value on DUT Ingress port: {} and tx_ok xounter value on DUT Egress port : {}"
        .format(p1_rcvd, p2_txmt))

    if (p1_rcvd and p2_txmt):
        return True
    else:
        return False
def check_intf_traffic_counters():
    (dut1) = (data.dut)
    papi.clear_interface_counters(dut1)
    st.wait(5)
    DUT_tx_value = papi.get_interface_counters(dut1, vars.D1T1P4, "tx_bps")

    for i in DUT_tx_value:
        p2_txmt = i['tx_bps']
        p2_txmt = p2_txmt.replace(" MB/s","")
        p2_txmt = p2_txmt.replace(" KB/s","")
        p2_txmt = p2_txmt.replace(" B/s","")

    st.log("tx_ok xounter value on DUT Egress port : {}".format(p2_txmt))

    if (abs(int(float(p2_txmt))) == 0):
        output = papi.get_interface_counters_all(dut1)
        entry1 = filter_and_select(output, ["tx_bps"], {'iface': vars.D1T1P4})
        for i in entry1:
            p2_txmt = i['tx_bps']
            p2_txmt = p2_txmt.replace(" MB/s","")
            p2_txmt = p2_txmt.replace(" KB/s","")
            p2_txmt = p2_txmt.replace(" B/s","")
        st.log("RETRY tx_ok xounter value on DUT Egress port : {}".format(p2_txmt))
        if (abs(int(float(p2_txmt))) == 0):
            st.show(dut1, "show arp")
            asicapi.dump_l3_egress(dut1)
            return False
        else:
            return True
    else:
        return True
Ejemplo n.º 3
0
def snapshot_feature_func_hooks(request):
    if (st.get_func_name(request) not in 'test_ft_watermark_telemetry_interval'
        ) and (st.get_func_name(request) not in 'test_ft_snapshot_interval'):
        clear_interface_counters(vars.D1)
    yield
    if st.get_func_name(
            request
    ) == 'test_ft_sf_all_buffer_stats_using_unicast_traffic' or st.get_func_name(
            request) == 'test_ft_sf_verify_buffer_pool_counters':
        sf_tg_traffic_start_stop(sf_data.unicast, False)
        sfapi.config_snapshot_interval(vars.D1, snap="clear_snaphot_interval")
    if st.get_func_name(
            request) == 'test_ft_sf_all_buffer_stats_using_multicast_traffic':
        sf_tg_traffic_start_stop(sf_data.multicast, False)
        sfapi.config_snapshot_interval(vars.D1, snap="clear_snaphot_interval")
    if st.get_func_name(request) == 'test_ft_sf_verify_cpu_counters':
        sflow.config_attributes(vars.D1,
                                sample_rate=sf_data.sflow_sample_rate,
                                interface_name=vars.D1T1P1,
                                no_form=True)
        sflow.enable_disable_config(vars.D1,
                                    interface=False,
                                    interface_name=None,
                                    action="disable")
        sf_tg_traffic_start_stop(sf_data.unicast, False)
        sfapi.config_snapshot_interval(vars.D1, snap="clear_snaphot_interval")
Ejemplo n.º 4
0
def test_bgp_v4_warm_reboot(fixture_v4):
    ################# Author Details ################
    # Name: V Sreenivasula Reddy
    # Email:  [email protected]
    #
    ############### Test bed details ################
    #  TG --- DUT --- TG
    #################################################

    bgpfeature.enable_docker_routing_config_mode(vars.D1)
    tr1 = tg.tg_traffic_config(
        port_handle=tg_handler["tg_ph_2"],
        emulation_src_handle=h2['handle'],
        emulation_dst_handle=bgp_rtr1['route'][0]['handle'],
        circuit_endpoint_type='ipv4',
        mode='create',
        transmit_mode='continuous',
        length_mode='fixed',
        rate_pps=data.traffic_rate_pps,
        enable_stream_only_gen='0')

    # Verify the total route count
    count = verify_bgp_route_count(dut,
                                   family='ipv4',
                                   neighbor=data.neigh_ip_addr,
                                   state='Established')
    st.log("Route count: " + str(count))
    if int(count) != int(data.test_bgp_route_count):
        st.report_fail("route_table_not_updated_by_advertise_from_tg")

    # Starting the TG traffic after clearing the DUT counters
    papi.clear_interface_counters(dut)
    tg.tg_traffic_control(action="run", handle=tr1['stream_id'])

    bgpfeature.enable_docker_routing_config_mode(vars.D1)
    st.log("saving the BGP config in vtysh shell")
    reboot_obj.config_save(vars.D1, shell='vtysh')
    st.log("config save in D1")
    reboot_obj.config_save([vars.D1])
    st.log("Performing warm reboot")
    st.reboot(vars.D1, "warm")

    # Stopping the TG traffic
    tg.tg_traffic_control(action='stop', handle=tr1['stream_id'])

    traffic_details = {
        '1': {
            'tx_ports': [vars.T1D1P2],
            'tx_obj': [tg],
            'exp_ratio': [1],
            'rx_ports': [vars.T1D1P1],
            'rx_obj': [tg],
        }
    }
    if not tgapi.validate_tgen_traffic(traffic_details=traffic_details,
                                       mode='aggregate',
                                       comp_type='packet_count'):
        st.report_fail("traffic_verification_failed_during_warm_reboot")
    st.report_pass("test_case_passed")
def check_intf_traffic_bo_counters():
    (dut1) = (data.dut)
    papi.clear_interface_counters(dut1)
    st.wait(5)
    output = papi.get_interface_counters_all(dut1)
    p1_tx = intf_traffic_stats(filter_and_select(output, ["tx_bps"], {'iface': vars.D1T1P1}))
    p2_tx = intf_traffic_stats(filter_and_select(output, ["tx_bps"], {'iface': vars.D1T1P2}))
    p3_tx = intf_traffic_stats(filter_and_select(output, ["tx_bps"], {'iface': vars.D1T1P3}))
    p4_tx = intf_traffic_stats(filter_and_select(output, ["tx_bps"], {'iface': vars.D1T1P4}))
    st.log("Inter Dut port stats  tx_ok xounter value on DUT Egress ports : {} {} {} {}".format(p1_tx, p2_tx, p3_tx, p4_tx))
    if (p2_tx == 0) | (p3_tx == 0) | (p4_tx == 0):
        st.log("Error:Inter Dut port stats  tx_ok xounter value on DUT Egress ports : {} {} {}".format(p2_tx, p3_tx, p4_tx))
    else:
        return True

    DUT_rx_value = papi.get_interface_counters(dut1, vars.D1T1P4, "rx_ok")
    for i in DUT_rx_value:
        p1_rcvd = i['rx_ok']
        p1_rcvd = p1_rcvd.replace(",","")

    st.log("rx_ok xounter value on DUT Inress port : {}".format(p1_rcvd))

    if (abs(int(float(p1_rcvd))) > 0):
        output = papi.get_interface_counters_all(dut1)
        entry1 = filter_and_select(output, ["tx_bps"], {'iface': vars.D1T1P1})
        entry2 = filter_and_select(output, ["tx_bps"], {'iface': vars.D1T1P2})
        entry3 = filter_and_select(output, ["tx_bps"], {'iface': vars.D1T1P3})
        entry4 = filter_and_select(output, ["tx_bps"], {'iface': vars.D1T1P4})
        for i in entry1:
            p1_txmt = i['tx_bps']
            p1_txmt = p1_txmt.replace(" MB/s","")
            p1_txmt = p1_txmt.replace(" KB/s","")
            p1_txmt = p1_txmt.replace(" B/s","")
        for i in entry2:
            p2_txmt = i['tx_bps']
            p2_txmt = p2_txmt.replace(" MB/s","")
            p2_txmt = p2_txmt.replace(" KB/s","")
            p2_txmt = p2_txmt.replace(" B/s","")
        for i in entry3:
            p3_txmt = i['tx_bps']
            p3_txmt = p3_txmt.replace(" MB/s","")
            p3_txmt = p3_txmt.replace(" KB/s","")
            p3_txmt = p3_txmt.replace(" B/s","")
        for i in entry4:
            p4_txmt = i['tx_bps']
            p4_txmt = p4_txmt.replace(" MB/s","")
            p4_txmt = p4_txmt.replace(" KB/s","")
            p4_txmt = p4_txmt.replace(" B/s","")

        st.log("RETRY tx_ok xounter value on DUT Egress ports : {} {} {} {}".format(p1_txmt, p2_txmt, p3_txmt, p4_txmt))
        if (abs(int(float(p2_txmt))) == 0) | (abs(int(float(p3_txmt))) == 0) | (abs(int(float(p4_txmt))) == 0):
            st.show(dut1, "show arp")
            return False
        else:
            return True
    else:
        return False
Ejemplo n.º 6
0
def test_bgp_v6_warm_boot(fixture_v6):
    ################# Author Details ################
    # Name: V Sreenivasula Reddy
    # Email:  [email protected]
    #
    ############### Test bed details ################
    #  TG --- DUT --- TG
    #################################################

    # Configuring traffic stream on the TG interfac

    tr1 = tg.tg_traffic_config(
        port_handle=tg_handler["tg_ph_2"],
        emulation_src_handle=h2['handle'],
        emulation_dst_handle=bgp_rtr2['route'][0]['handle'],
        circuit_endpoint_type='ipv6',
        mode='create',
        transmit_mode='continuous',
        length_mode='fixed',
        rate_pps=data.traffic_rate_pps,
        enable_stream_only_gen='0')

    # Starting the TG traffic after clearing the DUT counters
    papi.clear_interface_counters(dut)
    tgapi.traffic_action_control(tg_handler, actions=['clear_stats'])
    tg.tg_traffic_control(action="run", handle=tr1['stream_id'])

    bgpfeature.enable_docker_routing_config_mode(vars.D1)
    st.log("saving the BGP config in vtysh shell")
    reboot_obj.config_save(vars.D1, shell='vtysh')
    st.log("config save in D1")
    reboot_obj.config_save([vars.D1])
    st.log("Performing warm reboot")
    st.reboot(vars.D1, "warm")

    # Stopping the TG traffic
    tg.tg_traffic_control(action='stop', handle=tr1['stream_id'])
    st.wait(5)
    traffic_details = {
        '1': {
            'tx_ports': [vars.T1D1P2],
            'tx_obj': [tg],
            'exp_ratio': [1],
            'rx_ports': [vars.T1D1P1],
            'rx_obj': [tg],
        }
    }
    if not tgapi.validate_tgen_traffic(traffic_details=traffic_details,
                                       mode='aggregate',
                                       comp_type='packet_count'):
        st.report_fail("traffic_verification_failed_during_warm_reboot")
    st.report_pass("test_case_passed")
Ejemplo n.º 7
0
def test_l3_host_scaling_tc5_4():
    pre_test_l3_fwding()
    vars = st.get_testbed_vars()
    data.my_dut_list = st.get_dut_names()

    dut1 = vars.D1
    ipfeature.get_interface_ip_address(dut1, family="ipv4")
    ipfeature.get_interface_ip_address(dut1, family="ipv6")
    ipfeature.show_ip_route(dut1)
    ifapi.interface_status_show(dut1)

    # L3 traffic streams
    (tg1, tg2, tg_ph_1, tg_ph_2) = get_handles()

    tg1.tg_traffic_control(action='reset', port_handle=tg_ph_1)
    tr1 = create_l3_host(tg1, tg_ph_1, data.max_host_1, 20)
    st.wait(15)

    # Verified ARP and counters at the DUT.
    total = arpfeature.get_arp_count(dut1)
    st.log("Total ARP entries: {}".format(total))
    tg1.tg_traffic_control(action='stop', handle=tr1['stream_id'])
    tg1.tg_traffic_control(action='reset', port_handle=tg_ph_1)

    tg1.tg_traffic_control(action='reset', port_handle=tg_ph_1)
    tg2.tg_traffic_control(action='reset', port_handle=tg_ph_2)

    res = tg1.tg_interface_config(port_handle=tg_ph_1,
                                  mode='config',
                                  intf_ip_addr=data.t1d1_ip_addr,
                                  gateway=data.d1t1_ip_addr,
                                  src_mac_addr='00:0a:01:00:11:01',
                                  arp_send_req='1')
    st.log("INTFCONF: " + str(res))
    handle1 = res['handle']
    #tg1.tg_test_control(action='sync')

    res = tg2.tg_interface_config(port_handle=tg_ph_2,
                                  mode='config',
                                  intf_ip_addr=data.t1d2_ip_addr,
                                  gateway=data.d1t2_ip_addr,
                                  src_mac_addr='00:0a:01:00:12:01',
                                  arp_send_req='1')
    st.log("INTFCONF: " + str(res))
    handle2 = res['handle']
    #tg2.tg_test_control(action='sync')

    tr1 = tg1.tg_traffic_config(port_handle=tg_ph_1,
                                mode='create',
                                transmit_mode='continuous',
                                length_mode='fixed',
                                l3_length=data.tgen_l3_len,
                                rate_pps=data.tgen_rate_pps,
                                emulation_src_handle=handle1,
                                emulation_dst_handle=handle2)
    tr2 = tg2.tg_traffic_config(port_handle=tg_ph_2,
                                mode='create',
                                transmit_mode='continuous',
                                length_mode='fixed',
                                l3_length=data.tgen_l3_len,
                                rate_pps=data.tgen_rate_pps,
                                emulation_src_handle=handle2,
                                emulation_dst_handle=handle1)

    tg1.tg_packet_control(port_handle=tg_ph_1, action='start')
    tg2.tg_packet_control(port_handle=tg_ph_2, action='start')

    tg1.tg_traffic_control(action='clear_stats', handle=tr1['stream_id'])
    tg2.tg_traffic_control(action='clear_stats', handle=tr2['stream_id'])
    papi.clear_interface_counters(dut1)
    tg1.tg_traffic_control(action='run', handle=tr1['stream_id'], duration=2)
    tg2.tg_traffic_control(action='run', handle=tr2['stream_id'], duration=2)
    st.wait(data.traffic_run_time)
    tg1.tg_traffic_control(action='stop', handle=tr1['stream_id'])
    tg2.tg_traffic_control(action='stop', handle=tr2['stream_id'])

    st.wait(5)
    tg1.tg_packet_control(port_handle=tg_ph_1, action='stop')
    tg2.tg_packet_control(port_handle=tg_ph_2, action='stop')

    stats_tg1 = tg1.tg_traffic_stats(port_handle=tg_ph_1, mode='aggregate')
    total_tg1_tx = stats_tg1[tg_ph_1]['aggregate']['tx']['total_pkts']
    total_tg1_rx = stats_tg1[tg_ph_1]['aggregate']['rx']['total_pkts']

    stats_tg2 = tg2.tg_traffic_stats(port_handle=tg_ph_2, mode='aggregate')
    total_tg2_tx = stats_tg2[tg_ph_2]['aggregate']['tx']['total_pkts']
    total_tg2_rx = stats_tg2[tg_ph_2]['aggregate']['rx']['total_pkts']

    st.log(
        "Tgen Sent Packets on D1T1P1: {} and Received Packets on D2T1P1: {}".
        format(total_tg1_tx, total_tg2_rx))
    st.log(
        "Tgen Sent Packets on D2T1P1: {} and Received Packets on D1T1P1: {}".
        format(total_tg2_tx, total_tg1_rx))

    flap_interface(vars.D1T1P1)
    flap_interface(vars.D1T1P2)

    #Getting interfaces counter values on DUT
    DUT_rx_value = ifapi.get_interface_counters(dut1, vars.D1T1P1, "rx_ok")
    DUT_tx_value = ifapi.get_interface_counters(dut1, vars.D1T1P2, "tx_ok")

    for i in DUT_rx_value:
        p1_rcvd = i['rx_ok']
        p1_rcvd = p1_rcvd.replace(",", "")

    for i in DUT_tx_value:
        p2_txmt = i['tx_ok']
        p2_txmt = p2_txmt.replace(",", "")

    st.log(
        "rx_ok counter value on DUT Ingress port: {} and tx_ok xounter value on DUT Egress port : {}"
        .format(p1_rcvd, p2_txmt))

    post_test_l3_fwding()
    if (total >= data.max_host_1):
        st.report_pass("test_case_passed")
    else:
        st.report_fail("test_case_failed")
Ejemplo n.º 8
0
def test_l3_host_scaling_tc5_3():
    pre_test_l3_fwding()

    vars = st.get_testbed_vars()
    # Config 2 IPV4 interfaces on DUT.
    (tg1, tg2, tg_ph_1, tg_ph_2) = get_handles()
    dut1 = vars.D1
    ipfeature.get_interface_ip_address(dut1, family="ipv4")
    ipfeature.get_interface_ip_address(dut1, family="ipv6")
    ipfeature.show_ip_route(dut1)
    ifapi.interface_status_show(dut1)

    tr1 = create_l3_host(tg1, tg_ph_1, data.max_host_1, 20)
    st.wait(15)

    # Verified ARP and counters at the DUT.
    total = arpfeature.get_arp_count(dut1)
    st.log("Total ARP entries: {}".format(total))
    tg1.tg_traffic_control(action='stop', handle=tr1['stream_id'])
    tg1.tg_traffic_control(action='reset', port_handle=tg_ph_1)

    tg1.tg_traffic_control(action='reset', port_handle=tg_ph_1)
    tg2.tg_traffic_control(action='reset', port_handle=tg_ph_2)

    res = tg1.tg_interface_config(port_handle=tg_ph_1,
                                  mode='config',
                                  intf_ip_addr=data.t1d1_ip_addr,
                                  gateway=data.d1t1_ip_addr,
                                  src_mac_addr='00:0a:01:00:11:01',
                                  arp_send_req='1')
    st.log("INTFCONF: " + str(res))
    handle1 = res['handle']
    #tg1.tg_test_control(action='sync')

    res = tg2.tg_interface_config(port_handle=tg_ph_2,
                                  mode='config',
                                  intf_ip_addr=data.t1d2_ip_addr,
                                  gateway=data.d1t2_ip_addr,
                                  src_mac_addr='00:0a:01:00:12:01',
                                  arp_send_req='1')
    st.log("INTFCONF: " + str(res))
    handle2 = res['handle']
    #tg2.tg_test_control(action='sync')

    tr1 = tg1.tg_traffic_config(port_handle=tg_ph_1,
                                mode='create',
                                transmit_mode='continuous',
                                length_mode='fixed',
                                l3_length=data.tgen_l3_len,
                                rate_pps=data.tgen_rate_pps,
                                emulation_src_handle=handle1,
                                emulation_dst_handle=handle2)
    tr2 = tg2.tg_traffic_config(port_handle=tg_ph_2,
                                mode='create',
                                transmit_mode='continuous',
                                length_mode='fixed',
                                l3_length=data.tgen_l3_len,
                                rate_pps=data.tgen_rate_pps,
                                emulation_src_handle=handle2,
                                emulation_dst_handle=handle1)

    tg1.tg_packet_control(port_handle=tg_ph_1, action='start')
    tg2.tg_packet_control(port_handle=tg_ph_2, action='start')

    tg1.tg_traffic_control(action='clear_stats', handle=tr1['stream_id'])
    tg2.tg_traffic_control(action='clear_stats', handle=tr2['stream_id'])
    papi.clear_interface_counters(dut1)
    tg1.tg_traffic_control(action='run', handle=tr1['stream_id'], duration=2)
    tg2.tg_traffic_control(action='run', handle=tr2['stream_id'], duration=2)
    st.wait(data.traffic_run_time)
    tg1.tg_traffic_control(action='stop', handle=tr1['stream_id'])
    tg2.tg_traffic_control(action='stop', handle=tr2['stream_id'])

    tg1.tg_packet_control(port_handle=tg_ph_1, action='stop')
    tg2.tg_packet_control(port_handle=tg_ph_2, action='stop')

    papi.clear_interface_counters(dut1)
    tg2.tg_traffic_control(action='run', handle=tr1['stream_id'])
    st.wait(20)
    retval = check_intf_traffic_counters(dut1)

    post_test_l3_fwding()
    if (total >= data.max_host_1 and retval):
        st.report_pass("test_case_passed")
    else:
        st.report_fail("test_case_failed")
Ejemplo n.º 9
0
def test_l3_fwding():
    #pre_test_l3_fwding()
    data.my_dut_list = st.get_dut_names()

    dut1 = vars.D1
    ipfeature.get_interface_ip_address(dut1, family="ipv4")
    ipfeature.get_interface_ip_address(dut1, family="ipv6")
    ipfeature.show_ip_route(dut1)

    # L3 traffic streams
    (tg1, _, tg_ph_1, tg_ph_2) = get_handles()

    tg1.tg_traffic_control(action='reset', port_handle=[tg_ph_1, tg_ph_2])

    res = tg1.tg_interface_config(port_handle=tg_ph_1,
                                  mode='config',
                                  intf_ip_addr=data.t1d1_ip_addr,
                                  gateway=data.d1t1_ip_addr,
                                  src_mac_addr='00:0a:01:00:11:01',
                                  arp_send_req='1')
    st.log("INTFCONF: " + str(res))
    handle1 = res['handle']

    res = tg1.tg_interface_config(port_handle=tg_ph_2,
                                  mode='config',
                                  intf_ip_addr=data.t1d2_ip_addr,
                                  gateway=data.d2t1_ip_addr,
                                  src_mac_addr='00:0a:01:00:12:01',
                                  arp_send_req='1')
    st.log("INTFCONF: " + str(res))
    handle2 = res['handle']

    rv = tg1.tg_traffic_config(port_handle=tg_ph_1,
                               port_handle2=tg_ph_2,
                               mode='create',
                               transmit_mode='continuous',
                               length_mode='fixed',
                               l3_length=data.tgen_l3_len,
                               rate_pps=data.tgen_rate_pps,
                               emulation_src_handle=handle1,
                               emulation_dst_handle=handle2)
    tg_info['tg1_stream_id'] = rv['stream_id']
    rv_1 = tg1.tg_traffic_config(port_handle=tg_ph_2,
                                 port_handle2=tg_ph_1,
                                 mode='create',
                                 transmit_mode='continuous',
                                 length_mode='fixed',
                                 l3_length=data.tgen_l3_len,
                                 rate_pps=data.tgen_rate_pps,
                                 emulation_src_handle=handle2,
                                 emulation_dst_handle=handle1)
    tg_info['tg2_stream_id'] = rv_1['stream_id']

    tg1.tg_traffic_control(action='clear_stats',
                           port_handle=[tg_ph_1, tg_ph_2])
    papi.clear_interface_counters(dut1)

    tg1.tg_traffic_control(
        action='run',
        stream_handle=[tg_info['tg1_stream_id'], tg_info['tg2_stream_id']])
    st.wait(data.traffic_run_time)
    tg1.tg_traffic_control(
        action='stop',
        stream_handle=[tg_info['tg1_stream_id'], tg_info['tg2_stream_id']])

    traffic_details = {
        '1': {
            'tx_ports': [vars.T1D1P1],
            'tx_obj': [tg1],
            'exp_ratio': [1],
            'rx_ports': [vars.T1D2P1],
            'rx_obj': [tg1],
            'stream_list': [[tg_info['tg1_stream_id']]]
        },
        '2': {
            'tx_ports': [vars.T1D2P1],
            'tx_obj': [tg1],
            'exp_ratio': [1],
            'rx_ports': [vars.T1D1P1],
            'rx_obj': [tg1],
            'stream_list': [[tg_info['tg2_stream_id']]]
        }
    }
    if not tgapi.validate_tgen_traffic(traffic_details=traffic_details,
                                       mode='streamblock',
                                       comp_type='packet_count'):
        st.report_fail("failed_traffic_verification")

    # read interface counters
    rx_counters = intapi.get_interface_counters(dut1, vars.D1T1P1, "rx_ok")
    tx_counters = intapi.get_interface_counters(dut1, vars.D1D2P1, "tx_ok")

    # process interface counters
    p1_rcvd, p2_txmt = 0, 0
    for i in rx_counters:
        p1_rcvd = int(i['rx_ok'].replace(",", ""))
    for i in tx_counters:
        p2_txmt = int(i['tx_ok'].replace(",", ""))
    diff_count = abs(p1_rcvd - p2_txmt)
    st.log("ingress rx_ok = {} egress tx_ok = {} diff = {}".format(
        p1_rcvd, p2_txmt, diff_count))

    # verify interface counters
    if p1_rcvd == 0: st.report_fail("msg", "rx_ok is invalid")
    if p2_txmt == 0: st.report_fail("msg", "tx_ok is invalid")
    #if diff_count > data.counters_threshold: st.report_fail("msg", "unexpected counter values")

    # verify the ipv4 ping
    result = ipfeature.ping(dut1, data.d2t1_ip_addr)
    if not result: st.report_fail("msg", "IPv4 Ping Failed")

    # verify the ipv6 ping
    result = ipfeature.ping(dut1, data.d2t1_ip_addr_v6, 'ipv6')
    if not result: st.report_fail("msg", "IPv6 Ping Failed")

    st.report_pass("operation_successful")
Ejemplo n.º 10
0
def test_ft_l3_performance_enhancements_v4_bgp_clos_topology_indirect_link_fail_convergence_time(fixture_v4):
	################# Author Details ################
	# Name: Rakesh Kumar Vooturi
	# Email:  [email protected]
	#################################################
	#
	# Objective - FtOpSoRtPerfFn034 : Measure convergence time with BGP routes (with ECMP paths) in case of indirectly connected link failure
	#
	############### Test bed details ################
	#  TG --- DUT1 --- DUT2 --- DUT3 --- DUT4 --- TG
	#################################################
	print_topology("Indirect link failover time", "D3 -> D1 Link")

	# Verify the total route count using bcmcmd
	if not check_bcmcmd_route_count(dut1, 50, "ipv4", def_v4_route_count_d1, data.test_bgp_route_count):
		st.report_fail("route_table_not_updated_by_advertise_from_tg")

	if not check_bcmcmd_route_count(dut4, 50, "ipv4", def_v4_route_count_d4, data.test_bgp_route_count):
		st.report_fail("route_table_not_updated_by_advertise_from_tg")

	# Configuring traffic stream on the TG interface
	tr1=tg.tg_traffic_config(port_handle=tg_handler["tg_ph_2"], emulation_src_handle=h2['handle'], emulation_dst_handle=bgp_rtr1['route'][0]['handle'], circuit_endpoint_type='ipv4', mode='create', transmit_mode='continuous', length_mode='fixed', rate_pps=data.traffic_rate_pps, enable_stream_only_gen='0')

	st.log("#######################################################################################################################################################")
	st.log("# Measuring convergence time with BGP v4 routes (with ECMP paths) in case of indirectly connected link failure")
	st.log("#######################################################################################################################################################")
	# Starting the TG traffic after clearing the DUT counters
	papi.clear_interface_counters(dut1)
	tgapi.traffic_action_control(tg_handler, actions=['clear_stats'])
	tg.tg_traffic_control(action="run",handle=tr1['stream_id'])

	# Shutdown the routing interface link.
	st.log("Shutdown the routing interface link.")
	if not interface_obj.interface_operation(dut3, dut3_to_dut1_port_1 , "shutdown"):
		st.report_fail('interface_admin_shut_down_fail', dut3_to_dut1_port_1)

	# Wait for traffic to reroute
	papi.get_interface_counters_all(dut1)
	st.wait(30)
	if not check_intf_traffic_counters(dut1, dut1_to_tg_port_1, 30):
		st.report_fail("ingress_traffic_rate_not_matching_with_egress_rate")

	# Stopping the TG traffic
	tg.tg_traffic_control(action='stop', handle=tr1['stream_id'])

	# Stats fetching
	st.log("Fetching the stats on TG ports")
	tg_1_stats = tgapi.get_traffic_stats(tg, mode='aggregate', port_handle=tg_handler["tg_ph_1"])
	tg_2_stats = tgapi.get_traffic_stats(tg, mode='aggregate', port_handle=tg_handler["tg_ph_2"])
	total_rx = tg_1_stats.rx.total_packets
	total_tx = tg_2_stats.tx.total_packets

	# Stats verification
	st.log("Sent Packets On TG2: {} and Received Packets On TG1: {}".format(total_tx, total_rx))
	if (int(total_tx) == 0):
		st.log("Traffic verification failed : Failed to send traffic from TG2 to TG1.")
		st.report_fail("traffic_verification_failed")

	time_taken = round((int(total_tx)-int(total_rx))/(int(data.test_bgp_route_count)*1.0),1)

	# Time taken for convergence
	st.log("#######################################################################################################################################################")
	st.log(" Convergence time with BGP v4 routes (with ECMP paths) in case of indirectly connected link failure in secs = " +str(time_taken))
	st.log("#######################################################################################################################################################")

	st.report_pass("test_case_passed")
Ejemplo n.º 11
0
def test_ft_l3_performance_enhancements_v4_bgp_session_failover_convergence_time(
        fixture_v4):
    ################# Author Details ################
    # Name: Rakesh Kumar Vooturi
    # Email:  [email protected]
    #################################################
    #
    # Objective - FtOpSoRtPerfFn032 : Performance measurement for BGP Session Failover case
    #  Measure time taken for the traffic ( corresponding to BGP routes ) to resume fully
    #  (i.e RX rate = TX rate) after the BGP session flaps ( i.e BGP session goes down and then comes up
    #  This is triggered using "clear ip bgp * " CLI command ).
    #
    ############### Test bed details ################
    #  TG --- DUT --- TG
    #################################################
    # Configuring traffic stream on the TG interface
    tr1 = tg.tg_traffic_config(
        port_handle=tg_handler["tg_ph_2"],
        emulation_src_handle=h2['handle'],
        emulation_dst_handle=bgp_rtr1['route'][0]['handle'],
        circuit_endpoint_type='ipv4',
        mode='create',
        transmit_mode='continuous',
        length_mode='fixed',
        rate_pps=data.traffic_rate_pps,
        enable_stream_only_gen='0')

    # Verify the total route count using bcmcmd
    if not check_bcmcmd_route_count(dut, 50, "ipv4", def_v4_route_count,
                                    data.test_bgp_route_count):
        st.report_fail("route_table_not_updated_by_advertise_from_tg")

    # Verify the total route count
    count = verify_bgp_route_count(dut,
                                   family='ipv4',
                                   neighbor=data.neigh_ip_addr,
                                   state='Established')
    st.log("Route count: " + str(count))
    if int(count) != int(data.test_bgp_route_count):
        st.report_fail("route_table_not_updated_by_advertise_from_tg")

    # Starting the TG traffic after clearing the DUT counters
    papi.clear_interface_counters(dut)
    tg.tg_traffic_control(action="run", handle=tr1['stream_id'])

    st.wait(25)

    # Verifying the BGP route count on the DUT
    if not check_intf_traffic_counters(dut, 20, "install"):
        st.report_fail("ingress_traffic_rate_not_matching_with_egress_rate")

    # Clearing the BGP session.
    st.log("Clearing the BGP session.")
    bgpfeature.clear_ip_bgp(dut)

    st.banner(
        "# Measuring Convergence time ( control plane + data plane ) taken for BGP session failover scenario on HWSKU {}"
        .format(hwsku_under_test))
    # Taking the start time timestamp
    start_time = datetime.datetime.now()
    bgpfeature.config_bgp(dut=vars.D1,
                          local_as=data.as_num,
                          config='yes',
                          neighbor=data.neigh_ip_addr,
                          config_type_list=["connect"],
                          connect='1')

    # Verify the total route count using bcmcmd
    if not check_bcmcmd_route_count(dut, 50, "ipv4", def_v4_route_count,
                                    data.test_bgp_route_count):
        st.report_fail("route_table_not_updated_by_advertise_from_tg")

    # Verify the total route count
    count = verify_bgp_route_count(dut,
                                   family='ipv4',
                                   neighbor=data.neigh_ip_addr,
                                   state='Established')
    st.log("Route count: " + str(count))
    if int(count) != int(data.test_bgp_route_count):
        st.report_fail("route_table_not_updated_by_advertise_from_tg")

    # Taking the end time timestamp
    end_time = datetime.datetime.now()

    # Time taken for route installation
    st.log("Start Time: {}".format(start_time))
    st.log("End Time: {}".format(end_time))
    time_in_secs = end_time - start_time

    st.banner(
        "Convergence time ( control plane + data plane ) taken for BGP session failover scenario (After session up, time taken for BGP to re establish, learn and install the routes to hardware) on HWSKU {} = "
        .format(hwsku_under_test) + str(time_in_secs.seconds))

    # Stopping the TG traffic
    tg.tg_traffic_control(action='stop', handle=tr1['stream_id'])
    st.report_pass("test_case_passed")
Ejemplo n.º 12
0
def test_ft_l3_performance_enhancements_v6_route_intstall_withdraw(fixture_v6):
    ################# Author Details ################
    # Name: Rakesh Kumar Vooturi
    # Email:  [email protected]
    #################################################
    #
    # Objective - FtOpSoRtPerfFn042 : Performance measurement for IPv6 route installation in hardware
    #  Measure time taken for routes to get installed into the hardware
    #  (with fresh advertisement of routes ...but not due to any other trigger).
    # Objective - FtOpSoRtPerfFn043 : Performance measurement for IPv6 route withdraw in hardware
    #  Measure time taken for routes to get removed from the hardware by stop advertising the Routes from neighbor.
    #
    ############### Test bed details ################
    #  TG --- DUT --- TG
    #################################################
    # Withdraw the routes.
    ctrl1 = tg.tg_bgp_routes_control(
        handle=bgp_rtr2['conf']['handle'],
        route_handle=bgp_rtr2['route'][0]['handle'],
        mode='withdraw')
    st.log("TR_CTRL: " + str(ctrl1))

    # Verify the total route count using bcmcmd
    if not check_bcmcmd_route_count(dut, 50, "ipv6", def_v6_route_count, 0):
        st.report_fail("route_table_not_cleared_by_withdraw_from_tg")

    # Verify the total route count
    count = verify_bgp_route_count(dut,
                                   family='ipv6',
                                   neighbor=data.neigh_ipv6_addr,
                                   state='Established')
    st.log("Route count: " + str(count))
    if int(count) != 0:
        st.report_fail("route_table_not_cleared_by_withdraw_from_tg")

    if data.includeTraffic:
        # Configuring traffic stream on the TG interface
        tr2 = tg.tg_traffic_config(
            port_handle=tg_handler["tg_ph_2"],
            emulation_src_handle=h2['handle'],
            emulation_dst_handle=bgp_rtr2['route'][0]['handle'],
            circuit_endpoint_type='ipv6',
            mode='create',
            transmit_mode='continuous',
            length_mode='fixed',
            rate_pps=data.traffic_rate_pps,
            enable_stream_only_gen='0')

        # Starting the TG traffic after clearing the DUT counters
        papi.clear_interface_counters(dut)
        tg.tg_traffic_control(action="run", handle=tr2['stream_id'])

    st.banner(
        "# Measuring time taken for route installation of {} ipv6 routes on HWSKU {}"
        .format(data.test_bgp_route_count, hwsku_under_test))

    # Taking the start time timestamp
    start_time = datetime.datetime.now()

    # Readvertise the routes.
    ctrl1 = tg.tg_bgp_routes_control(
        handle=bgp_rtr2['conf']['handle'],
        route_handle=bgp_rtr2['route'][0]['handle'],
        mode='readvertise')
    st.log("TR_CTRL: " + str(ctrl1))

    # Verify the total route count using bcmcmd
    if not check_bcmcmd_route_count(dut, 50, "ipv6", def_v6_route_count,
                                    data.test_bgp_route_count):
        st.report_fail("route_table_not_updated_by_advertise_from_tg")

    if data.includeTraffic:
        st.wait(25)
        # Verifying the BGP route count on the DUT
        if not check_intf_traffic_counters(dut, 20, "install"):
            st.report_fail(
                "ingress_traffic_rate_not_matching_with_egress_rate")

    # Taking the end time timestamp
    end_time = datetime.datetime.now()

    # Verify the total route count
    count = verify_bgp_route_count(dut,
                                   family='ipv6',
                                   neighbor=data.neigh_ipv6_addr,
                                   state='Established')
    st.log("Route count: " + str(count))
    if int(count) != int(data.test_bgp_route_count):
        st.report_fail("route_table_not_updated_by_advertise_from_tg")

    # Time taken for route installation
    st.log("Start Time: {}".format(start_time))
    st.log("End Time: {}".format(end_time))
    time_in_secs = end_time - start_time

    st.banner("Time taken for intsalling {} v6 routes on HWSKU {} = ".format(
        data.test_bgp_route_count, hwsku_under_test) +
              str(time_in_secs.seconds))
    st.banner(
        "# Measuring time taken for route withdraw of {} ipv4 routes on HWSKU {}"
        .format(data.test_bgp_route_count, hwsku_under_test))

    # Taking the start time timestamp
    start_time = datetime.datetime.now()

    # Withdraw the routes.
    ctrl1 = tg.tg_bgp_routes_control(
        handle=bgp_rtr2['conf']['handle'],
        route_handle=bgp_rtr2['route'][0]['handle'],
        mode='withdraw')
    st.log("TR_CTRL: " + str(ctrl1))

    # Verify the total route count using bcmcmd
    if not check_bcmcmd_route_count(dut, 50, "ipv6", def_v6_route_count, 0):
        st.report_fail("route_table_not_cleared_by_withdraw_from_tg")

    if data.includeTraffic:
        # Verifying the BGP route count on the DUT
        if not check_intf_traffic_counters(dut, 20, "withdraw"):
            st.report_fail("egress_traffic_rate_not_zero")

    # Taking the end time timestamp
    end_time = datetime.datetime.now()

    # Verify the total route count
    count = verify_bgp_route_count(dut,
                                   family='ipv6',
                                   neighbor=data.neigh_ipv6_addr,
                                   state='Established')
    st.log("Route count: " + str(count))
    if int(count) != 0:
        st.report_fail("route_table_not_cleared_by_withdraw_from_tg")

    # Time taken for route withdraw
    st.log("Start Time: {}".format(start_time))
    st.log("End Time: {}".format(end_time))
    time_in_secs = end_time - start_time

    st.banner("Time taken for withdrawing {} v6 routes on HWSKU {} = ".format(
        data.test_bgp_route_count, hwsku_under_test) +
              str(time_in_secs.seconds))

    if data.includeTraffic:
        # Stopping the TG traffic
        tg.tg_traffic_control(action='stop', handle=tr2['stream_id'])
    st.report_pass("test_case_passed")