Example #1
0
def tf_tg_stream_config():
    st.log('TG configuration for tf tests')
    tg_handler = tgapi.get_handles(vars, tf_data.tg_port_list)
    tg = tg_handler["tg"]
    tg_ph_1 = tg_handler["tg_ph_1"]
    tg_ph_2 = tg_handler["tg_ph_2"]
    tg_ph_3 = tg_handler["tg_ph_3"]
    tg_ph_4 = tg_handler["tg_ph_4"]
    tg_ph_list = [tg_ph_1, tg_ph_2, tg_ph_3, tg_ph_4]

    stream_tf_data = {}

    tgapi.traffic_action_control(tg_handler, actions=["reset", "clear_stats"])

    stream_tf_data['1'] = tg.tg_traffic_config(
        port_handle=tg_ph_1,
        mode='create',
        rate_percent=100,
        transmit_mode="continuous",
        mac_src="00:00:00:00:00:02",
        mac_dst="00:00:00:00:00:01",
        vlan_id=tf_data.vlan,
        l2_encap='ethernet_ii_vlan',
        frame_size='1500',
        high_speed_result_analysis=1)['stream_id']
    stream_tf_data['2'] = tg.tg_traffic_config(
        port_handle=tg_ph_2,
        mode='create',
        rate_percent=100,
        transmit_mode="continuous",
        mac_src="00:00:00:00:00:03",
        mac_dst="00:00:00:00:00:01",
        vlan_id=tf_data.vlan,
        l2_encap='ethernet_ii_vlan',
        frame_size='1500',
        high_speed_result_analysis=1)['stream_id']
    stream_tf_data['3'] = tg.tg_traffic_config(
        port_handle=tg_ph_3,
        mode='create',
        rate_percent=100,
        transmit_mode="continuous",
        mac_src="00:00:00:00:00:04",
        mac_dst="00:00:00:00:00:01",
        vlan_id=tf_data.vlan,
        l2_encap='ethernet_ii_vlan',
        frame_size='1500',
        high_speed_result_analysis=1)['stream_id']
    stream_tf_data['4'] = tg.tg_traffic_config(
        port_handle=tg_ph_4,
        mode='create',
        rate_percent=100,
        transmit_mode="continuous",
        mac_src="00:00:00:00:00:01",
        mac_dst="00:00:00:00:00:02",
        vlan_id=tf_data.vlan,
        l2_encap='ethernet_ii_vlan',
        frame_size='1500',
        high_speed_result_analysis=1)['stream_id']

    return tg, tg_ph_list, stream_tf_data
Example #2
0
def test_ft_dynamic_nat_warmboot():
    # ################ Author Details ################
    # Name: Kesava Swamy Karedla
    # Eamil: [email protected]
    # ################################################
    # Objective - FtOpSoRoNatWb001 - Verify warm boot with dynamic nat scaling entries.
    # #################################################
    result_flag=0
    platform = basic_obj.get_hwsku(vars.D1)
    common_constants = st.get_datastore(vars.D1, "constants", "default")
    if not platform.lower() in common_constants['WARM_REBOOT_SUPPORTED_PLATFORMS']:
        st.error("Warm-Reboot is not supported for this platform {}".format(platform))
        st.report_unsupported('test_case_unsupported')
    nat_obj.clear_nat(vars.D1, translations=True)
    nat_obj.config_nat_pool_binding(vars.D1, binding_name=data.bind_name[0], pool_name=data.pool_name[0],
                                    config=data.config_del)
    nat_obj.config_nat_pool_binding(vars.D1, binding_name="scale_bind", pool_name="scale_pool",
                                    acl_name=data.acl_table_in_nat_eg, config=data.config_add)
    st.log("Sending continuous traffic at 600 pps for the max dynamic nat entries to get learned")
    tg1.tg_traffic_control(action='run', handle=tg_str_data[1]["tg1_scale_nat_udp_data_str_id_1"])
    st.log("Waiting for traffic to run, such that max nat entries get learned")
    if not util_check_nat_translations_count(vars.D1,20,data.max_nat_entries):
        nat_reboot_debug_fun()
        st.log("Failed to learn max nat entries")
        result_flag = 1
    tg1.tg_traffic_control(action='stop', handle=tg_str_data[1]["tg1_scale_nat_udp_data_str_id_1"])
    # Show command for debugging purpose in case of failures.
    intf_obj.show_interface_counters_all(vars.D1)
    st.log("Warm boot verification")
    tgapi.traffic_action_control(tg_handler, actions=['clear_stats'])
    tg1.tg_traffic_control(action='run', handle=tg_str_data[1]["tg1_scale_nat_udp_data_str_id_1"])
    st.log("Performing warm-reboot, while traffic is forwarding for nat entries")
    st.reboot(vars.D1, 'warm')
    tg1.tg_traffic_control(action='stop', handle=tg_str_data[1]["tg1_scale_nat_udp_data_str_id_1"])
    traffic_details = {
        '1': {
            'tx_ports': [vars.T1D1P1],
            'tx_obj': [tg1],
            'exp_ratio': [1],
            'rx_ports': [vars.T1D1P2],
            'rx_obj': [tg2],
             }
                      }

    filter_result = tgapi.validate_tgen_traffic(traffic_details=traffic_details, mode='aggregate', comp_type='packet_count')
    if not filter_result:
        nat_reboot_debug_fun()
        st.log("Traffic loss observed for the SNAT traffic during warm-boot")
        result_flag = 1
    nat_obj.config_nat_pool_binding(vars.D1, binding_name=data.bind_name[1], pool_name=data.pool_name[1],
                                    config=data.config_add)
    nat_obj.config_nat_pool_binding(vars.D1, binding_name="scale_bind", pool_name="scale_pool",
                                    acl_name=data.acl_table_in_nat_eg, config=data.config_del)
    if result_flag:
        st.report_fail("nat_warm_reboot_failed")
    st.report_pass("test_case_passed")
