summaryrefslogtreecommitdiff
path: root/tests/topotests/pim_basic_topo2/test_pim_basic_topo2.py
diff options
context:
space:
mode:
authorChristian Hopps <chopps@labn.net>2021-07-29 09:38:55 +0000
committerChristian Hopps <chopps@labn.net>2021-09-04 09:04:46 -0400
commite82b531df94b9fd7bc456df8a1b7c58f2770eff9 (patch)
treec5b8812d719c905bec58db38a2f0800be675c0e5 /tests/topotests/pim_basic_topo2/test_pim_basic_topo2.py
parentd7d21c3a190f7754afe4d5b969501756a3739e48 (diff)
tests: remove legacy Topo class (fixes many pylint errors)
Signed-off-by: Christian Hopps <chopps@labn.net>
Diffstat (limited to 'tests/topotests/pim_basic_topo2/test_pim_basic_topo2.py')
-rw-r--r--tests/topotests/pim_basic_topo2/test_pim_basic_topo2.py34
1 files changed, 15 insertions, 19 deletions
diff --git a/tests/topotests/pim_basic_topo2/test_pim_basic_topo2.py b/tests/topotests/pim_basic_topo2/test_pim_basic_topo2.py
index 2bed11c546..2352a9ab12 100644
--- a/tests/topotests/pim_basic_topo2/test_pim_basic_topo2.py
+++ b/tests/topotests/pim_basic_topo2/test_pim_basic_topo2.py
@@ -48,33 +48,29 @@ from lib.micronet_compat import Topo
pytestmark = [pytest.mark.bfdd, pytest.mark.pimd]
-class PimBasicTopo2(Topo):
- "Test topology builder"
+def build_topo(tgen):
+ "Build function"
- def build(self, *_args, **_opts):
- "Build function"
- tgen = get_topogen(self)
+ # Create 4 routers
+ for routern in range(1, 5):
+ tgen.add_router("r{}".format(routern))
- # Create 4 routers
- for routern in range(1, 5):
- tgen.add_router("r{}".format(routern))
+ switch = tgen.add_switch("s1")
+ switch.add_link(tgen.gears["r1"])
+ switch.add_link(tgen.gears["r2"])
- switch = tgen.add_switch("s1")
- switch.add_link(tgen.gears["r1"])
- switch.add_link(tgen.gears["r2"])
+ switch = tgen.add_switch("s2")
+ switch.add_link(tgen.gears["r2"])
+ switch.add_link(tgen.gears["r3"])
- switch = tgen.add_switch("s2")
- switch.add_link(tgen.gears["r2"])
- switch.add_link(tgen.gears["r3"])
-
- switch = tgen.add_switch("s3")
- switch.add_link(tgen.gears["r2"])
- switch.add_link(tgen.gears["r4"])
+ switch = tgen.add_switch("s3")
+ switch.add_link(tgen.gears["r2"])
+ switch.add_link(tgen.gears["r4"])
def setup_module(mod):
"Sets up the pytest environment"
- tgen = Topogen(PimBasicTopo2, mod.__name__)
+ tgen = Topogen(build_topo, mod.__name__)
tgen.start_topology()
router_list = tgen.routers()