summaryrefslogtreecommitdiff
path: root/tests/topotests/pim_basic/test_pim.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/test_pim.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/test_pim.py')
-rw-r--r--tests/topotests/pim_basic/test_pim.py74
1 files changed, 36 insertions, 38 deletions
diff --git a/tests/topotests/pim_basic/test_pim.py b/tests/topotests/pim_basic/test_pim.py
index e921b37b69..c346a77c08 100644
--- a/tests/topotests/pim_basic/test_pim.py
+++ b/tests/topotests/pim_basic/test_pim.py
@@ -46,48 +46,46 @@ from lib.micronet_compat import Topo
pytestmark = [pytest.mark.pimd]
-class PIMTopo(Topo):
- def build(self, *_args, **_opts):
- "Build function"
- tgen = get_topogen(self)
-
- for routern in range(1, 4):
- tgen.add_router("r{}".format(routern))
-
- tgen.add_router("rp")
-
- # rp ------ r1 -------- r2
- # \
- # --------- r3
- # r1 -> .1
- # r2 -> .2
- # rp -> .3
- # r3 -> .4
- # loopback network is 10.254.0.X/32
- #
- # r1 <- sw1 -> r2
- # r1-eth0 <-> r2-eth0
- # 10.0.20.0/24
- sw = tgen.add_switch("sw1")
- sw.add_link(tgen.gears["r1"])
- sw.add_link(tgen.gears["r2"])
-
- # r1 <- sw2 -> rp
- # r1-eth1 <-> rp-eth0
- # 10.0.30.0/24
- sw = tgen.add_switch("sw2")
- sw.add_link(tgen.gears["r1"])
- sw.add_link(tgen.gears["rp"])
-
- # 10.0.40.0/24
- sw = tgen.add_switch("sw3")
- sw.add_link(tgen.gears["r1"])
- sw.add_link(tgen.gears["r3"])
+def build_topo(tgen):
+ "Build function"
+
+ for routern in range(1, 4):
+ tgen.add_router("r{}".format(routern))
+
+ tgen.add_router("rp")
+
+ # rp ------ r1 -------- r2
+ # \
+ # --------- r3
+ # r1 -> .1
+ # r2 -> .2
+ # rp -> .3
+ # r3 -> .4
+ # loopback network is 10.254.0.X/32
+ #
+ # r1 <- sw1 -> r2
+ # r1-eth0 <-> r2-eth0
+ # 10.0.20.0/24
+ sw = tgen.add_switch("sw1")
+ sw.add_link(tgen.gears["r1"])
+ sw.add_link(tgen.gears["r2"])
+
+ # r1 <- sw2 -> rp
+ # r1-eth1 <-> rp-eth0
+ # 10.0.30.0/24
+ sw = tgen.add_switch("sw2")
+ sw.add_link(tgen.gears["r1"])
+ sw.add_link(tgen.gears["rp"])
+
+ # 10.0.40.0/24
+ sw = tgen.add_switch("sw3")
+ sw.add_link(tgen.gears["r1"])
+ sw.add_link(tgen.gears["r3"])
def setup_module(mod):
"Sets up the pytest environment"
- tgen = Topogen(PIMTopo, mod.__name__)
+ tgen = Topogen(build_topo, mod.__name__)
tgen.start_topology()
# For all registered routers, load the zebra configuration file