From: Trey Aspelund Date: Tue, 22 Jun 2021 04:38:29 +0000 (+0000) Subject: tests: Include evpn in bgp-default-afi-safi.py X-Git-Tag: base_8.1~373^2~1 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=b01830dc5b1a3f6aa758f629e43b9e535bb2a98e;p=matthieu%2Ffrr.git tests: Include evpn in bgp-default-afi-safi.py Expands "bgp default" tests to include l2vpn evpn in addition to ipv4/ipv6 unicast. Signed-off-by: Trey Aspelund --- diff --git a/tests/topotests/bgp_default_afi_safi/r3/bgpd.conf b/tests/topotests/bgp_default_afi_safi/r3/bgpd.conf index a405c047ca..f3ec3f06c5 100644 --- a/tests/topotests/bgp_default_afi_safi/r3/bgpd.conf +++ b/tests/topotests/bgp_default_afi_safi/r3/bgpd.conf @@ -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 index 0000000000..8a6af55ee7 --- /dev/null +++ b/tests/topotests/bgp_default_afi_safi/r4/bgpd.conf @@ -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 index 0000000000..e9fdfb70c5 --- /dev/null +++ b/tests/topotests/bgp_default_afi_safi/r4/zebra.conf @@ -0,0 +1,6 @@ +! +interface r3-eth0 + ip address 192.168.255.3/24 +! +ip forwarding +! diff --git a/tests/topotests/bgp_default_afi_safi/test_bgp-default-afi-safi.py b/tests/topotests/bgp_default_afi_safi/test_bgp-default-afi-safi.py index f9aa94fd14..28117b7fe4 100644 --- a/tests/topotests/bgp_default_afi_safi/test_bgp-default-afi-safi.py +++ b/tests/topotests/bgp_default_afi_safi/test_bgp-default-afi-safi.py @@ -20,12 +20,13 @@ # """ -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__":