Ejemplo n.º 1
0
def full_cleanup():
    bgpapi.cleanup_router_bgp(st.get_dut_names())
    ipapi.clear_ip_configuration(st.get_dut_names(),
                                 thread=eh_data.thread_mode,
                                 family='all')
    vapi.clear_vlan_configuration(st.get_dut_names(),
                                  thread=eh_data.thread_mode)
Ejemplo n.º 2
0
def bgp_fast_reboot_module_hooks(request):
    global vars
    vars = st.ensure_min_topology("D1D2:1", "D1T1:2")
    if not st.is_feature_supported("bgp-neighbotship-performance", vars.D1):
        data.neighborship_wait = 30

    st.log("Enabling IPv6 mode globally")
    ip_obj.config_ipv6(vars.D1, action='enable')
    ip_obj.config_ipv6(vars.D2, action='enable')

    st.log("Configuring ipv4 addresses on routing interfaces")
    ipv4_ip_address_config()

    st.log("Verifying ipv4 addresses on routing interfaces")
    verify_ipv4_address_config()

    if data.ipv6_support:
        st.log("Configuring ipv6 addresses on routing interfaces")
        ipv6_address_config()
        st.log("Verifying ipv6 addresses on routing interfaces")
        verify_ipv6_address_config()
        st.log(
            "Configuring IPV6 eBGP config between DUT1 and DUT2,iBGP config between DUT1 and TG2"
        )
        ipv6_bgp_config()

    st.log(
        "Configuring IPV4 eBGP config between DUT1 and DUT2,iBGP config between DUT1 and TG1"
    )
    ipv4_bgp_config()

    if data.ipv6_support:
        st.log("Configuring TG2 V6 iBGP config")
        tg_bgpv6_config(vars, data.local_asn4, data.remote_asn4)

    st.log("Configuring TG1 V4 iBGP config")
    tg_bgp_config(vars, data.local_asn4, data.remote_asn4)

    st.log(
        "Verify IPV4 eBGP neighborship between D1 and D2 and iBGP neighborship between D1 and TG1"
    )
    verify_v4_bgp_neigborship()

    if data.ipv6_support:
        st.log(
            "Verify IPV6 eBGP neighborship between D1 and D2 and iBGP neighborship between D1 and TG2"
        )
        verify_v6_bgp_neigborship()

    yield

    bgp_obj.cleanup_router_bgp(st.get_dut_names())
    ip_obj.clear_ip_configuration(st.get_dut_names())

    if data.ipv6_support:
        ip_obj.clear_ip_configuration(st.get_dut_names(), 'ipv6')

    vlan_obj.clear_vlan_configuration(st.get_dut_names())
    portchannel_obj.clear_portchannel_configuration(st.get_dut_names())
Ejemplo n.º 3
0
def bgp_rr_traffic_pre_config_cleanup():
    st.banner("BGP RR WITH TRAFFIC CLASS CONFIG CLEANUP - START")
    bgplib.l3tc_vrfipv4v6_address_leafspine_bgp_config(config='no',
                                                       rr_enable='true')
    bgplib.l3tc_vrfipv4v6_address_leafspine_config_unconfig(config='no')
    bgpapi.cleanup_router_bgp(st.get_dut_names())
    ipapi.clear_ip_configuration(st.get_dut_names(), family='all', thread=True)
    bgplib.l3tc_underlay_config_unconfig(config='no')
    bgplib.l3tc_vrfipv4v6_address_leafspine_rr_tg_bgp_config(config='no',
                                                             rr_enable='true')
    st.banner("BGP RR WITH TRAFFIC CLASS CONFIG CLEANUP - END")
Ejemplo n.º 4
0
def bgp_save_reboot_module_hooks(request):
    global vars
    vars = st.ensure_min_topology("D1D2:1", "D1T1:2")
    data.shell_vtysh = st.get_ui_type()
    if data.shell_vtysh == "click":
        data.shell_vtysh = "vtysh"
    if not st.is_feature_supported("bgp-neighbotship-performance", vars.D1):
        data.neighborship_wait = 30

    st.log("Enabling IPv6 mode globally")
    st.exec_each([vars.D1, vars.D2], ip_obj.config_ipv6, action='enable')

    st.log("Configuring ipv4 addresses on routing interfaces")
    st.exec_each([vars.D1, vars.D2], ipv4_ip_address_config)

    st.log("Verifying ipv4 addresses on routing interfaces")
    st.exec_each([vars.D1, vars.D2], verify_ipv4_address_config)

    if data.ipv6_support:
        st.log("Configuring ipv6 addresses on routing interfaces")
        st.exec_each([vars.D1, vars.D2], ipv6_address_config)
        st.log("Verifying ipv6 addresses on routing interfaces")
        st.exec_each([vars.D1, vars.D2], verify_ipv6_address_config)
        st.log(
            "Configuring IPV6 eBGP config between DUT1 and DUT2,iBGP config between DUT1 and TG2"
        )
        st.exec_each([vars.D1, vars.D2], ipv6_bgp_config)

    st.log(
        "Configuring IPV4 eBGP config between DUT1 and DUT2,iBGP config between DUT1 and TG1"
    )
    st.exec_each([vars.D1, vars.D2], ipv4_bgp_config)

    if data.ipv6_support:
        st.log("Configuring TG2 V6 iBGP config")
        tg_bgpv6_config(vars, data.local_asn4, data.remote_asn4)

    st.log("Configuring TG1 V4 iBGP config")
    tg_bgp_config(vars, data.local_asn4, data.remote_asn4)

    yield

    bgp_obj.cleanup_router_bgp(st.get_dut_names())
    ip_obj.clear_ip_configuration(st.get_dut_names())

    if data.ipv6_support:
        ip_obj.clear_ip_configuration(st.get_dut_names(),
                                      'ipv6',
                                      skip_error_check=True)

    vlan_obj.clear_vlan_configuration(st.get_dut_names())
    portchannel_obj.clear_portchannel_configuration(st.get_dut_names())
Ejemplo n.º 5
0
def test_ft_bgp_ebgp_multihop_4byteASN():
    """

    Verify the functioning of ebgp multihop command with 4 byte ASN
    """
    #On DUT1 and DUT3, create BGP with 4byte ASN
    dut1_as = 6500001
    dut1 = topo['dut_list'][0]
    dut3_as = 6500002
    dut3 = topo['dut_list'][2]

    #Configure bgp on DUT1 and add DUT3 as neighbor with ebgp-multihop ttl set to 5
    bgpapi.config_bgp(dut1,
                      local_as=dut1_as,
                      neighbor=topo['D3D2P1_ipv4'],
                      remote_as=dut3_as,
                      config_type_list=["neighbor", "ebgp_mhop"],
                      ebgp_mhop='5')
    #Add static route to DUT3 neighbor
    ipapi.create_static_route(dut1, topo['D1D2P1_neigh_ipv4'],
                              "{}/24".format(topo['D3D2P1_ipv4']))
    #Configure bgp on DUT3 and add DUT1 as neighbor with ebgp-multihop ttl set to 5
    bgpapi.config_bgp(dut3,
                      local_as=dut3_as,
                      neighbor=topo['D1D2P1_ipv4'],
                      remote_as=dut1_as,
                      config_type_list=["neighbor", "ebgp_mhop"],
                      ebgp_mhop='5')
    #Add static route to DUT1 neighbor
    ipapi.create_static_route(dut3, topo['D3D2P1_neigh_ipv4'],
                              "{}/24".format(topo['D1D2P1_ipv4']))

    result = bgpapi.verify_bgp_summary(dut1,
                                       family='ipv4',
                                       neighbor=topo['D3D2P1_ipv4'],
                                       state='Established')

    #Clear applied configs
    bgpapi.cleanup_router_bgp(dut1)
    bgpapi.cleanup_router_bgp(dut3)
    ipapi.delete_static_route(dut1, topo['D1D2P1_neigh_ipv4'],
                              "{}/24".format(topo['D3D2P1_ipv4']))
    ipapi.delete_static_route(dut3, topo['D3D2P1_neigh_ipv4'],
                              "{}/24".format(topo['D1D2P1_ipv4']))

    if result:
        st.report_pass("test_case_passed")
    else:
        st.report_fail("test_case_failed")
