def test_ft_verify_static_portchannel_enable_disable_with_MTU_Value():
    '''
    Author: Venkatesh Terli <*****@*****.**>
    Scenario - 3.1.4 Verify that mtu value is configured and enable/disable the portchannel.
    '''
    st.log(
        'Scenario - 3.1.4 Verify that mtu value is configured and enable/disable the portchannel.'
    )
    portchannelobj.add_del_portchannel_member(vars.D1,
                                              static_data.portchannel_name,
                                              static_data.members_dut1, 'del')
    intfobj.interface_properties_set(
        vars.D1, static_data.members_dut1 + [static_data.portchannel_name],
        'mtu', '4096')
    portchannelobj.add_del_portchannel_member(vars.D1,
                                              static_data.portchannel_name,
                                              static_data.members_dut1)
    portchannelobj.add_del_portchannel_member(vars.D1,
                                              static_data.portchannel_name,
                                              static_data.members_dut1, 'del')
    intfobj.interface_properties_set(
        vars.D1, static_data.members_dut1 + [static_data.portchannel_name],
        'mtu', static_data.mtu_default)
    portchannelobj.add_del_portchannel_member(vars.D1,
                                              static_data.portchannel_name,
                                              static_data.members_dut1)
    intfobj.interface_operation(vars.D1,
                                static_data.portchannel_name,
                                operation="shutdown")
    if not intfobj.interface_operation(
            vars.D1, static_data.portchannel_name, operation="startup"):
        st.report_fail('portchannel_state_fail', static_data.portchannel_name,
                       vars.D1, 'down')
    st.report_pass('Enable_disable_portchannel_with_mtu',
                   static_data.portchannel_name)
Example #2
0
def flap_interface(intf_name):
    vars = st.get_testbed_vars()
    ifapi.interface_operation(vars.D1, intf_name, operation="shutdown")

    st.wait(5)

    ifapi.interface_operation(vars.D1, intf_name, operation="startup")
def trigger_link_flap(dut, port):
    """

    :param dut:
    :type dut:
    :param port:
    :type port:
    :return:
    :rtype:
    """
    interface_operation(dut, port, operation="shutdown")
    st.wait(5)
    interface_operation(dut, port, operation="startup")
    st.wait(5)
def test_l3_perf_tc_12_1():
    pre_test_l3_fwding()

    vars = st.get_testbed_vars()
    # Config 2 IPV4 interfaces on DUT.
    (tg1, _, tg_ph_1, _) = get_handles()
    dut1 = vars.D1
    port1 = vars.D1T1P1

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

    tr1 = create_l3_host(tg1, tg_ph_1, 8000)

    # Verified ARP and counters at the DUT.
    cmd = "show arp | grep Total"
    default_arp = arpapi.get_arp_count(dut1)
    st.log("Total ARP entries: {}".format(default_arp))
    measure_arp_learn_time(dut1, default_arp, 8000, cmd, False)

    #shut the link and make sure all the entries deleted from the hw
    interface_operation(dut1, port1, operation="shutdown")
    st.wait(15)
    cmd = 'bcmcmd "l3 l3table show" | wc -l'
    output = bcm_show(dut1, cmd)
    st.log(output)
    curr_arp = parse_route_output(output)

    if (curr_arp != default_arp):
        st.log("cleaning up host entries from HW failed" + str(curr_arp) +
               str(default_arp))

    interface_operation(dut1, port1, operation="startup")

    #Now measure the hardware performance
    cmd = 'bcmcmd "l3 l3table show" | wc -l'
    output = bcm_show(dut1, cmd)
    st.log(output)
    default_arp = parse_route_output(output)
    measure_arp_learn_time(dut1, default_arp, 8000, cmd, True)

    tg1.tg_traffic_control(action='stop', handle=tr1['stream_id'])
    tg1.tg_traffic_control(action='reset', port_handle=tg_ph_1)

    post_test_l3_fwding()
    st.report_pass("test_case_passed")
