]> git.puffer.fish Git - mirror/frr.git/commitdiff
tests: test nexthop-local unchanged with route-server
authorLouis Scalbert <louis.scalbert@6wind.com>
Thu, 10 Oct 2024 12:51:11 +0000 (14:51 +0200)
committerLouis Scalbert <louis.scalbert@6wind.com>
Fri, 11 Oct 2024 12:07:52 +0000 (14:07 +0200)
Test nexthop-local unchanged with route-server.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
18 files changed:
tests/topotests/bgp_route_server_client/exabgp.env [new file with mode: 0644]
tests/topotests/bgp_route_server_client/r1/show_bgp_ipv6.json [deleted file]
tests/topotests/bgp_route_server_client/r1/show_bgp_ipv6_step1.json [new file with mode: 0644]
tests/topotests/bgp_route_server_client/r1/show_bgp_ipv6_step2.json [new file with mode: 0644]
tests/topotests/bgp_route_server_client/r2/bgpd.conf
tests/topotests/bgp_route_server_client/r2/show_bgp_ipv6.json [deleted file]
tests/topotests/bgp_route_server_client/r2/show_bgp_ipv6_step1.json [new file with mode: 0644]
tests/topotests/bgp_route_server_client/r2/show_bgp_ipv6_step2.json [new file with mode: 0644]
tests/topotests/bgp_route_server_client/r2/show_bgp_ipv6_summary.json
tests/topotests/bgp_route_server_client/r3/show_bgp_ipv6.json [deleted file]
tests/topotests/bgp_route_server_client/r3/show_bgp_ipv6_step1.json [new file with mode: 0644]
tests/topotests/bgp_route_server_client/r3/show_bgp_ipv6_step2.json [new file with mode: 0644]
tests/topotests/bgp_route_server_client/r4/bgpd.conf [new file with mode: 0644]
tests/topotests/bgp_route_server_client/r4/show_bgp_ipv6_step1.json [new file with mode: 0644]
tests/topotests/bgp_route_server_client/r4/show_bgp_ipv6_step2.json [new file with mode: 0644]
tests/topotests/bgp_route_server_client/r4/zebra.conf [new file with mode: 0644]
tests/topotests/bgp_route_server_client/r5/exabgp.cfg [new file with mode: 0644]
tests/topotests/bgp_route_server_client/test_bgp_route_server_client.py

