summaryrefslogtreecommitdiff
path: root/tests/topotests/bgp_rfapi_basic_sanity/customize.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/bgp_rfapi_basic_sanity/customize.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/bgp_rfapi_basic_sanity/customize.py')
-rw-r--r--tests/topotests/bgp_rfapi_basic_sanity/customize.py54
1 files changed, 25 insertions, 29 deletions
diff --git a/tests/topotests/bgp_rfapi_basic_sanity/customize.py b/tests/topotests/bgp_rfapi_basic_sanity/customize.py
index 9166c57dfc..3cf53a184d 100644
--- a/tests/topotests/bgp_rfapi_basic_sanity/customize.py
+++ b/tests/topotests/bgp_rfapi_basic_sanity/customize.py
@@ -81,35 +81,31 @@ CWD = os.path.dirname(os.path.realpath(__file__))
TEST = os.path.basename(CWD)
-class ThisTestTopo(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 P/PE routers
- tgen.add_router("r1")
- for routern in range(2, 5):
- tgen.add_router("r{}".format(routern))
- # Create a switch with just one router connected to it to simulate a
- # empty network.
- switch = {}
- switch[0] = tgen.add_switch("sw0")
- switch[0].add_link(tgen.gears["r1"], nodeif="r1-eth0")
- switch[0].add_link(tgen.gears["r2"], nodeif="r2-eth0")
-
- switch[1] = tgen.add_switch("sw1")
- switch[1].add_link(tgen.gears["r2"], nodeif="r2-eth1")
- switch[1].add_link(tgen.gears["r3"], nodeif="r3-eth0")
- switch[1].add_link(tgen.gears["r4"], nodeif="r4-eth0")
-
- switch[2] = tgen.add_switch("sw2")
- switch[2].add_link(tgen.gears["r2"], nodeif="r2-eth2")
- switch[2].add_link(tgen.gears["r3"], nodeif="r3-eth1")
+def build_topo(tgen):
+ "Build function"
+
+ # This function only purpose is to define allocation and relationship
+ # between routers, switches and hosts.
+ #
+ # Create P/PE routers
+ tgen.add_router("r1")
+ for routern in range(2, 5):
+ tgen.add_router("r{}".format(routern))
+ # Create a switch with just one router connected to it to simulate a
+ # empty network.
+ switch = {}
+ switch[0] = tgen.add_switch("sw0")
+ switch[0].add_link(tgen.gears["r1"], nodeif="r1-eth0")
+ switch[0].add_link(tgen.gears["r2"], nodeif="r2-eth0")
+
+ switch[1] = tgen.add_switch("sw1")
+ switch[1].add_link(tgen.gears["r2"], nodeif="r2-eth1")
+ switch[1].add_link(tgen.gears["r3"], nodeif="r3-eth0")
+ switch[1].add_link(tgen.gears["r4"], nodeif="r4-eth0")
+
+ switch[2] = tgen.add_switch("sw2")
+ switch[2].add_link(tgen.gears["r2"], nodeif="r2-eth2")
+ switch[2].add_link(tgen.gears["r3"], nodeif="r3-eth1")
def ltemplatePreRouterStartHook():