#!/usr/bin/env python
+# SPDX-License-Identifier: ISC
#
# test_bfd_profiles_topo1.py
# Copyright (c) 2020 by
# Network Device Education Foundation, Inc. ("NetDEF")
#
-# 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_bfd_profiles_topo1.py: Test the FRR BFD profile protocol integration.
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.topolog import logger
-# Required to instantiate the topology builder class.
-from mininet.topo import Topo
-
pytestmark = [pytest.mark.bfdd, pytest.mark.bgpd, pytest.mark.isisd, pytest.mark.ospfd]
-class BFDProfTopo(Topo):
- "Test topology builder"
-
- def build(self, *_args, **_opts):
- "Build function"
- tgen = get_topogen(self)
-
- # Create 6 routers
- for routern in range(1, 7):
- 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("s2")
- switch.add_link(tgen.gears["r2"])
- switch.add_link(tgen.gears["r3"])
-
- switch = tgen.add_switch("s3")
- switch.add_link(tgen.gears["r3"])
- switch.add_link(tgen.gears["r4"])
-
- switch = tgen.add_switch("s4")
- switch.add_link(tgen.gears["r4"])
- switch.add_link(tgen.gears["r5"])
-
- switch = tgen.add_switch("s5")
- switch.add_link(tgen.gears["r1"])
- switch.add_link(tgen.gears["r6"])
-
-
def setup_module(mod):
"Sets up the pytest environment"
- tgen = Topogen(BFDProfTopo, mod.__name__)
+
+ topodef = {
+ "s1": ("r1", "r2"),
+ "s2": ("r2", "r3"),
+ "s3": ("r3", "r4"),
+ "s4": ("r4", "r5"),
+ "s5": ("r1", "r6"),
+ }
+ tgen = Topogen(topodef, mod.__name__)
tgen.start_topology()
router_list = tgen.routers()