Skip to content

Commit

Permalink
topotests: add mpls l3vpn test with default vrf
Browse files Browse the repository at this point in the history
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.
An additional check is done to refine the real number
of interfaces based on the presence or not of the gre0,
gretap, and erspan interfaces.

Signed-off-by: Philippe Guibert <[email protected]>
Signed-off-by: Louis Scalbert <[email protected]>
  • Loading branch information
pguibert6WIND committed Nov 27, 2024
1 parent 3586068 commit 6b82440
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 21 deletions.
9 changes: 9 additions & 0 deletions tests/topotests/bgp_snmp_mplsl3vpn/r1/bgpd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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 192.0.2.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
Expand Down
57 changes: 36 additions & 21 deletions tests/topotests/bgp_snmp_mplsl3vpn/test_bgp_snmp_mplsvpn.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,19 +253,19 @@ def _convergence():


interfaces_up_test = {
"mplsL3VpnConfiguredVrfs": "2",
"mplsL3VpnActiveVrfs": "2",
"mplsL3VpnConnectedInterfaces": "3",
"mplsL3VpnConfiguredVrfs": "3",
"mplsL3VpnActiveVrfs": "3",
"mplsL3VpnConnectedInterfaces": "7",
"mplsL3VpnNotificationEnable": "true(1)",
"mplsL3VpnVrfConfMaxPossRts": "0",
"mplsL3VpnVrfConfRteMxThrshTime": "0 seconds",
"mplsL3VpnIlllblRcvThrsh": "0",
}

interfaces_down_test = {
"mplsL3VpnConfiguredVrfs": "2",
"mplsL3VpnActiveVrfs": "1",
"mplsL3VpnConnectedInterfaces": "3",
"mplsL3VpnConfiguredVrfs": "3",
"mplsL3VpnActiveVrfs": "2",
"mplsL3VpnConnectedInterfaces": "7",
"mplsL3VpnNotificationEnable": "true(1)",
"mplsL3VpnVrfConfMaxPossRts": "0",
"mplsL3VpnVrfConfRteMxThrshTime": "0 seconds",
Expand All @@ -277,6 +277,16 @@ def test_r1_mplsvpn_scalars():
"check scalar values"
tgen = get_topogen()
r1 = tgen.gears["r1"]

# hack: count ip_gre module interfaces if present
nb_interfaces = int(interfaces_up_test["mplsL3VpnConnectedInterfaces"])
output = r1.cmd("ip -br l")
nb_interfaces += 1 if "gre0" in output else 0
nb_interfaces += 1 if "gretap0" in output else 0
nb_interfaces += 1 if "erspan0" in output else 0
interfaces_up_test["mplsL3VpnConnectedInterfaces"] = str(nb_interfaces)
interfaces_down_test["mplsL3VpnConnectedInterfaces"] = str(nb_interfaces)

r1_snmp = SnmpTester(r1, "10.1.1.1", "public", "2c")

for item in interfaces_up_test.keys():
Expand Down Expand Up @@ -391,17 +401,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)"],
}


Expand Down Expand Up @@ -498,10 +508,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)"],
}


Expand All @@ -515,6 +529,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():
Expand Down

0 comments on commit 6b82440

Please sign in to comment.