]> git.proxmox.com Git - mirror_frr.git/blobdiff - tests/topotests/ospf6_topo1_vrf/test_ospf6_topo1_vrf.py
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / tests / topotests / ospf6_topo1_vrf / test_ospf6_topo1_vrf.py
index b158099d9a7373073394e4c482294c89c26576ba..f982990987b5427540310e0d3ef67f75e6f80b07 100755 (executable)
@@ -1,4 +1,5 @@
 #!/usr/bin/env python
+# SPDX-License-Identifier: ISC
 
 #
 # test_ospf6_topo1_vrf.py
@@ -8,22 +9,8 @@
 # Used Copyright (c) 2016 by Network Device Education Foundation,
 # Inc. ("NetDEF") in this file.
 #
-# 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.
-#
 
-"""
+r"""
 test_ospf6_topo1_vrf.py:
 
                                                   -----\
@@ -75,12 +62,9 @@ import os
 import re
 import sys
 import pytest
-import platform
-from time import sleep
 
 from functools import partial
 
-from mininet.topo import Topo
 
 # Save the Current Working Directory to find configuration files later.
 CWD = os.path.dirname(os.path.realpath(__file__))
@@ -94,56 +78,48 @@ from lib.topolog import logger
 from lib.topotest import iproute2_is_vrf_capable
 from lib.common_config import required_linux_kernel_version
 
-#####################################################
-##
-##   Network Topology Definition
-##
-#####################################################
-
 
-class NetworkTopo(Topo):
-    "OSPFv3 (IPv6) Test Topology 1"
+pytestmark = [pytest.mark.ospfd]
 
-    def build(self, **_opts):
-        "Build function"
 
-        tgen = get_topogen(self)
+def build_topo(tgen):
+    "Build function"
 
-        # Create 4 routers
-        for routern in range(1, 5):
-            tgen.add_router("r{}".format(routern))
+    # 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")
 
 
 #####################################################
@@ -161,7 +137,7 @@ def setup_module(mod):
     if result is not True:
         pytest.skip("Kernel requirements are not met")
 
-    tgen = Topogen(NetworkTopo, mod.__name__)
+    tgen = Topogen(build_topo, mod.__name__)
     tgen.start_topology()
 
     logger.info("** %s: Setup Topology" % mod.__name__)
@@ -284,7 +260,7 @@ def test_ospfv3_routingTable():
     # For debugging, uncomment the next line
     # tgen.mininet_cli()
     # Verify OSPFv3 Routing Table
-    for router, rnode in tgen.routers().iteritems():
+    for router, rnode in tgen.routers().items():
         logger.info('Waiting for router "%s" convergence', router)
 
         # Load expected results from the command
@@ -415,7 +391,7 @@ def test_ospfv3_routingTable_write_multiplier():
     r1.vtysh_cmd("clear ipv6 ospf interface r1-sw5")
 
     # Verify OSPFv3 Routing Table
-    for router, rnode in tgen.routers().iteritems():
+    for router, rnode in tgen.routers().items():
         logger.info('Waiting for router "%s" convergence', router)
 
         # Load expected results from the command