Ejemplo n.º 6
0
def bgp_unnum_post_config():
    vars = st.get_testbed_vars()
    bgp_obj.cleanup_router_bgp(st.get_dut_names())
    ip_obj.clear_ip_configuration(st.get_dut_names(),
                                  family='ipv4',
                                  skip_error_check=True)
    ip_obj.clear_ip_configuration(st.get_dut_names(),
                                  family='ipv6',
                                  skip_error_check=True)
    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"
                          ]])
    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"
    )
Ejemplo n.º 7
0
def bgp_warm_reboot_module_hooks(request):
    global vars, tg_handler, tg, dut, ctrl_start, ctrl_stop
    global dut_to_tg_port_1, dut_to_tg_port_2, hwsku_under_test
    initialize_variables()
    vars = st.ensure_min_topology("D1T1:2")

    # Initialize TG and TG port handlers
    tg_handler = tgapi.get_handles(vars, [vars.T1D1P1, vars.T1D1P2])
    tg = tg_handler["tg"]
    ctrl_start = {'mode': 'start'}
    ctrl_stop = {'mode': 'stop'}

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

    # Configuring v4/v6 routing interfaces on the DUT.
    ipfeature.clear_ip_configuration(st.get_dut_names())
    ipfeature.clear_ip_configuration(st.get_dut_names(), 'ipv6')
    ipfeature.config_ip_addr_interface(dut,
                                       dut_to_tg_port_1,
                                       data.my_ip_addr,
                                       data.ip_prefixlen,
                                       family="ipv4")
    ipfeature.config_ip_addr_interface(dut,
                                       dut_to_tg_port_1,
                                       data.my_ipv6_addr,
                                       data.ipv6_prefixlen,
                                       family="ipv6")
    ipfeature.config_ip_addr_interface(dut,
                                       dut_to_tg_port_2,
                                       data.intf_ip_addr,
                                       data.ip_prefixlen,
                                       family="ipv4")
    ipfeature.config_ip_addr_interface(dut,
                                       dut_to_tg_port_2,
                                       data.intf_ipv6_addr,
                                       data.ipv6_prefixlen,
                                       family="ipv6")

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

    yield
    st.log("L3 Performance Enhancements Module Cleanup.")
    ipfeature.delete_ip_interface(dut,
                                  dut_to_tg_port_1,
                                  data.my_ip_addr,
                                  data.ip_prefixlen,
                                  family="ipv4")
    ipfeature.delete_ip_interface(dut,
                                  dut_to_tg_port_1,
                                  data.my_ipv6_addr,
                                  data.ipv6_prefixlen,
                                  family="ipv6")
    ipfeature.delete_ip_interface(dut,
                                  dut_to_tg_port_2,
                                  data.intf_ip_addr,
                                  data.ip_prefixlen,
                                  family="ipv4")
    ipfeature.delete_ip_interface(dut,
                                  dut_to_tg_port_2,
                                  data.intf_ipv6_addr,
                                  data.ipv6_prefixlen,
                                  family="ipv6")
    bgpfeature.delete_bgp_neighbor(dut, data.as_num, data.neigh_ip_addr,
                                   data.remote_as_num)
    bgpfeature.delete_bgp_neighbor(dut, data.as_num, data.neigh_ipv6_addr,
                                   data.remote_as_num)
    bgpfeature.cleanup_router_bgp(dut)
Ejemplo n.º 8
0
def test_ft_bgp_unnumbered_nondefault_vrf():
    """
    # ################ Author Details ################
    # Name: Sesha Reddy Koilkonda
    # Email: [email protected]
    # ################################################
    :return:
    """
    utils_obj.banner_log("FtOtSoRtBgpUnFn016,FtOtSoRtBgpUnFn017")
    result = 0
    bgp_obj.cleanup_router_bgp(st.get_dut_names())
    dict1 = {'vrf_name': data.vrf_name, 'skip_error': True}
    parallel.exec_parallel(True, [vars.D1, vars.D2], vrf_api.config_vrf,
                           [dict1, dict1])
    utils.exec_all(True, [[
        ip_obj.config_interface_ip6_link_local, vars.D1, vars.D1D2P1, "disable"
    ], [
        ip_obj.config_interface_ip6_link_local, vars.D2, vars.D2D1P1, "disable"
    ]])
    dict1 = {
        'vrf_name': data.vrf_name,
        'intf_name': vars.D1D2P1,
        'skip_error': True
    }
    dict2 = {
        'vrf_name': data.vrf_name,
        'intf_name': vars.D2D1P1,
        'skip_error': True
    }

    parallel.exec_parallel(True, [vars.D1, vars.D2],
                           vrf_api.bind_vrf_interface, [dict1, dict2])
    utils.exec_all(
        True, [[ip_obj.config_interface_ip6_link_local, vars.D1, vars.D1D2P1],
               [ip_obj.config_interface_ip6_link_local, vars.D2, vars.D2D1P1]])
    utils.exec_all(True,
                   [[ip_obj.get_interface_ip_address, vars.D1, None, "ipv6"],
                    [ip_obj.get_interface_ip_address, vars.D2, None, "ipv6"]])
    dict1 = {
        'vrf_name': data.vrf_name,
        'router_id': data.d1_rid,
        'local_as': data.d1_local_as,
        'addr_family': 'ipv6',
        'neighbor': vars.D1D2P1,
        'remote_as': 'external',
        'config_type_list': ["remote-as", "activate"],
        'interface': vars.D1D2P1
    }
    dict2 = {
        'vrf_name': data.vrf_name,
        'router_id': data.d2_rid,
        'local_as': data.d2_local_as,
        'addr_family': 'ipv6',
        'neighbor': vars.D2D1P1,
        'remote_as': 'external',
        'config_type_list': ["remote-as", "activate"],
        'interface': vars.D2D1P1
    }
    parallel.exec_parallel(True, [vars.D1, vars.D2], bgp_obj.config_bgp,
                           [dict1, dict2])

    if not utils.poll_wait(bgp_obj.verify_bgp_summary,
                           data.wait_timer,
                           vars.D1,
                           family='ipv6',
                           shell=bgp_cli_type,
                           neighbor=vars.D1D2P1,
                           vrf=data.vrf_name,
                           state='Established'):
        st.error(
            "BGP unnumbered neighbourship with the non-default vrf configuration failed."
        )
        result += 1
    st.log('######------Save and reboot------######')
    reboot_obj.config_save(vars.D1, "sonic")
    reboot_obj.config_save(vars.D1, "vtysh")

    st.reboot(vars.D1)
    if not utils.poll_wait(bgp_obj.verify_bgp_summary,
                           data.wait_timer,
                           vars.D1,
                           family='ipv6',
                           shell=bgp_cli_type,
                           neighbor=vars.D1D2P1,
                           vrf=data.vrf_name,
                           state='Established'):
        st.error(
            "BGP unnumbered neighbourship with the non-default vrf configuration failed after save and reboot."
        )
        result += 1
    st.log('######------Config reload with BGP unnumbered------######')
    st.log("Config reload the DUT")
    reboot_obj.config_save_reload(vars.D1)
    if not utils.poll_wait(bgp_obj.verify_bgp_summary,
                           data.wait_timer,
                           vars.D1,
                           family='ipv6',
                           shell=bgp_cli_type,
                           neighbor=vars.D1D2P1,
                           vrf=data.vrf_name,
                           state='Established'):
        st.error(
            "BGP unnumbered neighbourship with the non-default vrf configuration failed after config reload."
        )
        result += 1
    # unconfig part:

    dict1 = {
        'vrf_name': data.vrf_name,
        'local_as': data.d1_local_as,
        'config': 'no',
        'removeBGP': 'yes',
        'config_type_list': ['removeBGP']
    }
    dict2 = {
        'vrf_name': data.vrf_name,
        'local_as': data.d2_local_as,
        'config': 'no',
        'removeBGP': 'yes',
        'config_type_list': ['removeBGP']
    }
    parallel.exec_parallel(True, [vars.D1, vars.D2], bgp_obj.config_bgp,
                           [dict1, dict2])
    utils.exec_all(True, [[
        ip_obj.config_interface_ip6_link_local, vars.D1, vars.D1D2P1, "disable"
    ], [
        ip_obj.config_interface_ip6_link_local, vars.D2, vars.D2D1P1, "disable"
    ]])
    dict1 = {
        'vrf_name': data.vrf_name,
        'intf_name': vars.D1D2P1,
        'skip_error': True,
        'config': 'no'
    }
    dict2 = {
        'vrf_name': data.vrf_name,
        'intf_name': vars.D2D1P1,
        'skip_error': True,
        'config': 'no'
    }
    parallel.exec_parallel(True, [vars.D1, vars.D2],
                           vrf_api.bind_vrf_interface, [dict1, dict2])
    dict1 = {'vrf_name': data.vrf_name, 'skip_error': True, 'config': 'no'}
    parallel.exec_parallel(True, [vars.D1, vars.D2], vrf_api.config_vrf,
                           [dict1, dict1])
    bgp_obj.cleanup_router_bgp(st.get_dut_names())
    utils.exec_all(
        True,
        [[ip_obj.config_interface_ip6_link_local, vars.D1, d1_int_ipv6_list],
         [ip_obj.config_interface_ip6_link_local, vars.D2, d2_int_ipv6_list]])
    if result == 0:
        st.report_pass("test_case_passed")
    else:
        st.error(
            "BGP unnumbered neighborship failed with the non-default vrf configuration."
        )
        st.report_fail("test_case_failed")