Example #3
0
def get_tg_parameters():
    global tg, tg_ph_list, tg_data
    tg_data = {}
    tg_handler = tgapi.get_handles(vars, [vars.T1D1P1, vars.T1D1P2])
    tg = tg_handler["tg"]
    tg_ph_1 = tg_handler["tg_ph_1"]
    tg_ph_2 = tg_handler["tg_ph_2"]
    tg_ph_list = [tg_ph_1, tg_ph_2]
    tgapi.traffic_action_control(tg_handler, actions=["reset", "clear_stats"])
    return tg, tg_ph_list
def test_ft_ipv6_link_local_manual():
    result_flag = 0
    st.log("Clearing all interface counters")
    utils.exec_all(True, [[intf_obj.clear_interface_counters, vars.D1], [intf_obj.clear_interface_counters, vars.D2]])
    st.log("clearing TG stats")
    tgapi.traffic_action_control(tg_handler, actions=['clear_stats'])
    ip_obj.delete_static_route(vars.D1, d2_prt_link_local[0], data.static_rt, 'ipv6', "vtysh", data.prt_chnl)
    utils.exec_all(True, [[ip_obj.config_interface_ip6_link_local,vars.D1, data.prt_chnl, 'disable'],
                          [ip_obj.config_interface_ip6_link_local,vars.D2, data.prt_chnl, 'disable']])
    utils.exec_all(True, [[ip_obj.config_ip_addr_interface, vars.D1, data.prt_chnl, data.ip6_manual_ll_addr[0], data.tg_ip6_addr_mask_l[0], "ipv6", 'add'],
                          [ip_obj.config_ip_addr_interface, vars.D2, data.prt_chnl, data.ip6_manual_ll_addr[1], data.tg_ip6_addr_mask_l[1], "ipv6", 'add']])
    utils.exec_all(True, [
        [ip_obj.create_static_route, vars.D1, data.ip6_manual_ll_addr[1], data.static_rt_manual, "vtysh", 'ipv6', data.prt_chnl],
        [ip_obj.create_static_route, vars.D2, data.tg_ip6_addr_l[1], data.static_rt_manual, "vtysh", 'ipv6', vars.D2T1P1]])
    utils.exec_all(True, [[ip_obj.get_interface_ip_address, vars.D1, None, "ipv6"],
                          [ip_obj.get_interface_ip_address, vars.D2, None, "ipv6"]])
    st.log("Get show ipv6 route output")
    utils.exec_all(True, [[ip_obj.show_ip_route, vars.D1, "ipv6", "sonic", None],
                          [ip_obj.show_ip_route, vars.D2, "ipv6", "sonic", None]])
    tg1.tg_traffic_config(mode='modify', stream_id=tg_str_data[1]["tg1_ipv6_data_str_id_1"],
                          ipv6_dst_addr=data.static_rt_manual_ip)
    if not poll_verify_interface_ip_address(vars.D1, data.prt_chnl, ["{}%{}/64".format(data.ip6_manual_ll_addr[0], data.prt_chnl), "{}/64".format(data.ip6_manual_ll_addr[0])],10):
        result_flag = 1
    if not ip_obj.ping(vars.D1, data.ip6_manual_ll_addr[1], family='ipv6', interface = data.prt_chnl):
        st.log("Ipv6 Ping over manual ipv6 Link Local address via the Port Channel based routing interface is failed.")
        result_flag =1
    tg1.tg_traffic_control(action='run', handle=tg_str_data[1]["tg1_ipv6_data_str_id_1"])
    st.wait(1)
    tg1.tg_traffic_control(action='stop', handle=tg_str_data[1]["tg1_ipv6_data_str_id_1"])
    tgapi.traffic_action_control(tg_handler, actions=['clear_stats'])
    tg1.tg_traffic_control(action='run', handle=tg_str_data[1]["tg1_ipv6_data_str_id_1"])
    st.wait(data.pkts_tx_time)
    tg1.tg_traffic_control(action='stop', handle=tg_str_data[1]["tg1_ipv6_data_str_id_1"])
    traffic_details = {
        '1': {
            'tx_ports': [vars.T1D1P1],
            'tx_obj': [tg1],
            'exp_ratio': [1],
            'rx_ports': [vars.T1D2P1],
            'rx_obj': [tg2],
        }
    }

    filter_result = tgapi.validate_tgen_traffic(traffic_details=traffic_details, mode='aggregate', comp_type='packet_count')
    if not filter_result:
        st.log("traffic loss observed for ipv6 traffic forwarded via ipv6 link local next hop")
        result_flag = 1
    if result_flag:
        st.log("Show command for debugging purpose in case of failures")
        utils.exec_all(True, [[intf_obj.show_interface_counters_all, vars.D1],
                              [intf_obj.show_interface_counters_all, vars.D2]])
        st.report_fail("ip6_traffic_over_link_local_nh_fail_manual")

    st.report_pass("test_case_passed")
