diff options
Diffstat (limited to 'tests/topotests/ospf6_topo1/test_ospf6_topo1.py')
-rw-r--r-- | tests/topotests/ospf6_topo1/test_ospf6_topo1.py | 75 |
1 files changed, 31 insertions, 44 deletions
diff --git a/tests/topotests/ospf6_topo1/test_ospf6_topo1.py b/tests/topotests/ospf6_topo1/test_ospf6_topo1.py index 4a4ae3d5b..1bc994aaa 100644 --- a/tests/topotests/ospf6_topo1/test_ospf6_topo1.py +++ b/tests/topotests/ospf6_topo1/test_ospf6_topo1.py @@ -91,59 +91,46 @@ from lib.topogen import Topogen, TopoRouter, get_topogen from lib.topolog import logger import platform -pytestmark = [pytest.mark.ospfd] - - -##################################################### -## -## Network Topology Definition -## -##################################################### - -class NetworkTopo(Topo): - "OSPFv3 (IPv6) Test Topology 1" - - def build(self, **_opts): - "Build function" +pytestmark = [pytest.mark.ospfd] - tgen = get_topogen(self) - # Create 4 routers - for routern in range(1, 5): - tgen.add_router("r{}".format(routern)) +def build_topo(tgen): + # Create 4 routers + for routern in range(1, 5): + tgen.add_router("r{}".format(routern)) - # - # Wire up the switches and routers - # Note that we specify the link names so we match the config files - # + # + # Wire up the switches and routers + # Note that we specify the link names so we match the config files + # - # Create a empty network for router 1 - switch = tgen.add_switch("s1") - switch.add_link(tgen.gears["r1"], nodeif="r1-stubnet") + # Create a empty network for router 1 + switch = tgen.add_switch("s1") + switch.add_link(tgen.gears["r1"], nodeif="r1-stubnet") - # Create a empty network for router 2 - switch = tgen.add_switch("s2") - switch.add_link(tgen.gears["r2"], nodeif="r2-stubnet") + # Create a empty network for router 2 + switch = tgen.add_switch("s2") + switch.add_link(tgen.gears["r2"], nodeif="r2-stubnet") - # Create a empty network for router 3 - switch = tgen.add_switch("s3") - switch.add_link(tgen.gears["r3"], nodeif="r3-stubnet") + # Create a empty network for router 3 + switch = tgen.add_switch("s3") + switch.add_link(tgen.gears["r3"], nodeif="r3-stubnet") - # Create a empty network for router 4 - switch = tgen.add_switch("s4") - switch.add_link(tgen.gears["r4"], nodeif="r4-stubnet") + # Create a empty network for router 4 + switch = tgen.add_switch("s4") + switch.add_link(tgen.gears["r4"], nodeif="r4-stubnet") - # Interconnect routers 1, 2, and 3 - switch = tgen.add_switch("s5") - switch.add_link(tgen.gears["r1"], nodeif="r1-sw5") - switch.add_link(tgen.gears["r2"], nodeif="r2-sw5") - switch.add_link(tgen.gears["r3"], nodeif="r3-sw5") + # Interconnect routers 1, 2, and 3 + switch = tgen.add_switch("s5") + switch.add_link(tgen.gears["r1"], nodeif="r1-sw5") + switch.add_link(tgen.gears["r2"], nodeif="r2-sw5") + switch.add_link(tgen.gears["r3"], nodeif="r3-sw5") - # Interconnect routers 3 and 4 - switch = tgen.add_switch("s6") - switch.add_link(tgen.gears["r3"], nodeif="r3-sw6") - switch.add_link(tgen.gears["r4"], nodeif="r4-sw6") + # Interconnect routers 3 and 4 + switch = tgen.add_switch("s6") + switch.add_link(tgen.gears["r3"], nodeif="r3-sw6") + switch.add_link(tgen.gears["r4"], nodeif="r4-sw6") ##################################################### @@ -156,7 +143,7 @@ class NetworkTopo(Topo): def setup_module(mod): "Sets up the pytest environment" - tgen = Topogen(NetworkTopo, mod.__name__) + tgen = Topogen(build_topo, mod.__name__) tgen.start_topology() logger.info("** %s: Setup Topology" % mod.__name__) |