summaryrefslogtreecommitdiffstats
path: root/tests/topotests/bgp_gshut/test_bgp_gshut.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/topotests/bgp_gshut/test_bgp_gshut.py')
-rw-r--r--tests/topotests/bgp_gshut/test_bgp_gshut.py35
1 files changed, 16 insertions, 19 deletions
diff --git a/tests/topotests/bgp_gshut/test_bgp_gshut.py b/tests/topotests/bgp_gshut/test_bgp_gshut.py
index d32ba1c1f..a08f74d6c 100644
--- a/tests/topotests/bgp_gshut/test_bgp_gshut.py
+++ b/tests/topotests/bgp_gshut/test_bgp_gshut.py
@@ -78,28 +78,25 @@ from lib.micronet_compat import Topo
pytestmark = [pytest.mark.bgpd]
-class TemplateTopo(Topo):
- def build(self, *_args, **_opts):
- tgen = get_topogen(self)
+def build_topo(tgen):
+ for routern in range(1, 6):
+ tgen.add_router("r{}".format(routern))
- for routern in range(1, 6):
- 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"])
-
- switch = tgen.add_switch("s4")
- switch.add_link(tgen.gears["r2"])
- switch.add_link(tgen.gears["r5"])
+ switch = tgen.add_switch("s4")
+ switch.add_link(tgen.gears["r2"])
+ switch.add_link(tgen.gears["r5"])
def _run_cmd_and_check(router, cmd, results_file, retries=100, intvl=0.5):
@@ -110,7 +107,7 @@ def _run_cmd_and_check(router, cmd, results_file, retries=100, intvl=0.5):
def setup_module(mod):
- tgen = Topogen(TemplateTopo, mod.__name__)
+ tgen = Topogen(build_topo, mod.__name__)
tgen.start_topology()
router_list = tgen.routers()