Example #5
0
def fixture_v4(request):
	global h1
	global h2
	global ctrl_start
	global ctrl_stop
	global bgp_rtr1
	st.log("Test Fixture Config.")
	# TG ports reset
	st.log("Resetting the TG ports")
	tgapi.traffic_action_control(tg_handler, actions=['reset'])

	# TG protocol interface creation
	st.log("TG protocol interface creation")
	h1 = tg.tg_interface_config(port_handle=tg_handler["tg_ph_1"], mode='config',intf_ip_addr=data.tg_to_dut1_port_1_ip,gateway=data.dut1_to_tg_port_1_ip,arp_send_req='1')
	st.log("INTFCONF: "+str(h1))
	h2 = tg.tg_interface_config(port_handle=tg_handler["tg_ph_2"], mode='config',intf_ip_addr=data.tg_to_dut4_port_1_ip,gateway=data.dut4_to_tg_port_1_ip,arp_send_req='1')
	st.log("INTFCONF: "+str(h2))

	# Configuring BGP on TG interface
	conf_var = {'mode':'enable', 'active_connect_enable':'1', 'local_as':data.remote_as_num1, 'remote_as':data.as_num_1, 'remote_ip_addr':data.dut1_to_tg_port_1_ip}
	route_var = {'mode':'add', 'num_routes':data.test_bgp_route_count, 'prefix':'121.1.1.0', 'as_path':'as_seq:1'}
	ctrl_start = {'mode':'start'}
	ctrl_stop = {'mode':'stop'}

	# Starting the BGP router on TG.
	bgp_rtr1 = tgapi.tg_bgp_config(tg=tg, handle=h1['handle'], conf_var=conf_var, route_var = route_var, ctrl_var=ctrl_start)
	st.log("BGP_HANDLE: "+str(bgp_rtr1))

	# Verifying the BGP neighborship
	st.wait(10)
	st.log("Verifying the BGP neighborships.")
	if not bgpfeature.verify_bgp_summary(dut1, neighbor=data.tg_to_dut1_port_1_ip, state='Established'):
		st.report_fail("bgp_ip_peer_establish_fail", data.tg_to_dut1_port_1_ip)

	yield
	st.log("Test Fixture Cleanup.")
	# Startup the routing interface link.
	if not interface_obj.interface_operation(dut2, dut2_to_dut4_port_1, "startup"):
		st.report_fail('interface_admin_startup_fail', dut2_to_dut4_port_1)
	if not interface_obj.interface_operation(dut3, dut3_to_dut1_port_1, "startup"):
		st.report_fail('interface_admin_startup_fail', dut3_to_dut1_port_1)

	tg.tg_interface_config(port_handle=tg_handler["tg_ph_1"], handle=h1['handle'], mode='destroy')
	tg.tg_interface_config(port_handle=tg_handler["tg_ph_2"], handle=h2['handle'], mode='destroy')
def test_ft_ipv6_link_local_ping():
    report_flag = 0
    if not ip_obj.ping(vars.D1, d2_prt_link_local[0], family='ipv6', interface = vars.D1D2P1):
        st.log("Ipv6 Ping over Link Local address via the Port based routing interface is failed.")
        report_flag = 1
    if not ip_obj.ping(vars.D1, d2_prt_link_local[0], family='ipv6', interface = data.vlan_in_1):
        st.log("Ipv6 Ping over Link Local address via the Vlan  based routing interface is failed.")
        report_flag =1
    if not ip_obj.ping(vars.D1, d2_prt_link_local[0], family='ipv6', interface = data.prt_chnl):
        st.log("Ipv6 Ping over Link Local address via the Port Channel based routing interface is failed.")
        report_flag =1
    # Get show ndp output
    utils.exec_all(True, [[arp_obj.show_ndp, vars.D1, None], [arp_obj.show_ndp, vars.D2, None]])
    d1_int_li = [vars.D2D1P1, vars.D2D1P2, data.prt_chnl]
    intf_obj.interface_operation(vars.D2, [vars.D2D1P1, vars.D2D1P2, data.prt_chnl], operation="shutdown", skip_verify=True)
    st.log("Waiting for 10 sec after shutdown the interfaces")
    st.wait(10)
    intf_obj.interface_status_show(vars.D1, [vars.D2D1P1, vars.D2D1P2, data.prt_chnl])
    intf_obj.interface_operation(vars.D2, [vars.D2D1P1, vars.D2D1P2, data.prt_chnl], operation="startup",
                                 skip_verify=True)
    st.log("Polling for interface status after no shutdown")
    for intf in d1_int_li:
        if not intf_obj.poll_for_interface_status(vars.D2, intf, "oper", "up", iteration=5, delay=1):
            st.error("Failed to startup interface {} on the DUT {}".format(intf, vars.D2))
            report_flag = 0

    if not ip_obj.ping(vars.D1, d2_prt_link_local[0], family='ipv6', interface = vars.D1D2P1):
        st.log("After shut no shut, Ipv6 Ping over Link Local address via the Port based routing interface is failed.")
        report_flag = 1
    if not ip_obj.ping(vars.D1, d2_prt_link_local[0], family='ipv6', interface=data.vlan_in_1):
        st.log("After shut no shut, Ipv6 Ping over Link Local address via the Vlan  based routing interface is failed.")
        report_flag = 1
    if not ip_obj.ping(vars.D1, d2_prt_link_local[0], family='ipv6', interface=data.prt_chnl):
        st.log("After shut no shut, Ipv6 Ping over Link Local address via the Port Channel based routing interface is failed.")
        report_flag = 1
    if report_flag:
        st.report_fail("ip6_ping_fail_over_link_local_addr")
    st.report_pass("test_case_passed")
