diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/topotests/bgp_default_afi_safi/__init__.py (renamed from tests/topotests/bgp_default_ipv4_ipv6_unicast/__init__.py) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_default_afi_safi/r1/bgpd.conf (renamed from tests/topotests/bgp_default_ipv4_ipv6_unicast/r1/bgpd.conf) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_default_afi_safi/r1/zebra.conf (renamed from tests/topotests/bgp_default_ipv4_ipv6_unicast/r1/zebra.conf) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_default_afi_safi/r2/bgpd.conf (renamed from tests/topotests/bgp_default_ipv4_ipv6_unicast/r2/bgpd.conf) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_default_afi_safi/r2/zebra.conf (renamed from tests/topotests/bgp_default_ipv4_ipv6_unicast/r2/zebra.conf) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_default_afi_safi/r3/bgpd.conf | 5 | ||||
| -rw-r--r-- | tests/topotests/bgp_default_afi_safi/r3/zebra.conf (renamed from tests/topotests/bgp_default_ipv4_ipv6_unicast/r3/zebra.conf) | 0 | ||||
| -rw-r--r-- | tests/topotests/bgp_default_afi_safi/r4/bgpd.conf (renamed from tests/topotests/bgp_default_ipv4_ipv6_unicast/r3/bgpd.conf) | 1 | ||||
| -rw-r--r-- | tests/topotests/bgp_default_afi_safi/r4/zebra.conf | 6 | ||||
| -rw-r--r-- | tests/topotests/bgp_default_afi_safi/test_bgp-default-afi-safi.py (renamed from tests/topotests/bgp_default_ipv4_ipv6_unicast/test_bgp-default-ipv4-ipv6-unicast.py) | 43 | ||||
| -rw-r--r-- | tests/topotests/bgp_route_map/test_route_map_topo1.py | 103 |
11 files changed, 97 insertions, 61 deletions
diff --git a/tests/topotests/bgp_default_ipv4_ipv6_unicast/__init__.py b/tests/topotests/bgp_default_afi_safi/__init__.py index e69de29bb2..e69de29bb2 100644 --- a/tests/topotests/bgp_default_ipv4_ipv6_unicast/__init__.py +++ b/tests/topotests/bgp_default_afi_safi/__init__.py diff --git a/tests/topotests/bgp_default_ipv4_ipv6_unicast/r1/bgpd.conf b/tests/topotests/bgp_default_afi_safi/r1/bgpd.conf index bf39152ea8..bf39152ea8 100644 --- a/tests/topotests/bgp_default_ipv4_ipv6_unicast/r1/bgpd.conf +++ b/tests/topotests/bgp_default_afi_safi/r1/bgpd.conf diff --git a/tests/topotests/bgp_default_ipv4_ipv6_unicast/r1/zebra.conf b/tests/topotests/bgp_default_afi_safi/r1/zebra.conf index 697765168d..697765168d 100644 --- a/tests/topotests/bgp_default_ipv4_ipv6_unicast/r1/zebra.conf +++ b/tests/topotests/bgp_default_afi_safi/r1/zebra.conf diff --git a/tests/topotests/bgp_default_ipv4_ipv6_unicast/r2/bgpd.conf b/tests/topotests/bgp_default_afi_safi/r2/bgpd.conf index abbd1b86fa..abbd1b86fa 100644 --- a/tests/topotests/bgp_default_ipv4_ipv6_unicast/r2/bgpd.conf +++ b/tests/topotests/bgp_default_afi_safi/r2/bgpd.conf diff --git a/tests/topotests/bgp_default_ipv4_ipv6_unicast/r2/zebra.conf b/tests/topotests/bgp_default_afi_safi/r2/zebra.conf index 606c17bec9..606c17bec9 100644 --- a/tests/topotests/bgp_default_ipv4_ipv6_unicast/r2/zebra.conf +++ b/tests/topotests/bgp_default_afi_safi/r2/zebra.conf diff --git a/tests/topotests/bgp_default_afi_safi/r3/bgpd.conf b/tests/topotests/bgp_default_afi_safi/r3/bgpd.conf new file mode 100644 index 0000000000..f3ec3f06c5 --- /dev/null +++ b/tests/topotests/bgp_default_afi_safi/r3/bgpd.conf @@ -0,0 +1,5 @@ +! +router bgp 65001 + no bgp default ipv4-unicast + bgp default l2vpn-evpn +! diff --git a/tests/topotests/bgp_default_ipv4_ipv6_unicast/r3/zebra.conf b/tests/topotests/bgp_default_afi_safi/r3/zebra.conf index e9fdfb70c5..e9fdfb70c5 100644 --- a/tests/topotests/bgp_default_ipv4_ipv6_unicast/r3/zebra.conf +++ b/tests/topotests/bgp_default_afi_safi/r3/zebra.conf diff --git a/tests/topotests/bgp_default_ipv4_ipv6_unicast/r3/bgpd.conf b/tests/topotests/bgp_default_afi_safi/r4/bgpd.conf index a405c047ca..8a6af55ee7 100644 --- a/tests/topotests/bgp_default_ipv4_ipv6_unicast/r3/bgpd.conf +++ b/tests/topotests/bgp_default_afi_safi/r4/bgpd.conf @@ -1,4 +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_ipv4_ipv6_unicast/test_bgp-default-ipv4-ipv6-unicast.py b/tests/topotests/bgp_default_afi_safi/test_bgp-default-afi-safi.py index f9aa94fd14..28117b7fe4 100644 --- a/tests/topotests/bgp_default_ipv4_ipv6_unicast/test_bgp-default-ipv4-ipv6-unicast.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__": diff --git a/tests/topotests/bgp_route_map/test_route_map_topo1.py b/tests/topotests/bgp_route_map/test_route_map_topo1.py index 0158e24d31..74172501db 100644 --- a/tests/topotests/bgp_route_map/test_route_map_topo1.py +++ b/tests/topotests/bgp_route_map/test_route_map_topo1.py @@ -20,47 +20,6 @@ # OF THIS SOFTWARE. # -################################# -# TOPOLOGY -################################# -""" - - +-------+ - +------- | R2 | - | +-------+ - | | - +-------+ | - | R1 | | - +-------+ | - | | - | +-------+ +-------+ - +---------- | R3 |----------| R4 | - +-------+ +-------+ - -""" - -################################# -# TEST SUMMARY -################################# -""" -Following tests are covered to test route-map functionality: -TC_34: - Verify if route-maps is applied in both inbound and - outbound direction to same neighbor/interface. -TC_36: - Test permit/deny statements operation in route-maps with a - permutation and combination of permit/deny in prefix-lists -TC_35: - Test multiple sequence numbers in a single route-map for different - match/set clauses. -TC_37: - Test add/remove route-maps with multiple set - clauses and without any match statement.(Set only) -TC_38: - Test add/remove route-maps with multiple match - clauses and without any set statement.(Match only) -""" - import sys import json import time @@ -91,6 +50,7 @@ from lib.common_config import ( create_bgp_community_lists, interface_status, create_route_maps, + create_static_routes, create_prefix_lists, verify_route_maps, check_address_types, @@ -107,6 +67,46 @@ from lib.bgp import ( ) from lib.topojson import build_topo_from_json, build_config_from_json +################################# +# TOPOLOGY +################################# +""" + + +-------+ + +------- | R2 | + | +-------+ + | | + +-------+ | + | R1 | | + +-------+ | + | | + | +-------+ +-------+ + +---------- | R3 |----------| R4 | + +-------+ +-------+ + +""" + +################################# +# TEST SUMMARY +################################# +""" +Following tests are covered to test route-map functionality: +TC_34: + Verify if route-maps is applied in both inbound and + outbound direction to same neighbor/interface. +TC_36: + Test permit/deny statements operation in route-maps with a + permutation and combination of permit/deny in prefix-lists +TC_35: + Test multiple sequence numbers in a single route-map for different + match/set clauses. +TC_37: + Test add/remove route-maps with multiple set + clauses and without any match statement.(Set only) +TC_38: + Test add/remove route-maps with multiple match + clauses and without any set statement.(Match only) +""" # Global variables bgp_convergence = False @@ -475,8 +475,8 @@ def test_route_map_inbound_outbound_same_neighbor_p0(request): result = verify_rib( tgen, adt, dut, input_dict_2, protocol=protocol, expected=False ) - assert result is not True, "Testcase {} : Failed \n" - "routes are not present in rib \n Error: {}".format(tc_name, result) + assert result is not True, ("Testcase {} : Failed \n" + "routes are not present in rib \n Error: {}".format(tc_name, result)) logger.info("Expected behaviour: {}".format(result)) # Verifying RIB routes @@ -495,8 +495,8 @@ def test_route_map_inbound_outbound_same_neighbor_p0(request): result = verify_rib( tgen, adt, dut, input_dict, protocol=protocol, expected=False ) - assert result is not True, "Testcase {} : Failed \n " - "routes are not present in rib \n Error: {}".format(tc_name, result) + assert result is not True, ("Testcase {} : Failed \n " + "routes are not present in rib \n Error: {}".format(tc_name, result)) logger.info("Expected behaviour: {}".format(result)) write_test_footer(tc_name) @@ -687,14 +687,17 @@ def test_route_map_with_action_values_combination_of_prefix_action_p0( } # tgen.mininet_cli() - result = verify_rib( - tgen, adt, dut, input_dict_2, protocol=protocol, expected=False - ) if "deny" in [prefix_action, rmap_action]: - assert result is not True, "Testcase {} : Failed \n " - "Routes are still present \n Error: {}".format(tc_name, result) + result = verify_rib( + tgen, adt, dut, input_dict_2, protocol=protocol, expected=False + ) + assert result is not True, ("Testcase {} : Failed \n " + "Routes are still present \n Error: {}".format(tc_name, result)) logger.info("Expected behaviour: {}".format(result)) else: + result = verify_rib( + tgen, adt, dut, input_dict_2, protocol=protocol + ) assert result is True, "Testcase {} : Failed \n Error: {}".format( tc_name, result ) |