diff --git a/tests/topotests/bgp_route_server_client/exabgp.env b/tests/topotests/bgp_route_server_client/exabgp.env
new file mode 100644 (file)
index 0000000..28e6423
--- /dev/null
@@ -0,0 +1,53 @@
+[exabgp.api]
+encoder = text
+highres = false
+respawn = false
+socket = ''
+
+[exabgp.bgp]
+openwait = 60
+
+[exabgp.cache]
+attributes = true
+nexthops = true
+
+[exabgp.daemon]
+daemonize = true
+pid = '/var/run/exabgp/exabgp.pid'
+user = 'exabgp'
+##daemonize = false
+
+[exabgp.log]
+all = false
+configuration = true
+daemon = true
+destination = '/var/log/exabgp.log'
+enable = true
+level = INFO
+message = false
+network = true
+packets = false
+parser = false
+processes = true
+reactor = true
+rib = false
+routes = false
+short = false
+timers = false
+
+[exabgp.pdb]
+enable = false
+
+[exabgp.profile]
+enable = false
+file = ''
+
+[exabgp.reactor]
+speed = 1.0
+
+[exabgp.tcp]
+acl = false
+bind = ''
+delay = 0
+once = false
+port = 179
diff --git a/tests/topotests/bgp_route_server_client/r1/show_bgp_ipv6.json b/tests/topotests/bgp_route_server_client/r1/show_bgp_ipv6.json
deleted file mode 100644 (file)
index 1776b19..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-{
-  "routerId": "10.10.10.1",
-  "localAS": 65001,
-  "routes": {
-    "2001:db8:1::/64": [
-      {
-        "nexthops": [
-          {
-            "ip": "::",
-            "hostname": "r1",
-            "afi": "ipv6",
-            "scope": "global",
-            "used": true
-          }
-        ]
-      }
-    ],
-    "2001:db8:3::/64": [
-      {
-        "nexthops": [
-          {
-            "ip": "2001:db8:3::2",
-            "hostname": "r2",
-            "afi": "ipv6",
-            "scope": "global",
-            "used": true
-          }
-        ]
-      }
-    ],
-    "2001:db8:f::1/128": [
-      {
-        "nexthops": [
-          {
-            "ip": "::",
-            "hostname": "r1",
-            "afi": "ipv6",
-            "scope": "global",
-            "used": true
-          }
-        ]
-      }
-    ],
-    "2001:db8:f::3/128": [
-      {
-        "nexthops": [
-          {
-            "ip": "2001:db8:3::2",
-            "hostname": "r2",
-            "afi": "ipv6",
-            "scope": "global",
-            "used": true
-          }
-        ]
-      }
-    ]
-  }
-}
diff --git a/tests/topotests/bgp_route_server_client/r1/show_bgp_ipv6_step1.json b/tests/topotests/bgp_route_server_client/r1/show_bgp_ipv6_step1.json
new file mode 100644 (file)
index 0000000..387d7b3
--- /dev/null
@@ -0,0 +1,95 @@
+{
+  "routerId": "10.10.10.1",
+  "localAS": 65001,
+  "routes": {
+    "2001:db8:1::/64": [
+      {
+        "nexthops": [
+          {
+            "ip": "::",
+            "hostname": "r1",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      },
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::4",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:3::/64": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:3::2",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::1/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "::",
+            "hostname": "r1",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::3/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:3::2",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::4/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::3",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::5/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::4",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      }
+    ]
+  }
+}
diff --git a/tests/topotests/bgp_route_server_client/r1/show_bgp_ipv6_step2.json b/tests/topotests/bgp_route_server_client/r1/show_bgp_ipv6_step2.json
new file mode 100644 (file)
index 0000000..f9e68b8
--- /dev/null
@@ -0,0 +1,113 @@
+{
+  "routerId": "10.10.10.1",
+  "localAS": 65001,
+  "routes": {
+    "2001:db8:1::/64": [
+      {
+        "nexthops": [
+          {
+            "ip": "::",
+            "hostname": "r1",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      },
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::4",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:3::/64": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:3::2",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "global"
+          },
+          {
+            "ip": "link-local:r2:r2-eth0",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "link-local",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::1/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "::",
+            "hostname": "r1",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::3/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:3::2",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "global"
+          },
+          {
+            "ip": "link-local:r2:r2-eth0",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "link-local",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::4/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::3",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "global"
+          },
+          {
+            "ip": "link-local:r4:r4-eth0",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "link-local",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::5/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::4",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      }
+    ]
+  }
+}
index 3b0a24b8ba5bde609d3d3997c0df12cf32ff776a..19607660f98f5a156321489fdbf8e6eaa2c7418e 100644 (file)
@@ -4,14 +4,24 @@ router bgp 65000 view RS
  neighbor 2001:db8:1::2 remote-as external
  neighbor 2001:db8:1::2 timers 3 10
  neighbor 2001:db8:1::2 timers connect 5
+ neighbor 2001:db8:1::3 remote-as external
+ neighbor 2001:db8:1::3 timers 3 10
+ neighbor 2001:db8:1::3 timers connect 5
+ neighbor 2001:db8:1::4 remote-as external
+ neighbor 2001:db8:1::4 timers 3 10
+ neighbor 2001:db8:1::4 timers connect 5
  neighbor 2001:db8:3::2 remote-as external
  neighbor 2001:db8:3::2 timers 3 10
  neighbor 2001:db8:3::2 timers connect 5
  address-family ipv6 unicast
   redistribute connected
   neighbor 2001:db8:1::2 activate
+  neighbor 2001:db8:1::3 activate
+  neighbor 2001:db8:1::4 activate
   neighbor 2001:db8:3::2 activate
   neighbor 2001:db8:1::2 route-server-client
+  neighbor 2001:db8:1::3 route-server-client
+  neighbor 2001:db8:1::4 route-server-client
   neighbor 2001:db8:3::2 route-server-client
  exit-address-family
 !
diff --git a/tests/topotests/bgp_route_server_client/r2/show_bgp_ipv6.json b/tests/topotests/bgp_route_server_client/r2/show_bgp_ipv6.json
deleted file mode 100644 (file)
index 78b4aae..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-{
-  "routerId": "10.10.10.2",
-  "localAS": 65000,
-  "routes": {
-    "2001:db8:1::/64": [
-      {
-        "nexthops": [
-          {
-            "ip": "2001:db8:1::2",
-            "hostname": "r1",
-            "afi": "ipv6",
-            "scope": "global"
-          },
-          {
-            "hostname": "r1",
-            "afi": "ipv6",
-            "scope": "link-local",
-            "used": true
-          }
-        ]
-      }
-    ],
-    "2001:db8:3::/64": [
-      {
-        "nexthops": [
-          {
-            "ip": "2001:db8:3::2",
-            "hostname": "r3",
-            "afi": "ipv6",
-            "scope": "global"
-          },
-          {
-            "hostname": "r3",
-            "afi": "ipv6",
-            "scope": "link-local",
-            "used": true
-          }
-        ]
-      }
-    ],
-    "2001:db8:f::1/128": [
-      {
-        "nexthops": [
-          {
-            "ip": "2001:db8:1::2",
-            "hostname": "r1",
-            "afi": "ipv6",
-            "scope": "global"
-          },
-          {
-            "hostname": "r1",
-            "afi": "ipv6",
-            "scope": "link-local",
-            "used": true
-          }
-        ]
-      }
-    ],
-    "2001:db8:f::3/128": [
-      {
-        "nexthops": [
-          {
-            "ip": "2001:db8:3::2",
-            "hostname": "r3",
-            "afi": "ipv6",
-            "scope": "global"
-          },
-          {
-            "hostname": "r3",
-            "afi": "ipv6",
-            "scope": "link-local",
-            "used": true
-          }
-        ]
-      }
-    ]
-  }
-}
diff --git a/tests/topotests/bgp_route_server_client/r2/show_bgp_ipv6_step1.json b/tests/topotests/bgp_route_server_client/r2/show_bgp_ipv6_step1.json
new file mode 100644 (file)
index 0000000..c2f31f8
--- /dev/null
@@ -0,0 +1,208 @@
+{
+  "routerId": "10.10.10.2",
+  "localAS": 65000,
+  "routes": {
+    "2001:db8:1::/64": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::4",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      },
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::2",
+            "hostname": "r1",
+            "afi": "ipv6",
+            "scope": "global"
+          },
+          {
+            "ip": "link-local:r1:r1-eth0",
+            "hostname": "r1",
+            "afi": "ipv6",
+            "scope": "link-local",
+            "used": true
+          }
+        ]
+      },
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::3",
+            "hostname": "r4",
+            "afi": "ipv6",
+            "scope": "global"
+          },
+          {
+            "ip": "link-local:r4:r4-eth0",
+            "hostname": "r4",
+            "afi": "ipv6",
+            "scope": "link-local",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:3::/64": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:3::2",
+            "hostname": "r3",
+            "afi": "ipv6",
+            "scope": "global"
+          },
+          {
+            "ip": "link-local:r3:r3-eth0",
+            "hostname": "r3",
+            "afi": "ipv6",
+            "scope": "link-local",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::1/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::2",
+            "hostname": "r1",
+            "afi": "ipv6",
+            "scope": "global"
+          },
+          {
+            "ip": "link-local:r1:r1-eth0",
+            "hostname": "r1",
+            "afi": "ipv6",
+            "scope": "link-local",
+            "used": true
+          }
+        ]
+      },
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::3",
+            "hostname": "r4",
+            "afi": "ipv6",
+            "scope": "global"
+          },
+          {
+            "ip": "link-local:r4:r4-eth0",
+            "hostname": "r4",
+            "afi": "ipv6",
+            "scope": "link-local",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::3/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:3::2",
+            "hostname": "r3",
+            "afi": "ipv6",
+            "scope": "global"
+          },
+          {
+            "ip": "link-local:r3:r3-eth0",
+            "hostname": "r3",
+            "afi": "ipv6",
+            "scope": "link-local",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::4/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::3",
+            "hostname": "r4",
+            "afi": "ipv6",
+            "scope": "global"
+          },
+          {
+            "ip": "link-local:r4:r4-eth0",
+            "hostname": "r4",
+            "afi": "ipv6",
+            "scope": "link-local",
+            "used": true
+          }
+        ]
+      },
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::2",
+            "hostname": "r1",
+            "afi": "ipv6",
+            "scope": "global"
+          },
+          {
+            "ip": "link-local:r1:r1-eth0",
+            "hostname": "r1",
+            "afi": "ipv6",
+            "scope": "link-local",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::5/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::4",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      },
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::2",
+            "hostname": "r1",
+            "afi": "ipv6",
+            "scope": "global"
+          },
+          {
+            "ip": "link-local:r1:r1-eth0",
+            "hostname": "r1",
+            "afi": "ipv6",
+            "scope": "link-local",
+            "used": true
+          }
+        ]
+      },
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::3",
+            "hostname": "r4",
+            "afi": "ipv6",
+            "scope": "global"
+          },
+          {
+            "ip": "link-local:r4:r4-eth0",
+            "hostname": "r4",
+            "afi": "ipv6",
+            "scope": "link-local",
+            "used": true
+          }
+        ]
+      }
+    ]
+  }
+}
diff --git a/tests/topotests/bgp_route_server_client/r2/show_bgp_ipv6_step2.json b/tests/topotests/bgp_route_server_client/r2/show_bgp_ipv6_step2.json
new file mode 100644 (file)
index 0000000..c2f31f8
--- /dev/null
@@ -0,0 +1,208 @@
+{
+  "routerId": "10.10.10.2",
+  "localAS": 65000,
+  "routes": {
+    "2001:db8:1::/64": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::4",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      },
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::2",
+            "hostname": "r1",
+            "afi": "ipv6",
+            "scope": "global"
+          },
+          {
+            "ip": "link-local:r1:r1-eth0",
+            "hostname": "r1",
+            "afi": "ipv6",
+            "scope": "link-local",
+            "used": true
+          }
+        ]
+      },
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::3",
+            "hostname": "r4",
+            "afi": "ipv6",
+            "scope": "global"
+          },
+          {
+            "ip": "link-local:r4:r4-eth0",
+            "hostname": "r4",
+            "afi": "ipv6",
+            "scope": "link-local",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:3::/64": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:3::2",
+            "hostname": "r3",
+            "afi": "ipv6",
+            "scope": "global"
+          },
+          {
+            "ip": "link-local:r3:r3-eth0",
+            "hostname": "r3",
+            "afi": "ipv6",
+            "scope": "link-local",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::1/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::2",
+            "hostname": "r1",
+            "afi": "ipv6",
+            "scope": "global"
+          },
+          {
+            "ip": "link-local:r1:r1-eth0",
+            "hostname": "r1",
+            "afi": "ipv6",
+            "scope": "link-local",
+            "used": true
+          }
+        ]
+      },
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::3",
+            "hostname": "r4",
+            "afi": "ipv6",
+            "scope": "global"
+          },
+          {
+            "ip": "link-local:r4:r4-eth0",
+            "hostname": "r4",
+            "afi": "ipv6",
+            "scope": "link-local",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::3/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:3::2",
+            "hostname": "r3",
+            "afi": "ipv6",
+            "scope": "global"
+          },
+          {
+            "ip": "link-local:r3:r3-eth0",
+            "hostname": "r3",
+            "afi": "ipv6",
+            "scope": "link-local",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::4/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::3",
+            "hostname": "r4",
+            "afi": "ipv6",
+            "scope": "global"
+          },
+          {
+            "ip": "link-local:r4:r4-eth0",
+            "hostname": "r4",
+            "afi": "ipv6",
+            "scope": "link-local",
+            "used": true
+          }
+        ]
+      },
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::2",
+            "hostname": "r1",
+            "afi": "ipv6",
+            "scope": "global"
+          },
+          {
+            "ip": "link-local:r1:r1-eth0",
+            "hostname": "r1",
+            "afi": "ipv6",
+            "scope": "link-local",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::5/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::4",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      },
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::2",
+            "hostname": "r1",
+            "afi": "ipv6",
+            "scope": "global"
+          },
+          {
+            "ip": "link-local:r1:r1-eth0",
+            "hostname": "r1",
+            "afi": "ipv6",
+            "scope": "link-local",
+            "used": true
+          }
+        ]
+      },
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::3",
+            "hostname": "r4",
+            "afi": "ipv6",
+            "scope": "global"
+          },
+          {
+            "ip": "link-local:r4:r4-eth0",
+            "hostname": "r4",
+            "afi": "ipv6",
+            "scope": "link-local",
+            "used": true
+          }
+        ]
+      }
+    ]
+  }
+}
index b40192b452e076d053e68c7cc3a7af178e210036..8a42a11c47a9a46bafa1bbaf4d08a8706ef38560 100644 (file)
@@ -1,6 +1,6 @@
 {
   "ipv6Unicast": {
     "failedPeers": 0,
-    "totalPeers": 2
+    "totalPeers": 4
   }
 }
