summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/topotests/ospf6-topo1/r1/ospf6d.conf4
-rw-r--r--tests/topotests/ospf6-topo1/r2/ospf6d.conf4
-rw-r--r--tests/topotests/ospf6-topo1/r3/ospf6d.conf6
-rw-r--r--tests/topotests/ospf6-topo1/r4/ospf6d.conf4
-rw-r--r--tests/topotests/ospf6-topo1/test_ospf6_topo1.py78
5 files changed, 41 insertions, 55 deletions
diff --git a/tests/topotests/ospf6-topo1/r1/ospf6d.conf b/tests/topotests/ospf6-topo1/r1/ospf6d.conf
index ab2c0c647..9f7e05893 100644
--- a/tests/topotests/ospf6-topo1/r1/ospf6d.conf
+++ b/tests/topotests/ospf6-topo1/r1/ospf6d.conf
@@ -11,9 +11,13 @@ debug ospf6 flooding
!
interface r1-stubnet
ipv6 ospf6 network broadcast
+ ipv6 ospf6 hello-interval 2
+ ipv6 ospf6 dead-interval 10
!
interface r1-sw5
ipv6 ospf6 network broadcast
+ ipv6 ospf6 hello-interval 2
+ ipv6 ospf6 dead-interval 10
!
router ospf6
ospf6 router-id 10.0.0.1
diff --git a/tests/topotests/ospf6-topo1/r2/ospf6d.conf b/tests/topotests/ospf6-topo1/r2/ospf6d.conf
index 075e815ed..26ebc2c0e 100644
--- a/tests/topotests/ospf6-topo1/r2/ospf6d.conf
+++ b/tests/topotests/ospf6-topo1/r2/ospf6d.conf
@@ -11,9 +11,13 @@ debug ospf6 flooding
!
interface r2-stubnet
ipv6 ospf6 network broadcast
+ ipv6 ospf6 hello-interval 2
+ ipv6 ospf6 dead-interval 10
!
interface r2-sw5
ipv6 ospf6 network broadcast
+ ipv6 ospf6 hello-interval 2
+ ipv6 ospf6 dead-interval 10
!
router ospf6
ospf6 router-id 10.0.0.2
diff --git a/tests/topotests/ospf6-topo1/r3/ospf6d.conf b/tests/topotests/ospf6-topo1/r3/ospf6d.conf
index e9a07a7e2..e90249653 100644
--- a/tests/topotests/ospf6-topo1/r3/ospf6d.conf
+++ b/tests/topotests/ospf6-topo1/r3/ospf6d.conf
@@ -11,12 +11,18 @@ debug ospf6 flooding
!
interface r3-stubnet
ipv6 ospf6 network broadcast
+ ipv6 ospf6 hello-interval 2
+ ipv6 ospf6 dead-interval 10
!
interface r3-sw5
ipv6 ospf6 network broadcast
+ ipv6 ospf6 hello-interval 2
+ ipv6 ospf6 dead-interval 10
!
interface r3-sw6
ipv6 ospf6 network broadcast
+ ipv6 ospf6 hello-interval 2
+ ipv6 ospf6 dead-interval 10
!
router ospf6
ospf6 router-id 10.0.0.3
diff --git a/tests/topotests/ospf6-topo1/r4/ospf6d.conf b/tests/topotests/ospf6-topo1/r4/ospf6d.conf
index fa66645f5..5607a789d 100644
--- a/tests/topotests/ospf6-topo1/r4/ospf6d.conf
+++ b/tests/topotests/ospf6-topo1/r4/ospf6d.conf
@@ -11,9 +11,13 @@ debug ospf6 flooding
!
interface r4-stubnet
ipv6 ospf6 network broadcast
+ ipv6 ospf6 hello-interval 2
+ ipv6 ospf6 dead-interval 10
!
interface r4-sw6
ipv6 ospf6 network broadcast
+ ipv6 ospf6 hello-interval 2
+ ipv6 ospf6 dead-interval 10
!
router ospf6
ospf6 router-id 10.0.0.4
diff --git a/tests/topotests/ospf6-topo1/test_ospf6_topo1.py b/tests/topotests/ospf6-topo1/test_ospf6_topo1.py
index 6ae886b76..f8c3476e1 100644
--- a/tests/topotests/ospf6-topo1/test_ospf6_topo1.py
+++ b/tests/topotests/ospf6-topo1/test_ospf6_topo1.py
@@ -185,70 +185,38 @@ def teardown_module(mod):
tgen.stop_topology()
-def test_ospf6_converged():
-
+def test_wait_protocol_convergence():
+ "Wait for OSPFv3 to converge"
tgen = get_topogen()
-
- # Don't run this test if we have any failure.
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
- # For debugging, uncomment the next line
- # tgen.mininet_cli()
-
- # Wait for OSPF6 to converge (All Neighbors in either Full or TwoWay State)
- logger.info("Waiting for OSPF6 convergence")
-
- # Set up for regex
- pat1 = re.compile("^[0-9]")
- pat2 = re.compile("Full")
-
- timeout = 60
- while timeout > 0:
- logger.info("Timeout in %s: " % timeout),
- sys.stdout.flush()
-
- # Look for any node not yet converged
- for router, rnode in tgen.routers().items():
- resStr = rnode.vtysh_cmd("show ipv6 ospf neigh")
-
- isConverged = False
+ logger.info("waiting for protocols to converge")
- for line in resStr.splitlines():
- res1 = pat1.match(line)
- if res1:
- isConverged = True
- res2 = pat2.search(line)
-
- if res2 == None:
- isConverged = False
- break
-
- if isConverged == False:
- logger.info("Waiting for {}".format(router))
- sys.stdout.flush()
- break
-
- if isConverged:
- logger.info("Done")
- break
- else:
- sleep(5)
- timeout -= 5
+ def expect_neighbor_full(router, neighbor):
+ "Wait until OSPFv3 convergence."
+ logger.info("waiting OSPFv3 router '{}'".format(router))
+ test_func = partial(
+ topotest.router_json_cmp,
+ tgen.gears[router],
+ "show ipv6 ospf6 neighbor json",
+ {"neighbors": [{"neighborId": neighbor, "state": "Full"}]},
+ )
+ _, result = topotest.run_and_expect(test_func, None, count=130, wait=1)
+ assertmsg = '"{}" convergence failure'.format(router)
+ assert result is None, assertmsg
- if timeout == 0:
- # Bail out with error if a router fails to converge
- ospfStatus = rnode.vtysh_cmd("show ipv6 ospf neigh")
- assert False, "OSPFv6 did not converge:\n{}".format(ospfStatus)
+ expect_neighbor_full("r1", "10.0.0.2")
+ expect_neighbor_full("r1", "10.0.0.3")
- logger.info("OSPFv3 converged.")
+ expect_neighbor_full("r2", "10.0.0.1")
+ expect_neighbor_full("r2", "10.0.0.3")
- # For debugging, uncomment the next line
- # tgen.mininet_cli()
+ expect_neighbor_full("r3", "10.0.0.1")
+ expect_neighbor_full("r3", "10.0.0.2")
+ expect_neighbor_full("r3", "10.0.0.4")
- # Make sure that all daemons are still running
- if tgen.routers_have_failure():
- assert tgen.errors == "", tgen.errors
+ expect_neighbor_full("r4", "10.0.0.3")
def compare_show_ipv6(rname, expected):