Example #5
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")
Example #6
0
def nat_post_config():
    vars = st.get_testbed_vars()

    util_nat_zone_config(vars, [vars.D1T1P1, vars.D1T1P2], [data.zone_1, data.zone_2], config=data.config_del)
    nat_obj.clear_nat_config(vars.D1)
    nat_obj.config_nat_feature(vars.D1, 'disable')
    ip_obj.delete_static_route(vars.D1, data.out_ip_addr_h,
                               "{}/{}".format(data.global_ip_addr_rt, data.global_ip_addr_mask))
    ip_obj.clear_ip_configuration(st.get_dut_names())
    vlan_obj.clear_vlan_configuration(st.get_dut_names())
    st.log("Cleaning up routing interfaces configured on TG")
    tg1.tg_interface_config(port_handle=tg_ph_1, handle=tg_rt_int_handle[0]['handle'], mode='destroy')
    tg1.tg_interface_config(port_handle=tg_ph_2, handle=tg_rt_int_handle[1]['handle'], mode='destroy')
    tgapi.traffic_action_control(tg_handler, actions=['reset'])
def test_ft_ipv6_link_local_nh_change():
    report_flag = 0
    st.log("Clearing all interface counters")
    utils.exec_all(True, [[intf_obj.clear_interface_counters, vars.D1], [intf_obj.clear_interface_counters, vars.D2]])
    st.log("clearing TG stats")
    tgapi.traffic_action_control(tg_handler, actions=['clear_stats'])
    st.log("Remove the vlan participation to bring down the Vlan routing intf")
    vlan_obj.delete_vlan_member(vars.D1, data.vlan_li[0], vars.D1D2P2, tagging_mode=True)
    vlan_obj.add_vlan_member(vars.D1, data.vlan_li[0], vars.D1D2P2, tagging_mode=True)
    if not ip_obj.get_link_local_addresses(vars.D1, data.vlan_in_1):
        st.error("ipv6 link local addr is not auto generated after remove and re add of vlan routing intf")
        report_flag = 1
    pc_obj.add_del_portchannel_member(vars.D1, data.prt_chnl, [vars.D1D2P3, vars.D1D2P4], flag="del", skip_verify=True)
    pc_obj.add_del_portchannel_member(vars.D1, data.prt_chnl, [vars.D1D2P3, vars.D1D2P4], flag="add", skip_verify=True)
    if not ip_obj.get_link_local_addresses(vars.D1, data.prt_chnl):
        st.error("ipv6 link local addr is not auto generated for {} after remove and re add of members".format(data.prt_chnl))
        report_flag = 1
    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
    utils.exec_all(True, [[get_mac, vars.D1] ,[get_mac, vars.D2]])
    st.log("Checking the IPv6 traffic forwarding over ECMP next hops after remove and re adding of next hop interfaces")
    tg1.tg_traffic_control(action='run', handle=tg_str_data[1]["tg1_ipv6_data_str_id_1"])
    st.wait(data.pkts_tx_time)
    tg1.tg_traffic_control(action='stop', handle=tg_str_data[1]["tg1_ipv6_data_str_id_1"])
    ecmp_cntrs = verify_traffic_hash(vars.D1, [vars.D1D2P1, vars.D1D2P2, vars.D1D2P3, vars.D1D2P4], data.pkts_per_port)
    st.log("Counter stats on next hop interfaces - {}".format(ecmp_cntrs))
    traffic_details = {
        '1': {
            'tx_ports': [vars.T1D1P1],
            'tx_obj': [tg1],
            'exp_ratio': [1],
            'rx_ports': [vars.T1D2P1],
            'rx_obj': [tg2],
        }
    }
    filter_result = tgapi.validate_tgen_traffic(traffic_details=traffic_details, mode='aggregate', comp_type='packet_count')
    if not filter_result:
        st.log("After flap in next hop interfaces, traffic loss observed for ipv6 traffic forwarded via ipv6 link local next hop")
        report_flag = 1
    if report_flag:
        st.report_fail("ip6_traffic_over_link_local_nh_fail")
    st.report_pass("test_case_passed")
