From 9f70325cd905efeea343d6c5dfce6a7400bbe0d4 Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Wed, 7 Jun 2023 14:56:21 +0200 Subject: [PATCH] topotests: add mpls l3vpn test with default vrf There is no MPLS VPN test with default VRF. Add a test to ensure that the MPLS VPN MIB also works with the default VRF. The number of interfaces in the default VRF is different, as it includes the gre0, gretap, erspan interfaces. Signed-off-by: Philippe Guibert --- .../topotests/bgp_snmp_mplsl3vpn/r1/bgpd.conf | 9 ++++ .../test_bgp_snmp_mplsvpn.py | 48 ++++++++++--------- 2 files changed, 35 insertions(+), 22 deletions(-) diff --git a/tests/topotests/bgp_snmp_mplsl3vpn/r1/bgpd.conf b/tests/topotests/bgp_snmp_mplsl3vpn/r1/bgpd.conf index 098e55d0ed34..8459d31a0190 100644 --- a/tests/topotests/bgp_snmp_mplsl3vpn/r1/bgpd.conf +++ b/tests/topotests/bgp_snmp_mplsl3vpn/r1/bgpd.conf @@ -6,6 +6,15 @@ router bgp 65000 neighbor 10.4.4.4 update-source 10.1.1.1 neighbor 10.4.4.4 timers connect 10 ! + address-family ipv4 unicast + network 8.8.8.8/32 + label vpn export 8888 + rd vpn export 88:88 + rt vpn both 88:99 + export vpn + import vpn + exit-address-family + no bgp network import-check address-family ipv4 vpn neighbor 10.4.4.4 activate exit-address-family diff --git a/tests/topotests/bgp_snmp_mplsl3vpn/test_bgp_snmp_mplsvpn.py b/tests/topotests/bgp_snmp_mplsl3vpn/test_bgp_snmp_mplsvpn.py index 0131e12579b3..69a4135566c3 100755 --- a/tests/topotests/bgp_snmp_mplsl3vpn/test_bgp_snmp_mplsvpn.py +++ b/tests/topotests/bgp_snmp_mplsl3vpn/test_bgp_snmp_mplsvpn.py @@ -253,9 +253,9 @@ def _convergence(): interfaces_up_test = { - "mplsL3VpnConfiguredVrfs": "2", - "mplsL3VpnActiveVrfs": "2", - "mplsL3VpnConnectedInterfaces": "3", + "mplsL3VpnConfiguredVrfs": "3", + "mplsL3VpnActiveVrfs": "3", + "mplsL3VpnConnectedInterfaces": "10", "mplsL3VpnNotificationEnable": "true(1)", "mplsL3VpnVrfConfMaxPossRts": "0", "mplsL3VpnVrfConfRteMxThrshTime": "0 seconds", @@ -263,9 +263,9 @@ def _convergence(): } interfaces_down_test = { - "mplsL3VpnConfiguredVrfs": "2", - "mplsL3VpnActiveVrfs": "1", - "mplsL3VpnConnectedInterfaces": "3", + "mplsL3VpnConfiguredVrfs": "3", + "mplsL3VpnActiveVrfs": "2", + "mplsL3VpnConnectedInterfaces": "10", "mplsL3VpnNotificationEnable": "true(1)", "mplsL3VpnVrfConfMaxPossRts": "0", "mplsL3VpnVrfConfRteMxThrshTime": "0 seconds", @@ -325,7 +325,6 @@ def router_interface_get_ifindex(router, interface): def generate_vrf_ifindex_oid(vrf, ifindex): - intoid = snmp_uint32_to_oid(int(ifindex)) vrfoid = snmp_str_to_oid(vrf) oid = "{}.{}".format(vrfoid, intoid) @@ -392,17 +391,17 @@ def test_r1_mplsvpn_IfTable(): vrftable_test = { - "mplsL3VpnVrfDescription": ["VRF-a", "VRF-b"], - "mplsL3VpnVrfRD": ['"10:1"', '"10:2"'], - "mplsL3VpnVrfOperStatus": ["up(1)", "up(1)"], - "mplsL3VpnVrfActiveInterfaces": ["2", "1"], - "mplsL3VpnVrfAssociatedInterfaces": ["2", "1"], - "mplsL3VpnVrfConfMidRteThresh": ["0", "0"], - "mplsL3VpnVrfConfHighRteThresh": ["0", "0"], - "mplsL3VpnVrfConfMaxRoutes": ["0", "0"], - "mplsL3VpnVrfConfRowStatus": ["active(1)", "active(1)"], - "mplsL3VpnVrfConfAdminStatus": ["up(1)", "up(1)"], - "mplsL3VpnVrfConfStorageType": ["volatile(2)", "volatile(2)"], + "mplsL3VpnVrfDescription": ["VRF-a", "VRF-b", "default"], + "mplsL3VpnVrfRD": ['"10:1"', '"10:2"', '"88:88"'], + "mplsL3VpnVrfOperStatus": ["up(1)", "up(1)", "up(1)"], + "mplsL3VpnVrfActiveInterfaces": ["2", "1", "3"], + "mplsL3VpnVrfAssociatedInterfaces": ["2", "1", "3"], + "mplsL3VpnVrfConfMidRteThresh": ["0", "0", "0"], + "mplsL3VpnVrfConfHighRteThresh": ["0", "0", "0"], + "mplsL3VpnVrfConfMaxRoutes": ["0", "0", "0"], + "mplsL3VpnVrfConfRowStatus": ["active(1)", "active(1)", "active(1)"], + "mplsL3VpnVrfConfAdminStatus": ["up(1)", "up(1)", "up(1)"], + "mplsL3VpnVrfConfStorageType": ["volatile(2)", "volatile(2)", "volatile(2)"], } @@ -499,10 +498,14 @@ def test_r1_mplsvpn_VrfTable(): rt_table_test = { - "mplsL3VpnVrfRT": ['"1:1"', '"1:2"'], - "mplsL3VpnVrfRTDescr": ["RT both for VRF VRF-a", "RT both for VRF VRF-b"], - "mplsL3VpnVrfRTRowStatus": ["active(1)", "active(1)"], - "mplsL3VpnVrfRTStorageType": ["volatile(2)", "volatile(2)"], + "mplsL3VpnVrfRT": ['"1:1"', '"1:2"', '"88:99"'], + "mplsL3VpnVrfRTDescr": [ + "RT both for VRF VRF-a", + "RT both for VRF VRF-b", + "RT both for VRF default", + ], + "mplsL3VpnVrfRTRowStatus": ["active(1)", "active(1)", "active(1)"], + "mplsL3VpnVrfRTStorageType": ["volatile(2)", "volatile(2)", "volatile(2)"], } @@ -516,6 +519,7 @@ def test_r1_mplsvpn_VrfRT_table(): oids = [] oids.append(generate_vrf_index_type_oid("VRF-a", 1, 3)) oids.append(generate_vrf_index_type_oid("VRF-b", 1, 3)) + oids.append(generate_vrf_index_type_oid("default", 1, 3)) # check items for item in rt_table_test.keys():