Esempio n. 1
0
    def test_ipv6_confed_route_distribution(self):
        st.log(
            "Verify the config of BGP v6 confederation and router advertisement"
        )

        st.log(
            "Advertise a network from DUT1 and check if it's learnt on confed peer DUT3"
        )
        dut1_name = topo['dut_list'][0]
        dut3_name = topo['dut_list'][2]
        network_ipv4 = '131.5.6.0/24'
        network_ipv6 = '2000:1::0/64'

        #Advertise a network to peer

        bgpapi.config_bgp_network_advertise(dut1_name, topo['D1_as'],
                                            network_ipv4)
        bgpapi.config_bgp_network_advertise(dut1_name,
                                            topo['D1_as'],
                                            network_ipv6,
                                            addr_family='ipv6',
                                            config='yes')
        entries = bgpapi.get_ip_bgp_route(dut3_name,
                                          family="ipv4",
                                          network=network_ipv4)
        entries1 = bgpapi.get_ip_bgp_route(dut3_name,
                                           family="ipv6",
                                           network="2000:1::/64")

        bgpapi.config_bgp_network_advertise(dut1_name,
                                            topo['D1_as'],
                                            network_ipv4,
                                            config='no')
        bgpapi.config_bgp_network_advertise(dut1_name,
                                            topo['D1_as'],
                                            network_ipv6,
                                            addr_family='ipv6',
                                            config='no')
        if entries and entries1:
            st.log("Advertised route present on DUT3")
        else:
            st.log("Advertised route not present on DUT3")
            st.report_fail("test_case_failed")

        st.report_pass("test_case_passed")
Esempio n. 2
0
def test_ft_bgp_unnumbered_rmap():
    """
    # ################ Author Details ################
    # Name: Sesha Reddy Koilkonda
    # Email: [email protected]
    # ################################################
    :return:
    """
    utils_obj.banner_log('FtOtSoRtBgpUnFn010,FtOtSoRtBgpUnFn016')
    result = 0
    network_ipv6 = '6002:1::0/64'

    bgp_obj.config_bgp(config='yes',
                       dut=vars.D2,
                       local_as=data.d2_local_as,
                       addr_family='ipv6',
                       neighbor=vars.D2D1P1,
                       weight='35000',
                       config_type_list=["weight"])
    bgp_obj.config_bgp_network_advertise(vars.D1,
                                         data.d1_local_as,
                                         network_ipv6,
                                         addr_family='ipv6',
                                         config='yes',
                                         network_import_check=True)
    st.wait(60)
    n1 = ip_obj.verify_ip_route(vars.D2,
                                family='ipv6',
                                shell='sonic',
                                ip_address='6002:1::/64')
    if (n1 is False):
        st.error("Failed to advertise the ipv6 network to the peer")
        result += 1
    bgp_obj.get_ip_bgp_route(vars.D2, family="ipv6", network="6002:1/64")
    # Add route-map to advertised network
    ip_obj.config_access_list(vars.D1,
                              'Ubgp-access-list1',
                              network_ipv6,
                              'deny',
                              family='ipv6',
                              seq_num="1")
    ip_obj.config_route_map_match_ip_address(vars.D1,
                                             'Ubgp-rmap',
                                             'deny',
                                             '10',
                                             'Ubgp-access-list1',
                                             family='ipv6')
    bgp_obj.advertise_bgp_network(vars.D1,
                                  data.d1_local_as,
                                  network_ipv6,
                                  'Ubgp-rmap',
                                  family='ipv6')
    # verify route-map to advertised network
    n1 = ip_obj.verify_ip_route(vars.D2,
                                family='ipv6',
                                shell='sonic',
                                ip_address='6002:1::/64')
    if (n1 is True):
        st.error(
            "Advertised network is not filtered by the configured route map")
        result += 1
    else:
        st.log("As expected, advertised network is filtered by the route map.")
    # Veirfy the BGP unnumbered neighbourship post r-map config
    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 route map configuration."
        )
        result += 1
    # Unconfig the r-map and verify the BGP neighbourship
    ip_obj.config_route_map_mode(vars.D1,
                                 'Ubgp-rmap',
                                 'deny',
                                 '10',
                                 config='no')
    ip_obj.config_access_list(vars.D1,
                              'Ubgp-access-list1',
                              network_ipv6,
                              'deny',
                              config='no',
                              family='ipv6',
                              seq_num="1")
    bgp_obj.config_bgp(config='no',
                       dut=vars.D2,
                       local_as=data.d2_local_as,
                       addr_family='ipv6',
                       neighbor=vars.D2D1P1,
                       weight='35000',
                       config_type_list=["weight"])
    bgp_obj.config_bgp_network_advertise(vars.D1,
                                         data.d1_local_as,
                                         network_ipv6,
                                         addr_family='ipv6',
                                         config='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.error(
            "Failed to form BGP unnumbered peering using IPv6 link local, after route map un-configuration."
        )
        result += 1
    if result == 0:
        st.report_pass("test_case_passed")
    else:
        st.error(
            "BGP unnumbered neighborship failed with the route map configuration."
        )
        st.report_fail("test_case_failed")
