#!/usr/bin/env python
+# SPDX-License-Identifier: ISC
#
# test_eigrp_topo1.py
# Cumulus Networks, Inc.
# Donald Sharp
#
-# Permission to use, copy, modify, and/or distribute this software
-# for any purpose with or without fee is hereby granted, provided
-# that the above copyright notice and this permission notice appear
-# in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND NETDEF DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
-# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
-# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
-# OF THIS SOFTWARE.
-#
"""
test_eigrp_topo1.py: Testing EIGRP
from lib.topolog import logger
# Required to instantiate the topology builder class.
-from mininet.topo import Topo
#####################################################
##
#####################################################
-class NetworkTopo(Topo):
- "EIGRP Topology 1"
-
- def build(self, **_opts):
- "Build function"
-
- tgen = get_topogen(self)
-
- for routern in range(1, 4):
- tgen.add_router("r{}".format(routern))
+def build_topo(tgen):
+ for routern in range(1, 4):
+ tgen.add_router("r{}".format(routern))
- # On main router
- # First switch is for a dummy interface (for local network)
- switch = tgen.add_switch("sw1")
- switch.add_link(tgen.gears["r1"])
+ # On main router
+ # First switch is for a dummy interface (for local network)
+ switch = tgen.add_switch("sw1")
+ switch.add_link(tgen.gears["r1"])
- # Switches for EIGRP
- # switch 2 switch is for connection to EIGRP router
- switch = tgen.add_switch("sw2")
- switch.add_link(tgen.gears["r1"])
- switch.add_link(tgen.gears["r2"])
+ # Switches for EIGRP
+ # switch 2 switch is for connection to EIGRP router
+ switch = tgen.add_switch("sw2")
+ switch.add_link(tgen.gears["r1"])
+ switch.add_link(tgen.gears["r2"])
- # switch 4 is stub on remote EIGRP router
- switch = tgen.add_switch("sw4")
- switch.add_link(tgen.gears["r3"])
+ # switch 4 is stub on remote EIGRP router
+ switch = tgen.add_switch("sw4")
+ switch.add_link(tgen.gears["r3"])
- # switch 3 is between EIGRP routers
- switch = tgen.add_switch("sw3")
- switch.add_link(tgen.gears["r2"])
- switch.add_link(tgen.gears["r3"])
+ # switch 3 is between EIGRP routers
+ switch = tgen.add_switch("sw3")
+ switch.add_link(tgen.gears["r2"])
+ switch.add_link(tgen.gears["r3"])
#####################################################
def setup_module(module):
"Setup topology"
- tgen = Topogen(NetworkTopo, module.__name__)
+ tgen = Topogen(build_topo, module.__name__)
tgen.start_topology()
# This is a sample of configuration loading.