]> git.puffer.fish Git - mirror/frr.git/commitdiff
topotests: add VRF leak tests in bgp_l3vpn_to_bgp_vrf
authorLouis Scalbert <louis.scalbert@6wind.com>
Thu, 12 May 2022 12:57:17 +0000 (14:57 +0200)
committerLouis Scalbert <louis.scalbert@6wind.com>
Fri, 16 Dec 2022 14:07:55 +0000 (15:07 +0100)
Check that route leaking between VRF within a router works properly.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
13 files changed:
tests/topotests/bgp_l3vpn_to_bgp_vrf/ce1/zebra.conf
tests/topotests/bgp_l3vpn_to_bgp_vrf/ce2/zebra.conf
tests/topotests/bgp_l3vpn_to_bgp_vrf/ce3/bgpd.conf
tests/topotests/bgp_l3vpn_to_bgp_vrf/ce3/zebra.conf
tests/topotests/bgp_l3vpn_to_bgp_vrf/ce4/bgpd.conf
tests/topotests/bgp_l3vpn_to_bgp_vrf/ce4/zebra.conf
tests/topotests/bgp_l3vpn_to_bgp_vrf/customize.py
tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/bgpd.conf
tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/staticd.conf [new file with mode: 0644]
tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/zebra.conf
tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_mpls.py
tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_vrf.py
tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_routes.py

index 46831bb7111d4200e6f47330fc4596c0fa04b1ec..375bbea9ff94247f50f3ad4f5fe83c80a9f4c54c 100644 (file)
@@ -4,6 +4,8 @@ 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
index fb4d8cc9c426e65817d9d7567acc378d76daebdb..90dd3c55b4761c03ffaaaef5fff5dc39d4400af4 100644 (file)
@@ -4,6 +4,8 @@ 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
index e316de569049487d0457d6230b84dd80952c0b3c..cf7396eb1263eaed9eabaecbe245918e85019ea4 100644 (file)
@@ -19,6 +19,7 @@ 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
 !
index 77a1163a4be1f55bceea8d75436632dfae90f122..df6ac47b088275adb9a9ddf99c87a79013ee27ee 100644 (file)
@@ -4,6 +4,7 @@ hostname ce3
 !
 interface lo
  ip address 99.0.0.3/32
+ ip address 6.0.3.1/24
 !
 interface ce3-eth0
  description to r4
index 60d9e931083fbf23a564f108d8c7c3947459b5b8..9a6ca08a0bdeb632b095164ef95f23a8bc3b493f 100644 (file)
@@ -19,6 +19,7 @@ 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
 !
index e55c9e779a965782c11d013cf2405645d7ead9df..0e3a7362922bcef285deba67e42b27507548ab79 100644 (file)
@@ -4,6 +4,7 @@ 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
index 5161d8471febd282fc0d54dabd77b8dbe710c1a0..b2bf5f5f631b13583340985b3c256bddd8f5c92b 100644 (file)
@@ -175,6 +175,20 @@ 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",
index 8d42cfc0d89c9c6dde2768ae2f339352999b1bed..24e9f9537234765c2cefb841ef0356f1c44953e2 100644 (file)
@@ -11,6 +11,7 @@ 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
@@ -39,6 +40,11 @@ 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
 
@@ -51,5 +57,47 @@ 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
new file mode 100644 (file)
index 0000000..59430fd
--- /dev/null
@@ -0,0 +1,6 @@
+hostname r1
+log file staticd.log
+!
+vrf r1-cust1
+ ip route 192.0.0.0/24 192.168.1.2
+exit-vrf
index 221bc7a839c870f0c4030a422f289a455d8e334f..e81bc6b2abdc867003710ac7d56b4e2c116575bf 100644 (file)
@@ -4,6 +4,9 @@ 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
@@ -18,6 +21,14 @@ 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
 
 
index 91a7adf9970e672a24ec3077acd375ef06b7548e..89369241a8e344a322198a5f39539dbd0d453cb4 100644 (file)
@@ -81,3 +81,24 @@ 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",
+    )
index 75158b127e7db74493e026432db32d7b0d0cea97..762af94d3f9f89881ec8ffdf8888b3c2c2284ee8 100644 (file)
@@ -72,3 +72,46 @@ luCommand(
     "wait",
     "CE4->PE4 ping",
 )
+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",
+)
index 1e2758c1c962d6a6c45307010bd82a95406d4cfe..f51fc6598e2405c5cb6ef54bf003e9f57c20bd53 100644 (file)
@@ -54,15 +54,44 @@ bgpribRequireUnicastRoutes("ce4", "ipv4", "ce4-cust2", "Cust 4 routes in ce1", w
 #
 # r1 vtysh -c "show bgp vrf r1-cust1 ipv4"
 #
-want_r1_cust1_routes = [
+want_r1_cust1_3_5_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_routes
+    "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
 )
 
 want_r3_cust1_routes = [
@@ -70,10 +99,20 @@ 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
+    "r3",
+    "ipv4",
+    "r3-cust1",
+    "Customer 1 routes in r3 vrf",
+    want_r3_cust1_routes,
+    retry=30,
 )
 
 want_r4_cust1_routes = [
@@ -81,10 +120,20 @@ 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
+    "r4",
+    "ipv4",
+    "r4-cust1",
+    "Customer 1 routes in r4 vrf",
+    want_r4_cust1_routes,
+    retry=30,
 )
 
 want_r4_cust2_routes = [
@@ -92,10 +141,20 @@ 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
+    "r4",
+    "ipv4",
+    "r4-cust2",
+    "Customer 2 routes in r4 vrf",
+    want_r4_cust2_routes,
+    retry=30,
 )
 
 ########################################################################