diff options
Diffstat (limited to 'tests/topotests/bgp_vpnv4_asbr')
-rw-r--r-- | tests/topotests/bgp_vpnv4_asbr/r1/bgpd.conf | 1 | ||||
-rw-r--r-- | tests/topotests/bgp_vpnv4_asbr/r2/bgpd.conf | 7 | ||||
-rw-r--r-- | tests/topotests/bgp_vpnv4_asbr/r3/bgpd.conf | 1 | ||||
-rw-r--r-- | tests/topotests/bgp_vpnv4_asbr/test_bgp_vpnv4_asbr.py | 60 |
4 files changed, 10 insertions, 59 deletions
diff --git a/tests/topotests/bgp_vpnv4_asbr/r1/bgpd.conf b/tests/topotests/bgp_vpnv4_asbr/r1/bgpd.conf index 3bbcc20..473e56b 100644 --- a/tests/topotests/bgp_vpnv4_asbr/r1/bgpd.conf +++ b/tests/topotests/bgp_vpnv4_asbr/r1/bgpd.conf @@ -1,6 +1,7 @@ router bgp 65500 bgp router-id 192.0.2.1 no bgp ebgp-requires-policy + no bgp enforce-first-as neighbor 192.0.2.100 remote-as 65500 neighbor 192.0.2.100 update-source lo neighbor 192.168.0.100 remote-as 65500 diff --git a/tests/topotests/bgp_vpnv4_asbr/r2/bgpd.conf b/tests/topotests/bgp_vpnv4_asbr/r2/bgpd.conf index 4c84d52..c7244c0 100644 --- a/tests/topotests/bgp_vpnv4_asbr/r2/bgpd.conf +++ b/tests/topotests/bgp_vpnv4_asbr/r2/bgpd.conf @@ -1,9 +1,10 @@ -debug bgp nht -debug bgp zebra -debug bgp labelpool +!debug bgp nht +!debug bgp zebra +!debug bgp labelpool router bgp 65500 bgp router-id 192.0.2.2 no bgp ebgp-requires-policy + no bgp enforce-first-as neighbor 192.0.2.100 remote-as 65500 neighbor 192.0.2.100 update-source lo neighbor 192.168.0.100 remote-as 65500 diff --git a/tests/topotests/bgp_vpnv4_asbr/r3/bgpd.conf b/tests/topotests/bgp_vpnv4_asbr/r3/bgpd.conf index c5d5727..b7592e4 100644 --- a/tests/topotests/bgp_vpnv4_asbr/r3/bgpd.conf +++ b/tests/topotests/bgp_vpnv4_asbr/r3/bgpd.conf @@ -1,6 +1,7 @@ router bgp 65501 bgp router-id 192.0.2.3 no bgp ebgp-requires-policy + no bgp enforce-first-as neighbor 192.168.1.200 remote-as 65502 address-family ipv4 unicast no neighbor 192.168.1.200 activate diff --git a/tests/topotests/bgp_vpnv4_asbr/test_bgp_vpnv4_asbr.py b/tests/topotests/bgp_vpnv4_asbr/test_bgp_vpnv4_asbr.py index a908e74..39865eb 100644 --- a/tests/topotests/bgp_vpnv4_asbr/test_bgp_vpnv4_asbr.py +++ b/tests/topotests/bgp_vpnv4_asbr/test_bgp_vpnv4_asbr.py @@ -48,6 +48,10 @@ sys.path.append(os.path.join(CWD, "../")) # pylint: disable=C0413 # Import topogen and topotest helpers from lib import topotest +from lib.bgpcheck import ( + check_show_bgp_vpn_prefix_found, + check_show_bgp_vpn_prefix_not_found, +) from lib.topogen import Topogen, TopoRouter, get_topogen from lib.topolog import logger from lib.checkping import check_ping @@ -259,62 +263,6 @@ def mpls_table_check_entry(router, out_label, out_nexthop): ) -def check_show_bgp_vpn_prefix_found( - router, ipversion, prefix, rd, label=None, nexthop=None -): - """ - Check if a given vpn prefix is present in the BGP RIB - * 'router': the router to check BGP VPN RIB - * 'ipversion': The ip version to check: ipv4 or ipv6 - * 'prefix': the IP prefix to check - * 'rd': the route distinguisher to check - * 'label: the label to check - """ - output = json.loads( - router.vtysh_cmd("show bgp {} vpn {} json".format(ipversion, prefix)) - ) - if label: - if nexthop: - expected = { - rd: { - "prefix": prefix, - "paths": [{"remoteLabel": label, "nexthops": [{"ip": nexthop}]}], - } - } - else: - expected = {rd: {"prefix": prefix, "paths": [{"remoteLabel": label}]}} - else: - if nexthop: - expected = { - rd: {"prefix": prefix, "paths": [{"nexthops": [{"ip": nexthop}]}]} - } - else: - expected = {rd: {"prefix": prefix}} - return topotest.json_cmp(output, expected) - - -def check_show_bgp_vpn_prefix_not_found(router, ipversion, prefix, rd, label=None): - """ - Check if a given vpn prefix is not present in the BGP RIB - * 'router': the router to check BGP VPN RIB - * 'ipversion': The ip version to check: ipv4 or ipv6 - * 'prefix': the IP prefix to check - * 'rd': the route distinguisher to check - * 'label: the label to check - """ - output = json.loads( - router.vtysh_cmd("show bgp {} vpn {} json".format(ipversion, prefix)) - ) - if label: - expected = {rd: {"prefix": prefix, "paths": [{"remoteLabel": label}]}} - else: - expected = {rd: {"prefix": prefix}} - ret = topotest.json_cmp(output, expected) - if ret is None: - return "not good" - return None - - def check_show_mpls_table_entry_label_not_found(router, inlabel): output = json.loads(router.vtysh_cmd("show mpls table {} json".format(inlabel))) expected = {"inLabel": inlabel, "installed": True} |