Example #7
0
def config_ip(config='yes'):
    if config == 'yes':
        api_name = ip_api.config_ip_addr_interface
        config_str = "Configure"
    else:
        api_name = ip_api.delete_ip_interface
        config_str = "Delete"

    hdrMsg("Bring-up the port on dut3 which is connected to dhcp server ")
    interface_api.interface_operation(data.dut3,
                                      data.dhcp_server_port,
                                      operation="startup")

    ##########################################################################
    hdrMsg(
        "IP-config: {} IP address between dut2 interface {} and dut3 interface {}"
        .format(config_str, data.d2d3_ports, data.d3d2_ports))
    ##########################################################################
    utils.exec_all(True, [[
        api_name, data.dut2, data.d2d3_ports[0], dut2_3_ip_list[0], mask_24
    ], [api_name, data.dut3, data.d3d2_ports[0], dut3_2_ip_list[0], mask_24]])

    if config == 'yes':
        st.banner('Install L2 DHCP rules on dhcp client device')
        copp_api.bind_class_action_copp_policy(data.dut4,
                                               classifier='copp-system-dhcpl2',
                                               action_group='copp-system-dhcp')
        ##########################################################################
        hdrMsg("Create loopback interfaces on dut1, dut2 and dut3")
        ##########################################################################
        parallel.exec_parallel(True, [data.dut1, data.dut2, data.dut3],
                               ip_api.configure_loopback,
                               [{
                                   'loopback_name': 'Loopback1'
                               }] * 3)

        ##########################################################################
        hdrMsg("Loopback-config: {} IP address on Loopback interface".format(
            config_str))
        ##########################################################################
        utils.exec_all(True, [[
            api_name, data.dut1, "Loopback1", dut1_loopback_ip_list[0], '32'
        ], [
            api_name, data.dut2, "Loopback1", dut2_loopback_ip_list[0], '32'
        ], [api_name, data.dut3, "Loopback1", dut3_loopback_ip_list[0], '32']])

        ##########################################
        hdrMsg("config required vlan to test on dut2 and dut4")
        ##########################################
        utils.exec_all(True, [[vlan_api.create_vlan, data.dut2, ['100']],
                              [vlan_api.create_vlan, data.dut4, ['100']]])
        vlan_api.create_vlan(data.dut4, ['200', '300'])

        ##########################################
        hdrMsg("Add vlan members")
        ##########################################
        utils.exec_all(True, [[
            vlan_api.add_vlan_member, data.dut2, '100', data.d2d4_ports[0],
            True
        ],
                              [
                                  vlan_api.add_vlan_member, data.dut4, '100',
                                  data.d4d2_ports[0], True
                              ]])

        #########################################################
        hdrMsg("LAG-Config: Create portchannel on dut2 and dut4")
        #########################################################
        utils.exec_all(True,
                       [[pc.create_portchannel, data.dut2, ['PortChannel12']],
                        [pc.create_portchannel, data.dut4, ['PortChannel12']]])

        #########################################################
        hdrMsg("LAG-Config: add member ports to portchannel")
        #########################################################
        utils.exec_all(True, [[
            pc.add_del_portchannel_member, data.dut2, 'PortChannel12',
            data.d2d4_ports[2], 'add'
        ],
                              [
                                  pc.add_del_portchannel_member, data.dut4,
                                  'PortChannel12', data.d4d2_ports[2], 'add'
                              ]])

        #########################################################
        hdrMsg("LAG-Config: Create portchannel on dut3 and dut1")
        #########################################################
        utils.exec_all(True,
                       [[pc.create_portchannel, data.dut3, ['PortChannel14']],
                        [pc.create_portchannel, data.dut1, ['PortChannel14']]])

        #########################################################
        hdrMsg("LAG-Config: add member ports to portchannel")
        #########################################################
        utils.exec_all(True, [[
            pc.add_del_portchannel_member, data.dut3, 'PortChannel14',
            data.d3d1_ports[0], 'add'
        ],
                              [
                                  pc.add_del_portchannel_member, data.dut1,
                                  'PortChannel14', data.d1d3_ports[0], 'add'
                              ]])

        ip_api.config_ip_addr_interface(data.dut2, 'Vlan100',
                                        dut2_4_ip_list[0], mask_24)
        ip_api.config_ip_addr_interface(data.dut2, data.d2d4_ports[1],
                                        dut2_4_ip_list[1], mask_24)
        ip_api.config_ip_addr_interface(data.dut2, 'PortChannel12',
                                        dut2_4_ip_list[2], mask_24)
        ip_api.config_ip_addr_interface(data.dut1,
                                        'PortChannel14',
                                        data.dhcp_server_ipv6,
                                        mask_v6,
                                        family='ipv6')

        #########################################
        hdrMsg("Add vlan members on DUT4")
        #########################################
        vlan_api.add_vlan_member(data.dut4, '200', data.d4d2_ports[1])
        vlan_api.add_vlan_member(data.dut4, '300', 'PortChannel12')

        st.exec_all([[create_static_route_dut2], [create_static_route_dut3]])
    else:
        st.banner('Remove L2 DHCP rules on dhcp client device')
        copp_api.bind_class_action_copp_policy(data.dut4,
                                               classifier='copp-system-dhcpl2',
                                               action_group='copp-system-dhcp',
                                               config='no')
        ##########################################################################
        hdrMsg("Loopback-config: {} IP address on Loopback interface".format(
            config_str))
        ##########################################################################
        utils.exec_all(True, [[
            api_name, data.dut1, "Loopback1", dut1_loopback_ip_list[0], '32'
        ], [
            api_name, data.dut2, "Loopback1", dut2_loopback_ip_list[0], '32'
        ], [api_name, data.dut3, "Loopback1", dut3_loopback_ip_list[0], '32']])

        ##########################################################################
        hdrMsg("Delete loopback interfaces on dut1, dut2 and dut3")
        ##########################################################################
        parallel.exec_parallel(True, [data.dut1, data.dut2, data.dut3],
                               ip_api.configure_loopback, [{
                                   'loopback_name': 'Loopback1',
                                   'config': 'no'
                               }] * 3)

        st.exec_all([[delete_static_route_dut2], [delete_static_route_dut3]])

        hdrMsg(" Remove all ip configs on dut2")
        ip_api.delete_ip_interface(data.dut2, 'Vlan100', dut2_4_ip_list[0],
                                   mask_24)
        ip_api.delete_ip_interface(data.dut2, data.d2d4_ports[1],
                                   dut2_4_ip_list[1], mask_24)
        ip_api.delete_ip_interface(data.dut2, 'PortChannel12',
                                   dut2_4_ip_list[2], mask_24)
        ip_api.delete_ip_interface(data.dut1,
                                   'PortChannel14',
                                   data.dhcp_server_ipv6,
                                   mask_v6,
                                   family='ipv6')

        ###########################################################
        hdrMsg("LAG-unConfig: delete member ports to portchannel")
        ###########################################################
        utils.exec_all(True, [[
            pc.add_del_portchannel_member, data.dut2, 'PortChannel12',
            data.d2d4_ports[2], 'del'
        ],
                              [
                                  pc.add_del_portchannel_member, data.dut4,
                                  'PortChannel12', data.d4d2_ports[2], 'del'
                              ]])
        utils.exec_all(True, [[
            pc.add_del_portchannel_member, data.dut3, 'PortChannel14',
            data.d3d1_ports[0], 'del'
        ],
                              [
                                  pc.add_del_portchannel_member, data.dut1,
                                  'PortChannel14', data.d1d3_ports[0], 'del'
                              ]])

        vlan_api.delete_vlan_member(data.dut4, '300', 'PortChannel12')
        #######################################################
        hdrMsg("LAG-UnConfig: Delete portchannel on dut2 and dut4")
        #######################################################
        utils.exec_all(True,
                       [[pc.delete_portchannel, data.dut2, ['PortChannel12']],
                        [pc.delete_portchannel, data.dut4, ['PortChannel12']]])
        utils.exec_all(True,
                       [[pc.delete_portchannel, data.dut3, ['PortChannel14']],
                        [pc.delete_portchannel, data.dut1, ['PortChannel14']]])

        ########################################
        hdrMsg("Delete vlan member ports")
        ########################################
        utils.exec_all(True, [[
            vlan_api.delete_vlan_member, data.dut2, '100', data.d2d4_ports[0],
            True
        ],
                              [
                                  vlan_api.delete_vlan_member, data.dut4,
                                  '100', data.d4d2_ports[0], True
                              ]])
        vlan_api.delete_vlan_member(data.dut4, '200', data.d4d2_ports[1])

        ####################################
        hdrMsg("Unconfig vlan fron dut2 and dut4")
        ###################################
        utils.exec_all(True, [[vlan_api.delete_vlan, data.dut2, ['100']],
                              [vlan_api.delete_vlan, data.dut4, ['100']]])
        vlan_api.delete_vlan(data.dut4, ['200', '300'])
