diff options
Diffstat (limited to 'tests')
55 files changed, 415 insertions, 374 deletions
diff --git a/tests/topotests/bfd_vrf_topo1/r1/bfdd.conf b/tests/topotests/bfd_vrf_topo1/r1/bfdd.conf index 5e736a7fcc..fd57b2c4d5 100644 --- a/tests/topotests/bfd_vrf_topo1/r1/bfdd.conf +++ b/tests/topotests/bfd_vrf_topo1/r1/bfdd.conf @@ -4,7 +4,7 @@ debug bfd peer debug bfd zebra ! bfd - peer 192.168.0.2 vrf r1-cust1 + peer 192.168.0.2 vrf r1-bfd-cust1 echo-mode no shutdown ! diff --git a/tests/topotests/bfd_vrf_topo1/r1/bgpd.conf b/tests/topotests/bfd_vrf_topo1/r1/bgpd.conf index 5bb45b9863..cf72f30d66 100644 --- a/tests/topotests/bfd_vrf_topo1/r1/bgpd.conf +++ b/tests/topotests/bfd_vrf_topo1/r1/bgpd.conf @@ -1,4 +1,4 @@ -router bgp 101 vrf r1-cust1 +router bgp 101 vrf r1-bfd-cust1 no bgp ebgp-requires-policy no bgp network import-check neighbor 192.168.0.2 remote-as 102 diff --git a/tests/topotests/bfd_vrf_topo1/r1/zebra.conf b/tests/topotests/bfd_vrf_topo1/r1/zebra.conf index fcd1e7db17..62ed36fdb8 100644 --- a/tests/topotests/bfd_vrf_topo1/r1/zebra.conf +++ b/tests/topotests/bfd_vrf_topo1/r1/zebra.conf @@ -1,3 +1,3 @@ -interface r1-eth0 vrf r1-cust1 +interface r1-eth0 vrf r1-bfd-cust1 ip address 192.168.0.1/24 ! diff --git a/tests/topotests/bfd_vrf_topo1/r2/bfdd.conf b/tests/topotests/bfd_vrf_topo1/r2/bfdd.conf index 94f502c7d9..e5539f14e5 100644 --- a/tests/topotests/bfd_vrf_topo1/r2/bfdd.conf +++ b/tests/topotests/bfd_vrf_topo1/r2/bfdd.conf @@ -4,13 +4,13 @@ debug bfd peer debug bfd zebra ! bfd - peer 192.168.0.1 vrf r2-cust1 + peer 192.168.0.1 vrf r2-bfd-cust1 receive-interval 1000 transmit-interval 500 echo-mode no shutdown ! - peer 192.168.1.1 vrf r2-cust1 + peer 192.168.1.1 vrf r2-bfd-cust1 echo-mode no shutdown ! diff --git a/tests/topotests/bfd_vrf_topo1/r2/bgpd.conf b/tests/topotests/bfd_vrf_topo1/r2/bgpd.conf index b2aac74685..132011cf86 100644 --- a/tests/topotests/bfd_vrf_topo1/r2/bgpd.conf +++ b/tests/topotests/bfd_vrf_topo1/r2/bgpd.conf @@ -1,4 +1,4 @@ -router bgp 102 vrf r2-cust1 +router bgp 102 vrf r2-bfd-cust1 no bgp ebgp-requires-policy no bgp network import-check neighbor 192.168.0.1 remote-as 101 diff --git a/tests/topotests/bfd_vrf_topo1/r2/zebra.conf b/tests/topotests/bfd_vrf_topo1/r2/zebra.conf index daffd1912e..1e817b19f6 100644 --- a/tests/topotests/bfd_vrf_topo1/r2/zebra.conf +++ b/tests/topotests/bfd_vrf_topo1/r2/zebra.conf @@ -1,9 +1,9 @@ -interface r2-eth0 vrf r2-cust1 +interface r2-eth0 vrf r2-bfd-cust1 ip address 192.168.0.2/24 ! -interface r2-eth1 vrf r2-cust1 +interface r2-eth1 vrf r2-bfd-cust1 ip address 192.168.1.2/24 ! -interface r2-eth2 vrf r2-cust1 +interface r2-eth2 vrf r2-bfd-cust1 ip address 192.168.2.2/24 ! diff --git a/tests/topotests/bfd_vrf_topo1/r3/bfdd.conf b/tests/topotests/bfd_vrf_topo1/r3/bfdd.conf index 76910ac927..e1f53e1abc 100644 --- a/tests/topotests/bfd_vrf_topo1/r3/bfdd.conf +++ b/tests/topotests/bfd_vrf_topo1/r3/bfdd.conf @@ -4,7 +4,7 @@ debug bfd peer debug bfd zebra ! bfd - peer 192.168.1.2 vrf r3-cust1 + peer 192.168.1.2 vrf r3-bfd-cust1 echo-interval 100 echo-mode no shutdown diff --git a/tests/topotests/bfd_vrf_topo1/r3/bgpd.conf b/tests/topotests/bfd_vrf_topo1/r3/bgpd.conf index 1d7c730395..f764647920 100644 --- a/tests/topotests/bfd_vrf_topo1/r3/bgpd.conf +++ b/tests/topotests/bfd_vrf_topo1/r3/bgpd.conf @@ -1,4 +1,4 @@ -router bgp 103 vrf r3-cust1 +router bgp 103 vrf r3-bfd-cust1 no bgp ebgp-requires-policy no bgp network import-check neighbor 192.168.1.2 remote-as 102 diff --git a/tests/topotests/bfd_vrf_topo1/r3/zebra.conf b/tests/topotests/bfd_vrf_topo1/r3/zebra.conf index f727c2d633..e67345948e 100644 --- a/tests/topotests/bfd_vrf_topo1/r3/zebra.conf +++ b/tests/topotests/bfd_vrf_topo1/r3/zebra.conf @@ -1,3 +1,3 @@ -interface r3-eth0 vrf r3-cust1 +interface r3-eth0 vrf r3-bfd-cust1 ip address 192.168.1.1/24 ! diff --git a/tests/topotests/bfd_vrf_topo1/r4/bfdd.conf b/tests/topotests/bfd_vrf_topo1/r4/bfdd.conf index 63d0da7805..9ef2023b21 100644 --- a/tests/topotests/bfd_vrf_topo1/r4/bfdd.conf +++ b/tests/topotests/bfd_vrf_topo1/r4/bfdd.conf @@ -4,7 +4,7 @@ debug bfd peer debug bfd zebra ! bfd - peer 192.168.2.2 vrf r4-cust1 + peer 192.168.2.2 vrf r4-bfd-cust1 transmit-interval 2000 receive-interval 2000 no shutdown diff --git a/tests/topotests/bfd_vrf_topo1/r4/bgpd.conf b/tests/topotests/bfd_vrf_topo1/r4/bgpd.conf index f34035d460..03353e45e3 100644 --- a/tests/topotests/bfd_vrf_topo1/r4/bgpd.conf +++ b/tests/topotests/bfd_vrf_topo1/r4/bgpd.conf @@ -1,4 +1,4 @@ -router bgp 104 vrf r4-cust1 +router bgp 104 vrf r4-bfd-cust1 no bgp ebgp-requires-policy no bgp network import-check neighbor 192.168.2.2 remote-as 102 diff --git a/tests/topotests/bfd_vrf_topo1/r4/zebra.conf b/tests/topotests/bfd_vrf_topo1/r4/zebra.conf index 69770dd2bf..15d3ec1d90 100644 --- a/tests/topotests/bfd_vrf_topo1/r4/zebra.conf +++ b/tests/topotests/bfd_vrf_topo1/r4/zebra.conf @@ -1,3 +1,3 @@ -interface r4-eth0 vrf r4-cust1 +interface r4-eth0 vrf r4-bfd-cust1 ip address 192.168.2.1/24 ! diff --git a/tests/topotests/bfd_vrf_topo1/test_bfd_vrf_topo1.py b/tests/topotests/bfd_vrf_topo1/test_bfd_vrf_topo1.py index 8a1ffe085d..a342997912 100644 --- a/tests/topotests/bfd_vrf_topo1/test_bfd_vrf_topo1.py +++ b/tests/topotests/bfd_vrf_topo1/test_bfd_vrf_topo1.py @@ -95,20 +95,18 @@ def setup_module(mod): logger.info("Testing with VRF Namespace support") cmds = [ - "if [ -e /var/run/netns/{0}-cust1 ] ; then ip netns del {0}-cust1 ; fi", - "ip netns add {0}-cust1", - "ip link set dev {0}-eth0 netns {0}-cust1", - "ip netns exec {0}-cust1 ifconfig {0}-eth0 up", + "if [ -e /var/run/netns/{0}-bfd-cust1 ] ; then ip netns del {0}-bfd-cust1 ; fi", + "ip netns add {0}-bfd-cust1", + "ip link set dev {0}-eth0 netns {0}-bfd-cust1 up", ] cmds2 = [ - "ip link set dev {0}-eth1 netns {0}-cust1", - "ip netns exec {0}-cust1 ifconfig {0}-eth1 up", - "ip link set dev {0}-eth2 netns {0}-cust1", - "ip netns exec {0}-cust1 ifconfig {0}-eth2 up", + "ip link set dev {0}-eth1 netns {0}-bfd-cust1", + "ip netns exec {0}-bfd-cust1 ip link set {0}-eth1 up", + "ip link set dev {0}-eth2 netns {0}-bfd-cust1 up", ] for rname, router in router_list.items(): - # create VRF rx-cust1 and link rx-eth0 to rx-cust1 + # create VRF rx-bfd-cust1 and link rx-eth0 to rx-bfd-cust1 for cmd in cmds: output = tgen.net[rname].cmd(cmd.format(rname)) if rname == "r2": @@ -138,11 +136,11 @@ def teardown_module(_mod): # move back rx-eth0 to default VRF # delete rx-vrf cmds = [ - "ip netns exec {0}-cust1 ip link set {0}-eth0 netns 1", - "ip netns delete {0}-cust1", + "ip netns exec {0}-bfd-cust1 ip link set {0}-eth0 netns 1", + "ip netns delete {0}-bfd-cust1", ] cmds2 = [ - "ip netns exec {0}-cust1 ip link set {0}-eth1 netns 1", + "ip netns exec {0}-bfd-cust1 ip link set {0}-eth1 netns 1", "ip netns exec {0}-cust2 ip link set {0}-eth1 netns 1", ] @@ -189,7 +187,7 @@ def test_bgp_convergence(): test_func = partial( topotest.router_json_cmp, router, - "show ip bgp vrf {}-cust1 summary json".format(router.name), + "show ip bgp vrf {}-bfd-cust1 summary json".format(router.name), expected, ) _, res = topotest.run_and_expect(test_func, None, count=125, wait=1.0) @@ -211,7 +209,7 @@ def test_bgp_fast_convergence(): test_func = partial( topotest.router_json_cmp, router, - "show ip bgp vrf {}-cust1 json".format(router.name), + "show ip bgp vrf {}-bfd-cust1 json".format(router.name), expected, ) _, res = topotest.run_and_expect(test_func, None, count=40, wait=1) @@ -231,7 +229,7 @@ def test_bfd_fast_convergence(): # Disable r2-eth0 link router2 = tgen.gears["r2"] topotest.interface_set_status( - router2, "r2-eth0", ifaceaction=False, vrf_name="r2-cust1" + router2, "r2-eth0", ifaceaction=False, vrf_name="r2-bfd-cust1" ) # Wait the minimum time we can before checking that BGP/BFD @@ -286,7 +284,7 @@ def test_bgp_fast_reconvergence(): test_func = partial( topotest.router_json_cmp, router, - "show ip bgp vrf {}-cust1 json".format(router.name), + "show ip bgp vrf {}-bfd-cust1 json".format(router.name), expected, ) _, res = topotest.run_and_expect(test_func, None, count=16, wait=1) diff --git a/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2.py b/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2.py index e7ce216042..83bf4fcc18 100644 --- a/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2.py +++ b/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2.py @@ -249,6 +249,8 @@ def configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut, peer): This function groups the repetitive function calls into one function. """ + logger.info("configure_gr_followed_by_clear: dut %s peer %s", dut, peer) + result = create_router_bgp(tgen, topo, input_dict) assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) @@ -766,9 +768,7 @@ def test_BGP_GR_10_p2(request): # Creating configuration from JSON reset_config_on_routers(tgen) - logger.info( - "[Step 1] : Test Setup " "[Helper Mode]R3-----R1[Restart Mode] initialized" - ) + step("Test Setup: [Helper Mode]R3-----R1[Restart Mode] initialized") # Configure graceful-restart input_dict = { @@ -847,6 +847,8 @@ def test_BGP_GR_10_p2(request): configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r3") for addr_type in ADDR_TYPES: + step("Verifying GR config and operational state for addr_type {}".format(addr_type)) + result = verify_graceful_restart( tgen, topo, addr_type, input_dict, dut="r1", peer="r3" ) @@ -870,7 +872,7 @@ def test_BGP_GR_10_p2(request): # verify multi address family result = verify_gr_address_family( - tgen, topo, addr_type, "ipv4Unicast", dut="r1" + tgen, topo, addr_type, "ipv4Unicast", dut="r1", peer="r3", ) assert result is True, "Testcase {} : Failed \n Error {}".format( tc_name, result @@ -878,7 +880,7 @@ def test_BGP_GR_10_p2(request): # verify multi address family result = verify_gr_address_family( - tgen, topo, addr_type, "ipv6Unicast", dut="r1" + tgen, topo, addr_type, "ipv6Unicast", dut="r1", peer="r3", ) assert result is True, "Testcase {} : Failed \n Error {}".format( tc_name, result @@ -886,7 +888,7 @@ def test_BGP_GR_10_p2(request): # verify multi address family result = verify_gr_address_family( - tgen, topo, addr_type, "ipv4Unicast", dut="r3" + tgen, topo, addr_type, "ipv4Unicast", dut="r3", peer="r1", ) assert result is True, "Testcase {} : Failed \n Error {}".format( tc_name, result @@ -894,12 +896,14 @@ def test_BGP_GR_10_p2(request): # verify multi address family result = verify_gr_address_family( - tgen, topo, addr_type, "ipv6Unicast", dut="r3" + tgen, topo, addr_type, "ipv6Unicast", dut="r3", peer="r1", ) assert result is True, "Testcase {} : Failed \n Error {}".format( tc_name, result ) + step("Killing bgpd on r1") + # Kill BGPd daemon on R1 kill_router_daemons(tgen, "r1", ["bgpd"]) @@ -917,6 +921,8 @@ def test_BGP_GR_10_p2(request): tc_name, result ) + step("Starting bgpd on r1") + # Start BGPd daemon on R1 start_router_daemons(tgen, "r1", ["bgpd"]) @@ -1671,7 +1677,7 @@ def test_BGP_GR_26_p2(request): # verify multi address family result = verify_gr_address_family( - tgen, topo, addr_type, "ipv4Unicast", dut="r1" + tgen, topo, addr_type, "ipv4Unicast", dut="r1", peer="r3", ) assert result is True, "Testcase {} : Failed \n Error {}".format( tc_name, result @@ -1679,7 +1685,7 @@ def test_BGP_GR_26_p2(request): # verify multi address family result = verify_gr_address_family( - tgen, topo, addr_type, "ipv6Unicast", dut="r1" + tgen, topo, addr_type, "ipv6Unicast", dut="r1", peer="r3", ) assert result is True, "Testcase {} : Failed \n Error {}".format( tc_name, result @@ -1687,7 +1693,7 @@ def test_BGP_GR_26_p2(request): # verify multi address family result = verify_gr_address_family( - tgen, topo, addr_type, "ipv4Unicast", dut="r3" + tgen, topo, addr_type, "ipv4Unicast", dut="r3", peer="r1", ) assert result is True, "Testcase {} : Failed \n Error {}".format( tc_name, result @@ -1695,7 +1701,7 @@ def test_BGP_GR_26_p2(request): # verify multi address family result = verify_gr_address_family( - tgen, topo, addr_type, "ipv6Unicast", dut="r3" + tgen, topo, addr_type, "ipv6Unicast", dut="r3", peer="r1", ) assert result is True, "Testcase {} : Failed \n Error {}".format( tc_name, result diff --git a/tests/topotests/bgp_multi_vrf_topo1/test_bgp_multi_vrf_topo1.py b/tests/topotests/bgp_multi_vrf_topo1/test_bgp_multi_vrf_topo1.py index c9a93bd75f..84e10af5b3 100644 --- a/tests/topotests/bgp_multi_vrf_topo1/test_bgp_multi_vrf_topo1.py +++ b/tests/topotests/bgp_multi_vrf_topo1/test_bgp_multi_vrf_topo1.py @@ -178,14 +178,10 @@ NEXT_HOP_IP = {"ipv4": "Null0", "ipv6": "Null0"} LOOPBACK_1 = { "ipv4": "10.10.10.10/32", "ipv6": "10::10:10/128", - "ipv4_mask": "255.255.255.255", - "ipv6_mask": None, } LOOPBACK_2 = { "ipv4": "20.20.20.20/32", "ipv6": "20::20:20/128", - "ipv4_mask": "255.255.255.255", - "ipv6_mask": None, } @@ -1911,7 +1907,6 @@ def test_static_routes_for_inter_vrf_route_leaking_p0(request): "loopback1", LOOPBACK_1[addr_type], "RED_A", - LOOPBACK_1["{}_mask".format(addr_type)], ) create_interface_in_kernel( tgen, @@ -1919,7 +1914,6 @@ def test_static_routes_for_inter_vrf_route_leaking_p0(request): "loopback2", LOOPBACK_2[addr_type], "RED_B", - LOOPBACK_2["{}_mask".format(addr_type)], ) step( @@ -2047,7 +2041,6 @@ def test_inter_vrf_and_intra_vrf_communication_iBGP_p0(request): "loopback1", LOOPBACK_1[addr_type], "RED_A", - LOOPBACK_1["{}_mask".format(addr_type)], ) create_interface_in_kernel( @@ -2056,7 +2049,6 @@ def test_inter_vrf_and_intra_vrf_communication_iBGP_p0(request): "loopback2", LOOPBACK_2[addr_type], "BLUE_A", - LOOPBACK_2["{}_mask".format(addr_type)], ) step( @@ -2216,7 +2208,6 @@ def test_inter_vrf_and_intra_vrf_communication_eBGP_p0(request): "loopback1", LOOPBACK_1[addr_type], "RED_A", - LOOPBACK_1["{}_mask".format(addr_type)], ) create_interface_in_kernel( tgen, @@ -2224,7 +2215,6 @@ def test_inter_vrf_and_intra_vrf_communication_eBGP_p0(request): "loopback2", LOOPBACK_2[addr_type], "BLUE_A", - LOOPBACK_2["{}_mask".format(addr_type)], ) step( diff --git a/tests/topotests/bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py b/tests/topotests/bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py index 37da53fc31..31569e69b4 100644 --- a/tests/topotests/bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py +++ b/tests/topotests/bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py @@ -131,8 +131,6 @@ NEXT_HOP_IP = {"ipv4": "Null0", "ipv6": "Null0"} LOOPBACK_2 = { "ipv4": "20.20.20.20/32", "ipv6": "20::20:20/128", - "ipv4_mask": "255.255.255.255", - "ipv6_mask": None, } MAX_PATHS = 2 @@ -1928,7 +1926,6 @@ def test_vrf_route_leaking_next_hop_interface_flapping_p1(request): "loopback2", LOOPBACK_2[addr_type], "RED_B", - LOOPBACK_2["{}_mask".format(addr_type)], ) intf_red1_r11 = topo["routers"]["red1"]["links"]["r1-link2"]["interface"] diff --git a/tests/topotests/bgp_recursive_route_ebgp_multi_hop/test_bgp_recursive_route_ebgp_multi_hop.py b/tests/topotests/bgp_recursive_route_ebgp_multi_hop/test_bgp_recursive_route_ebgp_multi_hop.py index e7d70f6d8e..2fe80c77f0 100644 --- a/tests/topotests/bgp_recursive_route_ebgp_multi_hop/test_bgp_recursive_route_ebgp_multi_hop.py +++ b/tests/topotests/bgp_recursive_route_ebgp_multi_hop/test_bgp_recursive_route_ebgp_multi_hop.py @@ -1103,7 +1103,7 @@ def test_next_hop_with_recursive_lookup_p1(request): tc_name, result ) - step("Toggle the interface on R3(ifconfig 192.34).") + step("Toggle the interface on R3.") intf_r3_r4 = topo["routers"]["r3"]["links"]["r4"]["interface"] shutdown_bringup_interface(tgen, "r3", intf_r3_r4) @@ -1161,7 +1161,7 @@ def test_next_hop_with_recursive_lookup_p1(request): tc_name, result ) - step("Toggle the interface on R4(ifconfig 192.34).") + step("Toggle the interface on R4.") intf_r4_r3 = topo["routers"]["r4"]["links"]["r3"]["interface"] shutdown_bringup_interface(tgen, "r4", intf_r4_r3) diff --git a/tests/topotests/bgp_vrf_dynamic_route_leak/test_bgp_vrf_dynamic_route_leak_topo1.py b/tests/topotests/bgp_vrf_dynamic_route_leak/test_bgp_vrf_dynamic_route_leak_topo1.py index d6f1058a98..ea1b1a42d7 100644 --- a/tests/topotests/bgp_vrf_dynamic_route_leak/test_bgp_vrf_dynamic_route_leak_topo1.py +++ b/tests/topotests/bgp_vrf_dynamic_route_leak/test_bgp_vrf_dynamic_route_leak_topo1.py @@ -123,8 +123,6 @@ LOOPBACK_1 = { LOOPBACK_2 = { "ipv4": "10.0.0.16/24", "ipv6": "fd00:0:0:3::5/64", - "ipv4_mask": "255.255.255.0", - "ipv6_mask": None, } PREFERRED_NEXT_HOP = "global" @@ -692,14 +690,13 @@ def test_dynamic_imported_routes_advertised_to_iBGP_peer_p0(request): "loopback2", LOOPBACK_2[addr_type], "ISR", - LOOPBACK_2["{}_mask".format(addr_type)], ) for addr_type in ADDR_TYPES: step( "On router R1 Change the next-hop of static routes in vrf " - "ISR to LOOPBACK_1" + "ISR to LOOPBACK_2" ) input_routes_r1 = { diff --git a/tests/topotests/bgp_vrf_netns/r1/bgpd.conf b/tests/topotests/bgp_vrf_netns/r1/bgpd.conf index cfe3f2e2b5..572dce7455 100644 --- a/tests/topotests/bgp_vrf_netns/r1/bgpd.conf +++ b/tests/topotests/bgp_vrf_netns/r1/bgpd.conf @@ -1,5 +1,5 @@ ! -router bgp 100 vrf r1-cust1 +router bgp 100 vrf r1-bgp-cust1 bgp router-id 10.0.1.1 bgp bestpath as-path multipath-relax no bgp ebgp-requires-policy diff --git a/tests/topotests/bgp_vrf_netns/r1/summary.txt b/tests/topotests/bgp_vrf_netns/r1/summary.txt index 1a079ff130..819f26133f 100644 --- a/tests/topotests/bgp_vrf_netns/r1/summary.txt +++ b/tests/topotests/bgp_vrf_netns/r1/summary.txt @@ -2,7 +2,7 @@ "ipv4Unicast":{ "routerId":"10.0.1.1", "as":100, - "vrfName":"r1-cust1", + "vrfName":"r1-bgp-cust1", "peerCount":1, "peers":{ "10.0.1.101":{ diff --git a/tests/topotests/bgp_vrf_netns/r1/summary20.txt b/tests/topotests/bgp_vrf_netns/r1/summary20.txt index 2b5787e6da..ea04a56d85 100644 --- a/tests/topotests/bgp_vrf_netns/r1/summary20.txt +++ b/tests/topotests/bgp_vrf_netns/r1/summary20.txt @@ -1,7 +1,7 @@ { "routerId":"10.0.1.1", "as":100, - "vrfName":"re1-cust1", + "vrfName":"re1-bgp-cust1", "peerCount":1, "peers":{ "10.0.1.101":{ diff --git a/tests/topotests/bgp_vrf_netns/r1/zebra.conf b/tests/topotests/bgp_vrf_netns/r1/zebra.conf index 817d9544d3..fd0e18f5fd 100644 --- a/tests/topotests/bgp_vrf_netns/r1/zebra.conf +++ b/tests/topotests/bgp_vrf_netns/r1/zebra.conf @@ -1,5 +1,5 @@ ! -interface r1-eth0 vrf r1-cust1 +interface r1-eth0 vrf r1-bgp-cust1 ip address 10.0.1.1/24 ! line vty diff --git a/tests/topotests/bgp_vrf_netns/test_bgp_vrf_netns_topo.py b/tests/topotests/bgp_vrf_netns/test_bgp_vrf_netns_topo.py index 9889e1cdd5..60511aebde 100644 --- a/tests/topotests/bgp_vrf_netns/test_bgp_vrf_netns_topo.py +++ b/tests/topotests/bgp_vrf_netns/test_bgp_vrf_netns_topo.py @@ -106,13 +106,12 @@ def setup_module(module): if CustomizeVrfWithNetns == True: logger.info("Testing with VRF Namespace support") - # create VRF r1-cust1 - # move r1-eth0 to VRF r1-cust1 + # create VRF r1-bgp-cust1 + # move r1-eth0 to VRF r1-bgp-cust1 cmds = [ - "if [ -e /var/run/netns/{0}-cust1 ] ; then ip netns del {0}-cust1 ; fi", - "ip netns add {0}-cust1", - "ip link set dev {0}-eth0 netns {0}-cust1", - "ip netns exec {0}-cust1 ifconfig {0}-eth0 up", + "if [ -e /var/run/netns/{0}-bgp-cust1 ] ; then ip netns del {0}-bgp-cust1 ; fi", + "ip netns add {0}-bgp-cust1", + "ip link set {0}-eth0 netns {0}-bgp-cust1 up", ] for cmd in cmds: cmd = cmd.format("r1") @@ -154,10 +153,10 @@ def setup_module(module): def teardown_module(module): tgen = get_topogen() # move back r1-eth0 to default VRF - # delete VRF r1-cust1 + # delete VRF r1-bgp-cust1 cmds = [ - "ip netns exec {0}-cust1 ip link set {0}-eth0 netns 1", - "ip netns delete {0}-cust1", + "ip netns exec {0}-bgp-cust1 ip link set {0}-eth0 netns 1", + "ip netns delete {0}-bgp-cust1", ] for cmd in cmds: tgen.net["r1"].cmd(cmd.format("r1")) @@ -203,7 +202,7 @@ def test_bgp_convergence(): expected = json.loads(open(reffile).read()) test_func = functools.partial( - topotest.router_json_cmp, router, "show bgp vrf r1-cust1 summary json", expected + topotest.router_json_cmp, router, "show bgp vrf r1-bgp-cust1 summary json", expected ) _, res = topotest.run_and_expect(test_func, None, count=90, wait=0.5) assertmsg = "BGP router network did not converge" @@ -231,11 +230,11 @@ def test_bgp_vrf_netns(): test_func = functools.partial( topotest.router_json_cmp, tgen.gears["r1"], - "show ip bgp vrf r1-cust1 ipv4 json", + "show ip bgp vrf r1-bgp-cust1 ipv4 json", expect, ) _, res = topotest.run_and_expect(test_func, None, count=12, wait=0.5) - assertmsg = 'expected routes in "show ip bgp vrf r1-cust1 ipv4" output' + assertmsg = 'expected routes in "show ip bgp vrf r1-bgp-cust1 ipv4" output' assert res is None, assertmsg diff --git a/tests/topotests/lib/bgp.py b/tests/topotests/lib/bgp.py index 2f1f67439f..922dee1291 100644 --- a/tests/topotests/lib/bgp.py +++ b/tests/topotests/lib/bgp.py @@ -3765,7 +3765,7 @@ def verify_graceful_restart_timers(tgen, topo, addr_type, input_dict, dut, peer) @retry(retry_timeout=8) -def verify_gr_address_family(tgen, topo, addr_type, addr_family, dut, expected=True): +def verify_gr_address_family(tgen, topo, addr_type, addr_family, dut, peer, expected=True): """ This API is to verify gr_address_family in the BGP gr capability advertised by the neighbor router @@ -3777,80 +3777,86 @@ def verify_gr_address_family(tgen, topo, addr_type, addr_family, dut, expected=T * `addr_type` : ip type ipv4/ipv6 * `addr_type` : ip type IPV4 Unicast/IPV6 Unicast * `dut`: input dut router name + * `peer`: input peer router to check * `expected` : expected results from API, by-default True Usage ----- - result = verify_gr_address_family(tgen, topo, "ipv4", "ipv4Unicast", "r1") + result = verify_gr_address_family(tgen, topo, "ipv4", "ipv4Unicast", "r1", "r3") Returns ------- - errormsg(str) or True + errormsg(str) or None """ logger.debug("Entering lib API: {}".format(sys._getframe().f_code.co_name)) - for router, rnode in tgen.routers().items(): - if router != dut: - continue + if not check_address_types(addr_type): + logger.debug("Exiting lib API: {}".format(sys._getframe().f_code.co_name)) + return - bgp_addr_type = topo["routers"][router]["bgp"]["address_family"] + routers = tgen.routers() + if dut not in routers: + return "{} not in routers".format(dut) - if addr_type in bgp_addr_type: - if not check_address_types(addr_type): - continue + rnode = routers[dut] + bgp_addr_type = topo["routers"][dut]["bgp"]["address_family"] - bgp_neighbors = bgp_addr_type[addr_type]["unicast"]["neighbor"] + if addr_type not in bgp_addr_type: + return "{} not in bgp_addr_types".format(addr_type) - for bgp_neighbor, peer_data in bgp_neighbors.items(): - for dest_link, peer_dict in peer_data["dest_link"].items(): - data = topo["routers"][bgp_neighbor]["links"] + if peer not in bgp_addr_type[addr_type]["unicast"]["neighbor"]: + return "{} not a peer of {} over {}".format(peer, dut, addr_type) - if dest_link in data: - neighbor_ip = data[dest_link][addr_type].split("/")[0] + nbr_links = topo["routers"][peer]["links"] + if dut not in nbr_links or addr_type not in nbr_links[dut]: + return "peer {} missing back link to {} over {}".format(peer, dut, addr_type) - logger.info( - "[DUT: {}]: Checking bgp graceful-restart" - " show o/p {}".format(dut, neighbor_ip) - ) + neighbor_ip = nbr_links[dut][addr_type].split("/")[0] - show_bgp_graceful_json = run_frr_cmd( - rnode, - "show bgp {} neighbor {} graceful-restart json".format( - addr_type, neighbor_ip - ), - isjson=True, - ) + logger.info( + "[DUT: {}]: Checking bgp graceful-restart show o/p {} for {}".format( + dut, neighbor_ip, addr_family + ) + ) - show_bgp_graceful_json_out = show_bgp_graceful_json[neighbor_ip] + show_bgp_graceful_json = run_frr_cmd( + rnode, + "show bgp {} neighbor {} graceful-restart json".format( + addr_type, neighbor_ip + ), + isjson=True, + ) - if show_bgp_graceful_json_out["neighborAddr"] == neighbor_ip: - logger.info("Neighbor ip matched {}".format(neighbor_ip)) - else: - errormsg = "Neighbor ip NOT a match {}".format(neighbor_ip) - return errormsg + show_bgp_graceful_json_out = show_bgp_graceful_json[neighbor_ip] - if addr_family == "ipv4Unicast": - if "ipv4Unicast" in show_bgp_graceful_json_out: - logger.info("ipv4Unicast present for {} ".format(neighbor_ip)) - return True - else: - errormsg = "ipv4Unicast NOT present for {} ".format(neighbor_ip) - return errormsg + if show_bgp_graceful_json_out["neighborAddr"] == neighbor_ip: + logger.info("Neighbor ip matched {}".format(neighbor_ip)) + else: + errormsg = "Neighbor ip NOT a match {}".format(neighbor_ip) + return errormsg - elif addr_family == "ipv6Unicast": - if "ipv6Unicast" in show_bgp_graceful_json_out: - logger.info("ipv6Unicast present for {} ".format(neighbor_ip)) - return True - else: - errormsg = "ipv6Unicast NOT present for {} ".format(neighbor_ip) - return errormsg - else: - errormsg = "Aaddress family: {} present for {} ".format( - addr_family, neighbor_ip - ) - return errormsg + if addr_family == "ipv4Unicast": + if "ipv4Unicast" in show_bgp_graceful_json_out: + logger.info("ipv4Unicast present for {} ".format(neighbor_ip)) + return True + else: + errormsg = "ipv4Unicast NOT present for {} ".format(neighbor_ip) + return errormsg + + elif addr_family == "ipv6Unicast": + if "ipv6Unicast" in show_bgp_graceful_json_out: + logger.info("ipv6Unicast present for {} ".format(neighbor_ip)) + return True + else: + errormsg = "ipv6Unicast NOT present for {} ".format(neighbor_ip) + return errormsg + else: + errormsg = "Aaddress family: {} present for {} ".format( + addr_family, neighbor_ip + ) + return errormsg logger.debug("Exiting lib API: {}".format(sys._getframe().f_code.co_name)) diff --git a/tests/topotests/lib/common_config.py b/tests/topotests/lib/common_config.py index 22a678862a..3754ad999e 100644 --- a/tests/topotests/lib/common_config.py +++ b/tests/topotests/lib/common_config.py @@ -971,22 +971,31 @@ def add_interfaces_to_vlan(tgen, input_dict): for intf_dict in interfaces: for interface, data in intf_dict.items(): # Adding interface to VLAN - cmd = "vconfig add {} {}".format(interface, vlan) + vlan_intf = "{}.{}".format(interface, vlan) + cmd = "ip link add link {} name {} type vlan id {}".format( + interface, + vlan_intf, + vlan + ) logger.info("[DUT: %s]: Running command: %s", dut, cmd) rnode.run(cmd) - vlan_intf = "{}.{}".format(interface, vlan) - - ip = data["ip"] - subnet = data["subnet"] - # Bringing interface up - cmd = "ip link set up {}".format(vlan_intf) + cmd = "ip link set {} up".format(vlan_intf) logger.info("[DUT: %s]: Running command: %s", dut, cmd) rnode.run(cmd) # Assigning IP address - cmd = "ifconfig {} {} netmask {}".format(vlan_intf, ip, subnet) + ifaddr = ipaddress.ip_interface( + u"{}/{}".format( + frr_unicode(data["ip"]), + frr_unicode(data["subnet"]) + ) + ) + + cmd = "ip -{0} a flush {1} scope global && ip a add {2} dev {1} && ip l set {1} up".format( + ifaddr.version, vlan_intf, ifaddr + ) logger.info("[DUT: %s]: Running command: %s", dut, cmd) rnode.run(cmd) @@ -1391,15 +1400,20 @@ def create_interface_in_kernel( rnode = tgen.routers()[dut] if create: - cmd = "sudo ip link add name {} type dummy".format(name) + cmd = "ip link show {0} >/dev/null || ip link add {0} type dummy".format(name) rnode.run(cmd) - addr_type = validate_ip_address(ip_addr) - if addr_type == "ipv4": - cmd = "ifconfig {} {} netmask {}".format(name, ip_addr, netmask) + if not netmask: + ifaddr = ipaddress.ip_interface(frr_unicode(ip_addr)) else: - cmd = "ifconfig {} inet6 add {}/{}".format(name, ip_addr, netmask) - + ifaddr = ipaddress.ip_interface(u"{}/{}".format( + frr_unicode(ip_addr), + frr_unicode(netmask) + )) + cmd = "ip -{0} a flush {1} scope global && ip a add {2} dev {1} && ip l set {1} up".format( + ifaddr.version, name, ifaddr + ) + logger.info("[DUT: %s]: Running command: %s", dut, cmd) rnode.run(cmd) if vrf: @@ -2933,7 +2947,7 @@ def configure_interface_mac(tgen, input_dict): rnode = tgen.routers()[dut] for intf, mac in input_dict[dut].items(): - cmd = "ifconfig {} hw ether {}".format(intf, mac) + cmd = "ip link set {} address {}".format(intf, mac) logger.info("[DUT: %s]: Running command: %s", dut, cmd) try: diff --git a/tests/topotests/lib/pim.py b/tests/topotests/lib/pim.py index 7de1c7a2f9..e093e6de53 100644 --- a/tests/topotests/lib/pim.py +++ b/tests/topotests/lib/pim.py @@ -55,7 +55,7 @@ def create_pim_config(tgen, topo, input_dict=None, build=False, load_config=True input_dict = { "r1": { "pim": { - "disable" : ["l1-i1-eth1"], + "join-prune-interval": "5", "rp": [{ "rp_addr" : "1.0.3.17". "keep-alive-timer": "100" @@ -90,7 +90,7 @@ def create_pim_config(tgen, topo, input_dict=None, build=False, load_config=True if "rp" not in input_dict[router]["pim"]: continue - result = _create_pim_config( + result = _create_pim_rp_config( tgen, topo, input_dict, router, build, load_config ) if result is not True: @@ -100,9 +100,9 @@ def create_pim_config(tgen, topo, input_dict=None, build=False, load_config=True return result -def _create_pim_config(tgen, topo, input_dict, router, build=False, load_config=False): +def _create_pim_rp_config(tgen, topo, input_dict, router, build=False, load_config=False): """ - Helper API to create pim configuration. + Helper API to create pim RP configurations. Parameters ---------- @@ -119,96 +119,93 @@ def _create_pim_config(tgen, topo, input_dict, router, build=False, load_config= result = False logger.debug("Entering lib API: {}".format(sys._getframe().f_code.co_name)) - try: - pim_data = input_dict[router]["pim"] + pim_data = input_dict[router]["pim"] + rp_data = pim_data["rp"] - for dut in tgen.routers(): - if "pim" not in input_dict[router]: - continue + # Configure this RP on every router. + for dut in tgen.routers(): - for destLink, data in topo[dut]["links"].items(): - if "pim" not in data: - continue + # At least one interface must be enabled for PIM on the router + pim_if_enabled = False + for destLink, data in topo[dut]["links"].items(): + if "pim" in data: + pim_if_enabled = True + if not pim_if_enabled: + continue - if "rp" in pim_data: - config_data = [] - rp_data = pim_data["rp"] + config_data = [] - for rp_dict in deepcopy(rp_data): - # ip address of RP - if "rp_addr" not in rp_dict and build: - logger.error( - "Router %s: 'ip address of RP' not " - "present in input_dict/JSON", - router, - ) + for rp_dict in deepcopy(rp_data): + # ip address of RP + if "rp_addr" not in rp_dict and build: + logger.error( + "Router %s: 'ip address of RP' not " + "present in input_dict/JSON", + router, + ) - return False - rp_addr = rp_dict.setdefault("rp_addr", None) + return False + rp_addr = rp_dict.setdefault("rp_addr", None) - # Keep alive Timer - keep_alive_timer = rp_dict.setdefault("keep_alive_timer", None) + # Keep alive Timer + keep_alive_timer = rp_dict.setdefault("keep_alive_timer", None) - # Group Address range to cover - if "group_addr_range" not in rp_dict and build: - logger.error( - "Router %s:'Group Address range to cover'" - " not present in input_dict/JSON", - router, - ) + # Group Address range to cover + if "group_addr_range" not in rp_dict and build: + logger.error( + "Router %s:'Group Address range to cover'" + " not present in input_dict/JSON", + router, + ) - return False - group_addr_range = rp_dict.setdefault("group_addr_range", None) + return False + group_addr_range = rp_dict.setdefault("group_addr_range", None) - # Group prefix-list filter - prefix_list = rp_dict.setdefault("prefix_list", None) + # Group prefix-list filter + prefix_list = rp_dict.setdefault("prefix_list", None) - # Delete rp config - del_action = rp_dict.setdefault("delete", False) + # Delete rp config + del_action = rp_dict.setdefault("delete", False) - if keep_alive_timer: - cmd = "ip pim rp keep-alive-timer {}".format(keep_alive_timer) - config_data.append(cmd) + if keep_alive_timer: + cmd = "ip pim rp keep-alive-timer {}".format(keep_alive_timer) + if del_action: + cmd = "no {}".format(cmd) + config_data.append(cmd) + + if rp_addr: + if group_addr_range: + if type(group_addr_range) is not list: + group_addr_range = [group_addr_range] + for grp_addr in group_addr_range: + cmd = "ip pim rp {} {}".format(rp_addr, grp_addr) if del_action: cmd = "no {}".format(cmd) - config_data.append(cmd) - - if rp_addr: - if group_addr_range: - if type(group_addr_range) is not list: - group_addr_range = [group_addr_range] - - for grp_addr in group_addr_range: - cmd = "ip pim rp {} {}".format(rp_addr, grp_addr) - config_data.append(cmd) - - if del_action: - cmd = "no {}".format(cmd) - config_data.append(cmd) - - if prefix_list: - cmd = "ip pim rp {} prefix-list {}".format( - rp_addr, prefix_list - ) - config_data.append(cmd) + config_data.append(cmd) - if del_action: - cmd = "no {}".format(cmd) - config_data.append(cmd) + if prefix_list: + cmd = "ip pim rp {} prefix-list {}".format( + rp_addr, prefix_list + ) + if del_action: + cmd = "no {}".format(cmd) + config_data.append(cmd) + try: result = create_common_configuration( tgen, dut, config_data, "pim", build, load_config ) if result is not True: + logger.error("Error applying PIM config", exc_info=True) + logger.debug("Exiting lib API: {}".format(sys._getframe().f_code.co_name)) return False - except InvalidCLIError: - # Traceback - errormsg = traceback.format_exc() - logger.error(errormsg) - return errormsg + except InvalidCLIError as error: + logger.error("Error applying PIM config: %s", error, exc_info=error) + logger.debug("Exiting lib API: {}".format(sys._getframe().f_code.co_name)) + return False logger.debug("Exiting lib API: {}".format(sys._getframe().f_code.co_name)) return result @@ -338,35 +335,19 @@ def _enable_disable_pim(tgen, topo, input_dict, router, build=False): try: config_data = [] - enable_flag = True - # Disable pim on interface - if "pim" in input_dict[router]: - if "disable" in input_dict[router]["pim"]: - enable_flag = False - interfaces = input_dict[router]["pim"]["disable"] - - if type(interfaces) is not list: - interfaces = [interfaces] - - for interface in interfaces: - cmd = "interface {}".format(interface) - config_data.append(cmd) - config_data.append("no ip pim") - - # Enable pim on interface - if enable_flag: - for destRouterLink, data in sorted(topo[router]["links"].items()): - if "pim" in data and data["pim"] == "enable": + # Enable pim on interfaces + for destRouterLink, data in sorted(topo[router]["links"].items()): + if "pim" in data and data["pim"] == "enable": - # Loopback interfaces - if "type" in data and data["type"] == "loopback": - interface_name = destRouterLink - else: - interface_name = data["interface"] + # Loopback interfaces + if "type" in data and data["type"] == "loopback": + interface_name = destRouterLink + else: + interface_name = data["interface"] - cmd = "interface {}".format(interface_name) - config_data.append(cmd) - config_data.append("ip pim") + cmd = "interface {}".format(interface_name) + config_data.append(cmd) + config_data.append("ip pim") result = create_common_configuration( tgen, router, config_data, "interface_config", build=build @@ -374,6 +355,22 @@ def _enable_disable_pim(tgen, topo, input_dict, router, build=False): if result is not True: return False + config_data = [] + if "pim" in input_dict[router]: + pim_data = input_dict[router]["pim"] + for t in [ + "join-prune-interval", + "keep-alive-timer", + "register-suppress-time", + ]: + if t in pim_data: + cmd = "ip pim {} {}".format(t, pim_data[t]) + config_data.append(cmd) + + if config_data: + result = create_common_configuration( + tgen, router, config_data, "pim", build=build + ) except InvalidCLIError: # Traceback errormsg = traceback.format_exc() diff --git a/tests/topotests/multicast_pim_bsm_topo2/test_mcast_pim_bsmp_02.py b/tests/topotests/multicast_pim_bsm_topo2/test_mcast_pim_bsmp_02.py index 98af4433ab..894326f19f 100644 --- a/tests/topotests/multicast_pim_bsm_topo2/test_mcast_pim_bsmp_02.py +++ b/tests/topotests/multicast_pim_bsm_topo2/test_mcast_pim_bsmp_02.py @@ -1008,8 +1008,8 @@ def test_BSM_fragmentation_p1(request): # set mtu of fhr(f1) to i1 interface to 100 so that bsm fragments step("set mtu of fhr(f1) to i1 interface to 100 so that bsm fragments") - fhr_node.run("ifconfig f1-i1-eth2 mtu 100") - inter_node.run("ifconfig i1-f1-eth0 mtu 100") + fhr_node.run("ip link set f1-i1-eth2 mtu 100") + inter_node.run("ip link set i1-f1-eth0 mtu 100") # Use scapy to send pre-defined packet from senser to receiver result = scapy_send_bsr_raw_packet(tgen, topo, "b1", "f1", "packet2") diff --git a/tests/topotests/multicast_pim_sm_topo1/multicast_pim_sm_topo1.json b/tests/topotests/multicast_pim_sm_topo1/multicast_pim_sm_topo1.json index 71454c2ab2..cc20abbe6a 100644 --- a/tests/topotests/multicast_pim_sm_topo1/multicast_pim_sm_topo1.json +++ b/tests/topotests/multicast_pim_sm_topo1/multicast_pim_sm_topo1.json @@ -13,10 +13,12 @@ "r2": {"ipv4": "auto", "pim": "enable"}, "c1": {"ipv4": "auto", "pim": "enable"} }, + "pim": { "join-prune-interval": "5", "keep-alive-timer": 15, "register-suppress-time": 12 }, "igmp": { "interfaces": { "l1-i1-eth1" :{ "igmp":{ + "query": {"query-max-response-time": 40, "query-interval": 5}, "version": "2" } } @@ -38,6 +40,7 @@ "f1": {"ipv4": "auto", "pim": "enable"}, "i3": {"ipv4": "auto", "pim": "enable"} }, + "pim": { "join-prune-interval": "5", "keep-alive-timer": 15, "register-suppress-time": 12 }, "static_routes": [{ "network": ["10.0.5.0/24", "10.0.6.0/24", "1.0.2.2/32", "10.0.1.0/24"], "next_hop": "10.0.7.1" @@ -55,6 +58,7 @@ "i2": {"ipv4": "auto", "pim": "enable"}, "i8": {"ipv4": "auto", "pim": "enable"} }, + "pim": { "join-prune-interval": "5", "keep-alive-timer": 15, "register-suppress-time": 12 }, "static_routes": [{ "network": ["1.0.5.17/32", "10.0.8.0/24", "10.0.9.0/24", "10.0.10.0/24", "10.0.12.0/24", "10.0.11.0/24"], "next_hop": "10.0.7.2" @@ -71,6 +75,7 @@ "l1": {"ipv4": "auto", "pim": "enable"}, "i4": {"ipv4": "auto", "pim": "enable"} }, + "pim": { "join-prune-interval": "5", "keep-alive-timer": 15, "register-suppress-time": 12 }, "static_routes": [{ "network": ["1.0.5.17/32", "10.0.6.0/24", "10.0.3.0/24", "10.0.8.0/24", "10.0.9.0/24", "10.0.12.0/24", "10.0.10.0/24", "10.0.11.0/24"], "next_hop": "10.0.2.2" @@ -87,6 +92,7 @@ "f1": {"ipv4": "auto", "pim": "enable"}, "i5": {"ipv4": "auto", "pim": "enable"} }, + "pim": { "join-prune-interval": "5", "keep-alive-timer": 15, "register-suppress-time": 12 }, "static_routes": [{ "network": ["1.0.5.17/32", "10.0.5.0/24", "10.0.6.0/24", "10.0.7.0/24", "10.0.8.0/24", "10.0.9.0/24", "10.0.7.0/24", "10.0.10.0/24", "10.0.11.0/24"], "next_hop": "10.0.3.2" diff --git a/tests/topotests/multicast_pim_sm_topo1/test_multicast_pim_sm_topo1.py b/tests/topotests/multicast_pim_sm_topo1/test_multicast_pim_sm_topo1.py index 99a6e5bacf..36a3103c9d 100755 --- a/tests/topotests/multicast_pim_sm_topo1/test_multicast_pim_sm_topo1.py +++ b/tests/topotests/multicast_pim_sm_topo1/test_multicast_pim_sm_topo1.py @@ -78,6 +78,7 @@ from lib.common_config import ( step, iperfSendIGMPJoin, addKernelRoute, + apply_raw_config, reset_config_on_routers, iperfSendTraffic, kill_iperf, @@ -1553,8 +1554,10 @@ def test_modify_igmp_max_query_response_timer_p0(request): assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result) step("Delete the PIM and IGMP on FRR1") - input_dict_1 = {"l1": {"pim": {"disable": ["l1-i1-eth1"]}}} - result = create_pim_config(tgen, topo, input_dict_1) + raw_config = { + "l1": {"raw_config": ["interface l1-i1-eth1", "no ip pim"]} + } + result = apply_raw_config(tgen, raw_config) assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) input_dict_2 = { diff --git a/tests/topotests/multicast_pim_sm_topo2/multicast_pim_sm_topo2.json b/tests/topotests/multicast_pim_sm_topo2/multicast_pim_sm_topo2.json index 71454c2ab2..cc20abbe6a 100644 --- a/tests/topotests/multicast_pim_sm_topo2/multicast_pim_sm_topo2.json +++ b/tests/topotests/multicast_pim_sm_topo2/multicast_pim_sm_topo2.json @@ -13,10 +13,12 @@ "r2": {"ipv4": "auto", "pim": "enable"}, "c1": {"ipv4": "auto", "pim": "enable"} }, + "pim": { "join-prune-interval": "5", "keep-alive-timer": 15, "register-suppress-time": 12 }, "igmp": { "interfaces": { "l1-i1-eth1" :{ "igmp":{ + "query": {"query-max-response-time": 40, "query-interval": 5}, "version": "2" } } @@ -38,6 +40,7 @@ "f1": {"ipv4": "auto", "pim": "enable"}, "i3": {"ipv4": "auto", "pim": "enable"} }, + "pim": { "join-prune-interval": "5", "keep-alive-timer": 15, "register-suppress-time": 12 }, "static_routes": [{ "network": ["10.0.5.0/24", "10.0.6.0/24", "1.0.2.2/32", "10.0.1.0/24"], "next_hop": "10.0.7.1" @@ -55,6 +58,7 @@ "i2": {"ipv4": "auto", "pim": "enable"}, "i8": {"ipv4": "auto", "pim": "enable"} }, + "pim": { "join-prune-interval": "5", "keep-alive-timer": 15, "register-suppress-time": 12 }, "static_routes": [{ "network": ["1.0.5.17/32", "10.0.8.0/24", "10.0.9.0/24", "10.0.10.0/24", "10.0.12.0/24", "10.0.11.0/24"], "next_hop": "10.0.7.2" @@ -71,6 +75,7 @@ "l1": {"ipv4": "auto", "pim": "enable"}, "i4": {"ipv4": "auto", "pim": "enable"} }, + "pim": { "join-prune-interval": "5", "keep-alive-timer": 15, "register-suppress-time": 12 }, "static_routes": [{ "network": ["1.0.5.17/32", "10.0.6.0/24", "10.0.3.0/24", "10.0.8.0/24", "10.0.9.0/24", "10.0.12.0/24", "10.0.10.0/24", "10.0.11.0/24"], "next_hop": "10.0.2.2" @@ -87,6 +92,7 @@ "f1": {"ipv4": "auto", "pim": "enable"}, "i5": {"ipv4": "auto", "pim": "enable"} }, + "pim": { "join-prune-interval": "5", "keep-alive-timer": 15, "register-suppress-time": 12 }, "static_routes": [{ "network": ["1.0.5.17/32", "10.0.5.0/24", "10.0.6.0/24", "10.0.7.0/24", "10.0.8.0/24", "10.0.9.0/24", "10.0.7.0/24", "10.0.10.0/24", "10.0.11.0/24"], "next_hop": "10.0.3.2" diff --git a/tests/topotests/multicast_pim_sm_topo3/multicast_pim_sm_topo3.json b/tests/topotests/multicast_pim_sm_topo3/multicast_pim_sm_topo3.json index f582f4929d..89c54a41d6 100644 --- a/tests/topotests/multicast_pim_sm_topo3/multicast_pim_sm_topo3.json +++ b/tests/topotests/multicast_pim_sm_topo3/multicast_pim_sm_topo3.json @@ -13,10 +13,12 @@ "r2": {"ipv4": "auto", "pim": "enable"}, "c1": {"ipv4": "auto", "pim": "enable"} }, + "pim": { "join-prune-interval": "5", "keep-alive-timer": 15, "register-suppress-time": 12 }, "igmp": { "interfaces": { "l1-i1-eth1" :{ "igmp":{ + "query": {"query-max-response-time": 40, "query-interval": 5}, "version": "2" } } @@ -38,6 +40,7 @@ "f1": {"ipv4": "auto", "pim": "enable"}, "i3": {"ipv4": "auto", "pim": "enable"} }, + "pim": { "join-prune-interval": "5", "keep-alive-timer": 15, "register-suppress-time": 12 }, "static_routes": [{ "network": ["10.0.5.0/24", "10.0.6.0/24", "1.0.2.2/32", "10.0.1.0/24", "1.0.3.5/32"], "next_hop": "10.0.7.1" @@ -55,6 +58,7 @@ "i2": {"ipv4": "auto", "pim": "enable"}, "i8": {"ipv4": "auto", "pim": "enable"} }, + "pim": { "join-prune-interval": "5", "keep-alive-timer": 15, "register-suppress-time": 12 }, "static_routes": [{ "network": ["1.0.5.17/32", "10.0.8.0/24", "10.0.9.0/24", "10.0.10.0/24", "10.0.11.0/24", "10.0.12.0/24"], "next_hop": "10.0.7.2" @@ -71,6 +75,7 @@ "l1": {"ipv4": "auto", "pim": "enable"}, "i4": {"ipv4": "auto", "pim": "enable"} }, + "pim": { "join-prune-interval": "5", "keep-alive-timer": 15, "register-suppress-time": 12 }, "static_routes": [{ "network": ["1.0.5.17/32", "10.0.6.0/24", "10.0.8.0/24", "10.0.9.0/24", "10.0.10.0/24", "10.0.11.0/24"], "next_hop": "10.0.2.2" @@ -87,6 +92,7 @@ "f1": {"ipv4": "auto", "pim": "enable"}, "i5": {"ipv4": "auto", "pim": "enable"} }, + "pim": { "join-prune-interval": "5", "keep-alive-timer": 15, "register-suppress-time": 12 }, "static_routes": [{ "network": ["1.0.5.17/32", "10.0.5.0/24", "10.0.6.0/24", "10.0.7.0/24", "10.0.8.0/24", "10.0.9.0/24", "10.0.10.0/24", "10.0.11.0/24"], "next_hop": "10.0.3.2" diff --git a/tests/topotests/multicast_pim_sm_topo3/multicast_pim_sm_topo4.json b/tests/topotests/multicast_pim_sm_topo3/multicast_pim_sm_topo4.json index 4635dac7d2..afb55994a7 100644 --- a/tests/topotests/multicast_pim_sm_topo3/multicast_pim_sm_topo4.json +++ b/tests/topotests/multicast_pim_sm_topo3/multicast_pim_sm_topo4.json @@ -13,10 +13,12 @@ "r2": {"ipv4": "auto", "pim": "enable"}, "c1": {"ipv4": "auto", "pim": "enable"} }, + "pim": { "join-prune-interval": "5", "keep-alive-timer": 15, "register-suppress-time": 12 }, "igmp": { "interfaces": { "l1-i1-eth1" :{ "igmp":{ + "query": {"query-max-response-time": 40, "query-interval": 5}, "version": "2" } } @@ -40,6 +42,7 @@ "f1": {"ipv4": "auto", "pim": "enable"}, "i3": {"ipv4": "auto", "pim": "enable"} }, + "pim": { "join-prune-interval": "5", "keep-alive-timer": 15, "register-suppress-time": 12 }, "static_routes": [{ "network": ["10.0.4.0/24","10.0.3.1/24"], "next_hop": "10.0.7.1" @@ -57,6 +60,7 @@ "i2": {"ipv4": "auto", "pim": "enable"}, "i8": {"ipv4": "auto", "pim": "enable"} }, + "pim": { "join-prune-interval": "5", "keep-alive-timer": 15, "register-suppress-time": 12 }, "static_routes": [{ "network": ["10.0.4.0/24","10.0.3.1/24"], "next_hop": "10.0.3.1" @@ -73,6 +77,7 @@ "l1": {"ipv4": "auto", "pim": "enable"}, "i4": {"ipv4": "auto", "pim": "enable"} }, + "pim": { "join-prune-interval": "5", "keep-alive-timer": 15, "register-suppress-time": 12 }, "static_routes": [{ "network": ["1.0.4.11/32","10.0.4.2/24", "10.0.3.1/24"], "next_hop": "10.0.2.2" @@ -87,6 +92,7 @@ "f1": {"ipv4": "auto", "pim": "enable"}, "i5": {"ipv4": "auto", "pim": "enable"} }, + "pim": { "join-prune-interval": "5", "keep-alive-timer": 15, "register-suppress-time": 12 }, "static_routes": [ { "network": ["1.0.4.11/32", "10.0.2.1/24", "10.0.1.2/24"], diff --git a/tests/topotests/multicast_pim_sm_topo3/test_multicast_pim_sm_topo3.py b/tests/topotests/multicast_pim_sm_topo3/test_multicast_pim_sm_topo3.py index 33f476de44..033c76081a 100755 --- a/tests/topotests/multicast_pim_sm_topo3/test_multicast_pim_sm_topo3.py +++ b/tests/topotests/multicast_pim_sm_topo3/test_multicast_pim_sm_topo3.py @@ -2014,7 +2014,7 @@ def test_verify_remove_add_igmp_commands_when_pim_configured_p0(request): intf_l1_i1 = topo["routers"]["l1"]["links"]["i1"]["interface"] input_dict_1 = { - "l1": {"igmp": {"interfaces": {intf_l1_i1: {"igmp": {"version": "2"}}}}} + "l1": {"igmp": {"interfaces": {intf_l1_i1: {"igmp": {"version": "2", "query": {"query-max-response-time": 40, "query-interval": 5}}}}}} } result = verify_igmp_config(tgen, input_dict_1) @@ -2231,8 +2231,10 @@ def test_verify_remove_add_pim_commands_when_igmp_configured_p1(request): step("Remove 'no ip pim' on receiver interface on FRR1") intf_l1_i1 = topo["routers"]["l1"]["links"]["i1"]["interface"] - input_dict_1 = {"l1": {"pim": {"disable": intf_l1_i1}}} - result = create_pim_config(tgen, topo, input_dict_1) + raw_config = { + "l1": {"raw_config": ["interface {}".format(intf_l1_i1), "no ip pim"]} + } + result = apply_raw_config(tgen, raw_config) assert result is True, "Testcase {}: Failed Error: {}".format(tc_name, result) step("Verify that no core is observed") diff --git a/tests/topotests/multicast_pim_static_rp_topo1/multicast_pim_static_rp.json b/tests/topotests/multicast_pim_static_rp_topo1/multicast_pim_static_rp.json index 6d6c047b00..39c68408b4 100644 --- a/tests/topotests/multicast_pim_static_rp_topo1/multicast_pim_static_rp.json +++ b/tests/topotests/multicast_pim_static_rp_topo1/multicast_pim_static_rp.json @@ -4,7 +4,11 @@ "link_ip_start": {"ipv4": "10.0.0.0", "v4mask": 24}, "lo_prefix": {"ipv4": "1.0.", "v4mask": 32}, "routers": { - "r0": {"links": {"r1": {"ipv4": "auto"}}}, + "r0": { + "links": { + "r1": {"ipv4": "auto"} + } + }, "r1": { "links": { "lo": {"ipv4": "auto", "type": "loopback", "pim": "enable"}, @@ -14,9 +18,20 @@ "r4": {"ipv4": "auto", "pim": "enable"} }, "pim": { - "rp": [{"rp_addr": "1.0.2.17", "group_addr_range": ["224.0.0.0/4"]}] + "join-prune-interval": "5", + "keep-alive-timer": 15, + "register-suppress-time": 12 + }, + "igmp": { + "interfaces": { + "r1-r0-eth0": { + "igmp": { + "query": {"query-max-response-time": 40, "query-interval": 5}, + "version": "2" + } + } + } }, - "igmp": {"interfaces": {"r1-r0-eth0": {"igmp": {"version": "2"}}}}, "static_routes": [ {"network": "10.0.4.0/24", "next_hop": "10.0.2.2"}, {"network": "10.0.5.0/24", "next_hop": "10.0.2.2"}, @@ -35,6 +50,9 @@ "r3": {"ipv4": "auto", "pim": "enable"} }, "pim": { + "join-prune-interval": "5", + "keep-alive-timer": 15, + "register-suppress-time": 12, "rp": [{"rp_addr": "1.0.2.17", "group_addr_range": ["224.0.0.0/4"]}] }, "static_routes": [ @@ -57,7 +75,9 @@ "r5": {"ipv4": "auto", "pim": "enable"} }, "pim": { - "rp": [{"rp_addr": "1.0.2.17", "group_addr_range": ["224.0.0.0/4"]}] + "join-prune-interval": "5", + "keep-alive-timer": 15, + "register-suppress-time": 12 }, "static_routes": [ {"network": "10.0.0.0/24", "next_hop": "10.0.2.1"}, @@ -75,7 +95,9 @@ "r3": {"ipv4": "auto", "pim": "enable"} }, "pim": { - "rp": [{"rp_addr": "1.0.2.17", "group_addr_range": ["224.0.0.0/4"]}] + "join-prune-interval": "5", + "keep-alive-timer": 15, + "register-suppress-time": 12 }, "static_routes": [ {"network": "10.0.0.0/24", "next_hop": "10.0.3.1"}, @@ -88,6 +110,10 @@ {"network": "1.0.3.17/32", "next_hop": "10.0.5.1"} ] }, - "r5": {"links": {"r3": {"ipv4": "auto"}}} + "r5": { + "links": { + "r3": {"ipv4": "auto"} + } + } } } diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_single_area.py b/tests/topotests/ospf_basic_functionality/test_ospf_single_area.py index a595bc0491..374d68509c 100644 --- a/tests/topotests/ospf_basic_functionality/test_ospf_single_area.py +++ b/tests/topotests/ospf_basic_functionality/test_ospf_single_area.py @@ -1011,7 +1011,7 @@ def test_ospf_tc4_mtu_ignore_p0(request): r0_r1_intf = topo["routers"]["r0"]["links"]["r1"]["interface"] r1_r0_intf = topo["routers"]["r1"]["links"]["r0"]["interface"] - rtr0.run("ifconfig {} mtu 1200".format(r0_r1_intf)) + rtr0.run("ip link set {} mtu 1200".format(r0_r1_intf)) clear_ospf(tgen, "r0") @@ -1037,7 +1037,7 @@ def test_ospf_tc4_mtu_ignore_p0(request): "Modify the MTU to non default Value on R0 to R1 interface. " "Reset ospf neighbors on R0." ) - rtr0.run("ifconfig {} mtu 1500".format(r0_r1_intf)) + rtr0.run("ip link set {} mtu 1500".format(r0_r1_intf)) clear_ospf(tgen, "r0") @@ -1062,7 +1062,7 @@ def test_ospf_tc4_mtu_ignore_p0(request): result = config_ospf_interface(tgen, topo, r1_ospf_mtu) assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) - rtr0.run("ifconfig {} mtu 1200".format(r0_r1_intf)) + rtr0.run("ip link set {} mtu 1200".format(r0_r1_intf)) clear_ospf(tgen, "r0") @@ -1094,7 +1094,7 @@ def test_ospf_tc4_mtu_ignore_p0(request): step("Modify the MTU to again default valaue on R0 to R1 interface.") - rtr0.run("ifconfig {} mtu 1500".format(r0_r1_intf)) + rtr0.run("ip link set {} mtu 1500".format(r0_r1_intf)) clear_ospf(tgen, "r0") @@ -1106,8 +1106,8 @@ def test_ospf_tc4_mtu_ignore_p0(request): "Configure ospf interface with jumbo MTU (9216)." "Reset ospf neighbors on R0." ) - rtr0.run("ifconfig {} mtu 9216".format(r0_r1_intf)) - rtr1.run("ifconfig {} mtu 9216".format(r1_r0_intf)) + rtr0.run("ip link set {} mtu 9216".format(r0_r1_intf)) + rtr1.run("ip link set {} mtu 9216".format(r1_r0_intf)) clear_ospf(tgen, "r0") clear_ospf(tgen, "r1") diff --git a/tests/topotests/ospf_topo1_vrf/r1/ospfd.conf b/tests/topotests/ospf_topo1_vrf/r1/ospfd.conf index 9a68635568..e1e2bfb99a 100644 --- a/tests/topotests/ospf_topo1_vrf/r1/ospfd.conf +++ b/tests/topotests/ospf_topo1_vrf/r1/ospfd.conf @@ -3,7 +3,7 @@ hostname r1 password zebra log file /tmp/r1-ospfd.log ! -router ospf vrf r1-cust1 +router ospf vrf r1-ospf-cust1 ospf router-id 10.0.255.1 redistribute kernel redistribute connected diff --git a/tests/topotests/ospf_topo1_vrf/r1/ospfroute.txt b/tests/topotests/ospf_topo1_vrf/r1/ospfroute.txt index 134a10a454..d617ab36d9 100644 --- a/tests/topotests/ospf_topo1_vrf/r1/ospfroute.txt +++ b/tests/topotests/ospf_topo1_vrf/r1/ospfroute.txt @@ -1,4 +1,4 @@ -VRF Name: r1-cust1 +VRF Name: r1-ospf-cust1 ============ OSPF network routing table ============ N 10.0.1.0/24 [10] area: 0.0.0.0 directly attached to r1-eth0 diff --git a/tests/topotests/ospf_topo1_vrf/r1/ospfroute_down.txt b/tests/topotests/ospf_topo1_vrf/r1/ospfroute_down.txt index 083d77126c..4f7fd699cf 100644 --- a/tests/topotests/ospf_topo1_vrf/r1/ospfroute_down.txt +++ b/tests/topotests/ospf_topo1_vrf/r1/ospfroute_down.txt @@ -1,4 +1,4 @@ -VRF Name: r1-cust1 +VRF Name: r1-ospf-cust1 ============ OSPF network routing table ============ N 10.0.1.0/24 [10] area: 0.0.0.0 directly attached to r1-eth0 diff --git a/tests/topotests/ospf_topo1_vrf/r1/zebra.conf b/tests/topotests/ospf_topo1_vrf/r1/zebra.conf index e826793657..e100d3b121 100644 --- a/tests/topotests/ospf_topo1_vrf/r1/zebra.conf +++ b/tests/topotests/ospf_topo1_vrf/r1/zebra.conf @@ -7,10 +7,10 @@ hostname r1 password zebra log file /tmp/r1-zebra.log ! -interface r1-eth0 vrf r1-cust1 +interface r1-eth0 vrf r1-ospf-cust1 ip address 10.0.1.1/24 ! -interface r1-eth1 vrf r1-cust1 +interface r1-eth1 vrf r1-ospf-cust1 ip address 10.0.3.2/24 ! ip forwarding diff --git a/tests/topotests/ospf_topo1_vrf/r1/zebraroute.txt b/tests/topotests/ospf_topo1_vrf/r1/zebraroute.txt index d72aa3b8e5..979af20c59 100644 --- a/tests/topotests/ospf_topo1_vrf/r1/zebraroute.txt +++ b/tests/topotests/ospf_topo1_vrf/r1/zebraroute.txt @@ -1,4 +1,4 @@ -VRF r1-cust1: +VRF r1-ospf-cust1: O 10.0.1.0/24 [110/10] is directly connected, r1-eth0, weight 1, XX:XX:XX C>* 10.0.1.0/24 is directly connected, r1-eth0, XX:XX:XX O>* 10.0.2.0/24 [110/20] via 10.0.3.3, r1-eth1, weight 1, XX:XX:XX diff --git a/tests/topotests/ospf_topo1_vrf/r1/zebraroutedown.txt b/tests/topotests/ospf_topo1_vrf/r1/zebraroutedown.txt index 5ea6bdc04d..ec99fad762 100644 --- a/tests/topotests/ospf_topo1_vrf/r1/zebraroutedown.txt +++ b/tests/topotests/ospf_topo1_vrf/r1/zebraroutedown.txt @@ -1,4 +1,4 @@ -VRF r1-cust1: +VRF r1-ospf-cust1: O 10.0.1.0/24 [110/10] is directly connected, r1-eth0, weight 1, XX:XX:XX C>* 10.0.1.0/24 is directly connected, r1-eth0, XX:XX:XX O>* 10.0.2.0/24 [110/20] via 10.0.3.3, r1-eth1, weight 1, XX:XX:XX diff --git a/tests/topotests/ospf_topo1_vrf/r2/ospfd.conf b/tests/topotests/ospf_topo1_vrf/r2/ospfd.conf index ad481a996d..c1984276f4 100644 --- a/tests/topotests/ospf_topo1_vrf/r2/ospfd.conf +++ b/tests/topotests/ospf_topo1_vrf/r2/ospfd.conf @@ -4,7 +4,7 @@ password zebra log file /tmp/r2-ospfd.log ! ! -router ospf vrf r2-cust1 +router ospf vrf r2-ospf-cust1 ospf router-id 10.0.255.2 redistribute kernel redistribute connected diff --git a/tests/topotests/ospf_topo1_vrf/r2/ospfroute.txt b/tests/topotests/ospf_topo1_vrf/r2/ospfroute.txt index a49cb77249..89763ff733 100644 --- a/tests/topotests/ospf_topo1_vrf/r2/ospfroute.txt +++ b/tests/topotests/ospf_topo1_vrf/r2/ospfroute.txt @@ -1,4 +1,4 @@ -VRF Name: r2-cust1 +VRF Name: r2-ospf-cust1 ============ OSPF network routing table ============ N 10.0.1.0/24 [20] area: 0.0.0.0 via 10.0.3.2, r2-eth1 diff --git a/tests/topotests/ospf_topo1_vrf/r2/ospfroute_down.txt b/tests/topotests/ospf_topo1_vrf/r2/ospfroute_down.txt index 2227bedf07..d946f02dfd 100644 --- a/tests/topotests/ospf_topo1_vrf/r2/ospfroute_down.txt +++ b/tests/topotests/ospf_topo1_vrf/r2/ospfroute_down.txt @@ -1,4 +1,4 @@ -VRF Name: r2-cust1 +VRF Name: r2-ospf-cust1 ============ OSPF network routing table ============ N 10.0.1.0/24 [20] area: 0.0.0.0 via 10.0.3.2, r2-eth1 diff --git a/tests/topotests/ospf_topo1_vrf/r2/zebra.conf b/tests/topotests/ospf_topo1_vrf/r2/zebra.conf index 8dcb713da6..6ff72d1267 100644 --- a/tests/topotests/ospf_topo1_vrf/r2/zebra.conf +++ b/tests/topotests/ospf_topo1_vrf/r2/zebra.conf @@ -3,10 +3,10 @@ hostname r2 password zebra log file /tmp/r2-zebra.log ! -interface r2-eth0 vrf r2-cust1 +interface r2-eth0 vrf r2-ospf-cust1 ip address 10.0.2.1/24 ! -interface r2-eth1 vrf r2-cust1 +interface r2-eth1 vrf r2-ospf-cust1 ip address 10.0.3.3/24 ! ip forwarding diff --git a/tests/topotests/ospf_topo1_vrf/r2/zebraroute.txt b/tests/topotests/ospf_topo1_vrf/r2/zebraroute.txt index ce5e5f3bab..df66e92abc 100644 --- a/tests/topotests/ospf_topo1_vrf/r2/zebraroute.txt +++ b/tests/topotests/ospf_topo1_vrf/r2/zebraroute.txt @@ -1,4 +1,4 @@ -VRF r2-cust1: +VRF r2-ospf-cust1: O>* 10.0.1.0/24 [110/20] via 10.0.3.2, r2-eth1, weight 1, XX:XX:XX O 10.0.2.0/24 [110/10] is directly connected, r2-eth0, weight 1, XX:XX:XX C>* 10.0.2.0/24 is directly connected, r2-eth0, XX:XX:XX diff --git a/tests/topotests/ospf_topo1_vrf/r2/zebraroutedown.txt b/tests/topotests/ospf_topo1_vrf/r2/zebraroutedown.txt index 157811ec77..4afc354ca7 100644 --- a/tests/topotests/ospf_topo1_vrf/r2/zebraroutedown.txt +++ b/tests/topotests/ospf_topo1_vrf/r2/zebraroutedown.txt @@ -1,4 +1,4 @@ -VRF r2-cust1: +VRF r2-ospf-cust1: O>* 10.0.1.0/24 [110/20] via 10.0.3.2, r2-eth1, weight 1, XX:XX:XX O 10.0.2.0/24 [110/10] is directly connected, r2-eth0, weight 1, XX:XX:XX C>* 10.0.2.0/24 is directly connected, r2-eth0, XX:XX:XX diff --git a/tests/topotests/ospf_topo1_vrf/r3/ospfd.conf b/tests/topotests/ospf_topo1_vrf/r3/ospfd.conf index d5214f734e..b73d547e3e 100644 --- a/tests/topotests/ospf_topo1_vrf/r3/ospfd.conf +++ b/tests/topotests/ospf_topo1_vrf/r3/ospfd.conf @@ -4,7 +4,7 @@ password zebra log file /tmp/r3-ospfd.log ! ! -router ospf vrf r3-cust1 +router ospf vrf r3-ospf-cust1 ospf router-id 10.0.255.3 redistribute kernel redistribute connected diff --git a/tests/topotests/ospf_topo1_vrf/r3/ospfroute.txt b/tests/topotests/ospf_topo1_vrf/r3/ospfroute.txt index 3b16bfbd55..917702b14c 100644 --- a/tests/topotests/ospf_topo1_vrf/r3/ospfroute.txt +++ b/tests/topotests/ospf_topo1_vrf/r3/ospfroute.txt @@ -1,4 +1,4 @@ -VRF Name: r3-cust1 +VRF Name: r3-ospf-cust1 ============ OSPF network routing table ============ N 10.0.1.0/24 [20] area: 0.0.0.0 via 10.0.3.2, r3-eth0 diff --git a/tests/topotests/ospf_topo1_vrf/r3/ospfroute_down.txt b/tests/topotests/ospf_topo1_vrf/r3/ospfroute_down.txt index 39beac7a73..966185e495 100644 --- a/tests/topotests/ospf_topo1_vrf/r3/ospfroute_down.txt +++ b/tests/topotests/ospf_topo1_vrf/r3/ospfroute_down.txt @@ -1,4 +1,4 @@ -VRF Name: r3-cust1 +VRF Name: r3-ospf-cust1 ============ OSPF network routing table ============ N 10.0.10.0/24 [10] area: 0.0.0.0 directly attached to r3-eth1 diff --git a/tests/topotests/ospf_topo1_vrf/r3/zebra.conf b/tests/topotests/ospf_topo1_vrf/r3/zebra.conf index b548694330..1534150048 100644 --- a/tests/topotests/ospf_topo1_vrf/r3/zebra.conf +++ b/tests/topotests/ospf_topo1_vrf/r3/zebra.conf @@ -3,10 +3,10 @@ hostname r3 password zebra log file /tmp/r3-zebra.log ! -interface r3-eth0 vrf r3-cust1 +interface r3-eth0 vrf r3-ospf-cust1 ip address 10.0.3.1/24 ! -interface r3-eth1 vrf r3-cust1 +interface r3-eth1 vrf r3-ospf-cust1 ip address 10.0.10.1/24 ! ip forwarding diff --git a/tests/topotests/ospf_topo1_vrf/r3/zebraroute.txt b/tests/topotests/ospf_topo1_vrf/r3/zebraroute.txt index f40b7b09af..b435c2ebe5 100644 --- a/tests/topotests/ospf_topo1_vrf/r3/zebraroute.txt +++ b/tests/topotests/ospf_topo1_vrf/r3/zebraroute.txt @@ -1,4 +1,4 @@ -VRF r3-cust1: +VRF r3-ospf-cust1: O>* 10.0.1.0/24 [110/20] via 10.0.3.2, r3-eth0, weight 1, XX:XX:XX O>* 10.0.2.0/24 [110/20] via 10.0.3.3, r3-eth0, weight 1, XX:XX:XX O 10.0.3.0/24 [110/10] is directly connected, r3-eth0, weight 1, XX:XX:XX diff --git a/tests/topotests/ospf_topo1_vrf/r3/zebraroutedown.txt b/tests/topotests/ospf_topo1_vrf/r3/zebraroutedown.txt index 89cd6f56c4..f30a4be6c6 100644 --- a/tests/topotests/ospf_topo1_vrf/r3/zebraroutedown.txt +++ b/tests/topotests/ospf_topo1_vrf/r3/zebraroutedown.txt @@ -1,4 +1,4 @@ -VRF r3-cust1: +VRF r3-ospf-cust1: O 10.0.10.0/24 [110/10] is directly connected, r3-eth1, weight 1, XX:XX:XX C>* 10.0.10.0/24 is directly connected, r3-eth1, XX:XX:XX diff --git a/tests/topotests/ospf_topo1_vrf/test_ospf_topo1_vrf.py b/tests/topotests/ospf_topo1_vrf/test_ospf_topo1_vrf.py index e2cb7bff03..713a65a812 100644 --- a/tests/topotests/ospf_topo1_vrf/test_ospf_topo1_vrf.py +++ b/tests/topotests/ospf_topo1_vrf/test_ospf_topo1_vrf.py @@ -100,17 +100,17 @@ def setup_module(mod): logger.info("Testing with VRF Namespace support") cmds = [ - "if [ -e /var/run/netns/{0}-cust1 ] ; then ip netns del {0}-cust1 ; fi", - "ip netns add {0}-cust1", - "ip link set dev {0}-eth0 netns {0}-cust1", - "ip netns exec {0}-cust1 ifconfig {0}-eth0 up", - "ip link set dev {0}-eth1 netns {0}-cust1", - "ip netns exec {0}-cust1 ifconfig {0}-eth1 up", + "if [ -e /var/run/netns/{0}-ospf-cust1 ] ; then ip netns del {0}-ospf-cust1 ; fi", + "ip netns add {0}-ospf-cust1", + "ip link set dev {0}-eth0 netns {0}-ospf-cust1", + "ip netns exec {0}-ospf-cust1 ip link set {0}-eth0 up", + "ip link set dev {0}-eth1 netns {0}-ospf-cust1", + "ip netns exec {0}-ospf-cust1 ip link set {0}-eth1 up", ] for rname, router in router_list.items(): - # create VRF rx-cust1 and link rx-eth0 to rx-cust1 + # create VRF rx-ospf-cust1 and link rx-eth0 to rx-ospf-cust1 for cmd in cmds: output = tgen.net[rname].cmd(cmd.format(rname)) @@ -137,9 +137,9 @@ def teardown_module(mod): # move back rx-eth0 to default VRF # delete rx-vrf cmds = [ - "ip netns exec {0}-cust1 ip link set {0}-eth0 netns 1", - "ip netns exec {0}-cust1 ip link set {0}-eth1 netns 1", - "ip netns delete {0}-cust1", + "ip netns exec {0}-ospf-cust1 ip link set {0}-eth0 netns 1", + "ip netns exec {0}-ospf-cust1 ip link set {0}-eth1 netns 1", + "ip netns delete {0}-ospf-cust1", ] router_list = tgen.routers() @@ -152,11 +152,11 @@ def teardown_module(mod): # Shared test function to validate expected output. def compare_show_ip_route_vrf(rname, expected): """ - Calls 'show ip ospf vrf [rname]-cust1 route' for router `rname` and compare the obtained + Calls 'show ip ospf vrf [rname]-ospf-cust1 route' for router `rname` and compare the obtained result with the expected output. """ tgen = get_topogen() - vrf_name = "{0}-cust1".format(rname) + vrf_name = "{0}-ospf-cust1".format(rname) current = topotest.ip4_route_zebra(tgen.gears[rname], vrf_name) ret = topotest.difflines( current, expected, title1="Current output", title2="Expected output" @@ -182,7 +182,7 @@ def test_ospf_convergence(): test_func = partial( topotest.router_output_cmp, router, - "show ip ospf vrf {0}-cust1 route".format(rname), + "show ip ospf vrf {0}-ospf-cust1 route".format(rname), expected, ) result, diff = topotest.run_and_expect(test_func, "", count=160, wait=0.5) @@ -220,13 +220,13 @@ def test_ospf_json(): for rname, router in tgen.routers().items(): logger.info( - 'Comparing router "%s" "show ip ospf vrf %s-cust1 json" output', + 'Comparing router "%s" "show ip ospf vrf %s-ospf-cust1 json" output', router.name, router.name, ) expected = { - "{}-cust1".format(router.name): { - "vrfName": "{}-cust1".format(router.name), + "{}-ospf-cust1".format(router.name): { + "vrfName": "{}-ospf-cust1".format(router.name), "routerId": "10.0.255.{}".format(rname[1:]), "tosRoutesOnly": True, "rfc2328Conform": True, @@ -244,7 +244,7 @@ def test_ospf_json(): } # Area specific additional checks if router.name == "r1" or router.name == "r2" or router.name == "r3": - expected["{}-cust1".format(router.name)]["areas"]["0.0.0.0"] = { + expected["{}-ospf-cust1".format(router.name)]["areas"]["0.0.0.0"] = { "areaIfActiveCounter": 2, "areaIfTotalCounter": 2, "authentication": "authenticationNone", @@ -263,7 +263,7 @@ def test_ospf_json(): test_func = partial( topotest.router_json_cmp, router, - "show ip ospf vrf {0}-cust1 json".format(rname), + "show ip ospf vrf {0}-ospf-cust1 json".format(rname), expected, ) _, diff = topotest.run_and_expect(test_func, None, count=10, wait=0.5) @@ -281,7 +281,7 @@ def test_ospf_link_down(): # Simulate a network down event on router3 switch3 interface. router3 = tgen.gears["r3"] topotest.interface_set_status( - router3, "r3-eth0", ifaceaction=False, vrf_name="r3-cust1" + router3, "r3-eth0", ifaceaction=False, vrf_name="r3-ospf-cust1" ) # Expect convergence on all routers @@ -295,7 +295,7 @@ def test_ospf_link_down(): test_func = partial( topotest.router_output_cmp, router, - "show ip ospf vrf {0}-cust1 route".format(rname), + "show ip ospf vrf {0}-ospf-cust1 route".format(rname), expected, ) result, diff = topotest.run_and_expect(test_func, "", count=140, wait=0.5) @@ -316,7 +316,7 @@ def test_ospf_link_down_kernel_route(): 'Checking OSPF IPv4 kernel routes in "%s" after link down', router.name ) - str = "{0}-cust1".format(router.name) + str = "{0}-ospf-cust1".format(router.name) reffile = os.path.join(CWD, "{}/zebraroutedown.txt".format(router.name)) expected = open(reffile).read() # Run test function until we get an result. Wait at most 60 seconds. diff --git a/tests/topotests/zebra_rib/test_zebra_rib.py b/tests/topotests/zebra_rib/test_zebra_rib.py index 56d112b7c3..778a710ee3 100644 --- a/tests/topotests/zebra_rib/test_zebra_rib.py +++ b/tests/topotests/zebra_rib/test_zebra_rib.py @@ -104,13 +104,19 @@ def test_zebra_kernel_admin_distance(): r1 = tgen.gears["r1"] # Route with 255/8192 metric - r1.run("ip route add 4.5.1.0/24 via 192.168.210.2 dev r1-eth0 metric 4278198272") + + distance = 255 + metric = 8192 + def makekmetric(dist, metric): + return (dist << 24) + metric + + r1.run("ip route add 4.5.1.0/24 via 192.168.210.2 dev r1-eth0 metric " + str(makekmetric(255, 8192))) # Route with 1/1 metric - r1.run("ip route add 4.5.2.0/24 via 192.168.211.2 dev r1-eth1 metric 16777217") + r1.run("ip route add 4.5.2.0/24 via 192.168.211.2 dev r1-eth1 metric " + str(makekmetric(1, 1))) # Route with 10/1 metric - r1.run("ip route add 4.5.3.0/24 via 192.168.212.2 dev r1-eth2 metric 167772161") + r1.run("ip route add 4.5.3.0/24 via 192.168.212.2 dev r1-eth2 metric " + str(makekmetric(10, 1))) # Same route with a 160/1 metric - r1.run("ip route add 4.5.3.0/24 via 192.168.213.2 dev r1-eth3 metric 2684354561") + r1.run("ip route add 4.5.3.0/24 via 192.168.213.2 dev r1-eth3 metric " + str(makekmetric(160, 1))) # Currently I believe we have a bug here with the same route and different # metric. That needs to be properly resolved. Making a note for @@ -194,93 +200,69 @@ def test_route_map_usage(): static_rmapfile = "%s/r1/static_rmap.ref" % (thisDir) expected = open(static_rmapfile).read().rstrip() expected = ("\n".join(expected.splitlines()) + "\n").rstrip() - actual = r1.vtysh_cmd("show route-map static") - actual = ("\n".join(actual.splitlines()) + "\n").rstrip() logger.info( "Does the show route-map static command run the correct number of times" ) - - diff = topotest.get_textdiff( - actual, - expected, - title1="Actual Route-map output", - title2="Expected Route-map output", - ) - if diff: - logger.info("Actual:") - logger.info(actual) - logger.info("Expected:") - logger.info(expected) - srun = r1.vtysh_cmd("show run") - srun = ("\n".join(srun.splitlines()) + "\n").rstrip() - logger.info("Show run") - logger.info(srun) - assert 0, "r1 static route processing:\n" + def check_static_map_correct_runs(): + actual = r1.vtysh_cmd("show route-map static") + actual = ("\n".join(actual.splitlines()) + "\n").rstrip() + return topotest.get_textdiff( + actual, + expected, + title1="Actual Route-map output", + title2="Expected Route-map output", + ) + ok, result = topotest.run_and_expect(check_static_map_correct_runs, "", count=5, wait=1) + assert ok, result sharp_rmapfile = "%s/r1/sharp_rmap.ref" % (thisDir) expected = open(sharp_rmapfile).read().rstrip() expected = ("\n".join(expected.splitlines()) + "\n").rstrip() - actual = r1.vtysh_cmd("show route-map sharp") - actual = ("\n".join(actual.splitlines()) + "\n").rstrip() logger.info("Does the show route-map sharp command run the correct number of times") - - diff = topotest.get_textdiff( - actual, - expected, - title1="Actual Route-map output", - title2="Expected Route-map output", - ) - if diff: - logger.info("Actual:") - logger.info(actual) - logger.info("Expected:") - logger.info(expected) - srun = r1.vtysh_cmd("show run") - srun = ("\n".join(srun.splitlines()) + "\n").rstrip() - logger.info("Show run:") - logger.info(srun) - assert 0, "r1 sharp route-map processing:\n" + def check_sharp_map_correct_runs(): + actual = r1.vtysh_cmd("show route-map sharp") + actual = ("\n".join(actual.splitlines()) + "\n").rstrip() + return topotest.get_textdiff( + actual, + expected, + title1="Actual Route-map output", + title2="Expected Route-map output", + ) + ok, result = topotest.run_and_expect(check_sharp_map_correct_runs, "", count=5, wait=1) + assert ok, result logger.info( "Add a extension to the static route-map to see the static route go away" + " and test that the routes installed are correct" ) + r1.vtysh_cmd("conf\nroute-map sharp deny 5\nmatch ip address 5") - sleep(2) # we are only checking the kernel here as that this will give us the implied # testing of both the route-map and staticd withdrawing the route # let's spot check that the routes were installed correctly # in the kernel - logger.info("Test that the routes installed are correct") sharp_ipfile = "%s/r1/iproute.ref" % (thisDir) expected = open(sharp_ipfile).read().rstrip() expected = ("\n".join(expected.splitlines()) + "\n").rstrip() - actual = r1.run("ip route show") - actual = ("\n".join(actual.splitlines()) + "\n").rstrip() - actual = re.sub(r" nhid [0-9][0-9]", "", actual) - actual = re.sub(r" proto sharp", " proto XXXX", actual) - actual = re.sub(r" proto static", " proto XXXX", actual) - actual = re.sub(r" proto 194", " proto XXXX", actual) - actual = re.sub(r" proto 196", " proto XXXX", actual) - actual = re.sub(r" proto kernel", " proto XXXX", actual) - actual = re.sub(r" proto 2", " proto XXXX", actual) - # Some platforms have double spaces? Why?????? - actual = re.sub(r" proto XXXX ", " proto XXXX ", actual) - actual = re.sub(r" metric", " metric", actual) - actual = re.sub(r" link ", " link ", actual) - diff = topotest.get_textdiff( - actual, expected, title1="Actual ip route show", title2="Expected ip route show" - ) - - if diff: - logger.info("Actual:") - logger.info(actual) - logger.info("Expected:") - logger.info(expected) - srun = r1.vtysh_cmd("show run") - srun = ("\n".join(srun.splitlines()) + "\n").rstrip() - logger.info("Show run:") - logger.info(srun) - assert 0, "r1 ip route show is not correct:" + def check_routes_installed(): + actual = r1.run("ip route show") + actual = ("\n".join(actual.splitlines()) + "\n").rstrip() + actual = re.sub(r" nhid [0-9][0-9]", "", actual) + actual = re.sub(r" proto sharp", " proto XXXX", actual) + actual = re.sub(r" proto static", " proto XXXX", actual) + actual = re.sub(r" proto 194", " proto XXXX", actual) + actual = re.sub(r" proto 196", " proto XXXX", actual) + actual = re.sub(r" proto kernel", " proto XXXX", actual) + actual = re.sub(r" proto 2", " proto XXXX", actual) + # Some platforms have double spaces? Why?????? + actual = re.sub(r" proto XXXX ", " proto XXXX ", actual) + actual = re.sub(r" metric", " metric", actual) + actual = re.sub(r" link ", " link ", actual) + return topotest.get_textdiff( + actual, expected, title1="Actual ip route show", title2="Expected ip route show" + ) + ok, result = topotest.run_and_expect(check_routes_installed, "", count=5, wait=1) + assert ok, result def test_memory_leak(): |
