diff options
Diffstat (limited to 'tests/topotests/ospf_basic_functionality/test_ospf_authentication.py')
| -rw-r--r-- | tests/topotests/ospf_basic_functionality/test_ospf_authentication.py | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_authentication.py b/tests/topotests/ospf_basic_functionality/test_ospf_authentication.py index bdba8fd8e4..030b77c609 100644 --- a/tests/topotests/ospf_basic_functionality/test_ospf_authentication.py +++ b/tests/topotests/ospf_basic_functionality/test_ospf_authentication.py @@ -28,7 +28,6 @@ import time import pytest from time import sleep from copy import deepcopy -import json from lib.topotest import frr_unicode # Save the Current Working Directory to find configuration files. @@ -38,7 +37,6 @@ sys.path.append(os.path.join(CWD, "../lib/")) # pylint: disable=C0413 # Import topogen and topotest helpers -from mininet.topo import Topo from lib.topogen import Topogen, get_topogen # Import topoJson from lib, to create topology and initial configuration @@ -52,7 +50,7 @@ from lib.common_config import ( topo_daemons, ) from lib.topolog import logger -from lib.topojson import build_topo_from_json, build_config_from_json +from lib.topojson import build_config_from_json from lib.ospf import verify_ospf_neighbor, config_ospf_interface, clear_ospf from ipaddress import IPv4Address @@ -61,13 +59,6 @@ pytestmark = [pytest.mark.ospfd] # Global variables topo = None -# Reading the data from JSON File for topology creation -jsonFile = "{}/ospf_authentication.json".format(CWD) -try: - with open(jsonFile, "r") as topoJson: - topo = json.load(topoJson) -except IOError: - assert False, "Could not read file {}".format(jsonFile) """ TOPOOLOGY = Please view in a fixed-width font such as Courier. @@ -92,28 +83,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) @@ -121,7 +96,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_authentication.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. |