Example #8
0
def test_ft_bgp_unnumbered_peer_basic():
    # ################ Author Details ################
    # Name: Kiran Vedula
    # Email: [email protected]
    # ################################################
    utils_obj.banner_log(
        'FtOtSoRtBgpUnFn001,FtOtSoRtBgpUnFn002,FtOtSoRtBgpUnFn018,FtOtSoRtBgpUnFn019'
    )
    st.log('######------Configure Unnumbered BGP peers------######')
    result = 0
    if not utils.poll_wait(bgp_obj.verify_bgp_summary,
                           data.wait_timer,
                           vars.D1,
                           family='ipv6',
                           shell=bgp_cli_type,
                           neighbor=vars.D1D2P1,
                           state='Established'):
        st.log("Failed to form BGP unnumbered peering using IPv6 link local")
        result += 1
    bgp_obj.config_bgp_neighbor_properties(vars.D1,
                                           data.d1_local_as,
                                           vars.D1D2P1,
                                           family="ipv6",
                                           neighbor_shutdown='',
                                           no_form='')
    if utils.poll_wait(bgp_obj.verify_bgp_summary,
                       data.wait,
                       vars.D1,
                       family='ipv6',
                       shell=bgp_cli_type,
                       neighbor=vars.D1D2P1,
                       state='Established'):
        st.log("unnumbered BGP peering is established even after shutdown")
        result += 1
    bgp_obj.config_bgp_neighbor_properties(vars.D1,
                                           data.d1_local_as,
                                           vars.D1D2P1,
                                           family="ipv6",
                                           neighbor_shutdown='',
                                           no_form='no')
    if not utils.poll_wait(bgp_obj.verify_bgp_summary,
                           data.wait_timer,
                           vars.D1,
                           family='ipv6',
                           shell=bgp_cli_type,
                           neighbor=vars.D1D2P1,
                           state='Established'):
        st.log(
            "Failed to form BGP unnumbered peering using IPv6 link local after no shutdown"
        )
        result += 1
    if not utils.poll_wait(bgp_obj.verify_bgp_summary,
                           data.wait_timer,
                           vars.D1,
                           family='ipv6',
                           shell=bgp_cli_type,
                           neighbor=data.vlan_in_1,
                           state='Established'):
        st.log(
            "Failed to form BGP unnumbered peering using IPv6 link local on a VLAN"
        )
        result += 1
    # Get show ndp output
    st.log('######------shut/no shut link with unnumbered BGP------######')
    utils.exec_all(
        True,
        [[arp_obj.show_ndp, vars.D1, None], [arp_obj.show_ndp, vars.D2, None]])
    intf_obj.interface_operation(vars.D1,
                                 vars.D1D2P1,
                                 operation="shutdown",
                                 skip_verify=True)
    st.wait(data.wait)
    intf_obj.interface_status_show(vars.D1, vars.D1D2P1)
    intf_obj.interface_operation(vars.D1,
                                 vars.D1D2P1,
                                 operation="startup",
                                 skip_verify=True)
    st.wait(data.wait)
    if not utils.poll_wait(bgp_obj.verify_bgp_summary,
                           data.wait_timer,
                           vars.D1,
                           family='ipv6',
                           shell=bgp_cli_type,
                           neighbor=vars.D1D2P1,
                           state='Established'):
        st.log("Failed to form BGP unnumbered peering using IPv6 link local")
        result += 1
    if result == 0:
        st.report_pass("test_case_passed")
    else:
        st.log("BGP IPv6 unnumbered neighborship failure")
        st.report_fail("test_case_failed")
