summaryrefslogtreecommitdiffstats
path: root/tests/topotests/rip_bfd_topo1
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-05 09:56:23 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-05 09:56:23 +0000
commitc15d6efd40655f717841d00839a43df1ead5cb26 (patch)
tree35d579f9a19170e2b39085669ca92533c2d161b4 /tests/topotests/rip_bfd_topo1
parentAdding upstream version 10.0.1. (diff)
downloadfrr-c15d6efd40655f717841d00839a43df1ead5cb26.tar.xz
frr-c15d6efd40655f717841d00839a43df1ead5cb26.zip
Adding upstream version 10.1.upstream/10.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/topotests/rip_bfd_topo1')
-rw-r--r--tests/topotests/rip_bfd_topo1/test_rip_bfd_topo1.py222
1 files changed, 106 insertions, 116 deletions
diff --git a/tests/topotests/rip_bfd_topo1/test_rip_bfd_topo1.py b/tests/topotests/rip_bfd_topo1/test_rip_bfd_topo1.py
index 71c9093..d03d547 100644
--- a/tests/topotests/rip_bfd_topo1/test_rip_bfd_topo1.py
+++ b/tests/topotests/rip_bfd_topo1/test_rip_bfd_topo1.py
@@ -32,10 +32,7 @@ pytestmark = [
def tgen(request):
"Setup/Teardown the environment and provide tgen argument to tests"
- topodef = {
- "s1": ("r1", "r2"),
- "s2": ("r1", "r3")
- }
+ topodef = {"s1": ("r1", "r2"), "s2": ("r1", "r3")}
tgen = Topogen(topodef, request.module.__name__)
tgen.start_topology()
@@ -68,16 +65,17 @@ def show_rip_json(router):
for route in routes:
match = re.match(
- r"(.)\((.)\)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)", route)
+ r"(.)\((.)\)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)", route
+ )
if match is None:
continue
route_entry = {
- "code": match[1],
- "subCode": match[2],
- "nextHop": match[4],
- "metric": int(match[5]),
- "from": match[6],
+ "code": match[1],
+ "subCode": match[2],
+ "nextHop": match[4],
+ "metric": int(match[5]),
+ "from": match[6],
}
if json.get(match[3]) is None:
@@ -95,12 +93,8 @@ def expect_routes(router, routes, time_amount):
"Internal test function."
return topotest.json_cmp(show_rip_json(router), routes)
- _, result = topotest.run_and_expect(test_function,
- None,
- count=time_amount,
- wait=1)
- assert result is None, "Unexpected routing table in {}".format(
- router.name)
+ _, result = topotest.run_and_expect(test_function, None, count=time_amount, wait=1)
+ assert result is None, "Unexpected routing table in {}".format(router.name)
def expect_bfd_peers(router, peers):
@@ -119,91 +113,87 @@ def test_rip_convergence(tgen):
"Test that RIP learns the neighbor routes."
expect_routes(
- tgen.gears["r1"], {
- "10.254.254.2/32": [{
- "code": "R",
- "subCode": "n",
- "from": "192.168.0.2"
- }],
- "10.254.254.3/32": [{
- "code": "R",
- "subCode": "n",
- "from": "192.168.1.2"
- }],
- "10.254.254.100/32": [{
- "code": "R",
- "subCode": "n",
- "from": "192.168.0.2",
- }, {
- "code": "R",
- "subCode": "n",
- "from": "192.168.1.2",
- }]
- }, 40)
-
- expect_bfd_peers(tgen.gears["r1"], [{
- "peer": "192.168.0.2",
- "status": "up",
- "receive-interval": 1000,
- "transmit-interval": 1000,
- }, {
- "peer": "192.168.1.2",
- "status": "up",
- "receive-interval": 1000,
- "transmit-interval": 1000,
- }])
+ tgen.gears["r1"],
+ {
+ "10.254.254.2/32": [{"code": "R", "subCode": "n", "from": "192.168.0.2"}],
+ "10.254.254.3/32": [{"code": "R", "subCode": "n", "from": "192.168.1.2"}],
+ "10.254.254.100/32": [
+ {
+ "code": "R",
+ "subCode": "n",
+ "from": "192.168.0.2",
+ },
+ {
+ "code": "R",
+ "subCode": "n",
+ "from": "192.168.1.2",
+ },
+ ],
+ },
+ 40,
+ )
+
+ expect_bfd_peers(
+ tgen.gears["r1"],
+ [
+ {
+ "peer": "192.168.0.2",
+ "status": "up",
+ "receive-interval": 1000,
+ "transmit-interval": 1000,
+ },
+ {
+ "peer": "192.168.1.2",
+ "status": "up",
+ "receive-interval": 1000,
+ "transmit-interval": 1000,
+ },
+ ],
+ )
expect_routes(
- tgen.gears["r2"], {
- "10.254.254.1/32": [{
- "code": "R",
- "subCode": "n",
- "from": "192.168.0.1"
- }],
- "10.254.254.3/32": [{
- "code": "R",
- "subCode": "n",
- "from": "192.168.0.1"
- }],
- "10.254.254.100/32": [{
- "code": "S",
- "subCode": "r",
- "from": "self"
- }]
- }, 40)
-
- expect_bfd_peers(tgen.gears["r2"], [{
- "peer": "192.168.0.1",
- "status": "up",
- "receive-interval": 1000,
- "transmit-interval": 1000,
- }])
+ tgen.gears["r2"],
+ {
+ "10.254.254.1/32": [{"code": "R", "subCode": "n", "from": "192.168.0.1"}],
+ "10.254.254.3/32": [{"code": "R", "subCode": "n", "from": "192.168.0.1"}],
+ "10.254.254.100/32": [{"code": "S", "subCode": "r", "from": "self"}],
+ },
+ 40,
+ )
+
+ expect_bfd_peers(
+ tgen.gears["r2"],
+ [
+ {
+ "peer": "192.168.0.1",
+ "status": "up",
+ "receive-interval": 1000,
+ "transmit-interval": 1000,
+ }
+ ],
+ )
expect_routes(
- tgen.gears["r3"], {
- "10.254.254.1/32": [{
- "code": "R",
- "subCode": "n",
- "from": "192.168.1.1"
- }],
- "10.254.254.2/32": [{
- "code": "R",
- "subCode": "n",
- "from": "192.168.1.1"
- }],
- "10.254.254.100/32": [{
- "code": "S",
- "subCode": "r",
- "from": "self"
- }]
- }, 40)
-
- expect_bfd_peers(tgen.gears["r3"], [{
- "peer": "192.168.1.1",
- "status": "up",
- "receive-interval": 1000,
- "transmit-interval": 1000,
- }])
+ tgen.gears["r3"],
+ {
+ "10.254.254.1/32": [{"code": "R", "subCode": "n", "from": "192.168.1.1"}],
+ "10.254.254.2/32": [{"code": "R", "subCode": "n", "from": "192.168.1.1"}],
+ "10.254.254.100/32": [{"code": "S", "subCode": "r", "from": "self"}],
+ },
+ 40,
+ )
+
+ expect_bfd_peers(
+ tgen.gears["r3"],
+ [
+ {
+ "peer": "192.168.1.1",
+ "status": "up",
+ "receive-interval": 1000,
+ "transmit-interval": 1000,
+ }
+ ],
+ )
def test_rip_bfd_convergence(tgen):
@@ -212,30 +202,30 @@ def test_rip_bfd_convergence(tgen):
tgen.gears["r3"].link_enable("r3-eth0", False)
expect_routes(
- tgen.gears["r1"], {
- "10.254.254.2/32": [{
- "code": "R",
- "subCode": "n",
- "from": "192.168.0.2"
- }],
+ tgen.gears["r1"],
+ {
+ "10.254.254.2/32": [{"code": "R", "subCode": "n", "from": "192.168.0.2"}],
"10.254.254.3/32": None,
- "10.254.254.100/32": [{
- "code": "R",
- "subCode": "n",
- "from": "192.168.0.2",
- }]
- }, 6)
+ "10.254.254.100/32": [
+ {
+ "code": "R",
+ "subCode": "n",
+ "from": "192.168.0.2",
+ }
+ ],
+ },
+ 6,
+ )
expect_routes(
- tgen.gears["r3"], {
+ tgen.gears["r3"],
+ {
"10.254.254.1/32": None,
"10.254.254.2/32": None,
- "10.254.254.100/32": [{
- "code": "S",
- "subCode": "r",
- "from": "self"
- }]
- }, 6)
+ "10.254.254.100/32": [{"code": "S", "subCode": "r", "from": "self"}],
+ },
+ 6,
+ )
def test_memory_leak(tgen):