Esempio n. 3
0
    def test_ipv6_confed_with_rr(self):
        st.log(
            "Verify the behavior of route-reflector within a confederation of BGPv6 peers"
        )
        st.log(
            "Consider the right confed iBGP_as and check RR functionality between the 3 iBGP routers"
        )

        network_ipv4 = '131.6.6.0/24'
        network_ipv6 = '3000:1::0/64'
        #IBGP as is one of D2/D3/D4 asn
        iBGP_as = topo['D2_as']

        bgpapi.config_bgp_network_advertise(topo['dut_list'][1], iBGP_as,
                                            network_ipv4)
        bgpapi.config_bgp_network_advertise(topo['dut_list'][1],
                                            iBGP_as,
                                            network_ipv6,
                                            addr_family='ipv6',
                                            config='yes')

        st.log(
            "Check the network on the 3rd IBGP peer is not learnt becaue RR is not configured"
        )
        entries = bgpapi.get_ip_bgp_route(topo['dut_list'][3],
                                          family="ipv4",
                                          network=network_ipv4)
        entries1 = bgpapi.get_ip_bgp_route(topo['dut_list'][3],
                                           family="ipv6",
                                           network="3000:1::/64")

        if entries and entries1:
            st.log("Routes learnt on the 3rd IBGP peer withour configuring RR")
            bgpapi.config_bgp_network_advertise(topo['dut_list'][1],
                                                iBGP_as,
                                                network_ipv4,
                                                config='no')
            bgpapi.config_bgp_network_advertise(topo['dut_list'][1],
                                                iBGP_as,
                                                network_ipv6,
                                                addr_family='ipv6',
                                                config='no')
            st.report_fail("test_case_failed")

        st.log(" Now configure RR")
        bgpapi.create_bgp_route_reflector_client(topo.dut_list[2], iBGP_as,
                                                 'ipv4',
                                                 topo['D3D4P1_neigh_ipv4'],
                                                 'yes')
        bgpapi.create_bgp_route_reflector_client(topo.dut_list[2], iBGP_as,
                                                 'ipv6',
                                                 topo['D3D4P1_neigh_ipv6'],
                                                 'yes')

        st.wait(10)
        st.log("Now the routes should be learnt on the 3rd IBGP peer")
        entries2 = bgpapi.get_ip_bgp_route(topo['dut_list'][3],
                                           family="ipv4",
                                           network=network_ipv4)
        entries3 = bgpapi.get_ip_bgp_route(topo['dut_list'][3],
                                           family="ipv6",
                                           network="3000:1::/64")

        bgpapi.config_bgp_network_advertise(topo['dut_list'][1],
                                            iBGP_as,
                                            network_ipv4,
                                            config='no')
        bgpapi.config_bgp_network_advertise(topo['dut_list'][1],
                                            iBGP_as,
                                            network_ipv6,
                                            addr_family='ipv6',
                                            config='no')
        bgpapi.create_bgp_route_reflector_client(topo.dut_list[2], iBGP_as,
                                                 'ipv4',
                                                 topo['D3D4P1_neigh_ipv4'],
                                                 'no')
        bgpapi.create_bgp_route_reflector_client(topo.dut_list[2], iBGP_as,
                                                 'ipv6',
                                                 topo['D3D4P1_neigh_ipv6'],
                                                 'no')

        if not entries2 and not entries3:
            st.report_fail("test_case_failed")

        st.report_pass("test_case_passed")