Example #9
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")
def test_ft_verify_static_portchannel_func_when_dis_en_mem_ports():
    '''
    Author: Venkatesh Terli <*****@*****.**>
    Scenario - 3.1.2 Verify that l2 traffic is forwarded Through the Static Port Channel.
    '''
    count = 0
    st.log(
        'Scenari - 3.1.5 Verify that traffic flow is fine through LAG after LAG member shut/no-shut.'
    )
    exceptions = exec_all(True,
                          [[intfobj.clear_interface_counters, vars.D1],
                           [intfobj.clear_interface_counters, vars.D2]])[1]
    ensure_no_exception(exceptions)
    st.wait(3)
    intfobj.interface_operation(vars.D1, vars.D1D2P1, operation="shutdown")
    st.wait(3)

    static_data.tg.tg_traffic_control(
        action='run',
        stream_handle=[
            static_data.streams['D1T1_SD_Mac_Hash1'],
            static_data.streams['D2T1_SD_Mac_Hash1']
        ])
    st.wait(3)
    intfobj.interface_operation(vars.D1, vars.D1D2P1, operation="startup")
    st.wait(3)
    if not intfobj.poll_for_interface_status(vars.D1,
                                             vars.D1D2P1,
                                             property='oper',
                                             value='up',
                                             iteration='2',
                                             delay=2):
        count += 1
        st.log("Interface is not UP after performing a Flap")
    portchannelobj.get_portchannel_members(
        vars.D1, portchannel=static_data.portchannel_name)
    static_data.tg.tg_traffic_control(
        action='stop',
        stream_handle=[
            static_data.streams['D1T1_SD_Mac_Hash1'],
            static_data.streams['D2T1_SD_Mac_Hash1']
        ])
    verify_traffic_hashed_or_not(
        vars.D1, [vars.D1D2P1, vars.D1D2P2, vars.D1D2P3, vars.D1D2P4],
        20,
        traffic_loss_verify=True,
        rx_port=vars.D1T1P1,
        tx_port=vars.D2T1P1,
        dut2=vars.D2)
    verify_traffic_hashed_or_not(
        vars.D2, [vars.D2D1P1, vars.D2D1P2, vars.D2D1P3, vars.D2D1P4],
        20,
        traffic_loss_verify=True,
        rx_port=vars.D2T1P1,
        tx_port=vars.D1T1P1,
        dut2=vars.D1)

    if count == 0:
        st.report_pass('portchannel_member_en_dis_success')
    else:
        st.report_fail('portchannel_member_en_dis_failed')
