]> git.proxmox.com Git - mirror_frr.git/blobdiff - tests/topotests/bgp_route_map/test_route_map_topo1.py
tests: cleanup - remove unused imports
[mirror_frr.git] / tests / topotests / bgp_route_map / test_route_map_topo1.py
index 74172501dbabdda74f1ceded88c435835d5b0476..5af7296fcbcc4e5c165bf87fa6298dfd74670c27 100644 (file)
 #
 
 import sys
-import json
 import time
 import pytest
-import inspect
 import os
-from time import sleep
 
 # Save the Current Working Directory to find configuration files.
 CWD = os.path.dirname(os.path.realpath(__file__))
@@ -34,38 +31,30 @@ sys.path.append(os.path.join(CWD, "../"))
 
 # pylint: disable=C0413
 # Import topogen and topotest helpers
-from lib import topotest
 from lib.topogen import Topogen, get_topogen
-from mininet.topo import Topo
 
 # Required to instantiate the topology builder class.
-from lib.topojson import *
 from lib.common_config import (
     start_topology,
     write_test_header,
     write_test_footer,
-    verify_bgp_community,
     verify_rib,
-    delete_route_maps,
-    create_bgp_community_lists,
-    interface_status,
     create_route_maps,
     create_static_routes,
     create_prefix_lists,
-    verify_route_maps,
     check_address_types,
-    shutdown_bringup_interface,
-    verify_prefix_lists,
     reset_config_on_routers,
 )
 from lib.topolog import logger
 from lib.bgp import (
     verify_bgp_convergence,
     create_router_bgp,
-    clear_bgp_and_verify,
     verify_bgp_attributes,
 )
-from lib.topojson import build_topo_from_json, build_config_from_json
+from lib.topojson import build_config_from_json
+
+pytestmark = [pytest.mark.bgpd, pytest.mark.staticd]
+
 
 #################################
 # TOPOLOGY
@@ -112,13 +101,6 @@ TC_38:
 bgp_convergence = False
 BGP_CONVERGENCE = False
 ADDR_TYPES = check_address_types()
-# Reading the data from JSON File for topology and configuration creation
-jsonFile = "{}/bgp_route_map_topo1.json".format(CWD)
-try:
-    with open(jsonFile, "r") as topoJson:
-        topo = json.load(topoJson)
-except IOError:
-    assert False, "Could not read file {}".format(jsonFile)
 
 # Global variables
 bgp_convergence = False
@@ -128,22 +110,6 @@ NEXT_HOP = {"ipv4": "10.0.0.2", "ipv6": "fd00::2"}
 ADDR_TYPES = check_address_types()
 
 
-class CreateTopo(Topo):
-    """
-    Test topology builder
-
-
-    * `Topo`: Topology object
-    """
-
-    def build(self, *_args, **_opts):
-        """Build function"""
-        tgen = get_topogen(self)
-
-        # Building topology from json file
-        build_topo_from_json(tgen, topo)
-
-
 def setup_module(mod):
     """
     Sets up the pytest environment
@@ -158,7 +124,10 @@ def setup_module(mod):
     logger.info("Running setup_module to create topology")
 
     # This function initiates the topology build with Topogen...
-    tgen = Topogen(CreateTopo, mod.__name__)
+    json_file = "{}/bgp_route_map_topo1.json".format(CWD)
+    tgen = Topogen(json_file, mod.__name__)
+    global topo
+    topo = tgen.json_topo
     # ... and here it calls Mininet initialization functions.
 
     # Starting topology, create tmp files which are loaded to routers