summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2023-01-11 16:14:11 +0100
committerDonald Sharp <sharpd@nvidia.com>2023-01-13 14:13:52 +0100
commit2bb8b49ce13aee725fbce975eac1493890f8caff (patch)
treebd594621e7bd3e909684f6bd7f20f5d6ae1b4131 /tests
parentMerge pull request #12629 from opensourcerouting/fix/use_static_repo (diff)
downloadfrr-2bb8b49ce13aee725fbce975eac1493890f8caff.tar.xz
frr-2bb8b49ce13aee725fbce975eac1493890f8caff.zip
Revert "Merge pull request #11127 from louis-6wind/bgp-leak"
This reverts commit 16aa1809e7c8caad37e8edd4e5aaac4f344bc7d3, reversing changes made to f616e716089b16d9a678846282a6ac5c55e31a56.
Diffstat (limited to 'tests')
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/ce1/zebra.conf2
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/ce2/zebra.conf2
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/ce3/bgpd.conf1
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/ce3/zebra.conf1
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/ce4/bgpd.conf1
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/ce4/zebra.conf1
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/customize.py14
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/bgpd.conf48
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/staticd.conf6
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/zebra.conf11
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_mpls.py21
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_vrf.py50
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_routes.py77
-rw-r--r--tests/topotests/bgp_vrf_route_leak_basic/r1/bgpd.conf6
-rw-r--r--tests/topotests/bgp_vrf_route_leak_basic/r1/zebra.conf6
-rw-r--r--tests/topotests/bgp_vrf_route_leak_basic/test_bgp-vrf-route-leak-basic.py234
-rw-r--r--tests/topotests/lib/bgprib.py193
-rw-r--r--tests/topotests/ospf_multi_vrf_bgp_route_leak/r1/zebra-vrf-default.txt2
-rw-r--r--tests/topotests/ospf_multi_vrf_bgp_route_leak/r2/zebra-vrf-default.txt2
-rw-r--r--tests/topotests/ospf_multi_vrf_bgp_route_leak/r2/zebra-vrf-ray.txt4
20 files changed, 136 insertions, 546 deletions
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce1/zebra.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce1/zebra.conf
index 375bbea9f..46831bb71 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce1/zebra.conf
+++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce1/zebra.conf
@@ -4,8 +4,6 @@ hostname ce1
!
interface lo
ip address 99.0.0.1/32
- ip address 5.1.0.1/24
- ip address 6.0.2.1/24
!
interface ce1-eth0
description to r1
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce2/zebra.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce2/zebra.conf
index 90dd3c55b..fb4d8cc9c 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce2/zebra.conf
+++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce2/zebra.conf
@@ -4,8 +4,6 @@ hostname ce2
!
interface lo
ip address 99.0.0.2/32
- ip address 5.1.0.1/24
- ip address 6.0.2.1/24
!
interface ce2-eth0
description to r3
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce3/bgpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce3/bgpd.conf
index cf7396eb1..e316de569 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce3/bgpd.conf
+++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce3/bgpd.conf
@@ -19,7 +19,6 @@ router bgp 5227
network 5.1.3.0/24 route-map rm-nh
network 6.0.1.0/24 route-map rm-nh
network 6.0.2.0/24 route-map rm-nh-same
- network 6.0.3.0/24 route-map rm-nh-same
neighbor 192.168.1.1 activate
exit-address-family
!
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce3/zebra.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce3/zebra.conf
index df6ac47b0..77a1163a4 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce3/zebra.conf
+++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce3/zebra.conf
@@ -4,7 +4,6 @@ hostname ce3
!
interface lo
ip address 99.0.0.3/32
- ip address 6.0.3.1/24
!
interface ce3-eth0
description to r4
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce4/bgpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce4/bgpd.conf
index 9a6ca08a0..60d9e9310 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce4/bgpd.conf
+++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce4/bgpd.conf
@@ -19,7 +19,6 @@ router bgp 5228 vrf ce4-cust2
network 5.4.3.0/24 route-map rm-nh
network 6.0.1.0/24 route-map rm-nh
network 6.0.2.0/24 route-map rm-nh-same
- network 6.0.3.0/24 route-map rm-nh-same
neighbor 192.168.2.1 activate
exit-address-family
!
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce4/zebra.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce4/zebra.conf
index 0e3a73629..e55c9e779 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce4/zebra.conf
+++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce4/zebra.conf
@@ -4,7 +4,6 @@ hostname ce4
!
interface ce4-cust2
ip address 99.0.0.4/32
- ip address 6.0.3.1/24
!
interface ce4-eth0
description to r4
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/customize.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/customize.py
index b2bf5f5f6..5161d8471 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/customize.py
+++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/customize.py
@@ -175,20 +175,6 @@ def ltemplatePreRouterStartHook():
"setup {0} vrf {0}-cust1, {0}-eth4. enabled mpls input.".format(rtr)
)
# configure cust2 VRFs & MPLS
- rtrs = ["r1"]
- cmds = [
- "ip link add {0}-cust3 type vrf table 20",
- "ip link set dev {0}-cust3 up",
- "ip link add {0}-cust4 type vrf table 30",
- "ip link set dev {0}-cust4 up",
- "ip link add {0}-cust5 type vrf table 40",
- "ip link set dev {0}-cust5 up",
- ]
- for rtr in rtrs:
- for cmd in cmds:
- cc.doCmd(tgen, rtr, cmd.format(rtr))
- logger.info("setup {0} vrf {0}-cust3 and{0}-cust4.".format(rtr))
- # configure cust2 VRFs & MPLS
rtrs = ["r4"]
cmds = [
"ip link add {0}-cust2 type vrf table 20",
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/bgpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/bgpd.conf
index 24e9f9537..8d42cfc0d 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/bgpd.conf
+++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/bgpd.conf
@@ -11,7 +11,6 @@ log file bgpd.log debugging
#debug bgp vpn leak-from-vrf
#debug bgp vpn label
#debug bgp updates out
-#debug bgp nht
router bgp 5226
bgp router-id 1.1.1.1
@@ -40,11 +39,6 @@ router bgp 5227 vrf r1-cust1
neighbor 192.168.1.2 timers 3 10
address-family ipv4 unicast
- network 10.2.3.4/32
- network 192.0.0.0/24
-
- redistribute connected
-
neighbor 192.168.1.2 activate
neighbor 192.168.1.2 next-hop-self
@@ -57,47 +51,5 @@ router bgp 5227 vrf r1-cust1
exit-address-family
-router bgp 5228 vrf r1-cust3
- bgp router-id 192.168.1.1
-
- address-family ipv4 unicast
- rd vpn export 10:13
- rt vpn import 52:100
-
- import vpn
- export vpn
- exit-address-family
-
-
-router bgp 5227 vrf r1-cust4
- no bgp network import-check
-
- bgp router-id 192.168.1.1
-
- address-family ipv4 unicast
- network 28.0.0.0/24
-
- rd vpn export 10:14
- rt vpn export 52:100
-
- import vpn
- export vpn
- exit-address-family
-
-
-router bgp 5227 vrf r1-cust5
- bgp router-id 192.168.1.1
-
- address-family ipv4 unicast
- redistribute connected
-
- label vpn export 105
- rd vpn export 10:15
- rt vpn both 52:100
-
- import vpn
- export vpn
- exit-address-family
-
!
end
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/staticd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/staticd.conf
deleted file mode 100644
index 59430fdf9..000000000
--- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/staticd.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-hostname r1
-log file staticd.log
-!
-vrf r1-cust1
- ip route 192.0.0.0/24 192.168.1.2
-exit-vrf
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/zebra.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/zebra.conf
index e81bc6b2a..221bc7a83 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/zebra.conf
+++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/zebra.conf
@@ -4,9 +4,6 @@ hostname r1
password zebra
#debug zebra packet
-#debug zebra rib detailed
-#debug zebra dplane detailed
-#debug zebra nexthop detail
interface lo
ip address 1.1.1.1/32
@@ -21,14 +18,6 @@ interface r1-eth4
ip address 192.168.1.1/24
no link-detect
-interface r1-cust1
- ip address 10.4.5.6/24
- no link-detect
-
-interface r1-cust5
- ip address 29.0.0.1/32
- no link-detect
-
ip forwarding
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_mpls.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_mpls.py
index 89369241a..91a7adf99 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_mpls.py
+++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_mpls.py
@@ -81,24 +81,3 @@ if ret != False and found != None:
"wait",
"CE3->CE4 (loopback) ping",
)
- luCommand(
- "r1",
- "ip vrf exec r1-cust1 ping 6.0.3.1 -I 10.4.5.6 -c 1",
- " 0. packet loss",
- "wait",
- "R1(r1-cust1)->CE3/4 (loopback) ping",
- )
- luCommand(
- "r1",
- "ip vrf exec r1-cust1 ping 6.0.3.1 -I 10.4.5.6 -c 1",
- " 0. packet loss",
- "pass",
- "R1(r1-cust1)->CE3/4 (loopback) ping",
- )
- luCommand(
- "r1",
- "ip vrf exec r1-cust5 ping 6.0.3.1 -I 29.0.0.1 -c 1",
- " 0. packet loss",
- "pass",
- "R1(r1-cust5)->CE3/4 ( (loopback) ping",
- )
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_vrf.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_vrf.py
index e9647898a..75158b127 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_vrf.py
+++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_vrf.py
@@ -72,53 +72,3 @@ luCommand(
"wait",
"CE4->PE4 ping",
)
-ret = luCommand(
- "r1",
- "ip vrf exec r1-cust5 ping 29.0.0.1 -I 29.0.0.1 -c 1",
- " 0. packet loss",
- "pass",
- "Ping its own IP. Check https://bugzilla.kernel.org/show_bug.cgi?id=203483 if it fails",
-)
-luCommand(
- "r1",
- "ip vrf exec r1-cust5 ping 192.168.1.1 -I 29.0.0.1 -c 1",
- " 0. packet loss",
- "pass",
- "R1(r1-cust5)->R1(r1-cust1 - r1-eth4) ping",
-)
-luCommand(
- "r1",
- "ip vrf exec r1-cust5 ping 192.168.1.2 -I 29.0.0.1 -c 1",
- " 0. packet loss",
- "wait",
- "R1(r1-cust5)->CE1 ping",
-)
-luCommand(
- "r1",
- "ip vrf exec r1-cust5 ping 192.168.1.2 -I 29.0.0.1 -c 1",
- " 0. packet loss",
- "pass",
- "R1(r1-cust5)->CE1 ping",
-)
-luCommand(
- "r1",
- "ip vrf exec r1-cust5 ping 99.0.0.1 -I 29.0.0.1 -c 1",
- " 0. packet loss",
- "pass",
- "R1(r1-cust5)->CE1 (loopback) ping",
-)
-luCommand(
- "r1",
- "ip vrf exec r1-cust5 ping 5.1.0.1 -I 29.0.0.1 -c 1",
- " 0. packet loss",
- "wait",
- "R1(r1-cust5)->CE1 (loopback) ping",
- time=30,
-)
-luCommand(
- "r1",
- "ip vrf exec r1-cust5 ping 5.1.0.1 -I 29.0.0.1 -c 1",
- " 0. packet loss",
- "pass",
- "R1(r1-cust5)->CE1 (loopback) ping",
-)
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_routes.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_routes.py
index 3242e3bd3..1e2758c1c 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_routes.py
+++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_routes.py
@@ -54,44 +54,15 @@ bgpribRequireUnicastRoutes("ce4", "ipv4", "ce4-cust2", "Cust 4 routes in ce1", w
#
# r1 vtysh -c "show bgp vrf r1-cust1 ipv4"
#
-want_r1_cust1_3_5_routes = [
+want_r1_cust1_routes = [
{"p": "5.1.0.0/24", "n": "99.0.0.1"},
{"p": "5.1.1.0/24", "n": "99.0.0.1"},
{"p": "6.0.1.0/24", "n": "99.0.0.1"},
{"p": "6.0.2.0/24", "n": "99.0.0.1"},
- {"p": "10.2.3.4/32", "n": "0.0.0.0", "bp": False},
- {"p": "10.4.5.0/24", "n": "0.0.0.0", "bp": True},
- {"p": "28.0.0.0/24", "n": "0.0.0.0", "bp": True},
- {"p": "29.0.0.1/32", "n": "0.0.0.0", "bp": True},
{"p": "99.0.0.1/32", "n": "192.168.1.2"},
- {"p": "192.0.0.0/24", "n": "0.0.0.0", "bp": True},
- {"p": "192.168.1.0/24", "n": "0.0.0.0", "bp": True},
]
bgpribRequireUnicastRoutes(
- "r1", "ipv4", "r1-cust1", "Customer 1 routes in r1 vrf", want_r1_cust1_3_5_routes
-)
-bgpribRequireUnicastRoutes(
- "r1", "ipv4", "r1-cust3", "Customer 3 routes in r1 vrf", want_r1_cust1_3_5_routes
-)
-bgpribRequireUnicastRoutes(
- "r1", "ipv4", "r1-cust5", "Customer 5 routes in r1 vrf", want_r1_cust1_3_5_routes
-)
-
-want_r1_cust4_routes = [
- {"p": "5.1.0.0/24", "n": "99.0.0.1", "exist": False},
- {"p": "5.1.1.0/24", "n": "99.0.0.1", "exist": False},
- {"p": "6.0.1.0/24", "n": "99.0.0.1", "exist": False},
- {"p": "6.0.2.0/24", "n": "99.0.0.1", "exist": False},
- {"p": "10.2.3.4/32", "n": "0.0.0.0", "exist": False},
- {"p": "10.4.5.0/24", "n": "0.0.0.0", "exist": False},
- {"p": "28.0.0.0/24", "n": "0.0.0.0", "bp": True},
- {"p": "29.0.0.1/32", "n": "0.0.0.0", "exist": False},
- {"p": "99.0.0.1/32", "n": "192.168.1.2", "exist": False},
- {"p": "192.0.0.0/24", "n": "0.0.0.0", "exist": False},
- {"p": "192.168.1.0/24", "n": "0.0.0.0", "exist": False},
-]
-bgpribRequireUnicastRoutes(
- "r1", "ipv4", "r1-cust4", "Customer 4 routes in r1 vrf", want_r1_cust4_routes
+ "r1", "ipv4", "r1-cust1", "Customer 1 routes in r1 vrf", want_r1_cust1_routes
)
want_r3_cust1_routes = [
@@ -99,20 +70,10 @@ want_r3_cust1_routes = [
{"p": "5.1.1.0/24", "n": "99.0.0.2"},
{"p": "6.0.1.0/24", "n": "99.0.0.2"},
{"p": "6.0.2.0/24", "n": "99.0.0.2"},
- {"p": "10.2.3.4/32", "n": "0.0.0.0", "exist": False},
- {"p": "28.0.0.0/24", "n": "1.1.1.1", "bp": True},
- {"p": "29.0.0.1/32", "n": "1.1.1.1", "bp": True},
{"p": "99.0.0.2/32", "n": "192.168.1.2"},
- {"p": "192.0.0.0/24", "n": "1.1.1.1", "bp": True},
- {"p": "192.168.1.0/24", "n": "1.1.1.1", "bp": True},
]
bgpribRequireUnicastRoutes(
- "r3",
- "ipv4",
- "r3-cust1",
- "Customer 1 routes in r3 vrf",
- want_r3_cust1_routes,
- retry=30,
+ "r3", "ipv4", "r3-cust1", "Customer 1 routes in r3 vrf", want_r3_cust1_routes
)
want_r4_cust1_routes = [
@@ -120,20 +81,10 @@ want_r4_cust1_routes = [
{"p": "5.1.3.0/24", "n": "99.0.0.3"},
{"p": "6.0.1.0/24", "n": "99.0.0.3"},
{"p": "6.0.2.0/24", "n": "99.0.0.3"},
- {"p": "10.2.3.4/32", "n": "0.0.0.0", "exist": False},
- {"p": "28.0.0.0/24", "n": "1.1.1.1", "bp": True},
- {"p": "29.0.0.1/32", "n": "1.1.1.1", "bp": True},
{"p": "99.0.0.3/32", "n": "192.168.1.2"},
- {"p": "192.0.0.0/24", "n": "1.1.1.1", "bp": True},
- {"p": "192.168.1.0/24", "n": "1.1.1.1", "bp": True},
]
bgpribRequireUnicastRoutes(
- "r4",
- "ipv4",
- "r4-cust1",
- "Customer 1 routes in r4 vrf",
- want_r4_cust1_routes,
- retry=30,
+ "r4", "ipv4", "r4-cust1", "Customer 1 routes in r4 vrf", want_r4_cust1_routes
)
want_r4_cust2_routes = [
@@ -141,20 +92,10 @@ want_r4_cust2_routes = [
{"p": "5.4.3.0/24", "n": "99.0.0.4"},
{"p": "6.0.1.0/24", "n": "99.0.0.4"},
{"p": "6.0.2.0/24", "n": "99.0.0.4"},
- {"p": "10.2.3.4/32", "n": "0.0.0.0", "exist": False},
- {"p": "28.0.0.0/24", "n": "1.1.1.1", "bp": True},
- {"p": "29.0.0.1/32", "n": "1.1.1.1", "bp": True},
{"p": "99.0.0.4/32", "n": "192.168.2.2"},
- {"p": "192.0.0.0/24", "n": "1.1.1.1", "bp": True},
- {"p": "192.168.1.0/24", "n": "1.1.1.1", "bp": True},
]
bgpribRequireUnicastRoutes(
- "r4",
- "ipv4",
- "r4-cust2",
- "Customer 2 routes in r4 vrf",
- want_r4_cust2_routes,
- retry=30,
+ "r4", "ipv4", "r4-cust2", "Customer 2 routes in r4 vrf", want_r4_cust2_routes
)
########################################################################
@@ -726,7 +667,7 @@ bgpribRequireUnicastRoutes(
luCommand(
"ce1",
'vtysh -c "show bgp ipv4 uni"',
- "18 routes and 19",
+ "12 routes and 12",
"wait",
"Local and remote routes",
10,
@@ -748,7 +689,7 @@ bgpribRequireUnicastRoutes(
luCommand(
"ce2",
'vtysh -c "show bgp ipv4 uni"',
- "18 routes and 22",
+ "12 routes and 15",
"wait",
"Local and remote routes",
10,
@@ -780,7 +721,7 @@ luCommand("r4", 'vtysh -c "show ip route vrf r4-cust2"')
luCommand(
"ce3",
'vtysh -c "show bgp ipv4 uni"',
- "18 routes and 19",
+ "12 routes and 13",
"wait",
"Local and remote routes",
10,
@@ -802,7 +743,7 @@ bgpribRequireUnicastRoutes(
luCommand(
"ce4",
'vtysh -c "show bgp vrf ce4-cust2 ipv4 uni"',
- "18 routes and 21",
+ "12 routes and 14",
"wait",
"Local and remote routes",
10,
diff --git a/tests/topotests/bgp_vrf_route_leak_basic/r1/bgpd.conf b/tests/topotests/bgp_vrf_route_leak_basic/r1/bgpd.conf
index 0540a6209..03dfbf932 100644
--- a/tests/topotests/bgp_vrf_route_leak_basic/r1/bgpd.conf
+++ b/tests/topotests/bgp_vrf_route_leak_basic/r1/bgpd.conf
@@ -1,11 +1,5 @@
hostname r1
-
-#debug bgp vpn leak-to-vrf
-#debug bgp vpn leak-from-vrf
-#debug bgp nht
-
-
router bgp 99 vrf DONNA
no bgp ebgp-requires-policy
address-family ipv4 unicast
diff --git a/tests/topotests/bgp_vrf_route_leak_basic/r1/zebra.conf b/tests/topotests/bgp_vrf_route_leak_basic/r1/zebra.conf
index 731a00829..35038557d 100644
--- a/tests/topotests/bgp_vrf_route_leak_basic/r1/zebra.conf
+++ b/tests/topotests/bgp_vrf_route_leak_basic/r1/zebra.conf
@@ -16,9 +16,3 @@ int dummy4
ip address 10.0.3.1/24
no shut
!
-int EVA
- no shut
-!
-int DONNA
- no shut
-!
diff --git a/tests/topotests/bgp_vrf_route_leak_basic/test_bgp-vrf-route-leak-basic.py b/tests/topotests/bgp_vrf_route_leak_basic/test_bgp-vrf-route-leak-basic.py
index be07c8599..191a0b53e 100644
--- a/tests/topotests/bgp_vrf_route_leak_basic/test_bgp-vrf-route-leak-basic.py
+++ b/tests/topotests/bgp_vrf_route_leak_basic/test_bgp-vrf-route-leak-basic.py
@@ -29,7 +29,6 @@ import os
import sys
from functools import partial
import pytest
-import time
CWD = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(CWD, "../"))
@@ -78,117 +77,7 @@ def teardown_module(mod):
tgen.stop_topology()
-def check_bgp_rib(router, vrf, in_fib):
- if in_fib:
- attr = [{"protocol": "bgp", "selected": True, "nexthops": [{"fib": True}]}]
- else:
- attr = [{"protocol": "bgp", "nexthops": []}]
-
- if vrf == "DONNA":
- expect = {
- "10.0.0.0/24": [
- {
- "protocol": "connected",
- }
- ],
- "10.0.1.0/24": attr,
- "10.0.2.0/24": [{"protocol": "connected"}],
- "10.0.3.0/24": attr,
- }
- else:
- expect = {
- "10.0.0.0/24": attr,
- "10.0.1.0/24": [
- {
- "protocol": "connected",
- }
- ],
- "10.0.2.0/24": attr,
- "10.0.3.0/24": [
- {
- "protocol": "connected",
- }
- ],
- }
-
- test_func = partial(
- topotest.router_json_cmp, router, "show ip route vrf %s json" % vrf, expect
- )
- return topotest.run_and_expect(test_func, None, count=10, wait=0.5)
-
-
-def check_bgp_fib(router, vrf, in_rib):
- # Check FIB
- # DONNA
- # 10.0.1.0/24 dev EVA proto bgp metric 20
- # 10.0.3.0/24 dev EVA proto bgp metric 20
- # EVA
- # 10.0.0.0/24 dev DONNA proto bgp metric 20
- # 10.0.2.0/24 dev DONNA proto bgp metric 20
-
- if vrf == "DONNA":
- table = 1001
- nh_vrf = "EVA"
- else:
- table = 1002
- nh_vrf = "DONNA"
-
- negate = "" if in_rib else "! "
-
- cmd = "%sip route show table %s | grep %s" % (negate, table, nh_vrf)
- result = False
- retry = 5
- output = ""
- while retry:
- retry -= 1
- try:
- output = router.cmd_raises(cmd)
- result = True
- break
- except:
- time.sleep(0.1)
-
- logger.info("VRF %s leaked FIB content %s: %s", vrf, cmd, output)
-
- return result, output
-
-
-def check_bgp_ping(router, vrf):
- if vrf == "DONNA":
- cmd = "ip vrf exec DONNA ping -c1 10.0.1.1 -I 10.0.0.1"
- else:
- cmd = "ip vrf exec EVA ping -c1 10.0.0.1 -I 10.0.1.1"
-
- result = False
- retry = 5
- output = ""
- while retry:
- retry -= 1
- try:
- output = router.cmd_raises(cmd)
- result = True
- break
- except:
- time.sleep(0.1)
-
- return result, output
-
-
-def check_bgp_ping_own_ip(router):
- cmd = "ip vrf exec DONNA ping -c1 10.0.0.1 -I 10.0.0.1"
-
- output = ""
- try:
- output = router.cmd_raises(cmd)
- result = True
- except:
- result = False
- pass
-
- return result, output
-
-
-def test_vrf_route_leak_test1():
+def test_vrf_route_leak():
logger.info("Ensure that routes are leaked back and forth")
tgen = get_topogen()
# Don't run this test if we have any failure.
@@ -197,86 +86,53 @@ def test_vrf_route_leak_test1():
r1 = tgen.gears["r1"]
- result, output = check_bgp_ping_own_ip(r1)
- assert (
- result
- ), "Ping from VRF fails - check https://bugzilla.kernel.org/show_bug.cgi?id=203483\n:{}".format(
- output
- )
-
- for vrf in ["EVA", "DONNA"]:
- result, diff = check_bgp_rib(r1, vrf, True)
- assert result, "BGP RIB VRF {} check failed:\n{}".format(vrf, diff)
- result, output = check_bgp_fib(r1, vrf, True)
- assert result, "BGP FIB VRF {} check failed:\n{}".format(vrf, output)
- result, output = check_bgp_ping(r1, vrf)
- assert result, "Ping from VRF {} failed:\n{}".format(vrf, output)
-
+ # Test DONNA VRF.
+ expect = {
+ "10.0.0.0/24": [
+ {
+ "protocol": "connected",
+ }
+ ],
+ "10.0.1.0/24": [
+ {"protocol": "bgp", "selected": True, "nexthops": [{"fib": True}]}
+ ],
+ "10.0.2.0/24": [{"protocol": "connected"}],
+ "10.0.3.0/24": [
+ {"protocol": "bgp", "selected": True, "nexthops": [{"fib": True}]}
+ ],
+ }
-def test_vrf_route_leak_test2():
- logger.info(
- "Ensure that leaked are still present after VRF iface IP address deletion"
+ test_func = partial(
+ topotest.router_json_cmp, r1, "show ip route vrf DONNA json", expect
)
- tgen = get_topogen()
- # Don't run this test if we have any failure.
- if tgen.routers_have_failure():
- pytest.skip(tgen.errors)
-
- r1 = tgen.gears["r1"]
-
- logger.info("Adding and removing an IPv4 address to EVA and DONNA VRF ifaces")
- r1.cmd("ip address add 1.1.1.1/32 dev EVA && ip address del 1.1.1.1/32 dev EVA")
- r1.cmd("ip address add 2.2.2.2/32 dev DONNA && ip address del 2.2.2.2/32 dev DONNA")
-
- for vrf in ["EVA", "DONNA"]:
- result, diff = check_bgp_rib(r1, vrf, True)
- assert result, "BGP RIB VRF {} check failed:\n{}".format(vrf, diff)
- result, output = check_bgp_fib(r1, vrf, True)
- assert result, "BGP FIB VRF {} check failed:\n{}".format(vrf, output)
- result, output = check_bgp_ping(r1, vrf)
- assert result, "Ping from VRF {} failed:\n{}".format(vrf, output)
-
-
-def test_vrf_route_leak_test3():
- logger.info("Ensure that setting down the VRF ifaces invalidates leaked routes")
- tgen = get_topogen()
- # Don't run this test if we have any failure.
- if tgen.routers_have_failure():
- pytest.skip(tgen.errors)
-
- r1 = tgen.gears["r1"]
+ result, diff = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ assert result, "BGP VRF DONNA check failed:\n{}".format(diff)
+
+ # Test EVA VRF.
+ expect = {
+ "10.0.0.0/24": [
+ {"protocol": "bgp", "selected": True, "nexthops": [{"fib": True}]}
+ ],
+ "10.0.1.0/24": [
+ {
+ "protocol": "connected",
+ }
+ ],
+ "10.0.2.0/24": [
+ {"protocol": "bgp", "selected": True, "nexthops": [{"fib": True}]}
+ ],
+ "10.0.3.0/24": [
+ {
+ "protocol": "connected",
+ }
+ ],
+ }
- logger.info("Setting down EVA and DONNA VRF ifaces")
- r1.cmd("ip link set EVA down")
- r1.cmd("ip link set DONNA down")
-
- for vrf in ["EVA", "DONNA"]:
- result, diff = check_bgp_rib(r1, vrf, False)
- assert result, "BGP RIB VRF {} check failed:\n{}".format(vrf, diff)
- result, output = check_bgp_fib(r1, vrf, False)
- assert result, "BGP FIB VRF {} check failed:\n{}".format(vrf, output)
-
-
-def test_vrf_route_leak_test4():
- logger.info("Ensure that setting up the VRF ifaces validates leaked routes")
- tgen = get_topogen()
- # Don't run this test if we have any failure.
- if tgen.routers_have_failure():
- pytest.skip(tgen.errors)
-
- r1 = tgen.gears["r1"]
-
- logger.info("Setting up EVA and DONNA VRF ifaces")
- r1.cmd("ip link set EVA up")
- r1.cmd("ip link set DONNA up")
-
- for vrf in ["EVA", "DONNA"]:
- result, diff = check_bgp_rib(r1, vrf, True)
- assert result, "BGP RIB VRF {} check failed:\n{}".format(vrf, diff)
- result, output = check_bgp_fib(r1, vrf, True)
- assert result, "BGP FIB VRF {} check failed:\n{}".format(vrf, output)
- result, output = check_bgp_ping(r1, vrf)
- assert result, "Ping from VRF {} failed:\n{}".format(vrf, output)
+ test_func = partial(
+ topotest.router_json_cmp, r1, "show ip route vrf EVA json", expect
+ )
+ result, diff = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ assert result, "BGP VRF EVA check failed:\n{}".format(diff)
def test_memory_leak():
diff --git a/tests/topotests/lib/bgprib.py b/tests/topotests/lib/bgprib.py
index 01439373c..35a57d0a9 100644
--- a/tests/topotests/lib/bgprib.py
+++ b/tests/topotests/lib/bgprib.py
@@ -37,7 +37,6 @@
from lib.lutil import luCommand, luResult, LUtil
import json
import re
-import time
# gpz: get rib in json form and compare against desired routes
class BgpRib:
@@ -49,15 +48,7 @@ class BgpRib:
for pfx in pfxtbl.keys():
if debug:
self.log("trying pfx %s" % pfx)
- if "exist" in want and want["exist"] == False:
- if pfx == want["p"]:
- if debug:
- self.log("unexpected route: pfx=" + want["p"])
- return 0
- if debug:
- self.log("unwant pfx=" + want["p"] + ", not " + pfx)
- continue
- elif pfx != want["p"]:
+ if pfx != want["p"]:
if debug:
self.log("want pfx=" + want["p"] + ", not " + pfx)
continue
@@ -84,67 +75,53 @@ class BgpRib:
if debug:
self.log("missing route: pfx=" + want["p"] + ", nh=" + want["n"])
return 0
- if "exist" in want and want["exist"] == False:
- return 1
- return 0
- def RequireVpnRoutes(self, target, title, wantroutes, retry=0, wait=1, debug=0):
+ def RequireVpnRoutes(self, target, title, wantroutes, debug=0):
import json
logstr = "RequireVpnRoutes " + str(wantroutes)
- retry += 1
- while retry:
- retry -= 1
- # non json form for humans
- luCommand(
- target,
- 'vtysh -c "show bgp ipv4 vpn"',
- ".",
- "None",
- "Get VPN RIB (non-json)",
- )
- ret = luCommand(
- target,
- 'vtysh -c "show bgp ipv4 vpn json"',
- ".*",
- "None",
- "Get VPN RIB (json)",
- )
- if re.search(r"^\s*$", ret):
- # degenerate case: empty json means no routes
- if len(wantroutes) > 0:
- luResult(target, False, title, logstr)
- return
- luResult(target, True, title, logstr)
- rib = json.loads(ret)
- rds = rib["routes"]["routeDistinguishers"]
- for want in wantroutes:
- found = 0
- if debug:
- self.log("want rd %s" % want["rd"])
- for rd in rds.keys():
- if rd != want["rd"]:
- continue
- if debug:
- self.log("found rd %s" % rd)
- table = rds[rd]
- if self.routes_include_wanted(table, want, debug):
- found = 1
- break
- if not found:
- if retry:
- break
- luResult(target, False, title, logstr)
- return
- if not found and retry:
- time.sleep(wait)
- continue
+ # non json form for humans
+ luCommand(
+ target,
+ 'vtysh -c "show bgp ipv4 vpn"',
+ ".",
+ "None",
+ "Get VPN RIB (non-json)",
+ )
+ ret = luCommand(
+ target,
+ 'vtysh -c "show bgp ipv4 vpn json"',
+ ".*",
+ "None",
+ "Get VPN RIB (json)",
+ )
+ if re.search(r"^\s*$", ret):
+ # degenerate case: empty json means no routes
+ if len(wantroutes) > 0:
+ luResult(target, False, title, logstr)
+ return
luResult(target, True, title, logstr)
- break
+ rib = json.loads(ret)
+ rds = rib["routes"]["routeDistinguishers"]
+ for want in wantroutes:
+ found = 0
+ if debug:
+ self.log("want rd %s" % want["rd"])
+ for rd in rds.keys():
+ if rd != want["rd"]:
+ continue
+ if debug:
+ self.log("found rd %s" % rd)
+ table = rds[rd]
+ if self.routes_include_wanted(table, want, debug):
+ found = 1
+ break
+ if not found:
+ luResult(target, False, title, logstr)
+ return
+ luResult(target, True, title, logstr)
- def RequireUnicastRoutes(
- self, target, afi, vrf, title, wantroutes, retry=0, wait=1, debug=0
- ):
+ def RequireUnicastRoutes(self, target, afi, vrf, title, wantroutes, debug=0):
logstr = "RequireUnicastRoutes %s" % str(wantroutes)
vrfstr = ""
if vrf != "":
@@ -153,62 +130,48 @@ class BgpRib:
if (afi != "ipv4") and (afi != "ipv6"):
self.log("ERROR invalid afi")
- retry += 1
- while retry:
- retry -= 1
- cmdstr = "show bgp %s %s unicast" % (vrfstr, afi)
- # non json form for humans
- cmd = 'vtysh -c "%s"' % cmdstr
- luCommand(
- target, cmd, ".", "None", "Get %s %s RIB (non-json)" % (vrfstr, afi)
- )
- cmd = 'vtysh -c "%s json"' % cmdstr
- ret = luCommand(
- target, cmd, ".*", "None", "Get %s %s RIB (json)" % (vrfstr, afi)
- )
- if re.search(r"^\s*$", ret):
- # degenerate case: empty json means no routes
- if len(wantroutes) > 0:
- luResult(target, False, title, logstr)
- return
- luResult(target, True, title, logstr)
- rib = json.loads(ret)
- try:
- table = rib["routes"]
- # KeyError: 'routes' probably means missing/bad VRF
- except KeyError as err:
- if vrf != "":
- errstr = "-script ERROR: check if wrong vrf (%s)" % (vrf)
- else:
- errstr = "-script ERROR: check if vrf missing"
- if retry:
- time.sleep(wait)
- continue
- luResult(target, False, title + errstr, logstr)
+ cmdstr = "show bgp %s %s unicast" % (vrfstr, afi)
+ # non json form for humans
+ cmd = 'vtysh -c "%s"' % cmdstr
+ luCommand(target, cmd, ".", "None", "Get %s %s RIB (non-json)" % (vrfstr, afi))
+ cmd = 'vtysh -c "%s json"' % cmdstr
+ ret = luCommand(
+ target, cmd, ".*", "None", "Get %s %s RIB (json)" % (vrfstr, afi)
+ )
+ if re.search(r"^\s*$", ret):
+ # degenerate case: empty json means no routes
+ if len(wantroutes) > 0:
+ luResult(target, False, title, logstr)
return
- # if debug:
- # self.log("table=%s" % table)
- for want in wantroutes:
- if debug:
- self.log("want=%s" % want)
- if not self.routes_include_wanted(table, want, debug):
- if retry:
- time.sleep(wait)
- continue
- luResult(target, False, title, logstr)
- return
luResult(target, True, title, logstr)
- break
+ rib = json.loads(ret)
+ try:
+ table = rib["routes"]
+ # KeyError: 'routes' probably means missing/bad VRF
+ except KeyError as err:
+ if vrf != "":
+ errstr = "-script ERROR: check if wrong vrf (%s)" % (vrf)
+ else:
+ errstr = "-script ERROR: check if vrf missing"
+ luResult(target, False, title + errstr, logstr)
+ return
+ # if debug:
+ # self.log("table=%s" % table)
+ for want in wantroutes:
+ if debug:
+ self.log("want=%s" % want)
+ if not self.routes_include_wanted(table, want, debug):
+ luResult(target, False, title, logstr)
+ return
+ luResult(target, True, title, logstr)
BgpRib = BgpRib()
-def bgpribRequireVpnRoutes(target, title, wantroutes, retry=0, wait=1, debug=0):
- BgpRib.RequireVpnRoutes(target, title, wantroutes, retry, wait, debug)
+def bgpribRequireVpnRoutes(target, title, wantroutes, debug=0):
+ BgpRib.RequireVpnRoutes(target, title, wantroutes, debug)
-def bgpribRequireUnicastRoutes(
- target, afi, vrf, title, wantroutes, retry=0, wait=1, debug=0
-):
- BgpRib.RequireUnicastRoutes(target, afi, vrf, title, wantroutes, retry, wait, debug)
+def bgpribRequireUnicastRoutes(target, afi, vrf, title, wantroutes, debug=0):
+ BgpRib.RequireUnicastRoutes(target, afi, vrf, title, wantroutes, debug)
diff --git a/tests/topotests/ospf_multi_vrf_bgp_route_leak/r1/zebra-vrf-default.txt b/tests/topotests/ospf_multi_vrf_bgp_route_leak/r1/zebra-vrf-default.txt
index 6bafbbb55..86c089ab3 100644
--- a/tests/topotests/ospf_multi_vrf_bgp_route_leak/r1/zebra-vrf-default.txt
+++ b/tests/topotests/ospf_multi_vrf_bgp_route_leak/r1/zebra-vrf-default.txt
@@ -5,5 +5,5 @@ B>* 10.0.3.0/24 [20/20] via 10.0.30.3, r1-eth2 (vrf neno), weight 1, XX:XX:XX
O>* 10.0.4.0/24 [110/20] via 10.0.20.2, r1-eth1, weight 1, XX:XX:XX
O 10.0.20.0/24 [110/10] is directly connected, r1-eth1, weight 1, XX:XX:XX
C>* 10.0.20.0/24 is directly connected, r1-eth1, XX:XX:XX
-B>* 10.0.30.0/24 [20/0] is directly connected, neno (vrf neno), weight 1, XX:XX:XX
+B>* 10.0.30.0/24 [20/0] is directly connected, r1-eth2 (vrf neno), weight 1, XX:XX:XX
O>* 10.0.40.0/24 [110/20] via 10.0.20.2, r1-eth1, weight 1, XX:XX:XX
diff --git a/tests/topotests/ospf_multi_vrf_bgp_route_leak/r2/zebra-vrf-default.txt b/tests/topotests/ospf_multi_vrf_bgp_route_leak/r2/zebra-vrf-default.txt
index 3ed6b1b3a..9681d8a04 100644
--- a/tests/topotests/ospf_multi_vrf_bgp_route_leak/r2/zebra-vrf-default.txt
+++ b/tests/topotests/ospf_multi_vrf_bgp_route_leak/r2/zebra-vrf-default.txt
@@ -7,4 +7,4 @@ B>* 10.0.4.0/24 [20/20] via 10.0.40.4, r2-eth2 (vrf ray), weight 1, XX:XX:XX
O 10.0.20.0/24 [110/10] is directly connected, r2-eth1, weight 1, XX:XX:XX
C>* 10.0.20.0/24 is directly connected, r2-eth1, XX:XX:XX
O>* 10.0.30.0/24 [110/20] via 10.0.20.1, r2-eth1, weight 1, XX:XX:XX
-B>* 10.0.40.0/24 [20/0] is directly connected, ray (vrf ray), weight 1, XX:XX:XX
+B>* 10.0.40.0/24 [20/0] is directly connected, r2-eth2 (vrf ray), weight 1, XX:XX:XX
diff --git a/tests/topotests/ospf_multi_vrf_bgp_route_leak/r2/zebra-vrf-ray.txt b/tests/topotests/ospf_multi_vrf_bgp_route_leak/r2/zebra-vrf-ray.txt
index 4ad8441d8..ce9903ae7 100644
--- a/tests/topotests/ospf_multi_vrf_bgp_route_leak/r2/zebra-vrf-ray.txt
+++ b/tests/topotests/ospf_multi_vrf_bgp_route_leak/r2/zebra-vrf-ray.txt
@@ -1,9 +1,9 @@
VRF ray:
B 10.0.1.0/24 [20/20] via 10.0.20.1, r2-eth1 (vrf default) inactive, weight 1, XX:XX:XX
-B 10.0.2.0/24 [20/0] is directly connected, lo (vrf default) inactive, weight 1, XX:XX:XX
+B 10.0.2.0/24 [20/0] is directly connected, r2-eth0 (vrf default) inactive, weight 1, XX:XX:XX
B>* 10.0.3.0/24 [20/20] via 10.0.20.1, r2-eth1 (vrf default), weight 1, XX:XX:XX
O>* 10.0.4.0/24 [110/20] via 10.0.40.4, r2-eth2, weight 1, XX:XX:XX
-B 10.0.20.0/24 [20/0] is directly connected, lo (vrf default) inactive, weight 1, XX:XX:XX
+B 10.0.20.0/24 [20/0] is directly connected, r2-eth1 (vrf default) inactive, weight 1, XX:XX:XX
B>* 10.0.30.0/24 [20/20] via 10.0.20.1, r2-eth1 (vrf default), weight 1, XX:XX:XX
O 10.0.40.0/24 [110/10] is directly connected, r2-eth2, weight 1, XX:XX:XX
C>* 10.0.40.0/24 is directly connected, r2-eth2, XX:XX:XX