def test_ft_ipv6_link_local_vrf():
    report_flag = 0
    st.log("Clearing all interface counters")
    utils.exec_all(True, [[intf_obj.clear_interface_counters, vars.D1], [intf_obj.clear_interface_counters, vars.D2]])
    st.log("clearing TG stats")
    tgapi.traffic_action_control(tg_handler, actions=['clear_stats'])
    st.log("Check the auto configured ipv6 link local address for VRF interface")
    if not ip_obj.get_link_local_addresses(vars.D1, data.vlan_in_2):
        st.log(
            "Ipv6 link local address is not auto generated for VRF binded vlan based routing interface {}".format(data.vlan_in_2))
        report_flag = 1
    ip_obj.show_ip_route(vars.D1, "ipv6", "sonic", data.vrf_name)
    st.log("binding the TG connected interface to VRF {}".format(data.vrf_name))
    ip_obj.config_ip_addr_interface(vars.D1, vars.D1T1P1, data.tgd_ip6_addr_l[0], data.tg_ip6_addr_mask_l[0], "ipv6",
                                    'remove')
    vrf_obj.bind_vrf_interface(vars.D1, vrf_name=data.vrf_name, intf_name=vars.D1T1P1, config='yes', skip_error=True)
    ip_obj.config_ip_addr_interface(vars.D1, vars.D1T1P1, data.tgd_ip6_addr_l[0],data.tg_ip6_addr_mask_l[0], "ipv6", 'add')
    tg1.tg_traffic_control(action='run', handle=tg_str_data[1]["tg1_ipv6_data_str_id_1"])
    st.wait(data.pkts_tx_time)
    tg1.tg_traffic_control(action='stop', handle=tg_str_data[1]["tg1_ipv6_data_str_id_1"])
    # Show command for debugging purpose in case of failures.
    utils.exec_all(True, [[intf_obj.show_interface_counters_all, vars.D1],
                          [intf_obj.show_interface_counters_all, vars.D2]])
    traffic_details = {
        '1': {
            'tx_ports': [vars.T1D1P1],
            'tx_obj': [tg1],
            'exp_ratio': [1],
            'rx_ports': [vars.T1D2P1],
            'rx_obj': [tg2],
        }
    }

    filter_result = tgapi.validate_tgen_traffic(traffic_details=traffic_details, mode='aggregate', comp_type='packet_count')
    if not filter_result:
        st.log(
            "After flap in next hop interfaces, traffic loss observed for ipv6 traffic forwarded via ipv6 link local next hop")
        report_flag = 1
    if report_flag:
        vrf_obj.bind_vrf_interface(vars.D1, vrf_name=data.vrf_name, intf_name=vars.D1T1P1, config='no', skip_error=True)
        ip_obj.config_ip_addr_interface(vars.D1, vars.D1T1P1, data.tgd_ip6_addr_l[0], data.tg_ip6_addr_mask_l[0],
                                        "ipv6", 'add')
        st.report_fail("ip6_traffic_over_link_local_nh_fail_vrf")
    ip_obj.config_ip_addr_interface(vars.D1, vars.D1T1P1, data.tgd_ip6_addr_l[0], data.tg_ip6_addr_mask_l[0], "ipv6",
                                    'remove')
    vrf_obj.bind_vrf_interface(vars.D1, vrf_name=data.vrf_name, intf_name=vars.D1T1P1, config='no', skip_error=True)
    ip_obj.config_ip_addr_interface(vars.D1, vars.D1T1P1, data.tgd_ip6_addr_l[0],data.tg_ip6_addr_mask_l[0], "ipv6", 'add')
    st.report_pass("test_case_passed")