Ejemplo n.º 9
0
def test_ft_bgp_unnumbered_manual_ll():
    """
    # ################ Author Details ################
    # Name: Sesha Reddy Koilkonda
    # Email: [email protected]
    # ################################################
    :return:
    """
    utils_obj.banner_log(
        'FtOtSoRtBgpUnFn013,FtOtSoRtBgpUnFn014,FtOtSoRtBgpUnFn015')
    result = 0
    # Configure the Link-local manually on Dut1 and auto link-local on DUT2 and verify the neighbourship.
    bgp_obj.cleanup_router_bgp(st.get_dut_names())
    ip_obj.config_ip_addr_interface(vars.D1,
                                    vars.D1D2P1,
                                    data.ip6_addr_manual_ll[0],
                                    96,
                                    family='ipv6')
    dict1 = {
        'config': 'yes',
        'router_id': data.d1_rid,
        'addr_family': 'ipv6',
        'local_as': data.d1_local_as,
        'remote_as': 'external',
        'config_type_list': ["remote-as", "activate"],
        'interface': vars.D1D2P1,
        'neighbor': vars.D1D2P1
    }
    dict2 = {
        'config': 'yes',
        'router_id': data.d2_rid,
        'addr_family': 'ipv6',
        'local_as': data.d2_local_as,
        'remote_as': 'external',
        'config_type_list': ["remote-as", "activate"],
        'interface': vars.D2D1P1,
        'neighbor': vars.D2D1P1
    }
    parallel.exec_parallel(True, [vars.D1, vars.D2], bgp_obj.config_bgp,
                           [dict1, dict2])
    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.error(
            "Failed to form BGP unnumbered peering using IPv6 link local with the Manual-Auto link-local address combination."
        )
        result += 1
    # with the manual link-local on Dut1 and configure the link-local on DUT2 also manually and verify the neighbourship.
    bgp_obj.cleanup_router_bgp(st.get_dut_names())
    ip_obj.config_ip_addr_interface(vars.D2,
                                    vars.D2D1P1,
                                    data.ip6_addr_manual_ll[1],
                                    96,
                                    family='ipv6')
    parallel.exec_parallel(True, [vars.D1, vars.D2], bgp_obj.config_bgp,
                           [dict1, dict2])
    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.error(
            "Failed to form BGP unnumbered peering using IPv6 link local with the manual-manual link-local address combination."
        )
        result += 1
    # update the manual link-local on Dut2 and verify the neighbourship.
    bgp_obj.cleanup_router_bgp(st.get_dut_names())
    data.ip6_addr_ll3 = 'FE80:0:0:0:204:5FF:FE00:500'
    ip_obj.config_ip_addr_interface(vars.D2,
                                    vars.D2D1P1,
                                    data.ip6_addr_manual_ll[2],
                                    96,
                                    family='ipv6')
    parallel.exec_parallel(True, [vars.D1, vars.D2], bgp_obj.config_bgp,
                           [dict1, dict2])
    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.error(
            "Failed to form BGP unnumbered peering using IPv6 link local, after uodating the manual link-local address on peer DUT.."
        )
        result += 1
    bgp_obj.cleanup_router_bgp(st.get_dut_names())
    ip_obj.config_ip_addr_interface(vars.D1,
                                    vars.D1D2P1,
                                    data.ip6_addr_manual_ll[0],
                                    96,
                                    family='ipv6',
                                    config='remove')
    ip_obj.config_ip_addr_interface(vars.D2,
                                    vars.D2D1P1,
                                    data.ip6_addr_manual_ll[1],
                                    96,
                                    family='ipv6',
                                    config='remove')
    ip_obj.config_ip_addr_interface(vars.D2,
                                    vars.D2D1P1,
                                    data.ip6_addr_manual_ll[2],
                                    96,
                                    family='ipv6',
                                    config='remove')
    if result == 0:
        st.report_pass("test_case_passed")
    else:
        st.error(
            "BGP unnumbered neighborship failed with the manual link-local address configuration."
        )
        st.report_fail("test_case_failed")