diff --git a/tests/topotests/bgp_route_server_client/r3/show_bgp_ipv6.json b/tests/topotests/bgp_route_server_client/r3/show_bgp_ipv6.json
deleted file mode 100644 (file)
index 5ebcbe4..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-{
-  "routerId": "10.10.10.3",
-  "localAS": 65003,
-  "routes": {
-    "2001:db8:1::/64": [
-      {
-        "nexthops": [
-          {
-            "ip": "2001:db8:1::2",
-            "hostname": "r2",
-            "afi": "ipv6",
-            "scope": "global",
-            "used": true
-          }
-        ]
-      }
-    ],
-    "2001:db8:3::/64": [
-      {
-        "nexthops": [
-          {
-            "ip": "::",
-            "hostname": "r3",
-            "afi": "ipv6",
-            "scope": "global",
-            "used": true
-          }
-        ]
-      }
-    ],
-    "2001:db8:f::1/128": [
-      {
-        "nexthops": [
-          {
-            "ip": "2001:db8:1::2",
-            "hostname": "r2",
-            "afi": "ipv6",
-            "scope": "global",
-            "used": true
-          }
-        ]
-      }
-    ],
-    "2001:db8:f::3/128": [
-      {
-        "nexthops": [
-          {
-            "ip": "::",
-            "hostname": "r3",
-            "afi": "ipv6",
-            "scope": "global",
-            "used": true
-          }
-        ]
-      }
-    ]
-  }
-}
diff --git a/tests/topotests/bgp_route_server_client/r3/show_bgp_ipv6_step1.json b/tests/topotests/bgp_route_server_client/r3/show_bgp_ipv6_step1.json
new file mode 100644 (file)
index 0000000..bf8d748
--- /dev/null
@@ -0,0 +1,84 @@
+{
+  "routerId": "10.10.10.3",
+  "localAS": 65003,
+  "routes": {
+    "2001:db8:1::/64": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::4",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:3::/64": [
+      {
+        "nexthops": [
+          {
+            "ip": "::",
+            "hostname": "r3",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::1/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::2",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::3/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "::",
+            "hostname": "r3",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::4/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::3",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::5/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::4",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      }
+    ]
+  }
+}
diff --git a/tests/topotests/bgp_route_server_client/r3/show_bgp_ipv6_step2.json b/tests/topotests/bgp_route_server_client/r3/show_bgp_ipv6_step2.json
new file mode 100644 (file)
index 0000000..31c1eb7
--- /dev/null
@@ -0,0 +1,96 @@
+{
+  "routerId": "10.10.10.3",
+  "localAS": 65003,
+  "routes": {
+    "2001:db8:1::/64": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::4",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:3::/64": [
+      {
+        "nexthops": [
+          {
+            "ip": "::",
+            "hostname": "r3",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::1/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::2",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "global"
+          },
+          {
+            "ip": "link-local:r2:r2-eth1",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "link-local",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::3/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "::",
+            "hostname": "r3",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::4/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::3",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "global"
+          },
+          {
+            "ip": "link-local:r2:r2-eth1",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "link-local",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::5/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::4",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      }
+    ]
+  }
+}
diff --git a/tests/topotests/bgp_route_server_client/r4/bgpd.conf b/tests/topotests/bgp_route_server_client/r4/bgpd.conf
new file mode 100644 (file)
index 0000000..c907d72
--- /dev/null
@@ -0,0 +1,13 @@
+!
+router bgp 65004
+ bgp router-id 10.10.10.4
+ no bgp ebgp-requires-policy
+ no bgp enforce-first-as
+ neighbor 2001:db8:1::1 remote-as external
+ neighbor 2001:db8:1::1 timers 3 10
+ neighbor 2001:db8:1::1 timers connect 5
+ address-family ipv6 unicast
+  redistribute connected
+  neighbor 2001:db8:1::1 activate
+ exit-address-family
+!
diff --git a/tests/topotests/bgp_route_server_client/r4/show_bgp_ipv6_step1.json b/tests/topotests/bgp_route_server_client/r4/show_bgp_ipv6_step1.json
new file mode 100644 (file)
index 0000000..5c090d9
--- /dev/null
@@ -0,0 +1,95 @@
+{
+  "routerId": "10.10.10.4",
+  "localAS": 65004,
+  "routes": {
+    "2001:db8:1::/64": [
+      {
+        "nexthops": [
+          {
+            "ip": "::",
+            "hostname": "r4",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      },
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::4",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:3::/64": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:3::2",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::1/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::2",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::3/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:3::2",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::4/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "::",
+            "hostname": "r4",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::5/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::4",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      }
+    ]
+  }
+}
diff --git a/tests/topotests/bgp_route_server_client/r4/show_bgp_ipv6_step2.json b/tests/topotests/bgp_route_server_client/r4/show_bgp_ipv6_step2.json
new file mode 100644 (file)
index 0000000..01db18e
--- /dev/null
@@ -0,0 +1,113 @@
+{
+  "routerId": "10.10.10.4",
+  "localAS": 65004,
+  "routes": {
+    "2001:db8:1::/64": [
+      {
+        "nexthops": [
+          {
+            "ip": "::",
+            "hostname": "r4",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      },
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::4",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:3::/64": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:3::2",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "global"
+          },
+          {
+            "ip": "link-local:r2:r2-eth0",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "link-local",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::1/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::2",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "global"
+          },
+          {
+            "ip": "link-local:r1:r1-eth0",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "link-local",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::3/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:3::2",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "global"
+          },
+          {
+            "ip": "link-local:r2:r2-eth0",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "link-local",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::4/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "::",
+            "hostname": "r4",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      }
+    ],
+    "2001:db8:f::5/128": [
+      {
+        "nexthops": [
+          {
+            "ip": "2001:db8:1::4",
+            "hostname": "r2",
+            "afi": "ipv6",
+            "scope": "global",
+            "used": true
+          }
+        ]
+      }
+    ]
+  }
+}
diff --git a/tests/topotests/bgp_route_server_client/r4/zebra.conf b/tests/topotests/bgp_route_server_client/r4/zebra.conf
new file mode 100644 (file)
index 0000000..8498840
--- /dev/null
@@ -0,0 +1,7 @@
+!
+int lo
+ ipv6 address 2001:db8:f::4/128
+!
+int r4-eth0
+ ipv6 address 2001:db8:1::3/64
+!
diff --git a/tests/topotests/bgp_route_server_client/r5/exabgp.cfg b/tests/topotests/bgp_route_server_client/r5/exabgp.cfg
new file mode 100644 (file)
index 0000000..b151f16
--- /dev/null
@@ -0,0 +1,16 @@
+neighbor 2001:db8:1::1{
+    router-id 10.10.10.5;
+    local-address 2001:db8:1::4;
+    local-as 65005;
+    peer-as 65000;
+
+    family {
+        ipv6 unicast;
+    }
+
+    static {
+        route 2001:db8:1::0/64 next-hop 2001:db8:1::4;
+        route 2001:db8:f::5/128 next-hop 2001:db8:1::4;
+    }
+    hold-time 10;
+}
index 8582b09c8601514a4fc85c3542821893bea4dbc9..a6334918dfcb20e5282e6cef0708462a23ba5180 100644 (file)
@@ -27,16 +27,49 @@ from lib.topogen import Topogen, TopoRouter, get_topogen
 
 
 def build_topo(tgen):
-    for routern in range(1, 4):
+    """
+    All peers are FRR BGP peers except r5 that is a exabgp peer.
+    Exabgp does not send any IPv6 Link-Local nexthop
+
+    r2 is a route-server view RS AS 65000
+    Other routers rX has AS 6500X
+
+                     +---+
+                     | r3|
+                     +---+
+                       |
+                2001:db8:3::0/64
+                       |
+                     eth1
+                     +---+
+                     |r2 |
+                     +---+
+                     eth0
+                       |
+                 2001:db8:1::0/64
+                  /    |     \
+              +---+  +---+  +---+
+              | r1|  | r4|  |r5 |
+              +---+  +---+  +---+
+    """
+
+    for routern in range(1, 5):
         tgen.add_router("r{}".format(routern))
 
-    switch = tgen.add_switch("s1")
-    switch.add_link(tgen.gears["r1"])
-    switch.add_link(tgen.gears["r2"])
+    sw1 = tgen.add_switch("s1")
+    sw1.add_link(tgen.gears["r1"])
+    sw1.add_link(tgen.gears["r2"])
+    sw1.add_link(tgen.gears["r4"])
 
-    switch = tgen.add_switch("s2")
-    switch.add_link(tgen.gears["r2"])
-    switch.add_link(tgen.gears["r3"])
+    sw2 = tgen.add_switch("s2")
+    sw2.add_link(tgen.gears["r2"])
+    sw2.add_link(tgen.gears["r3"])
+
+    ## Add iBGP ExaBGP neighbor
+    peer_ip = "2001:db8:1::4"  ## peer
+    peer_route = "via 2001:db8:1::1"  ## router
+    r5 = tgen.add_exabgp_peer("r5", ip=peer_ip, defaultRoute=peer_route)
+    sw1.add_link(r5)
 
 
 def setup_module(mod):
@@ -55,12 +88,59 @@ def setup_module(mod):
 
     tgen.start_router()
 
+    # Start r5 exabgp peer
+    r5 = tgen.gears["r5"]
+    r5.start(os.path.join(CWD, "r5"), os.path.join(CWD, "exabgp.env"))
+
 
 def teardown_module(mod):
     tgen = get_topogen()
     tgen.stop_topology()
 
 
+def get_link_local(rname, ifname, cache):
+    ip = cache.get(rname, {}).get(ifname)
+    if ip:
+        return ip
+
+    tgen = get_topogen()
+    out = tgen.gears[rname].vtysh_cmd("show interface %s json" % ifname, isjson=True)
+    for address in out[ifname]["ipAddresses"]:
+        if not address["address"].startswith("fe80::"):
+            continue
+        ip = address["address"].split("/")[0]
+        cache.setdefault(rname, {})[ifname] = ip
+        return ip
+
+
+def replace_link_local(expected, cache):
+    for prefix, prefix_infos in expected.get("routes", {}).items():
+        for prefix_info in prefix_infos:
+            for nexthop in prefix_info.get("nexthops", []):
+                ip = nexthop.get("ip", "")
+                if not ip.startswith("link-local:"):
+                    continue
+                rname = ip.split(":")[1]
+                ifname = ip.split(":")[2]
+                ip = get_link_local(rname, ifname, cache)
+                nexthop["ip"] = ip
+
+
+def check_r2_sub_group(expected):
+    tgen = get_topogen()
+
+    r2 = tgen.gears["r2"]
+
+    output = json.loads(r2.vtysh_cmd("show bgp view RS update-groups json"))
+    actual = [
+        subgroup["peers"]
+        for entry in output.get("RS", {}).values()
+        for subgroup in entry["subGroup"]
+    ]
+
+    return topotest.json_cmp(actual, expected)
+
+
 def test_converge_protocols():
     "Wait for protocol convergence"
 
@@ -90,6 +170,58 @@ def test_bgp_route_server_client_step1():
     if tgen.routers_have_failure():
         pytest.skip(tgen.errors)
 
+    global link_local_cache
+    link_local_cache = {}
+    router_list = tgen.routers().values()
+    for router in router_list:
+        if router.name == "r2":
+            # route-server
+            cmd = "show bgp view RS ipv6 unicast json"
+        else:
+            cmd = "show bgp ipv6 unicast json"
+
+        # router.cmd("vtysh -c 'sh bgp ipv6 json' >/tmp/show_bgp_ipv6_%s.json" % router.name)
+        ref_file = "{}/{}/show_bgp_ipv6_step1.json".format(CWD, router.name)
+        expected = json.loads(open(ref_file).read())
+        replace_link_local(expected, link_local_cache)
+
+        test_func = partial(
+            topotest.router_json_cmp,
+            router,
+            cmd,
+            expected,
+        )
+        _, res = topotest.run_and_expect(test_func, None, count=30, wait=1)
+        assertmsg = "{}: BGP IPv6 table failure".format(router.name)
+        assert res is None, assertmsg
+
+    # check r2 sub-groups
+    expected = [["2001:db8:1::4"], ["2001:db8:1::3", "2001:db8:1::2", "2001:db8:3::2"]]
+
+    test_func = functools.partial(check_r2_sub_group, expected)
+    _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+    assert result is None, "Peer group split failed"
+
+
+def test_bgp_route_server_client_step2():
+    tgen = get_topogen()
+
+    if tgen.routers_have_failure():
+        pytest.skip(tgen.errors)
+
+    r2 = tgen.gears["r2"]
+    r2.vtysh_cmd(
+        """
+configure terminal
+router bgp 65000 view RS
+ address-family ipv6 unicast
+  neighbor 2001:db8:1::2 nexthop-local unchanged
+  neighbor 2001:db8:1::3 nexthop-local unchanged
+  neighbor 2001:db8:1::4 nexthop-local unchanged
+  neighbor 2001:db8:3::2 nexthop-local unchanged
+"""
+    )
+
     router_list = tgen.routers().values()
     for router in router_list:
         if router.name == "r2":
@@ -99,8 +231,9 @@ def test_bgp_route_server_client_step1():
             cmd = "show bgp ipv6 unicast json"
 
         # router.cmd("vtysh -c 'sh bgp ipv6 json' >/tmp/show_bgp_ipv6_%s.json" % router.name)
-        ref_file = "{}/{}/show_bgp_ipv6.json".format(CWD, router.name)
+        ref_file = "{}/{}/show_bgp_ipv6_step2.json".format(CWD, router.name)
         expected = json.loads(open(ref_file).read())
+        replace_link_local(expected, link_local_cache)
 
         test_func = partial(
             topotest.router_json_cmp,
@@ -112,6 +245,69 @@ def test_bgp_route_server_client_step1():
         assertmsg = "{}: BGP IPv6 table failure".format(router.name)
         assert res is None, assertmsg
 
+    # check r2 sub-groups
+    expected = [
+        ["2001:db8:1::4"],
+        ["2001:db8:1::3", "2001:db8:1::2"],
+        ["2001:db8:3::2"],
+    ]
+
+    test_func = functools.partial(check_r2_sub_group, expected)
+    _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+    assert result is None, "Peer group split failed"
+
+
+def test_bgp_route_server_client_step3():
+    tgen = get_topogen()
+
+    if tgen.routers_have_failure():
+        pytest.skip(tgen.errors)
+
+    r2 = tgen.gears["r2"]
+    r2.vtysh_cmd(
+        """
+configure terminal
+router bgp 65000 view RS
+ address-family ipv6 unicast
+  no neighbor 2001:db8:1::2 nexthop-local unchanged
+  no neighbor 2001:db8:1::3 nexthop-local unchanged
+  no neighbor 2001:db8:1::4 nexthop-local unchanged
+  no neighbor 2001:db8:3::2 nexthop-local unchanged
+"""
+    )
+
+    global link_local_cache
+    link_local_cache = {}
+    router_list = tgen.routers().values()
+    for router in router_list:
+        if router.name == "r2":
+            # route-server
+            cmd = "show bgp view RS ipv6 unicast json"
+        else:
+            cmd = "show bgp ipv6 unicast json"
+
+        # router.cmd("vtysh -c 'sh bgp ipv6 json' >/tmp/show_bgp_ipv6_%s.json" % router.name)
+        ref_file = "{}/{}/show_bgp_ipv6_step1.json".format(CWD, router.name)
+        expected = json.loads(open(ref_file).read())
+        replace_link_local(expected, link_local_cache)
+
+        test_func = partial(
+            topotest.router_json_cmp,
+            router,
+            cmd,
+            expected,
+        )
+        _, res = topotest.run_and_expect(test_func, None, count=30, wait=1)
+        assertmsg = "{}: BGP IPv6 table failure".format(router.name)
+        assert res is None, assertmsg
+
+    # check r2 sub-groups
+    expected = [["2001:db8:1::4"], ["2001:db8:1::3", "2001:db8:1::2", "2001:db8:3::2"]]
+
+    test_func = functools.partial(check_r2_sub_group, expected)
+    _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+    assert result is None, "Peer group split failed"
+
 
 if __name__ == "__main__":
     args = ["-s"] + sys.argv[1:]