Example #9
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 tg_stream_config():

    st.log('TG configuration')
    tgapi.traffic_action_control(tg_handler, actions=["reset", "clear_stats"])
    st.log("Creating TG streams")
    data.streams = {}
    stream = tg.tg_traffic_config(port_handle=tg_handler["tg_ph_1"],
                                  mode='create',
                                  rate_pps=20000,
                                  mac_src='00:00:11:11:00:01',
                                  mac_src_mode="increment",
                                  mac_src_count=data.mac_addrs_count,
                                  transmit_mode="continuous",
                                  mac_src_step="00:00:00:00:00:01",
                                  mac_dst='00:00:00:00:00:02',
                                  l2_encap='ethernet_ii_vlan',
                                  vlan_id=data.vlan,
                                  vlan="enable")
    data.streams['Ixia_1'] = stream['stream_id']
def ipv6_link_local_post_config():
    vars = st.get_testbed_vars()
    st.log("Static route cleanup")
    utils.exec_all(True, [
        [ip_obj.delete_static_route, vars.D1, d2_prt_link_local[0], data.static_rt, 'ipv6', "vtysh", vars.D1D2P1],
        [ip_obj.delete_static_route, vars.D2, data.tg_ip6_addr_l[1], data.static_rt, 'ipv6', "vtysh", vars.D2T1P1]])
    ip_obj.delete_static_route(vars.D1, d2_prt_link_local[0], data.static_rt, 'ipv6',"vtysh",  data.vlan_in_1)
    ip_obj.delete_static_route(vars.D1, d2_prt_link_local[0], data.static_rt, 'ipv6',"vtysh", data.prt_chnl)
    ip_obj.delete_static_route(vars.D1, d2_prt_link_local[0], data.static_rt, 'ipv6', "vtysh", data.vlan_in_2, vrf=data.vrf_name)
    vrf_obj.config_vrf(vars.D1, vrf_name=data.vrf_name, config='no')
    st.log("Disabling ipv6 link local")
    utils.exec_all(True, [[ip_obj.config_interface_ip6_link_local, vars.D1, d1_int_ipv6_list, 'disable'],
                          [ip_obj.config_interface_ip6_link_local, vars.D2, d2_int_ipv6_list, 'disable']])
    ip_obj.clear_ip_configuration(st.get_dut_names(), family = 'ipv6')
    st.log("Vlan and Port Channel clean up")
    vlan_obj.clear_vlan_configuration(st.get_dut_names())
    pc_obj.clear_portchannel_configuration(st.get_dut_names())
    st.log("Cleaning up routing interfaces configured on TG")
    st.log("Stopping the TG traffic again, if in case of any failures in test function misses the stop operation")
    tgapi.traffic_action_control(tg_handler, actions=['reset'])
    tg1.tg_interface_config(port_handle=tg_ph_1, handle=tg_rt_int_handle[0]['handle'], mode='destroy')
    tg2.tg_interface_config(port_handle=tg_ph_2, handle=tg_rt_int_handle[1]['handle'], mode='destroy')
