Skip to content

Commit

Permalink
Merge pull request FRRouting#12481 from kuldeepkash/topotests_startup
Browse files Browse the repository at this point in the history
tests: Topotests daemon start as per feature test
  • Loading branch information
donaldsharp authored Dec 15, 2022
2 parents a1dcf30 + ac6ef90 commit 9da878b
Show file tree
Hide file tree
Showing 46 changed files with 328 additions and 448 deletions.
22 changes: 5 additions & 17 deletions tests/topotests/bgp_as_allow_in/test_bgp_as_allow_in.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,29 +76,13 @@

pytestmark = [pytest.mark.bgpd, pytest.mark.staticd]


# Reading the data from JSON File for topology creation
jsonFile = "{}/bgp_as_allow_in.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()
NETWORK = {"ipv4": "2.2.2.2/32", "ipv6": "22:22::2/128"}
NEXT_HOP_IP = {"ipv4": "Null0", "ipv6": "Null0"}


def build_topo(tgen):
"""Build function"""

# Building topology from json file
build_topo_from_json(tgen, topo)


def setup_module(mod):
"""
Sets up the pytest environment
Expand All @@ -118,7 +102,11 @@ def setup_module(mod):
logger.info("Running setup_module to create topology")

# This function initiates the topology build with Topogen...
tgen = Topogen(build_topo, mod.__name__)
json_file = "{}/bgp_as_allow_in.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
Expand Down
18 changes: 14 additions & 4 deletions tests/topotests/bgp_ecmp_topo3/test_ibgp_ecmp_topo3.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@

# pylint: disable=C0413
# Import topogen and topotest helpers
from lib.topogen import get_topogen
from lib import topojson
from lib.topogen import Topogen, get_topogen

from lib.common_config import (
write_test_header,
Expand All @@ -51,11 +50,12 @@
reset_config_on_routers,
shutdown_bringup_interface,
apply_raw_config,
start_topology,
)
from lib.topolog import logger
from lib.topojson import build_config_from_json
from lib.bgp import create_router_bgp, verify_bgp_convergence


pytestmark = [pytest.mark.bgpd, pytest.mark.staticd]


Expand All @@ -78,9 +78,19 @@ def setup_module(mod):
logger.info("Testsuite start time: {}".format(testsuite_run_time))
logger.info("=" * 40)

tgen = topojson.setup_module_from_json(mod.__file__)
# This function initiates the topology build with Topogen...
json_file = "{}/ibgp_ecmp_topo3.json".format(CWD)
tgen = Topogen(json_file, mod.__name__)
global topo
topo = tgen.json_topo

# Starting topology, create tmp files which are loaded to routers
# to start daemons and then start routers
start_topology(tgen)

# Creating configuration from JSON
build_config_from_json(tgen, topo)

# Don't run this test if we have any failure.
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,6 @@

pytestmark = [pytest.mark.bgpd, pytest.mark.staticd]


# Reading the data from JSON File for topology creation
jsonFile = "{}/bgp_vrf_dynamic_route_leak_topo2.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
NETWORK1_1 = {"ipv4": "11.11.11.1/32", "ipv6": "11:11::1/128"}
NETWORK3_3 = {"ipv4": "50.50.50.5/32", "ipv6": "50:50::5/128"}
Expand All @@ -92,13 +83,6 @@
PREFERRED_NEXT_HOP = "global"


def build_topo(tgen):
"""Build function"""

# Building topology from json file
build_topo_from_json(tgen, topo)


def setup_module(mod):
"""
Sets up the pytest environment
Expand All @@ -114,7 +98,9 @@ def setup_module(mod):
logger.info("Running setup_module to create topology")

# This function initiates the topology build with Topogen...
tgen = Topogen(build_topo, mod.__name__)
json_file = "{}/bgp_vrf_dynamic_route_leak_topo2.json".format(CWD)
tgen = Topogen(json_file, mod.__name__)
topo = tgen.json_topo
# ... and here it calls Mininet initialization functions.

# Starting topology, create tmp files which are loaded to routers
Expand Down
Loading

0 comments on commit 9da878b

Please sign in to comment.