]> git.puffer.fish Git - matthieu/frr.git/commitdiff
tests: Include evpn in bgp-default-afi-safi.py
authorTrey Aspelund <taspelund@nvidia.com>
Tue, 22 Jun 2021 04:38:29 +0000 (04:38 +0000)
committerTrey Aspelund <taspelund@nvidia.com>
Mon, 28 Jun 2021 20:55:51 +0000 (20:55 +0000)
Expands "bgp default" tests to include l2vpn evpn in addition
to ipv4/ipv6 unicast.

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
tests/topotests/bgp_default_afi_safi/r3/bgpd.conf
tests/topotests/bgp_default_afi_safi/r4/bgpd.conf [new file with mode: 0644]
tests/topotests/bgp_default_afi_safi/r4/zebra.conf [new file with mode: 0644]
tests/topotests/bgp_default_afi_safi/test_bgp-default-afi-safi.py

index a405c047ca7a04517e8228785e71e9f27605fe47..f3ec3f06c5953da1f1fbcd8ca9d45fb3ed07dfc3 100644 (file)
@@ -1,4 +1,5 @@
 !
 router bgp 65001
- bgp default ipv6-unicast
+ no bgp default ipv4-unicast
+ bgp default l2vpn-evpn
 !
diff --git a/tests/topotests/bgp_default_afi_safi/r4/bgpd.conf b/tests/topotests/bgp_default_afi_safi/r4/bgpd.conf
new file mode 100644 (file)
index 0000000..8a6af55
--- /dev/null
@@ -0,0 +1,5 @@
+!
+router bgp 65001
+ bgp default ipv6-unicast
+ bgp default l2vpn-evpn
+!
diff --git a/tests/topotests/bgp_default_afi_safi/r4/zebra.conf b/tests/topotests/bgp_default_afi_safi/r4/zebra.conf
new file mode 100644 (file)
index 0000000..e9fdfb7
--- /dev/null
@@ -0,0 +1,6 @@
+!
+interface r3-eth0
+ ip address 192.168.255.3/24
+!
+ip forwarding
+!
index f9aa94fd14d39291d1500c8e971c1b5edc08409f..28117b7fe4eea51f9db6f504a427fbcc104c44dc 100644 (file)
 #
 
 """
-Test if `bgp default ipv4-unicast` and `bgp default ipv6-unicast`
-commands work as expected.
+Test if `bgp default ipv4-unicast`, `bgp default ipv6-unicast`
+and `bgp default l2vpn-evpn` commands work as expected.
 
 STEP 1: 'Check if neighbor 192.168.255.254 is enabled for ipv4 address-family only'
 STEP 2: 'Check if neighbor 192.168.255.254 is enabled for ipv6 address-family only'
-STEP 3: 'Check if neighbor 192.168.255.254 is enabled for ipv4 and ipv6 address-families'
+STEP 3: 'Check if neighbor 192.168.255.254 is enabled for l2vpn evpn address-family only'
+STEP 4: 'Check if neighbor 192.168.255.254 is enabled for ipv4/ipv6 unicast and l2vpn evpn address-families'
 """
 
 import os
@@ -98,7 +99,7 @@ def test_bgp_default_ipv4_ipv6_unicast():
 
         output = json.loads(tgen.gears["r1"].vtysh_cmd("show bgp summary json"))
 
-        if "ipv4Unicast" in output and "ipv6Unicast" not in output:
+        if len(output.keys()) == 1 and "ipv4Unicast" in output:
             return True
         return False
 
@@ -113,28 +114,48 @@ def test_bgp_default_ipv4_ipv6_unicast():
 
         output = json.loads(tgen.gears["r2"].vtysh_cmd("show bgp summary json"))
 
-        if "ipv4Unicast" not in output and "ipv6Unicast" in output:
+        if len(output.keys()) == 1 and "ipv6Unicast" in output:
             return True
         return False
 
     assert _bgp_neighbor_ipv6_af_only() == True
 
-    step(
-        "Check if neighbor 192.168.255.254 is enabled for ipv4 and ipv6 address-families"
-    )
+    step("Check if neighbor 192.168.255.254 is enabled for evpn address-family only")
 
-    def _bgp_neighbor_ipv4_and_ipv6_af():
+    def _bgp_neighbor_evpn_af_only():
         tgen.gears["r3"].vtysh_cmd(
             "conf t\nrouter bgp\nneighbor 192.168.255.254 remote-as external"
         )
 
         output = json.loads(tgen.gears["r3"].vtysh_cmd("show bgp summary json"))
 
-        if "ipv4Unicast" in output and "ipv6Unicast" in output:
+        if len(output.keys()) == 1 and "l2VpnEvpn" in output:
+            return True
+        return False
+
+    assert _bgp_neighbor_evpn_af_only() == True
+
+    step(
+        "Check if neighbor 192.168.255.254 is enabled for ipv4/ipv6 unicast and evpn address-families"
+    )
+
+    def _bgp_neighbor_ipv4_ipv6_and_evpn_af():
+        tgen.gears["r4"].vtysh_cmd(
+            "conf t\nrouter bgp\nneighbor 192.168.255.254 remote-as external"
+        )
+
+        output = json.loads(tgen.gears["r4"].vtysh_cmd("show bgp summary json"))
+
+        if (
+            len(output.keys()) == 3
+            and "ipv4Unicast" in output
+            and "ipv6Unicast" in output
+            and "l2VpnEvpn" in output
+        ):
             return True
         return False
 
-    assert _bgp_neighbor_ipv4_and_ipv6_af() == True
+    assert _bgp_neighbor_ipv4_ipv6_and_evpn_af() == True
 
 
 if __name__ == "__main__":