diff options
| author | Quentin Young <qlyoung@users.noreply.github.com> | 2021-09-04 12:20:00 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-04 12:20:00 -0400 |
| commit | 5653bb515c97119661f37c6571de0164a2274744 (patch) | |
| tree | 0339eb1bb7da05987f447e9f24d01b7d1b6bb2b0 /tests/topotests/ospf_basic_functionality/test_ospf_chaos.py | |
| parent | 3b934c400626e27b89a3bd7fce003b56783cb88e (diff) | |
| parent | a53c08bc131c02f4a20931d7aa9f974194ab16e7 (diff) | |
Merge pull request #9199 from LabNConsulting/chopps/micronet-prime
Diffstat (limited to 'tests/topotests/ospf_basic_functionality/test_ospf_chaos.py')
| -rw-r--r-- | tests/topotests/ospf_basic_functionality/test_ospf_chaos.py | 38 |
1 files changed, 6 insertions, 32 deletions
diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_chaos.py b/tests/topotests/ospf_basic_functionality/test_ospf_chaos.py index c117fc6a72..86f3213fce 100644 --- a/tests/topotests/ospf_basic_functionality/test_ospf_chaos.py +++ b/tests/topotests/ospf_basic_functionality/test_ospf_chaos.py @@ -26,8 +26,6 @@ import os import sys import time import pytest -from copy import deepcopy -import json # Save the Current Working Directory to find configuration files. CWD = os.path.dirname(os.path.realpath(__file__)) @@ -36,7 +34,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 @@ -46,7 +43,6 @@ from lib.common_config import ( write_test_footer, reset_config_on_routers, step, - shutdown_bringup_interface, topo_daemons, verify_rib, stop_router, @@ -59,8 +55,7 @@ from lib.common_config import ( from lib.ospf import verify_ospf_neighbor, verify_ospf_rib, create_router_ospf from lib.topolog import logger -from lib.topojson import build_topo_from_json, build_config_from_json -from ipaddress import IPv4Address +from lib.topojson import build_config_from_json pytestmark = [pytest.mark.ospfd, pytest.mark.staticd] @@ -98,29 +93,6 @@ TESTCASES = 3. Verify ospf functionality when staticd is restarted. """ -# Reading the data from JSON File for topology creation -jsonFile = "{}/ospf_chaos.json".format(CWD) -try: - with open(jsonFile, "r") as topoJson: - topo = json.load(topoJson) -except IOError: - assert False, "Could not read file {}".format(jsonFile) - - -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): """ @@ -128,7 +100,6 @@ def setup_module(mod): * `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) @@ -136,7 +107,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_chaos.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. @@ -324,7 +298,7 @@ def test_ospf_chaos_tc31_p1(request): def test_ospf_chaos_tc32_p1(request): - """Verify ospf functionality after restart FRR service. """ + """Verify ospf functionality after restart FRR service.""" tc_name = request.node.name write_test_header(tc_name) tgen = get_topogen() |