Ejemplo n.º 10
0
def test_ft_bgp_unnumbered_rr():
    """
    # ################ Author Details ################
    # Name: Sesha Reddy Koilkonda
    # Email: [email protected]
    # ################################################
    :return:
    """
    utils_obj.banner_log('FtOtSoRtBgpUnFn011,FtOtSoRtBgpUnFn012')
    result = 0

    bgp_obj.cleanup_router_bgp(st.get_dut_names())
    dict1 = {
        'config': 'yes',
        'router_id': data.d1_rid,
        'addr_family': 'ipv6',
        'local_as': data.d1_local_as,
        'remote_as': 'internal',
        'config_type_list': ["remote-as", "activate"],
        'interface': vars.D1D2P1,
        'neighbor': vars.D1D2P1
    }
    dict2 = {
        'config': 'yes',
        'router_id': data.d2_rid,
        'addr_family': 'ipv6',
        'local_as': data.d1_local_as,
        'remote_as': 'internal',
        'config_type_list': ["remote-as", "activate"],
        'interface': vars.D2D1P1,
        'neighbor': vars.D2D1P1
    }
    parallel.exec_parallel(True, [vars.D1, vars.D2], bgp_obj.config_bgp,
                           [dict1, dict2])
    result_rr = bgp_obj.create_bgp_route_reflector_client(
        vars.D1, data.d1_local_as, 'ipv6', vars.D1D2P1, 'yes')
    if not result_rr:
        st.error(
            "BGP SP - Configuring client reflection on {} {} bgp {} Failed".
            format(vars.D1, 'ipv6', data.d1_local_as))
        result += 1
    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.error(
            "Failed to form iBGP unnumbered peering using IPv6 link local with Route-reflector-client config"
        )
        result += 1
    # Unconfiguration
    bgp_obj.create_bgp_route_reflector_client(vars.D1,
                                              data.d1_local_as,
                                              'ipv6',
                                              vars.D1D2P1,
                                              config='no')

    bgp_obj.cleanup_router_bgp(st.get_dut_names())
    if result == 0:
        st.report_pass("test_case_passed")
    else:
        st.error(
            "BGP unnumbered neighborship failed with the Route-reflector-client configuration failed."
        )
        st.report_fail("test_case_failed")
Ejemplo n.º 11
0
def config_bgp_topology(config='yes'):
    st.banner(
        "{}Config BGP on devices".format('Un' if config != 'yes' else ''))
    if config == 'yes':
        thread_info = list()
        thread_info.append(
            utils.ExecAllFunc(bgpapi.config_bgp_multi_neigh_use_peergroup,
                              vars.D1,
                              local_asn=eh_data.local_asn,
                              peer_grp_name=eh_data.peer_gp_namev4,
                              remote_asn=eh_data.remote_asn,
                              neigh_ip_list=eh_data.ipv4_nbr,
                              family=eh_data.af_ipv4,
                              activate=1))
        thread_info.append(
            utils.ExecAllFunc(bgpapi.config_bgp_multi_neigh_use_peergroup,
                              vars.D2,
                              local_asn=eh_data.remote_asn,
                              peer_grp_name=eh_data.peer_gp_namev4,
                              remote_asn=eh_data.local_asn,
                              neigh_ip_list=eh_data.ipv4_addr,
                              family=eh_data.af_ipv4,
                              activate=1))
        thread_call(thread_info)

        thread_info = list()
        thread_info.append(
            utils.ExecAllFunc(bgpapi.config_bgp_multi_neigh_use_peergroup,
                              vars.D1,
                              local_asn=eh_data.local_asn,
                              peer_grp_name=eh_data.peer_gp_namev6,
                              remote_asn=eh_data.remote_asn,
                              neigh_ip_list=eh_data.ipv6_nbr,
                              family=eh_data.af_ipv6,
                              activate=1,
                              routemap=eh_data.route_map_name,
                              routemap_dir='in'))
        thread_info.append(
            utils.ExecAllFunc(bgpapi.config_bgp_multi_neigh_use_peergroup,
                              vars.D2,
                              local_asn=eh_data.remote_asn,
                              peer_grp_name=eh_data.peer_gp_namev6,
                              remote_asn=eh_data.local_asn,
                              neigh_ip_list=eh_data.ipv6_addr,
                              family=eh_data.af_ipv6,
                              activate=1,
                              routemap=eh_data.route_map_name,
                              routemap_dir='in'))
        thread_call(thread_info)

        if config == 'yes':
            if not utils.poll_wait(bgpapi.verify_bgp_summary,
                                   30,
                                   vars.D1,
                                   family='ipv4',
                                   neighbor=[eh_data.ipv4_nbr],
                                   state='Established'):
                st.error(
                    "BGP Neighbor failed to Establish between DUT and Partner")
                st.report_fail('operation_failed')
            if not utils.poll_wait(bgpapi.verify_bgp_summary,
                                   30,
                                   vars.D1,
                                   family='ipv6',
                                   neighbor=[eh_data.ipv6_nbr],
                                   state='Established'):
                st.error(
                    "BGP Neighbor failed to Establish between DUT and Partner")
                st.report_fail('operation_failed')
    else:
        bgpapi.cleanup_router_bgp(st.get_dut_names())