Example #11
0
def test_ft_arp_entry_link_failure():
    ################# Author Details ################
    # Name: Rakesh Kumar Vooturi
    # Email:  [email protected]
    #################################################
    #
    # Objective - Verify an ARP table entry learned on port based routing interface is
    #               removed from ARP table after link failure on which that entry is learned.
    # Objective - Verify an ARP table entry learned on vlan based routing interface is
    #               removed from ARP table after link failure on which that entry is learned
    #
    ############### Test bed details ################
    #  DUT-----TG
    #################################################
    # Ping from tgen to DUT.
    res = tgapi.verify_ping(src_obj=tg,
                            port_handle=tg_handler["tg_ph_1"],
                            dev_handle=h1['handle'],
                            dst_ip=data.d1t1_ip_addr,
                            ping_count='1',
                            exp_count='1')
    if res:
        st.log("Ping succeeded.")
    else:
        st.warn("Ping failed.")

    res = tgapi.verify_ping(src_obj=tg,
                            port_handle=tg_handler["tg_ph_2"],
                            dev_handle=h2['handle'],
                            dst_ip=data.d1t2_ip_addr,
                            ping_count='1',
                            exp_count='1')
    st.log("PING_RES: " + str(res))
    if res:
        st.log("Ping succeeded.")
    else:
        st.warn("Ping failed.")

    # Verify dynamic arp entries
    st.log("Verifying the arp entries on the DUT.")
    if not arp_obj.verify_arp(dut1, data.t1d1_ip_addr, data.t1d1_mac_addr,
                              vars.D1T1P1):
        st.report_fail("ARP_entry_dynamic_entry_fail", data.t1d1_ip_addr, dut1)
    st.log("Verifying the arp entries on the DUT")
    if not arp_obj.verify_arp(dut1, data.t2d1_ip_addr, data.t2d1_mac_addr,
                              vars.D1T1P2, data.vlan_1):
        st.report_fail("ARP_entry_dynamic_entry_fail", data.t2d1_ip_addr, dut1)

    # Shutdown the routing interface link.
    st.log("Shutdown the routing interface links.")
    if not interface_obj.interface_operation(dut1, [vars.D1T1P1, vars.D1T1P2],
                                             "shutdown"):
        st.report_fail('interface_admin_shut_down_fail',
                       [vars.D1T1P1, vars.D1T1P2])

    # Verify dynamic arp entries
    st.log("Verifying the arp entries on the DUT.")
    if arp_obj.verify_arp(dut1, data.t1d1_ip_addr, data.t1d1_mac_addr,
                          vars.D1T1P1):
        st.report_fail("ARP_dynamic_entry_removal_fail", data.t1d1_ip_addr,
                       vars.D1T1P1)
    st.log("Verifying the arp entries on the DUT")
    if arp_obj.verify_arp(dut1, data.t2d1_ip_addr):
        st.report_fail("ARP_dynamic_entry_removal_fail", data.t2d1_ip_addr,
                       vars.D1T1P2)

    # Startup the routing interface link.
    st.log("Startup the routing interface link.")
    if not interface_obj.interface_operation(dut1, [vars.D1T1P1, vars.D1T1P2],
                                             "startup"):
        st.report_fail('interface_admin_startup_fail',
                       [vars.D1T1P1, vars.D1T1P2])

    st.wait(5)

    # Verify dynamic arp entries
    st.log("Verifying the arp entries on the DUT.")
    if not arp_obj.verify_arp(dut1, data.t1d1_ip_addr, data.t1d1_mac_addr,
                              vars.D1T1P1):
        st.report_fail("ARP_entry_dynamic_entry_fail", data.t1d1_ip_addr, dut1)
    st.log("Verifying the arp entries on the DUT")
    if not arp_obj.verify_arp(dut1, data.t2d1_ip_addr, data.t2d1_mac_addr,
                              vars.D1T1P2, data.vlan_1):
        st.report_fail("ARP_entry_dynamic_entry_fail", data.t2d1_ip_addr, dut1)

    st.report_pass("test_case_passed")
