diff options
Diffstat (limited to 'tests/topotests/ospf_basic_functionality/test_ospf_nssa.py')
| -rw-r--r-- | tests/topotests/ospf_basic_functionality/test_ospf_nssa.py | 39 |
1 files changed, 5 insertions, 34 deletions
diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_nssa.py b/tests/topotests/ospf_basic_functionality/test_ospf_nssa.py index 0af83548b9..aa34208acb 100644 --- a/tests/topotests/ospf_basic_functionality/test_ospf_nssa.py +++ b/tests/topotests/ospf_basic_functionality/test_ospf_nssa.py @@ -25,14 +25,11 @@ import ipaddress from lib.ospf import ( verify_ospf_neighbor, - config_ospf_interface, - clear_ospf, verify_ospf_rib, create_router_ospf, - verify_ospf_interface, redistribute_ospf, ) -from lib.topojson import build_topo_from_json, build_config_from_json +from lib.topojson import build_config_from_json from lib.topolog import logger from lib.common_config import ( start_topology, @@ -42,19 +39,13 @@ from lib.common_config import ( verify_rib, create_static_routes, step, - create_route_maps, - shutdown_bringup_interface, - create_interfaces_cfg, topo_daemons, ) -from ipaddress import IPv4Address from lib.topogen import Topogen, get_topogen -from mininet.topo import Topo import os import sys import time import pytest -import json # Save the Current Working Directory to find configuration files. CWD = os.path.dirname(os.path.realpath(__file__)) @@ -68,13 +59,6 @@ pytestmark = [pytest.mark.ospfd, pytest.mark.staticd] # Global variables topo = None -# Reading the data from JSON File for topology creation -jsonFile = "{}/ospf_nssa.json".format(CWD) -try: - with open(jsonFile, "r") as topoJson: - topo = json.load(topoJson) -except IOError: - assert False, "Could not read file {}".format(jsonFile) NETWORK = { "ipv4": [ "11.0.20.1/32", @@ -111,28 +95,12 @@ TESTCASES = """ -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 * `mod`: module name """ - global topo testsuite_run_time = time.asctime(time.localtime(time.time())) logger.info("Testsuite start time: {}".format(testsuite_run_time)) logger.info("=" * 40) @@ -140,7 +108,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 = "{}/ospf_nssa.json".format(CWD) + tgen = Topogen(json_file, mod.__name__) + global topo + topo = tgen.json_topo # ... and here it calls Mininet initialization functions. # get list of daemons needs to be started for this suite. |
