#
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__))
# 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]
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
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
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