summaryrefslogtreecommitdiffstats
path: root/tests/topotests/bgp_snmp_mplsl3vpn
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_snmp_mplsl3vpn
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_snmp_mplsl3vpn')
-rwxr-xr-xtests/topotests/bgp_snmp_mplsl3vpn/test_bgp_snmp_mplsvpn.py136
1 files changed, 66 insertions, 70 deletions
diff --git a/tests/topotests/bgp_snmp_mplsl3vpn/test_bgp_snmp_mplsvpn.py b/tests/topotests/bgp_snmp_mplsl3vpn/test_bgp_snmp_mplsvpn.py
index 37486f1d7..7f58c65ab 100755
--- a/tests/topotests/bgp_snmp_mplsl3vpn/test_bgp_snmp_mplsvpn.py
+++ b/tests/topotests/bgp_snmp_mplsl3vpn/test_bgp_snmp_mplsvpn.py
@@ -50,75 +50,71 @@ from lib.micronet_compat import Topo
pytestmark = [pytest.mark.bgpd, pytest.mark.isisd, pytest.mark.snmp]
-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")
- tgen.add_router("r4")
- tgen.add_router("ce1")
- tgen.add_router("ce2")
- tgen.add_router("ce3")
- tgen.add_router("ce4")
-
- # r1-r2
- switch = tgen.add_switch("s1")
- switch.add_link(tgen.gears["r1"])
- switch.add_link(tgen.gears["r2"])
-
- # r1-r3
- switch = tgen.add_switch("s2")
- switch.add_link(tgen.gears["r1"])
- switch.add_link(tgen.gears["r3"])
-
- # r1-r4
- switch = tgen.add_switch("s3")
- switch.add_link(tgen.gears["r1"])
- switch.add_link(tgen.gears["r4"])
-
- # r1-ce1
- switch = tgen.add_switch("s4")
- switch.add_link(tgen.gears["r1"])
- switch.add_link(tgen.gears["ce1"])
-
- # r1-ce3
- switch = tgen.add_switch("s5")
- switch.add_link(tgen.gears["r1"])
- switch.add_link(tgen.gears["ce3"])
-
- # r1-ce4
- switch = tgen.add_switch("s6")
- switch.add_link(tgen.gears["r1"])
- switch.add_link(tgen.gears["ce4"])
-
- # r1-dangling
- switch = tgen.add_switch("s7")
- switch.add_link(tgen.gears["r1"])
-
- # r2-r3
- switch = tgen.add_switch("s8")
- switch.add_link(tgen.gears["r2"])
- switch.add_link(tgen.gears["r3"])
-
- # r3-r4
- switch = tgen.add_switch("s9")
- switch.add_link(tgen.gears["r3"])
- switch.add_link(tgen.gears["r4"])
-
- # r4-ce2
- switch = tgen.add_switch("s10")
- switch.add_link(tgen.gears["r4"])
- switch.add_link(tgen.gears["ce2"])
+def build_topo(tgen):
+ "Build function"
+
+ # 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")
+ tgen.add_router("r4")
+ tgen.add_router("ce1")
+ tgen.add_router("ce2")
+ tgen.add_router("ce3")
+ tgen.add_router("ce4")
+
+ # r1-r2
+ switch = tgen.add_switch("s1")
+ switch.add_link(tgen.gears["r1"])
+ switch.add_link(tgen.gears["r2"])
+
+ # r1-r3
+ switch = tgen.add_switch("s2")
+ switch.add_link(tgen.gears["r1"])
+ switch.add_link(tgen.gears["r3"])
+
+ # r1-r4
+ switch = tgen.add_switch("s3")
+ switch.add_link(tgen.gears["r1"])
+ switch.add_link(tgen.gears["r4"])
+
+ # r1-ce1
+ switch = tgen.add_switch("s4")
+ switch.add_link(tgen.gears["r1"])
+ switch.add_link(tgen.gears["ce1"])
+
+ # r1-ce3
+ switch = tgen.add_switch("s5")
+ switch.add_link(tgen.gears["r1"])
+ switch.add_link(tgen.gears["ce3"])
+
+ # r1-ce4
+ switch = tgen.add_switch("s6")
+ switch.add_link(tgen.gears["r1"])
+ switch.add_link(tgen.gears["ce4"])
+
+ # r1-dangling
+ switch = tgen.add_switch("s7")
+ switch.add_link(tgen.gears["r1"])
+
+ # r2-r3
+ switch = tgen.add_switch("s8")
+ switch.add_link(tgen.gears["r2"])
+ switch.add_link(tgen.gears["r3"])
+
+ # r3-r4
+ switch = tgen.add_switch("s9")
+ switch.add_link(tgen.gears["r3"])
+ switch.add_link(tgen.gears["r4"])
+
+ # r4-ce2
+ switch = tgen.add_switch("s10")
+ switch.add_link(tgen.gears["r4"])
+ switch.add_link(tgen.gears["ce2"])
def setup_module(mod):
@@ -131,7 +127,7 @@ def setup_module(mod):
pytest.skip(error_msg)
# 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()