Esempio n. 4
0
    def test_ipv6_confed_with_rr(self):
        st.banner(
            "Verify Route Reflector behavior within a confederation of BGP v6 peers"
        )
        st.banner(
            "Consider the right confederation iBGP AS and check Route Reflector functionality between the 3 iBGP Routers"
        )

        network_ipv4 = '131.6.6.0/24'
        network_ipv6 = '3000:1::0/64'
        # iBGP AS is one of D2/D3/D4 ASN
        iBGP_as = topo['D2_as']

        st.log("Advertise an IPv4 and an IPv6 network from DUT2 through BGP")
        bgpapi.config_bgp_network_advertise(topo['dut_list'][1],
                                            iBGP_as,
                                            network_ipv4,
                                            network_import_check=True)
        bgpapi.config_bgp_network_advertise(topo['dut_list'][1],
                                            iBGP_as,
                                            network_ipv6,
                                            addr_family='ipv6',
                                            config='yes',
                                            network_import_check=True)

        st.log(
            "Check the network on the 3rd iBGP peer DUT4 is not learnt because Route Reflector is not configured on peer DUT3"
        )
        entries = bgpapi.get_ip_bgp_route(topo['dut_list'][3],
                                          family="ipv4",
                                          network=network_ipv4)
        entries1 = bgpapi.get_ip_bgp_route(topo['dut_list'][3],
                                           family="ipv6",
                                           network="3000:1::/64")

        if not entries and not entries1:
            st.log(
                "Pass: DUT4 did not learn routes without configuring Route Reflector on peer DUT3"
            )
        else:
            st.error(
                "Fail: DUT4 learned route without configuring Route Reflector on peer DUT3"
            )
            st.banner("Collecting techsupport")
            exec_all(True, [[
                st.generate_tech_support, topo['dut_list'][1],
                "test_ipv6_confed_with_rr"
            ],
                            [
                                st.generate_tech_support, topo['dut_list'][2],
                                "test_ipv6_confed_with_rr"
                            ],
                            [
                                st.generate_tech_support, topo['dut_list'][3],
                                "test_ipv6_confed_with_rr"
                            ]])
            # Clear applied configurations
            st.banner("Cleanup for TestFunction")
            bgpapi.config_bgp_network_advertise(topo['dut_list'][1],
                                                iBGP_as,
                                                network_ipv4,
                                                config='no')
            bgpapi.config_bgp_network_advertise(topo['dut_list'][1],
                                                iBGP_as,
                                                network_ipv6,
                                                addr_family='ipv6',
                                                config='no')
            st.report_fail("test_case_failed")

        st.log("Now configure Route Reflector on DUT3")
        bgpapi.create_bgp_route_reflector_client(topo.dut_list[2], iBGP_as,
                                                 'ipv4',
                                                 topo['D3D4P1_neigh_ipv4'],
                                                 'yes')
        bgpapi.create_bgp_route_reflector_client(topo.dut_list[2], iBGP_as,
                                                 'ipv6',
                                                 topo['D3D4P1_neigh_ipv6'],
                                                 'yes')

        st.wait(10)
        st.log("Now the routes should be learnt on the 3rd IBGP peer DUT4")
        entries2 = bgpapi.get_ip_bgp_route(topo['dut_list'][3],
                                           family="ipv4",
                                           network=network_ipv4)
        entries3 = bgpapi.get_ip_bgp_route(topo['dut_list'][3],
                                           family="ipv6",
                                           network="3000:1::/64")
        if entries2 and entries3:
            st.log("Pass: DUT4 learned the routes advertised by peer DUT2")
        else:
            st.error(
                "Fail: DUT4 did not learn the routes advertised by peer DUT2")
            st.banner("Collecting techsupport")
            exec_all(True, [[
                st.generate_tech_support, topo['dut_list'][1],
                "test_ipv6_confed_with_rr"
            ],
                            [
                                st.generate_tech_support, topo['dut_list'][2],
                                "test_ipv6_confed_with_rr"
                            ],
                            [
                                st.generate_tech_support, topo['dut_list'][3],
                                "test_ipv6_confed_with_rr"
                            ]])

        # Clear applied configurations
        st.banner("Cleanup for TestFunction")
        bgpapi.config_bgp_network_advertise(topo['dut_list'][1],
                                            iBGP_as,
                                            network_ipv4,
                                            config='no')
        bgpapi.config_bgp_network_advertise(topo['dut_list'][1],
                                            iBGP_as,
                                            network_ipv6,
                                            addr_family='ipv6',
                                            config='no')
        bgpapi.create_bgp_route_reflector_client(topo.dut_list[2], iBGP_as,
                                                 'ipv4',
                                                 topo['D3D4P1_neigh_ipv4'],
                                                 'no')
        bgpapi.create_bgp_route_reflector_client(topo.dut_list[2], iBGP_as,
                                                 'ipv6',
                                                 topo['D3D4P1_neigh_ipv6'],
                                                 'no')

        if entries2 and entries3:
            st.report_pass("test_case_passed")
        else:
            st.report_fail("test_case_failed")