def test_ft_ipv6_link_local_warm_boot():
    result_flag=0
    ip_obj.delete_static_route(vars.D1, d2_prt_link_local[0], data.static_rt, 'ipv6', "vtysh", data.prt_chnl)
    st.log("Clearing all interface counters")
    utils.exec_all(True, [[intf_obj.clear_interface_counters, vars.D1], [intf_obj.clear_interface_counters, vars.D2]])
    utils.exec_all(True, [[ip_obj.show_ip_route, vars.D1, "ipv6", "sonic", None],
                          [ip_obj.show_ip_route, vars.D2, "ipv6", "sonic", None]])
    tg1.tg_traffic_config(mode='modify', stream_id=tg_str_data[1]["tg1_ipv6_data_str_id_1"],
                          ipv6_dst_addr=data.static_rt_ip)
    st.log("clearing TG stats")
    tgapi.traffic_action_control(tg_handler, actions=['clear_stats'])
    tg1.tg_traffic_control(action='run', handle=tg_str_data[1]["tg1_ipv6_data_str_id_1"])
    st.log("Performing warm-reboot, while ipv6 traffic is forwarding via link local next hops ")
    st.reboot(vars.D1, 'warm')
    tg1.tg_traffic_control(action='stop', handle=tg_str_data[1]["tg1_ipv6_data_str_id_1"])
    verify_traffic_hash(vars.D1,[vars.D1D2P1, vars.D1D2P2], data.pkts_per_port)
    traffic_details = {
        '1': {
            'tx_ports': [vars.T1D1P1],
            'tx_obj': [tg1],
            'exp_ratio': [1],
            'rx_ports': [vars.T1D2P1],
            'rx_obj': [tg2],
        }
    }

    filter_result = tgapi.validate_tgen_traffic(traffic_details=traffic_details, mode='aggregate', comp_type='packet_count')
    if not filter_result:
        st.log("During Warm boot, traffic loss observed for ipv6 traffic forwarded via ipv6 link local next hop")
        result_flag = 1
    if result_flag:
        utils.exec_all(True, [[ip_obj.get_interface_ip_address, vars.D1, None, "ipv6"],
                              [ip_obj.get_interface_ip_address, vars.D2, None, "ipv6"]])
        utils.exec_all(True, [[ip_obj.show_ip_route, vars.D1, "ipv6", "sonic", None],
                              [ip_obj.show_ip_route, vars.D2, "ipv6", "sonic", None]])
        utils.exec_all(True, [[intf_obj.show_interface_counters_all, vars.D1],
                              [intf_obj.show_interface_counters_all, vars.D2]])
        st.report_fail("ip6_traffic_over_link_local_nh_fail")
    st.report_pass("test_case_passed")
Example #13
0
def fixture_v6(request):
    global h1, h2, bgp_rtr2

    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',
                                ipv6_intf_addr=data.neigh_ipv6_addr,
                                ipv6_prefix_length=64,
                                ipv6_gateway=data.my_ipv6_addr,
                                arp_send_req='1')
    st.log("INTFCONF: " + str(h1))
    h2 = tg.tg_interface_config(port_handle=tg_handler["tg_ph_2"],
                                mode='config',
                                ipv6_intf_addr=data.neigh_ipv6_addr2,
                                ipv6_prefix_length=64,
                                ipv6_gateway=data.intf_ipv6_addr,
                                arp_send_req='1')
    st.log("INTFCONF: " + str(h2))

    # Configuring BGP on TG interface
    conf_var = {
        'mode': 'enable',
        'ip_version': '6',
        'active_connect_enable': '1',
        'local_as': data.remote_as_num,
        'remote_as': data.as_num,
        'remote_ipv6_addr': data.my_ipv6_addr
    }
    route_var = {
        'mode': 'add',
        'ip_version': '6',
        'num_routes': data.test_bgp_route_count,
        'prefix': '3300:1::',
        'as_path': 'as_seq:1'
    }

    # Starting the BGP router on TG.
    bgp_rtr2 = 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_rtr2))

    # Verifying the BGP neighborship
    st.wait(10)
    st.log("Verifying the BGP neighborship.")
    if not bgpfeature.verify_bgp_summary(
            dut, family='ipv6', neighbor=data.neigh_ipv6_addr,
            state='Established'):
        st.report_fail("bgp_ip6_peer_establish_fail", data.neigh_ip_addr)

    yield
    st.log("Test Fixture Cleanup.")
    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')
Example #14
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")
Example #15
0
def util_tg_init(vars, tg_port_list):
    tg_port_list = list(tg_port_list) if isinstance(tg_port_list, list) else [tg_port_list]
    tg_handler = tgapi.get_handles(vars, tg_port_list)
    tgapi.traffic_action_control(tg_handler, actions=['reset', 'clear_stats'])
    return tg_handler