def test_udld_loops_normal_aggressive():
    '''
        Verify  UDLD Tx/Rx loops in normal mode with out PVST/RPVST
        Verify  UDLD Tx/Rx loops in aggressive mode with out PVST/RPVST
    '''
    tc_list = ['FtOpSoSwudldloopnormal001', 'FtOpSoSwudldloopaggressive001']
    print_log("START of TC:test_pvst_udld_normal_aggressive ==>Sub-Test:Verify UDLD functionality with PVST\n TCs:<{}>".format(tc_list), "HIGH")
    final_result = True
    tc_result1 = 0
    tc_result2 = 0
    #udld_global_fail = 0
    udld_mode_fail = 0
    udld_interface_normal_loop_fail = 0
    udld_interface_no_normal_loop_fail = 0
    udld_interface_aggressive_loop_fail = 0
    udld_interface_no_aggressive_loop_fail = 0
    udld_neighbor_fail = 0
    udld_neighbor_warm_reboot_norm_fail = 0
    ##########################################NORMAL MODE UDLD RX/TX loop TESTS START#######################################
    st.wait(5)
    print_log("Verify that the port from DUT1 to DUT2 should go down in Normal Mode with UDLD TX/RX loop...",'MED')
    udld_interfaces = [vars.D1D2P1]
    state = 'down'
    if verify_udld_port_status(udld_interfaces,dut1,state):
        print_log("The ports from DUT1 to DUT3 is going to down state verification PASSED", "HIGH")
    else:
        print_log("The ports from DUT1 to DUT3 is not going to down state verification FAILED", "HIGH")
        udld_interface_normal_loop_fail += 1
        tc_result1 += 1
        final_result = False

    ###Disable UDLD on Interfaces
    dict1 = {'intf': udld_int[dut1]['udld_int'],'udld_enable': 'no', 'config': 'no'}
    pll.exec_parallel(True,[dut1],udld.config_intf_udld, [dict1])

    ###Disable UDLD global
    dict1 = {'udld_enable': 'no', 'config': 'no'}
    pll.exec_parallel(True,[dut1],udld.config_udld_global, [dict1])

    ###do shut and no shut on DUt1 to DUT2
    udld_interfaces = [vars.D1D2P1]
    for udld_interface in udld_interfaces:
        intf.interface_operation(dut1, udld_interface , "shutdown")
        intf.interface_operation(dut1, udld_interface , "startup")
    st.wait(5)

    print_log("Verify that the port from DUT1 to DUT2 should go up in Normal Mode with UDLD TX/RX loop...",'MED')
    udld_interfaces = [vars.D1D2P1]
    state = 'up'
    if verify_udld_port_status(udld_interfaces,dut1,state):
        print_log("The ports from DUT1 to DUT2 is going to up state verification PASSED", "HIGH")
    else:
        print_log("The ports from DUT1 to DUT2 is not going to up state verification FAILED", "HIGH")
        udld_interface_no_normal_loop_fail += 1
        tc_result1 += 1
        final_result = False

    if tc_result1 > 0:
       st.report_tc_fail("FtOpSoSwudldloopnormal001", "UDLD_TX_RX_loop_Normal_Failed", "test_udld_loops_normal_aggressive")
    else:
       st.report_tc_pass("FtOpSoSwudldloopnormal001", "UDLD_TX_RX_loop_Normal_Passed", "test_udld_loops_normal_aggressive")

    ###Enable UDLD global
    dict1 = {'udld_enable': udld_global[dut1]['udld_enable'], 'config': udld_global[dut1]['config']}
    pll.exec_parallel(True,[dut1],udld.config_udld_global, [dict1])

    ###Enable UDLD on Interfaces
    dict1 = {'intf': udld_int[dut1]['udld_int'],'udld_enable': udld_int[dut1]['udld_enable'], 'config': udld_int[dut1]['config']}
    pll.exec_parallel(True,[dut1],udld.config_intf_udld, [dict1])

    ###Enable UDLD mode Aggressive
    print_log("Enable the UDLD Mode Agrgressive on All DUTs...", 'MED')
    dict1 = {'udld_mode': udld_global[dut1]['udld_enable'], 'config': udld_global[dut1]['config']}
    pll.exec_parallel(True,[dut1],udld.config_udld_mode, [dict1])

    ### Verify UDLD mode
    if verify_udld_mode('Aggressive'):
        print_log("UDLD Mode Aggressive verification PASSED", "HIGH")
    else:
        print_log("UDLD Mode Aggressive verification FAILED", "HIGH")
        udld_mode_fail += 1
        tc_result2 += 1
        final_result = False

    st.wait(2)
    print_log("Verify that the port from DUT1 to DUT2 should go down in Aggressive Mode with UDLD TX/RX loop...",'MED')
    udld_interfaces = [vars.D1D2P1]
    state = 'down'
    if verify_udld_port_status(udld_interfaces,dut1,state):
        print_log("The ports from DUT1 to DUT2 is going to down state verification PASSED", "HIGH")
    else:
        print_log("The ports from DUT1 to DUT2 is not going to down state verification FAILED", "HIGH")
        udld_interface_aggressive_loop_fail += 1
        tc_result2 += 1
        final_result = False

    ###Disable UDLD on Interfaces
    dict1 = {'intf': udld_int[dut1]['udld_int'],'udld_enable': 'no', 'config': 'no'}
    pll.exec_parallel(True,[dut1],udld.config_intf_udld, [dict1])

    ###Disable UDLD global
    dict1 = {'udld_enable': 'no', 'config': 'no'}
    pll.exec_parallel(True,[dut1],udld.config_udld_global, [dict1])

    ###do shut and no shut on DUt1 to DUT2
    udld_interfaces = [vars.D1D2P1]
    for udld_interface in udld_interfaces:
        intf.interface_operation(dut1, udld_interface , "shutdown")
        intf.interface_operation(dut1, udld_interface , "startup")
    st.wait(5)

    print_log("Verify that the port from DUT1 to DUT2 should go up in Aggressive Mode with UDLD TX/RX loop...",'MED')
    udld_interfaces = [vars.D1D2P1]
    state = 'up'
    if verify_udld_port_status(udld_interfaces,dut1,state):
        print_log("The ports from DUT1 to DUT2 is going to up state verification PASSED", "HIGH")
    else:
        print_log("The ports from DUT1 to DUT2 is not going to up state verification FAILED", "HIGH")
        udld_interface_no_aggressive_loop_fail += 1
        tc_result2 += 1
        final_result = False

    api_list = []
    api_list.append([vlan.delete_vlan_member, dut2, trunk_base_vlan, [vars.D2D3P1,vars.D2D3P2]])
    api_list.append([vlan.delete_vlan_member, dut3, trunk_base_vlan, [vars.D3D2P1,vars.D3D2P2]])
    utils.exec_all(True, api_list)

    ###Enable UDLD global
    dict1 = {'udld_enable': udld_global[dut1]['udld_enable'], 'config': udld_global[dut1]['config']}
    dict2 = {'udld_enable': udld_global[dut2]['udld_enable'], 'config': udld_global[dut2]['config']}
    pll.exec_parallel(True,dut_list,udld.config_udld_global, [dict1, dict2])

    ###Enable UDLD on Interfaces
    dict1 = {'intf': udld_int[dut1]['udld_int'],'udld_enable': udld_int[dut1]['udld_enable'], 'config': udld_int[dut1]['config']}
    dict2 = {'intf': udld_int[dut2]['udld_int'],'udld_enable': udld_int[dut2]['udld_enable'], 'config': udld_int[dut2]['config']}
    pll.exec_parallel(True,dut_list,udld.config_intf_udld, [dict1, dict2])
    st.wait(2)

    ####################PDB will REMOVE after suite completion
    #import pdb;pdb.set_trace()

    if verify_udld_neighbor(udld_neighbor):
        print_log("UDLD neighbor verification PASSED", "HIGH")
    else:
        print_log("UDLD neighbor verification FAILED", "HIGH")
        udld_neighbor_fail += 1
        tc_result2 += 1
        final_result = False

    print_log("Do Warm Reboot in Aggressive Mode...", 'MED')
    utils.exec_foreach(True, dut_reload, reboot_api.config_warm_restart, oper="enable")
    utils.exec_all(True, [[st.reboot, dut, "warm"] for dut in dut_reload])
    st.wait(10)
    if verify_udld_neighbor(udld_neighbor):
        print_log("UDLD neighbor in normal mode after cold reboot verification PASSED", "HIGH")
    else:
        print_log("UDLD neighbor in normal mode after cold reboot verification FAILED", "HIGH")
        udld_neighbor_warm_reboot_norm_fail += 1
        tc_result2 += 1
        final_result = False

    ###Disable UDLD on Interfaces
    dict1 = {'intf': udld_int[dut1]['udld_int'],'udld_enable': 'no', 'config': 'no'}
    dict2 = {'intf': udld_int[dut2]['udld_int'],'udld_enable': 'no', 'config': 'no'}
    pll.exec_parallel(True,dut_list,udld.config_intf_udld, [dict1, dict2])

    ###Disable UDLD global
    dict1 = {'udld_enable': 'no', 'config': 'no'}
    dict2 = {'udld_enable': 'no', 'config': 'no'}
    pll.exec_parallel(True,dut_list,udld.config_udld_global, [dict1, dict2])


    if tc_result2 > 0:
       st.report_tc_fail("FtOpSoSwudldloopaggressive001", "UDLD_TX_RX_loop_Aggressive_Failed", "test_udld_loops_normal_aggressive")
    else:
       st.report_tc_pass("FtOpSoSwudldloopaggressive001", "UDLD_TX_RX_loop_Aggressive_Passed", "test_udld_loops_normal_aggressive")

    if final_result:
        st.report_pass("test_case_passed")
    else:
        fail_msg = ''
        if udld_interface_normal_loop_fail > 0:
            fail_msg += 'UDLD loop port down Failed in Normal mode:'
        if udld_interface_no_normal_loop_fail > 0:
            fail_msg += 'UDLD no loop port up Failed in Normal mode:'
        if udld_mode_fail > 0:
            fail_msg += 'UDLD mode Aggressive config Failed:'
        if udld_interface_aggressive_loop_fail > 0:
            fail_msg += 'UDLD loop port down Failed in Aggressive mode:'
        if udld_interface_no_aggressive_loop_fail > 0:
            fail_msg += 'UDLD no loop port up Failed in Aggressive mode:'
        if udld_neighbor_fail > 0:
            fail_msg += 'UDLD neighbor Failed:'
        if udld_neighbor_warm_reboot_norm_fail > 0:
            fail_msg += 'UDLD neighbor Failed after warm reboot:'
        st.report_fail("test_case_failure_message", fail_msg.strip(':'))