Esempio n. 5
0
    def test_ipv6_confed_route_distribution(self):
        st.banner(
            "Verify the config of BGP v6 confederation and router advertisement"
        )

        st.log(
            "Advertise a network from DUT1 and check if it is learnt on confederation peer DUT3"
        )
        dut1_name = topo['dut_list'][0]
        dut3_name = topo['dut_list'][2]
        network_ipv4 = '131.5.6.0/24'
        network_ipv6 = '2000:1::0/64'

        # Advertise a network to peer

        bgpapi.config_bgp_network_advertise(dut1_name,
                                            topo['D1_as'],
                                            network_ipv4,
                                            network_import_check=True)
        bgpapi.config_bgp_network_advertise(dut1_name,
                                            topo['D1_as'],
                                            network_ipv6,
                                            addr_family='ipv6',
                                            config='yes',
                                            network_import_check=True)
        entries = bgpapi.get_ip_bgp_route(dut3_name,
                                          family="ipv4",
                                          network=network_ipv4)
        entries1 = bgpapi.get_ip_bgp_route(dut3_name,
                                           family="ipv6",
                                           network="2000:1::/64")
        if entries and entries1:
            st.log("Pass: Routes advertised by DUT1 found on DUT3")
        else:
            st.error("Fail: Route advertised by DUT1 not found on DUT3")
            st.banner("Collecting techsupport")
            exec_all(True, [[
                st.generate_tech_support, topo['dut_list'][0],
                "test_ipv6_confed_route_distribution"
            ],
                            [
                                st.generate_tech_support, topo['dut_list'][1],
                                "test_ipv6_confed_route_distribution"
                            ],
                            [
                                st.generate_tech_support, topo['dut_list'][2],
                                "test_ipv6_confed_route_distribution"
                            ]])

        # Clear applied configs
        st.banner("Cleanup for TestFunction")
        bgpapi.config_bgp_network_advertise(dut1_name,
                                            topo['D1_as'],
                                            network_ipv4,
                                            config='no')
        bgpapi.config_bgp_network_advertise(dut1_name,
                                            topo['D1_as'],
                                            network_ipv6,
                                            addr_family='ipv6',
                                            config='no')

        if entries and entries1:
            st.report_pass("test_case_passed")
        else:
            st.report_fail("test_case_failed")