]> git.proxmox.com Git - mirror_frr.git/blobdiff - tests/topotests/example_topojson_test/test_topo_json_single_link_loopback/test_example_topojson.py
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / tests / topotests / example_topojson_test / test_topo_json_single_link_loopback / test_example_topojson.py
index 012b05d3769dac9ab57234e2c88541c015a0f21b..4f3a8d82abf9c1c065ae3059e901f1ca55b13e0d 100755 (executable)
@@ -1,24 +1,11 @@
 #!/usr/bin/env python
+# SPDX-License-Identifier: ISC
 
 #
 # Copyright (c) 2019 by VMware, Inc. ("VMware")
 # Used Copyright (c) 2018 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 VMWARE DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VMWARE 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.
-#
 
 """
 <example>.py: Test <example tests>.
@@ -28,7 +15,6 @@ import os
 import sys
 import time
 import json
-import inspect
 import pytest
 
 # Save the Current Working Directory to find configuration files.
@@ -41,7 +27,6 @@ sys.path.append(os.path.join(CWD, "../../"))
 from lib.topogen import Topogen, get_topogen
 
 # Required to instantiate the topology builder class.
-from mininet.topo import Topo
 
 # Import topoJson from lib, to create topology and initial configuration
 from lib.common_config import (
@@ -81,27 +66,19 @@ bgp_convergence = False
 input_dict = {}
 
 
-class TemplateTopo(Topo):
-    """
-    Test topology builder
-
-    * `Topo`: Topology object
-    """
-
-    def build(self, *_args, **_opts):
-        "Build function"
-        tgen = get_topogen(self)
+def build_topo(tgen):
+    "Build function"
 
-        # This function only purpose is to create topology
-        # as defined in input json file.
-        #
-        # Example
-        #
-        # Creating 2 routers having single links in between,
-        # which is used to establised BGP neighborship
+    # This function only purpose is to create topology
+    # as defined in input json file.
+    #
+    # Example
+    #
+    # Creating 2 routers having single links in between,
+    # which is used to establised BGP neighborship
 
-        # Building topology from json file
-        build_topo_from_json(tgen, topo)
+    # Building topology from json file
+    build_topo_from_json(tgen, topo)
 
 
 def setup_module(mod):
@@ -118,11 +95,11 @@ def setup_module(mod):
     logger.info("Running setup_module to create topology")
 
     # This function initiates the topology build with Topogen...
-    tgen = Topogen(TemplateTopo, mod.__name__)
+    tgen = Topogen(build_topo, mod.__name__)
     # ... and here it calls Mininet initialization functions.
 
     # Starting topology, create tmp files which are loaded to routers
-    #  to start deamons and then start routers
+    #  to start daemons and then start routers
     start_topology(tgen)
 
     # This function only purpose is to create configuration
@@ -156,7 +133,7 @@ def teardown_module(mod):
 
 
 def test_bgp_convergence(request):
-    " Test BGP daemon convergence "
+    "Test BGP daemon convergence"
 
     tgen = get_topogen()
     global bgp_convergence
@@ -179,7 +156,7 @@ def test_bgp_convergence(request):
 
 
 def test_static_routes(request):
-    " Test to create and verify static routes. "
+    "Test to create and verify static routes."
 
     tgen = get_topogen()
     if bgp_convergence is not True: