Skip to content
Snippets Groups Projects
Commit 829ea636 authored by Attila Farkas's avatar Attila Farkas
Browse files

delete dummy-router if present

parent b05d0db4
No related branches found
No related tags found
1 merge request!12Resolve "43-add-compatibility-with-kypo-topo-library-using-dummy-router"
...@@ -11,6 +11,7 @@ from modules.file_manager import open_yaml, cleanup_and_exit ...@@ -11,6 +11,7 @@ from modules.file_manager import open_yaml, cleanup_and_exit
FLAVORS = open_yaml("conf/flavors.yml") FLAVORS = open_yaml("conf/flavors.yml")
ROUTER_ATTRIBUTES = open_yaml("conf/router_attributes.yml") ROUTER_ATTRIBUTES = open_yaml("conf/router_attributes.yml")
DUMMY_ROUTER_NAME = "dummy-router"
def _add_missing_tags(definitions): def _add_missing_tags(definitions):
...@@ -62,6 +63,14 @@ def _add_flavors(definitions): ...@@ -62,6 +63,14 @@ def _add_flavors(definitions):
host.pop("flavor") host.pop("flavor")
def _delete_dummy_router(definitions):
"""Delete dummy router if it is defined."""
for router in definitions["routers"]:
if router["name"] == DUMMY_ROUTER_NAME:
definitions["routers"].remove(router)
return
def preprocess(definitions, flags): def preprocess(definitions, flags):
"""Run preprocessing. """Run preprocessing.
...@@ -75,6 +84,12 @@ def preprocess(definitions, flags): ...@@ -75,6 +84,12 @@ def preprocess(definitions, flags):
cleanup_and_exit("Preprocessing not successful: " cleanup_and_exit("Preprocessing not successful: "
"Could not add missing tags.") "Could not add missing tags.")
try:
_delete_dummy_router(definitions)
except Exception:
cleanup_and_exit("Preprocessing not successful: "
"Could not delete dummy router.")
try: try:
if "border_router" in flags and flags["border_router"]: if "border_router" in flags and flags["border_router"]:
create_border_router(definitions) create_border_router(definitions)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment