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

Create empty function for adding controller to topology

parent a5507b08
No related branches found
No related tags found
1 merge request!22Resolve "Support Windows boxes"
"""Contains functions for controller creation."""
CONTROLLER_NAME = "controller"
def _are_controller_parameters_free(definitions):
"""Check if controller parameters are not already taken."""
for host in definitions["hosts"]:
if host["name"] == CONTROLLER_NAME:
return False
# TODO add other parameters
return True
def create_controller(definitions):
"""Add the definition of controller to definitions.
:param definitions: device definition structure
"""
# TODO this should be later moved to input check
if not _are_controller_parameters_free(definitions):
raise ValueError("A device with the same name as border router "
"already exists.")
return
......@@ -7,6 +7,7 @@ creation.
import itertools
from modules.border_router import create_border_router
from modules.controller import create_controller
from modules.file_manager import open_yaml, cleanup_and_exit
FLAVORS = open_yaml("conf/flavors.yml")
......@@ -106,6 +107,13 @@ def preprocess(definitions, flags):
cleanup_and_exit("Preprocessing not successful: "
"Could not create border router (" + error + ")")
try:
if _find_windows_boxes(definitions):
create_controller(definitions)
except (ValueError, IndexError) as error:
cleanup_and_exit("Preprocessing not successful: "
"Could not create controller (" + error + ")")
try:
_configure_routers(definitions)
except Exception:
......
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