Example #13
0
def test_ft_l3_performance_enhancements_v4_bgp_link_flap_convergence_time(
        fixture_v4):
    ################# Author Details ################
    # Name: Rakesh Kumar Vooturi
    # Email:  [email protected]
    #################################################
    #
    # Objective - FtOpSoRtPerfFn031 : Performance measurement for BGP Link Flap case
    #   Measure time taken for the traffic ( corresponding to BGP routes )
    #   to resume when the link carrying traffic ( corresponding to BGP routes )
    #   goes down and then comes up.
    #   Measurement is taken from the time of link up
    #   (i.e link up after link going down) to the time of RX rate = TX rate.
    #
    ############### 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")

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

    if not interface_obj.poll_for_interface_status(
            dut, dut_to_tg_port_1, 'oper', 'down', iteration=10, delay=1):
        st.report_fail('interface_admin_shut_down_fail', dut_to_tg_port_1)

    st.banner(
        "# Measuring Convergence time ( control plane + data plane ) taken for BGP Link Flap scenario on HWSKU {}"
        .format(hwsku_under_test))

    # Startup the routing interface link.
    st.log("Startup the routing interface link.")
    if not interface_obj.interface_operation(dut, dut_to_tg_port_1, "startup"):
        st.report_fail('interface_admin_startup_fail', dut_to_tg_port_1)

    if not interface_obj.poll_for_interface_status(
            dut, dut_to_tg_port_1, 'oper', 'up', iteration=10, delay=1):
        st.report_fail('interface_admin_startup_fail', dut_to_tg_port_1)

    # 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 Link Flap scenario (After Link 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")