Ejemplo n.º 12
0
def l3_performance_enhancements_module_hooks(request):
	global vars
	global tg_handler
	global tg
	global dut1
	global dut2
	global dut3
	global dut4
	global dut1_to_tg_port_1
	global dut1_to_dut2_port_1
	global dut2_to_dut1_port_1
	global dut1_to_dut3_port_1
	global dut3_to_dut1_port_1
	global dut2_to_dut4_port_1
	global dut4_to_dut2_port_1
	global dut3_to_dut4_port_1
	global dut4_to_dut3_port_1
	global dut4_to_tg_port_1
	global hwsku_under_test1
	global hwsku_under_test2
	global hwsku_under_test3
	global hwsku_under_test4
	global def_v4_route_count_d1
	global def_v4_route_count_d4
	global def_v6_route_count_d1
	global def_v6_route_count_d4
	# Min topology verification
	st.log("Ensuring minimum topology")
	vars = st.ensure_min_topology("D1D2:1", "D1D3:1", "D2D4:1", "D3D4:1", "D1T1:1", "D4T1:1")

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

	# Test setup details
	dut1 = vars.D1
	dut2 = vars.D2
	dut3 = vars.D3
	dut4 = vars.D4
	dut1_to_tg_port_1 = vars.D1T1P1
	dut1_to_dut2_port_1 = vars.D1D2P1
	dut2_to_dut1_port_1 = vars.D2D1P1
	dut1_to_dut3_port_1 = vars.D1D3P1
	dut3_to_dut1_port_1 = vars.D3D1P1
	dut2_to_dut4_port_1 = vars.D2D4P1
	dut4_to_dut2_port_1 = vars.D4D2P1
	dut3_to_dut4_port_1 = vars.D3D4P1
	dut4_to_dut3_port_1 = vars.D4D3P1
	dut4_to_tg_port_1 = vars.D4T1P1
	hwsku_under_test1 = basic_obj.get_hwsku(dut1)
	hwsku_under_test2 = basic_obj.get_hwsku(dut2)
	hwsku_under_test3 = basic_obj.get_hwsku(dut3)
	hwsku_under_test4 = basic_obj.get_hwsku(dut4)

	# Module Configuration
	st.log("L3 Performance Enhancements Module Configuration.")
	# Configuring v4/v6 routing interfaces on the DUT.
	st.log("Configuring IPv4 routing interfaces.")
	ipfeature.config_ip_addr_interface(dut1, dut1_to_tg_port_1, data.dut1_to_tg_port_1_ip, data.ip_prefixlen, family="ipv4")
	ipfeature.config_ip_addr_interface(dut1, dut1_to_dut2_port_1, data.dut1_to_dut2_port_1_ip, data.ip_prefixlen, family="ipv4")
	ipfeature.config_ip_addr_interface(dut1, dut1_to_dut3_port_1, data.dut1_to_dut3_port_1_ip, data.ip_prefixlen, family="ipv4")
	ipfeature.config_ip_addr_interface(dut2, dut2_to_dut1_port_1, data.dut2_to_dut1_port_1_ip, data.ip_prefixlen, family="ipv4")
	ipfeature.config_ip_addr_interface(dut2, dut2_to_dut4_port_1, data.dut2_to_dut4_port_1_ip, data.ip_prefixlen, family="ipv4")
	ipfeature.config_ip_addr_interface(dut3, dut3_to_dut1_port_1, data.dut3_to_dut1_port_1_ip, data.ip_prefixlen, family="ipv4")
	ipfeature.config_ip_addr_interface(dut3, dut3_to_dut4_port_1, data.dut3_to_dut4_port_1_ip, data.ip_prefixlen, family="ipv4")
	ipfeature.config_ip_addr_interface(dut4, dut4_to_dut2_port_1, data.dut4_to_dut2_port_1_ip, data.ip_prefixlen, family="ipv4")
	ipfeature.config_ip_addr_interface(dut4, dut4_to_dut3_port_1, data.dut4_to_dut3_port_1_ip, data.ip_prefixlen, family="ipv4")
	ipfeature.config_ip_addr_interface(dut4, dut4_to_tg_port_1, data.dut4_to_tg_port_1_ip, data.ip_prefixlen, family="ipv4")

	st.log("Configuring IPv6 routing interfaces.")
	ipfeature.config_ipv6(dut1, action='enable')
	ipfeature.config_ip_addr_interface(dut1, dut1_to_tg_port_1, data.dut1_to_tg_port_1_ip6, data.ipv6_prefixlen, family="ipv6")
	ipfeature.config_ip_addr_interface(dut1, dut1_to_dut2_port_1, data.dut1_to_dut2_port_1_ip6, data.ipv6_prefixlen, family="ipv6")
	ipfeature.config_ip_addr_interface(dut1, dut1_to_dut3_port_1, data.dut1_to_dut3_port_1_ip6, data.ipv6_prefixlen, family="ipv6")
	ipfeature.config_ipv6(dut2, action='enable')
	ipfeature.config_ip_addr_interface(dut2, dut2_to_dut1_port_1, data.dut2_to_dut1_port_1_ip6, data.ipv6_prefixlen, family="ipv6")
	ipfeature.config_ip_addr_interface(dut2, dut2_to_dut4_port_1, data.dut2_to_dut4_port_1_ip6, data.ipv6_prefixlen, family="ipv6")
	ipfeature.config_ipv6(dut3, action='enable')
	ipfeature.config_ip_addr_interface(dut3, dut3_to_dut1_port_1, data.dut3_to_dut1_port_1_ip6, data.ipv6_prefixlen, family="ipv6")
	ipfeature.config_ip_addr_interface(dut3, dut3_to_dut4_port_1, data.dut3_to_dut4_port_1_ip6, data.ipv6_prefixlen, family="ipv6")
	ipfeature.config_ipv6(dut4, action='enable')
	ipfeature.config_ip_addr_interface(dut4, dut4_to_dut2_port_1, data.dut4_to_dut2_port_1_ip6, data.ipv6_prefixlen, family="ipv6")
	ipfeature.config_ip_addr_interface(dut4, dut4_to_dut3_port_1, data.dut4_to_dut3_port_1_ip6, data.ipv6_prefixlen, family="ipv6")
	ipfeature.config_ip_addr_interface(dut4, dut4_to_tg_port_1, data.dut4_to_tg_port_1_ip6, data.ipv6_prefixlen, family="ipv6")

	# Configuring BGP router and v4/v6 neighbors on the DUT.
	st.log("Configuring BGP routers.")
	bgpfeature.create_bgp_router(dut1, data.as_num_1, '')
	bgpfeature.create_bgp_router(dut2, data.as_num_2, '')
	bgpfeature.create_bgp_router(dut3, data.as_num_3, '')
	bgpfeature.create_bgp_router(dut4, data.as_num_4, '')

	st.log("Configuring BGP IPv4 neighbors.")
	bgpfeature.create_bgp_neighbor(dut1, data.as_num_1, data.tg_to_dut1_port_1_ip, data.remote_as_num1)
	bgpfeature.create_bgp_neighbor(dut1, data.as_num_1, data.dut2_to_dut1_port_1_ip, data.as_num_2)
	bgpfeature.create_bgp_neighbor(dut1, data.as_num_1, data.dut3_to_dut1_port_1_ip, data.as_num_3)
	bgpfeature.create_bgp_neighbor(dut2, data.as_num_2, data.dut1_to_dut2_port_1_ip, data.as_num_1)
	bgpfeature.create_bgp_neighbor(dut2, data.as_num_2, data.dut4_to_dut2_port_1_ip, data.as_num_4)
	bgpfeature.create_bgp_neighbor(dut3, data.as_num_3, data.dut1_to_dut3_port_1_ip, data.as_num_1)
	bgpfeature.create_bgp_neighbor(dut3, data.as_num_3, data.dut4_to_dut3_port_1_ip, data.as_num_4)
	bgpfeature.create_bgp_neighbor(dut4, data.as_num_4, data.dut2_to_dut4_port_1_ip, data.as_num_2)
	bgpfeature.create_bgp_neighbor(dut4, data.as_num_4, data.dut3_to_dut4_port_1_ip, data.as_num_3)

	st.log("Configuring BGP IPv6 neighbors.")
	bgpfeature.create_bgp_neighbor(dut1, data.as_num_1, data.tg_to_dut1_port_1_ip6, data.remote_as_num1, family="ipv6")
	bgpfeature.create_bgp_neighbor(dut1, data.as_num_1, data.dut2_to_dut1_port_1_ip6, data.as_num_2, family="ipv6")
	bgpfeature.create_bgp_neighbor(dut1, data.as_num_1, data.dut3_to_dut1_port_1_ip6, data.as_num_3, family="ipv6")
	bgpfeature.create_bgp_neighbor(dut2, data.as_num_2, data.dut1_to_dut2_port_1_ip6, data.as_num_1, family="ipv6")
	bgpfeature.create_bgp_neighbor(dut2, data.as_num_2, data.dut4_to_dut2_port_1_ip6, data.as_num_4, family="ipv6")
	bgpfeature.create_bgp_neighbor(dut3, data.as_num_3, data.dut1_to_dut3_port_1_ip6, data.as_num_1, family="ipv6")
	bgpfeature.create_bgp_neighbor(dut3, data.as_num_3, data.dut4_to_dut3_port_1_ip6, data.as_num_4, family="ipv6")
	bgpfeature.create_bgp_neighbor(dut4, data.as_num_4, data.dut2_to_dut4_port_1_ip6, data.as_num_2, family="ipv6")
	bgpfeature.create_bgp_neighbor(dut4, data.as_num_4, data.dut3_to_dut4_port_1_ip6, data.as_num_3, family="ipv6")

	# st.log("Configuring BGP as-path multipath-relax.")
	bgpfeature.create_bgp_best_path(dut1, data.as_num_1, "as-path multipath-relax")
	bgpfeature.create_bgp_best_path(dut2, data.as_num_2, "as-path multipath-relax")
	bgpfeature.create_bgp_best_path(dut3, data.as_num_3, "as-path multipath-relax")
	bgpfeature.create_bgp_best_path(dut4, data.as_num_4, "as-path multipath-relax")

	# Get the default route count from DUT
	def_v4_route_count_d1 = asicapi.bcmcmd_route_count_hardware(dut1)
	def_v4_route_count_d4 = asicapi.bcmcmd_route_count_hardware(dut4)
	def_v6_route_count_d1 = asicapi.bcmcmd_ipv6_route_count_hardware(dut1)
	def_v6_route_count_d4 = asicapi.bcmcmd_ipv6_route_count_hardware(dut4)

	# Verifying the BGP neighborship
	st.wait(20)
	st.log("Verifying the BGP IPv4 neighborships.")
	if not poll_wait(bgpfeature.verify_bgp_summary, 120, dut1, neighbor=data.dut2_to_dut1_port_1_ip,state='Established'):
		st.report_fail("bgp_ip_peer_establish_fail", data.dut2_to_dut1_port_1_ip)
	if not poll_wait(bgpfeature.verify_bgp_summary, 120, dut1, neighbor=data.dut3_to_dut1_port_1_ip,state='Established'):
		st.report_fail("bgp_ip_peer_establish_fail", data.dut3_to_dut1_port_1_ip)
	if not poll_wait(bgpfeature.verify_bgp_summary, 120, dut2, neighbor=data.dut1_to_dut2_port_1_ip,state='Established'):
		st.report_fail("bgp_ip_peer_establish_fail", data.dut1_to_dut2_port_1_ip)
	if not poll_wait(bgpfeature.verify_bgp_summary, 120, dut2, neighbor=data.dut4_to_dut2_port_1_ip,state='Established'):
		st.report_fail("bgp_ip_peer_establish_fail", data.dut4_to_dut2_port_1_ip)
	# if not bgpfeature.verify_bgp_summary(dut1, neighbor=data.dut2_to_dut1_port_1_ip, state='Established'):
	# 	st.report_fail("bgp_ip_peer_establish_fail", data.dut2_to_dut1_port_1_ip)
	# if not bgpfeature.verify_bgp_summary(dut1, neighbor=data.dut3_to_dut1_port_1_ip, state='Established'):
	# 	st.report_fail("bgp_ip_peer_establish_fail", data.dut3_to_dut1_port_1_ip)
	# if not bgpfeature.verify_bgp_summary(dut2, neighbor=data.dut1_to_dut2_port_1_ip, state='Established'):
	# 	st.report_fail("bgp_ip_peer_establish_fail", data.dut1_to_dut2_port_1_ip)
	# if not bgpfeature.verify_bgp_summary(dut2, neighbor=data.dut4_to_dut2_port_1_ip, state='Established'):
	# 	st.report_fail("bgp_ip_peer_establish_fail", data.dut4_to_dut2_port_1_ip)
	if not bgpfeature.verify_bgp_summary(dut3, neighbor=data.dut1_to_dut3_port_1_ip, state='Established'):
		st.report_fail("bgp_ip_peer_establish_fail", data.dut1_to_dut3_port_1_ip)
	if not bgpfeature.verify_bgp_summary(dut3, neighbor=data.dut4_to_dut3_port_1_ip, state='Established'):
		st.report_fail("bgp_ip_peer_establish_fail", data.dut4_to_dut3_port_1_ip)
	if not bgpfeature.verify_bgp_summary(dut4, neighbor=data.dut2_to_dut4_port_1_ip, state='Established'):
		st.report_fail("bgp_ip_peer_establish_fail", data.dut2_to_dut4_port_1_ip)
	if not bgpfeature.verify_bgp_summary(dut4, neighbor=data.dut3_to_dut4_port_1_ip, state='Established'):
		st.report_fail("bgp_ip_peer_establish_fail", data.dut3_to_dut4_port_1_ip)

	st.log("Verifying the BGP IPv6 neighborships.")
	if not bgpfeature.verify_bgp_summary(dut1, family='ipv6', neighbor=data.dut2_to_dut1_port_1_ip6, state='Established'):
		st.report_fail("bgp_ip_peer_establish_fail", data.dut2_to_dut1_port_1_ip6)
	if not bgpfeature.verify_bgp_summary(dut1, family='ipv6', neighbor=data.dut3_to_dut1_port_1_ip6, state='Established'):
		st.report_fail("bgp_ip_peer_establish_fail", data.dut3_to_dut1_port_1_ip6)
	if not bgpfeature.verify_bgp_summary(dut2, family='ipv6', neighbor=data.dut1_to_dut2_port_1_ip6, state='Established'):
		st.report_fail("bgp_ip_peer_establish_fail", data.dut1_to_dut2_port_1_ip6)
	if not bgpfeature.verify_bgp_summary(dut2, family='ipv6', neighbor=data.dut4_to_dut2_port_1_ip6, state='Established'):
		st.report_fail("bgp_ip_peer_establish_fail", data.dut4_to_dut2_port_1_ip6)
	if not bgpfeature.verify_bgp_summary(dut3, family='ipv6', neighbor=data.dut1_to_dut3_port_1_ip6, state='Established'):
		st.report_fail("bgp_ip_peer_establish_fail", data.dut1_to_dut3_port_1_ip6)
	if not bgpfeature.verify_bgp_summary(dut3, family='ipv6', neighbor=data.dut4_to_dut3_port_1_ip6, state='Established'):
		st.report_fail("bgp_ip_peer_establish_fail", data.dut4_to_dut3_port_1_ip6)
	if not bgpfeature.verify_bgp_summary(dut4, family='ipv6', neighbor=data.dut2_to_dut4_port_1_ip6, state='Established'):
		st.report_fail("bgp_ip_peer_establish_fail", data.dut2_to_dut4_port_1_ip6)
	if not bgpfeature.verify_bgp_summary(dut4, family='ipv6', neighbor=data.dut3_to_dut4_port_1_ip6, state='Established'):
		st.report_fail("bgp_ip_peer_establish_fail", data.dut3_to_dut4_port_1_ip6)

	yield
	# Module Cleanup
	st.log("L3 Performance Enhancements Module Cleanup.")
	st.log("Unconfiguring IPv4 routing interfaces.")
	ipfeature.delete_ip_interface(dut1, dut1_to_tg_port_1, data.dut1_to_tg_port_1_ip, data.ip_prefixlen, family="ipv4")
	ipfeature.delete_ip_interface(dut1, dut1_to_dut2_port_1, data.dut1_to_dut2_port_1_ip, data.ip_prefixlen, family="ipv4")
	ipfeature.delete_ip_interface(dut1, dut1_to_dut3_port_1, data.dut1_to_dut3_port_1_ip, data.ip_prefixlen, family="ipv4")
	ipfeature.delete_ip_interface(dut2, dut2_to_dut1_port_1, data.dut2_to_dut1_port_1_ip, data.ip_prefixlen, family="ipv4")
	ipfeature.delete_ip_interface(dut2, dut2_to_dut4_port_1, data.dut2_to_dut4_port_1_ip, data.ip_prefixlen, family="ipv4")
	ipfeature.delete_ip_interface(dut3, dut3_to_dut1_port_1, data.dut3_to_dut1_port_1_ip, data.ip_prefixlen, family="ipv4")
	ipfeature.delete_ip_interface(dut3, dut3_to_dut4_port_1, data.dut3_to_dut4_port_1_ip, data.ip_prefixlen, family="ipv4")
	ipfeature.delete_ip_interface(dut4, dut4_to_dut2_port_1, data.dut4_to_dut2_port_1_ip, data.ip_prefixlen, family="ipv4")
	ipfeature.delete_ip_interface(dut4, dut4_to_dut3_port_1, data.dut4_to_dut3_port_1_ip, data.ip_prefixlen, family="ipv4")
	ipfeature.delete_ip_interface(dut4, dut4_to_tg_port_1, data.dut4_to_tg_port_1_ip, data.ip_prefixlen, family="ipv4")

	st.log("Unconfiguring IPv6 routing interfaces.")
	ipfeature.delete_ip_interface(dut1, dut1_to_tg_port_1, data.dut1_to_tg_port_1_ip6, data.ipv6_prefixlen, family="ipv6")
	ipfeature.delete_ip_interface(dut1, dut1_to_dut2_port_1, data.dut1_to_dut2_port_1_ip6, data.ipv6_prefixlen, family="ipv6")
	ipfeature.delete_ip_interface(dut1, dut1_to_dut3_port_1, data.dut1_to_dut3_port_1_ip6, data.ipv6_prefixlen, family="ipv6")
	ipfeature.delete_ip_interface(dut2, dut2_to_dut1_port_1, data.dut2_to_dut1_port_1_ip6, data.ipv6_prefixlen, family="ipv6")
	ipfeature.delete_ip_interface(dut2, dut2_to_dut4_port_1, data.dut2_to_dut4_port_1_ip6, data.ipv6_prefixlen, family="ipv6")
	ipfeature.delete_ip_interface(dut3, dut3_to_dut1_port_1, data.dut3_to_dut1_port_1_ip6, data.ipv6_prefixlen, family="ipv6")
	ipfeature.delete_ip_interface(dut3, dut3_to_dut4_port_1, data.dut3_to_dut4_port_1_ip6, data.ipv6_prefixlen, family="ipv6")
	ipfeature.delete_ip_interface(dut4, dut4_to_dut2_port_1, data.dut4_to_dut2_port_1_ip6, data.ipv6_prefixlen, family="ipv6")
	ipfeature.delete_ip_interface(dut4, dut4_to_dut3_port_1, data.dut4_to_dut3_port_1_ip6, data.ipv6_prefixlen, family="ipv6")
	ipfeature.delete_ip_interface(dut4, dut4_to_tg_port_1, data.dut4_to_tg_port_1_ip6, data.ipv6_prefixlen, family="ipv6")

	st.log("Unconfiguring BGP IPv4 neighbors.")
	bgpfeature.delete_bgp_neighbor(dut1, data.as_num_1, data.tg_to_dut1_port_1_ip, data.remote_as_num1)
	bgpfeature.delete_bgp_neighbor(dut1, data.as_num_1, data.dut2_to_dut1_port_1_ip, data.as_num_2)
	bgpfeature.delete_bgp_neighbor(dut1, data.as_num_1, data.dut3_to_dut1_port_1_ip, data.as_num_3)
	bgpfeature.delete_bgp_neighbor(dut2, data.as_num_2, data.dut1_to_dut2_port_1_ip, data.as_num_1)
	bgpfeature.delete_bgp_neighbor(dut2, data.as_num_2, data.dut4_to_dut2_port_1_ip, data.as_num_4)
	bgpfeature.delete_bgp_neighbor(dut3, data.as_num_3, data.dut1_to_dut3_port_1_ip, data.as_num_1)
	bgpfeature.delete_bgp_neighbor(dut3, data.as_num_3, data.dut4_to_dut3_port_1_ip, data.as_num_4)
	bgpfeature.delete_bgp_neighbor(dut4, data.as_num_4, data.dut2_to_dut4_port_1_ip, data.as_num_2)
	bgpfeature.delete_bgp_neighbor(dut4, data.as_num_4, data.dut3_to_dut4_port_1_ip, data.as_num_3)

	st.log("Unconfiguring BGP IPv6 neighbors.")
	bgpfeature.delete_bgp_neighbor(dut1, data.as_num_1, data.tg_to_dut1_port_1_ip6, data.remote_as_num1)
	bgpfeature.delete_bgp_neighbor(dut1, data.as_num_1, data.dut2_to_dut1_port_1_ip6, data.as_num_2)
	bgpfeature.delete_bgp_neighbor(dut1, data.as_num_1, data.dut3_to_dut1_port_1_ip6, data.as_num_3)
	bgpfeature.delete_bgp_neighbor(dut2, data.as_num_2, data.dut1_to_dut2_port_1_ip6, data.as_num_1)
	bgpfeature.delete_bgp_neighbor(dut2, data.as_num_2, data.dut4_to_dut2_port_1_ip6, data.as_num_4)
	bgpfeature.delete_bgp_neighbor(dut3, data.as_num_3, data.dut1_to_dut3_port_1_ip6, data.as_num_1)
	bgpfeature.delete_bgp_neighbor(dut3, data.as_num_3, data.dut4_to_dut3_port_1_ip6, data.as_num_4)
	bgpfeature.delete_bgp_neighbor(dut4, data.as_num_4, data.dut2_to_dut4_port_1_ip6, data.as_num_2)
	bgpfeature.delete_bgp_neighbor(dut4, data.as_num_4, data.dut3_to_dut4_port_1_ip6, data.as_num_3)

	st.log("Unconfiguring BGP routers.")
	bgpfeature.cleanup_router_bgp(dut1)
	bgpfeature.cleanup_router_bgp(dut2)
	bgpfeature.cleanup_router_bgp(dut3)
	bgpfeature.cleanup_router_bgp(dut4)
