summaryrefslogtreecommitdiffstats
path: root/tests/topotests/pim_igmp_vrf
diff options
context:
space:
mode:
Diffstat (limited to 'tests/topotests/pim_igmp_vrf')
-rw-r--r--tests/topotests/pim_igmp_vrf/r1/ospf_blue_route.json54
-rw-r--r--tests/topotests/pim_igmp_vrf/r1/ospf_red_route.json54
-rw-r--r--tests/topotests/pim_igmp_vrf/r1/ospfd.conf2
-rw-r--r--tests/topotests/pim_igmp_vrf/r1/pimd.conf1
-rw-r--r--tests/topotests/pim_igmp_vrf/r11/ospfd.conf2
-rw-r--r--tests/topotests/pim_igmp_vrf/r12/ospfd.conf2
-rwxr-xr-xtests/topotests/pim_igmp_vrf/test_pim_vrf.py76
7 files changed, 179 insertions, 12 deletions
diff --git a/tests/topotests/pim_igmp_vrf/r1/ospf_blue_route.json b/tests/topotests/pim_igmp_vrf/r1/ospf_blue_route.json
new file mode 100644
index 0000000..c5e89d1
--- /dev/null
+++ b/tests/topotests/pim_igmp_vrf/r1/ospf_blue_route.json
@@ -0,0 +1,54 @@
+{
+ "blue": {
+ "vrfName": "blue",
+ "192.168.0.1/32": {
+ "routeType": "N",
+ "transit": false,
+ "cost": 0,
+ "area": "0.0.0.0",
+ "nexthops": [
+ {
+ "ip": " ",
+ "directlyAttachedTo": "blue"
+ }
+ ]
+ },
+ "192.168.0.11/32": {
+ "routeType": "N",
+ "transit": false,
+ "cost": 10,
+ "area": "0.0.0.0",
+ "nexthops": [
+ {
+ "ip": "192.168.101.11",
+ "via": "r1-eth1",
+ "advertisedRouter": "192.168.0.11"
+ }
+ ]
+ },
+ "192.168.100.0/24": {
+ "routeType": "N",
+ "transit": false,
+ "cost": 10,
+ "area": "0.0.0.0",
+ "nexthops": [
+ {
+ "ip": " ",
+ "directlyAttachedTo": "r1-eth0"
+ }
+ ]
+ },
+ "192.168.101.0/24": {
+ "routeType": "N",
+ "transit": true,
+ "cost": 10,
+ "area": "0.0.0.0",
+ "nexthops": [
+ {
+ "ip": " ",
+ "directlyAttachedTo": "r1-eth1"
+ }
+ ]
+ }
+ }
+}
diff --git a/tests/topotests/pim_igmp_vrf/r1/ospf_red_route.json b/tests/topotests/pim_igmp_vrf/r1/ospf_red_route.json
new file mode 100644
index 0000000..2fc340d
--- /dev/null
+++ b/tests/topotests/pim_igmp_vrf/r1/ospf_red_route.json
@@ -0,0 +1,54 @@
+{
+ "red": {
+ "vrfName": "red",
+ "192.168.0.1/32": {
+ "routeType": "N",
+ "transit": false,
+ "cost": 0,
+ "area": "0.0.0.0",
+ "nexthops": [
+ {
+ "ip": " ",
+ "directlyAttachedTo": "red"
+ }
+ ]
+ },
+ "192.168.0.12/32": {
+ "routeType": "N",
+ "transit": false,
+ "cost": 10,
+ "area": "0.0.0.0",
+ "nexthops": [
+ {
+ "ip": "192.168.101.12",
+ "via": "r1-eth3",
+ "advertisedRouter": "192.168.0.12"
+ }
+ ]
+ },
+ "192.168.100.0/24": {
+ "routeType": "N",
+ "transit": false,
+ "cost": 10,
+ "area": "0.0.0.0",
+ "nexthops": [
+ {
+ "ip": " ",
+ "directlyAttachedTo": "r1-eth2"
+ }
+ ]
+ },
+ "192.168.101.0/24": {
+ "routeType": "N",
+ "transit": true,
+ "cost": 10,
+ "area": "0.0.0.0",
+ "nexthops": [
+ {
+ "ip": " ",
+ "directlyAttachedTo": "r1-eth3"
+ }
+ ]
+ }
+ }
+}
diff --git a/tests/topotests/pim_igmp_vrf/r1/ospfd.conf b/tests/topotests/pim_igmp_vrf/r1/ospfd.conf
index 88eb5a8..9b9a261 100644
--- a/tests/topotests/pim_igmp_vrf/r1/ospfd.conf
+++ b/tests/topotests/pim_igmp_vrf/r1/ospfd.conf
@@ -1,6 +1,8 @@
hostname r1
!
! debug ospf event
+! debug ospf nsm
+! debug ospf packet hello
!
!
interface r1-eth1
diff --git a/tests/topotests/pim_igmp_vrf/r1/pimd.conf b/tests/topotests/pim_igmp_vrf/r1/pimd.conf
index 040c3d0..c4ddced 100644
--- a/tests/topotests/pim_igmp_vrf/r1/pimd.conf
+++ b/tests/topotests/pim_igmp_vrf/r1/pimd.conf
@@ -2,6 +2,7 @@ hostname r1
!
! debug igmp events
! debug igmp packets
+! debug mroute detail
! debug pim events
! debug pim packets
! debug pim trace
diff --git a/tests/topotests/pim_igmp_vrf/r11/ospfd.conf b/tests/topotests/pim_igmp_vrf/r11/ospfd.conf
index 86fb66d..e52737c 100644
--- a/tests/topotests/pim_igmp_vrf/r11/ospfd.conf
+++ b/tests/topotests/pim_igmp_vrf/r11/ospfd.conf
@@ -1,6 +1,8 @@
hostname r11
!
! debug ospf event
+! debug ospf nsm
+! debug ospf packet hello
!
interface r11-eth0
ip ospf hello-interval 2
diff --git a/tests/topotests/pim_igmp_vrf/r12/ospfd.conf b/tests/topotests/pim_igmp_vrf/r12/ospfd.conf
index f0dcabe..cd94406 100644
--- a/tests/topotests/pim_igmp_vrf/r12/ospfd.conf
+++ b/tests/topotests/pim_igmp_vrf/r12/ospfd.conf
@@ -1,6 +1,8 @@
hostname r12
!
! debug ospf event
+! debug ospf nsm
+! debug ospf packet hello
!
interface r12-eth0
ip ospf hello-interval 2
diff --git a/tests/topotests/pim_igmp_vrf/test_pim_vrf.py b/tests/topotests/pim_igmp_vrf/test_pim_vrf.py
index ddc4303..01c496d 100755
--- a/tests/topotests/pim_igmp_vrf/test_pim_vrf.py
+++ b/tests/topotests/pim_igmp_vrf/test_pim_vrf.py
@@ -60,7 +60,7 @@ TOPOLOGY = """
+---------+ +------------+ | +---------+
| Host H1 | 192.168.100.0/24 | | .1 | .11 | Host H2 |
| receive |------------------| VRF Blue |---------+--------| PIM RP |
-|IGMP JOIN| .10 .1 | | 192.168.101.0/24 | |
+|IGMP JOIN| .10 .1 | | 192.168.101.0/24 | |
+---------+ | | +---------+
=| = = R1 = = |=
+---------+ | | +---------+
@@ -68,7 +68,7 @@ TOPOLOGY = """
| receive |------------------| VRF Red |---------+--------| PIM RP |
|IGMP JOIN| .20 .1 | | .1 | .12 | |
+---------+ +------------+ | +---------+
- .4 |
+ .4 |
+----------+
| Host H4 |
| Source |
@@ -80,6 +80,7 @@ import functools
import os
import sys
import pytest
+import logging
# Save the Current Working Directory to find configuration files.
CWD = os.path.dirname(os.path.realpath(__file__))
@@ -91,7 +92,7 @@ from lib import topotest
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.topolog import logger
from lib.topotest import iproute2_is_vrf_capable
-from lib.common_config import required_linux_kernel_version
+from lib.common_config import required_linux_kernel_version, retry
from lib.pim import McastTesterHelper
@@ -192,6 +193,17 @@ def setup_module(module):
tgen.start_router()
+ # iproute2 needs to support VRFs for this suite to run.
+ if not iproute2_is_vrf_capable():
+ pytest.skip(
+ "Installed iproute2 version does not support VRFs", allow_module_level=True
+ )
+
+ if os.getenv("MROUTE_VRF_MISSING"):
+ pytest.skip(
+ "Kernel does not support vrf mroute tables.", allow_module_level=True
+ )
+
def teardown_module(module):
tgen = get_topogen()
@@ -202,16 +214,13 @@ def test_ospf_convergence():
"Test for OSPFv2 convergence"
tgen = get_topogen()
- # iproute2 needs to support VRFs for this suite to run.
- if not iproute2_is_vrf_capable():
- pytest.skip("Installed iproute2 version does not support VRFs")
-
# Skip if previous fatal error condition is raised
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
logger.info("Checking OSPFv2 convergence on router r1 for VRF blue")
+ # Check for blue neighbor
router = tgen.gears["r1"]
reffile = os.path.join(CWD, "r1/ospf_blue_neighbor.json")
expected = json.loads(open(reffile).read())
@@ -223,7 +232,22 @@ def test_ospf_convergence():
expected,
)
_, res = topotest.run_and_expect(test_func, None, count=60, wait=2)
- assertmsg = "OSPF router R1 did not converge on VRF blue"
+ assertmsg = "OSPF router R1 did not converge on VRF blue (nbr)"
+ assert res is None, assertmsg
+
+ # Check for blue loopback route
+ router = tgen.gears["r1"]
+ reffile = os.path.join(CWD, "r1/ospf_blue_route.json")
+ expected = json.loads(open(reffile).read())
+
+ test_func = functools.partial(
+ topotest.router_json_cmp,
+ router,
+ "show ip ospf vrf blue route json",
+ expected,
+ )
+ _, res = topotest.run_and_expect(test_func, None, count=30, wait=2)
+ assertmsg = "OSPF router R1 did not converge on VRF blue (route)"
assert res is None, assertmsg
logger.info("Checking OSPFv2 convergence on router r1 for VRF red")
@@ -236,7 +260,22 @@ def test_ospf_convergence():
topotest.router_json_cmp, router, "show ip ospf vrf red neighbor json", expected
)
_, res = topotest.run_and_expect(test_func, None, count=60, wait=2)
- assertmsg = "OSPF router R1 did not converge on VRF red"
+ assertmsg = "OSPF router R1 did not converge on VRF red (nbr)"
+ assert res is None, assertmsg
+
+ # Check for red loopback route
+ router = tgen.gears["r1"]
+ reffile = os.path.join(CWD, "r1/ospf_red_route.json")
+ expected = json.loads(open(reffile).read())
+
+ test_func = functools.partial(
+ topotest.router_json_cmp,
+ router,
+ "show ip ospf vrf red route json",
+ expected,
+ )
+ _, res = topotest.run_and_expect(test_func, None, count=30, wait=2)
+ assertmsg = "OSPF router R1 did not converge on VRF red (route)"
assert res is None, assertmsg
@@ -275,10 +314,13 @@ def test_pim_convergence():
assert res is None, assertmsg
-def test_vrf_pimreg_interfaces():
+def _test_vrf_pimreg_interfaces():
"Adding PIM RP in VRF information and verify pimreg interfaces"
tgen = get_topogen()
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
r1 = tgen.gears["r1"]
r1.vtysh_cmd("conf\ninterface blue\nip pim")
r1.vtysh_cmd("conf\nvrf blue\nip pim rp 192.168.0.11 239.100.0.1/32\nexit-vrf")
@@ -292,7 +334,7 @@ def test_vrf_pimreg_interfaces():
"show ip pim vrf blue inter pimreg11 json",
expected,
)
- _, res = topotest.run_and_expect(test_func, None, count=5, wait=2)
+ _, res = topotest.run_and_expect(test_func, None, count=15, wait=2)
assertmsg = "PIM router R1, VRF blue (table 11) pimreg11 interface missing or incorrect status"
assert res is None, assertmsg
@@ -308,10 +350,20 @@ def test_vrf_pimreg_interfaces():
"show ip pim vrf red inter pimreg12 json",
expected,
)
- _, res = topotest.run_and_expect(test_func, None, count=5, wait=2)
+ _, res = topotest.run_and_expect(test_func, None, count=15, wait=2)
assertmsg = "PIM router R1, VRF red (table 12) pimreg12 interface missing or incorrect status"
assert res is None, assertmsg
+def test_vrf_pimreg_interfaces():
+ tgen = get_topogen()
+ r1 = tgen.gears["r1"]
+ try:
+ _test_vrf_pimreg_interfaces()
+ except Exception:
+ # get some debug info.
+ output = r1.net.cmd_nostatus("ip -o link")
+ logging.error("ip link info after failure: %s", output)
+ raise
##################################
### Test PIM / IGMP with VRF