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

move border router creation to preprocessing

parent 910f198f
No related branches found
No related tags found
1 merge request!7Resolve Refactoring
...@@ -8,9 +8,9 @@ import sys ...@@ -8,9 +8,9 @@ import sys
from modules.file_generator import generate_vagrantfile, generate_ansible_files from modules.file_generator import generate_vagrantfile, generate_ansible_files
from modules.device_creator import open_file from modules.device_creator import open_file
from modules.routing import create_border_router
from modules.input_argument_parser import parse_input_args from modules.input_argument_parser import parse_input_args
from modules.input_file_validator import validate_device_definitions from modules.input_file_validator import validate_device_definitions
from modules.preprocessing import preprocess
""" Parsing the input arguments. """ """ Parsing the input arguments. """
...@@ -36,10 +36,16 @@ except Exception: ...@@ -36,10 +36,16 @@ except Exception:
print("Device definition validation was not sussessful.") print("Device definition validation was not sussessful.")
sys.exit(1) sys.exit(1)
""" Preprocessing the definitions before device creation. """
try:
preprocess(device_definitions, flags)
except Exception:
print("Preprocessing was not successful.")
sys.exit(1)
# TODO # TODO
create_border_router(device_definitions)
if "ansible_local" in flags and flags["ansible_local"]: if "ansible_local" in flags and flags["ansible_local"]:
generate_vagrantfile(device_definitions, True) generate_vagrantfile(device_definitions, True)
else: else:
......
""" This module contains functions for preprocessing. They are supposed to be
called after validating the input but before device creation.
"""
from modules.routing import create_border_router
def preprocess(definitions, flags):
"""
This function handles the preprocessing, operations that need to be done
before the actual device creation.
:param definitions: device definition structure
:param flags: a structure with command line flags
"""
""" Creating Border router """
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