Ejemplo n.º 13
0
def l3tc_vrfipv4v6_confed_bgp_config(config='yes',
                                     vrf_type='all',
                                     config_type='all'):
    """

    :param config:
    :param vrf_type:
    :param config_type:
    :return:
    """
    st.banner("{}Configuring BGP with 4-node confederation topology.".format(
        'Un' if config != 'yes' else ''))
    #Confedration topo:
    #DUT1 in sub-AS1 (AS1 = 24)
    #DUT2, DUT3, DUT 4 in sub-AS2 (AS2 = 35)
    #IBGP AS = 100
    config = 'add' if config == 'yes' else 'remove'

    leftconfed_as = 24
    rightconfed_as = 35
    iBGP_as = 100

    topo['D1_as'] = 24
    topo['D2_as'] = 35
    topo['D3_as'] = 35
    topo['D4_as'] = 35

    result = True

    if config == 'add':
        if config_type == 'ipv4' or config_type == 'all':
            #Confederation config for DUT1
            dut = topo['dut_list'][0]
            neighbor = topo['D1D2P1_neigh_ipv4']
            bgpapi.config_bgp(dut,
                              local_as=leftconfed_as,
                              config='yes',
                              conf_peers=rightconfed_as,
                              conf_identf=iBGP_as,
                              remote_as=rightconfed_as,
                              config_type_list=["neighbor"],
                              neighbor=neighbor)

            #Confederation config for DUT2
            dut = topo['dut_list'][1]
            neighbor = topo['D2D3P1_neigh_ipv4']
            bgpapi.config_bgp(dut,
                              local_as=rightconfed_as,
                              config='yes',
                              conf_peers=leftconfed_as,
                              conf_identf=iBGP_as,
                              remote_as=rightconfed_as,
                              config_type_list=["neighbor"],
                              neighbor=neighbor)
            bgpapi.create_bgp_neighbor(dut, rightconfed_as,
                                       topo['D2D1P1_neigh_ipv4'],
                                       leftconfed_as)

            #Confederation config for DUT3
            dut = topo['dut_list'][2]
            neighbor = topo['D3D4P1_neigh_ipv4']
            bgpapi.config_bgp(dut,
                              local_as=rightconfed_as,
                              config='yes',
                              conf_peers=leftconfed_as,
                              conf_identf=iBGP_as,
                              remote_as=rightconfed_as,
                              config_type_list=["neighbor"],
                              neighbor=neighbor)
            bgpapi.create_bgp_neighbor(dut, rightconfed_as,
                                       topo['D3D2P1_neigh_ipv4'],
                                       rightconfed_as)

            #Confederation config for DUT4
            dut = topo['dut_list'][3]
            neighbor = topo['D4D3P1_neigh_ipv4']
            bgpapi.config_bgp(dut,
                              local_as=rightconfed_as,
                              config='yes',
                              conf_peers=leftconfed_as,
                              conf_identf=iBGP_as,
                              remote_as=rightconfed_as,
                              config_type_list=["neighbor"],
                              neighbor=neighbor)

        if config_type == 'ipv6' or config_type == 'all':
            #Confederation config for DUT1
            dut = topo['dut_list'][0]
            neighbor = topo['D1D2P1_neigh_ipv6']
            bgpapi.config_bgp(dut,
                              local_as=leftconfed_as,
                              config='yes',
                              addr_family='ipv6',
                              conf_peers=rightconfed_as,
                              conf_identf=iBGP_as,
                              remote_as=rightconfed_as,
                              config_type_list=["neighbor", "activate"],
                              neighbor=neighbor)

            #Confederation config for DUT2
            dut = topo['dut_list'][1]
            neighbor = topo['D2D3P1_neigh_ipv6']
            bgpapi.config_bgp(dut,
                              local_as=rightconfed_as,
                              config='yes',
                              addr_family='ipv6',
                              conf_peers=leftconfed_as,
                              conf_identf=iBGP_as,
                              remote_as=rightconfed_as,
                              config_type_list=["neighbor", "activate"],
                              neighbor=neighbor)
            bgpapi.create_bgp_neighbor(dut,
                                       rightconfed_as,
                                       topo['D2D1P1_neigh_ipv6'],
                                       leftconfed_as,
                                       family="ipv6")

            #Confederation config for DUT3
            dut = topo['dut_list'][2]
            neighbor = topo['D3D4P1_neigh_ipv6']
            bgpapi.config_bgp(dut,
                              local_as=rightconfed_as,
                              config='yes',
                              addr_family='ipv6',
                              conf_peers=leftconfed_as,
                              conf_identf=iBGP_as,
                              remote_as=rightconfed_as,
                              config_type_list=["neighbor", "activate"],
                              neighbor=neighbor)
            bgpapi.create_bgp_neighbor(dut,
                                       rightconfed_as,
                                       topo['D3D2P1_neigh_ipv6'],
                                       rightconfed_as,
                                       family="ipv6")

            #Confederation config for DUT4
            dut = topo['dut_list'][3]
            neighbor = topo['D4D3P1_neigh_ipv6']
            bgpapi.config_bgp(dut,
                              local_as=rightconfed_as,
                              config='yes',
                              addr_family='ipv6',
                              conf_peers=leftconfed_as,
                              conf_identf=iBGP_as,
                              remote_as=rightconfed_as,
                              config_type_list=["neighbor", "activate"],
                              neighbor=neighbor)

    else:
        bgpapi.cleanup_router_bgp(topo['dut_list'])

    return result
Ejemplo n.º 14
0
def test_ft_bgp_ebgp_multihop_4byteASN():
    """

    Verify the functioning of ebgp multihop command with 4 byte ASN
    """
    # On DUT1 and DUT3, create BGP with 4byte ASN
    dut1_as = 6500001
    dut1 = topo['dut_list'][0]
    dut3_as = 6500002
    dut3 = topo['dut_list'][2]
    result = 0
    wait_timer = 150

    st.banner("Verify the ebgp multihop functionality with 4 byte AS Number")

    # Configure bgp on DUT1 and configure DUT3 as neighbor with ebgp-multihop ttl set to 5
    st.log(
        "Configure eBGP on DUT1 with Neighbor as DUT3 with multihop set to maximum hops of 5"
    )
    bgpapi.config_bgp(dut1,
                      local_as=dut1_as,
                      neighbor=topo['D3D2P1_ipv4'],
                      remote_as=dut3_as,
                      config_type_list=["neighbor", "ebgp_mhop"],
                      ebgp_mhop='5')

    # Add static route towards neighbor DUT3
    st.log("Add static route towards DUT3")
    ipapi.create_static_route(dut1, topo['D1D2P1_neigh_ipv4'],
                              "{}/24".format(topo['D3D2P1_ipv4']))

    # Configure bgp on DUT3 and configure DUT1 as neighbor with ebgp-multihop ttl set to 5
    st.log(
        "Configure eBGP on DUT3 with DUT1 as Neighbor with multihop set to maximum hops of 5"
    )
    bgpapi.config_bgp(dut3,
                      local_as=dut3_as,
                      neighbor=topo['D1D2P1_ipv4'],
                      remote_as=dut1_as,
                      config_type_list=["neighbor", "ebgp_mhop"],
                      ebgp_mhop='5')

    # Add static route towards neighbor DUT1
    st.log("Add static route towards DUT1")
    ipapi.create_static_route(dut3, topo['D3D2P1_neigh_ipv4'],
                              "{}/24".format(topo['D1D2P1_ipv4']))

    st.log("Verify BGP neighborship on DUT1")
    #result = bgpapi.verify_bgp_summary(dut1, family='ipv4', neighbor=topo['D3D2P1_ipv4'], state='Established')
    if not utils.poll_wait(bgpapi.verify_bgp_summary,
                           wait_timer,
                           dut1,
                           family='ipv4',
                           neighbor=topo['D3D2P1_ipv4'],
                           state='Established'):
        st.log("Failed to form BGP eBGP multihop peering with 4byte ASN")
        result += 1
    if result == 0:
        st.log("Pass: BGP neighborship established between DUT1 and DUT3")
    else:
        st.error(
            "Fail: BGP neighborship not established between DUT1 and DUT3")
        st.banner("Collecting techsupport")
        exec_all(True, [[
            st.generate_tech_support, topo['dut_list'][0],
            "test_ft_bgp_ebgp_multihop_4byteASN"
        ],
                        [
                            st.generate_tech_support, topo['dut_list'][1],
                            "test_ft_bgp_ebgp_multihop_4byteASN"
                        ],
                        [
                            st.generate_tech_support, topo['dut_list'][2],
                            "test_ft_bgp_ebgp_multihop_4byteASN"
                        ]])

    #Clear applied configs
    st.banner("Cleanup for TestFunction")
    bgpapi.cleanup_router_bgp(dut1)
    bgpapi.cleanup_router_bgp(dut3)
    ipapi.delete_static_route(dut1, topo['D1D2P1_neigh_ipv4'],
                              "{}/24".format(topo['D3D2P1_ipv4']))
    ipapi.delete_static_route(dut3, topo['D3D2P1_neigh_ipv4'],
                              "{}/24".format(topo['D1D2P1_ipv4']))

    if result == 0:
        st.report_pass("test_case_passed")
    else:
        st.report_fail("test_case_failed")
Ejemplo n.º 15
0
def l3_performance_enhancements_module_hooks(request):
    global vars, tg_handler, tg, dut, dut_to_tg_port_1, dut_to_tg_port_2, cli_type
    global hwsku_under_test, def_v4_route_count, def_v6_route_count

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

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

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

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

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

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

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

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