summaryrefslogtreecommitdiffstats
path: root/tests/topotests/bgp_auth
diff options
context:
space:
mode:
authorChristian Hopps <chopps@labn.net>2021-07-29 11:38:55 +0200
committerChristian Hopps <chopps@labn.net>2021-09-04 15:04:46 +0200
commite82b531df94b9fd7bc456df8a1b7c58f2770eff9 (patch)
treec5b8812d719c905bec58db38a2f0800be675c0e5 /tests/topotests/bgp_auth
parenttests: fix pylint test errors (diff)
downloadfrr-e82b531df94b9fd7bc456df8a1b7c58f2770eff9.tar.xz
frr-e82b531df94b9fd7bc456df8a1b7c58f2770eff9.zip
tests: remove legacy Topo class (fixes many pylint errors)
Signed-off-by: Christian Hopps <chopps@labn.net>
Diffstat (limited to 'tests/topotests/bgp_auth')
-rw-r--r--tests/topotests/bgp_auth/test_bgp_auth.py114
1 files changed, 51 insertions, 63 deletions
diff --git a/tests/topotests/bgp_auth/test_bgp_auth.py b/tests/topotests/bgp_auth/test_bgp_auth.py
index b13f3d6e2..48ba0cca5 100644
--- a/tests/topotests/bgp_auth/test_bgp_auth.py
+++ b/tests/topotests/bgp_auth/test_bgp_auth.py
@@ -74,76 +74,64 @@ pytestmark = [pytest.mark.bgpd, pytest.mark.ospfd]
class InvalidCLIError(Exception):
"""Raise when the CLI command is wrong"""
-
pass
-
-class TemplateTopo(Topo):
- "Test topology builder"
-
- def build(self, *_args, **_opts):
- "Build function"
- tgen = get_topogen(self)
-
- # This function only purpose is to define allocation and relationship
- # between routers, switches and hosts.
- #
- #
- # Create routers
- tgen.add_router("R1")
- tgen.add_router("R2")
- tgen.add_router("R3")
-
- # R1-R2 1
- switch = tgen.add_switch("s1")
- switch.add_link(tgen.gears["R1"])
- switch.add_link(tgen.gears["R2"])
-
- # R1-R3 1
- switch = tgen.add_switch("s2")
- switch.add_link(tgen.gears["R1"])
- switch.add_link(tgen.gears["R3"])
-
- # R2-R3 1
- switch = tgen.add_switch("s3")
- switch.add_link(tgen.gears["R2"])
- switch.add_link(tgen.gears["R3"])
-
- # R1-R2 2
- switch = tgen.add_switch("s4")
- switch.add_link(tgen.gears["R1"])
- switch.add_link(tgen.gears["R2"])
-
- # R1-R3 2
- switch = tgen.add_switch("s5")
- switch.add_link(tgen.gears["R1"])
- switch.add_link(tgen.gears["R3"])
-
- # R2-R3 2
- switch = tgen.add_switch("s6")
- switch.add_link(tgen.gears["R2"])
- switch.add_link(tgen.gears["R3"])
-
- # R1-R2 3
- switch = tgen.add_switch("s7")
- switch.add_link(tgen.gears["R1"])
- switch.add_link(tgen.gears["R2"])
-
- # R1-R3 2
- switch = tgen.add_switch("s8")
- switch.add_link(tgen.gears["R1"])
- switch.add_link(tgen.gears["R3"])
-
- # R2-R3 2
- switch = tgen.add_switch("s9")
- switch.add_link(tgen.gears["R2"])
- switch.add_link(tgen.gears["R3"])
+def build_topo(tgen):
+ # Create routers
+ tgen.add_router("R1")
+ tgen.add_router("R2")
+ tgen.add_router("R3")
+
+ # R1-R2 1
+ switch = tgen.add_switch("s1")
+ switch.add_link(tgen.gears["R1"])
+ switch.add_link(tgen.gears["R2"])
+
+ # R1-R3 1
+ switch = tgen.add_switch("s2")
+ switch.add_link(tgen.gears["R1"])
+ switch.add_link(tgen.gears["R3"])
+
+ # R2-R3 1
+ switch = tgen.add_switch("s3")
+ switch.add_link(tgen.gears["R2"])
+ switch.add_link(tgen.gears["R3"])
+
+ # R1-R2 2
+ switch = tgen.add_switch("s4")
+ switch.add_link(tgen.gears["R1"])
+ switch.add_link(tgen.gears["R2"])
+
+ # R1-R3 2
+ switch = tgen.add_switch("s5")
+ switch.add_link(tgen.gears["R1"])
+ switch.add_link(tgen.gears["R3"])
+
+ # R2-R3 2
+ switch = tgen.add_switch("s6")
+ switch.add_link(tgen.gears["R2"])
+ switch.add_link(tgen.gears["R3"])
+
+ # R1-R2 3
+ switch = tgen.add_switch("s7")
+ switch.add_link(tgen.gears["R1"])
+ switch.add_link(tgen.gears["R2"])
+
+ # R1-R3 2
+ switch = tgen.add_switch("s8")
+ switch.add_link(tgen.gears["R1"])
+ switch.add_link(tgen.gears["R3"])
+
+ # R2-R3 2
+ switch = tgen.add_switch("s9")
+ switch.add_link(tgen.gears["R2"])
+ switch.add_link(tgen.gears["R3"])
def setup_module(mod):
"Sets up the pytest environment"
# This function initiates the topology build with Topogen...
- tgen = Topogen(TemplateTopo, mod.__name__)
+ tgen = Topogen(build_topo, mod.__name__)
# ... and here it calls Mininet initialization functions.
tgen.start_topology()