Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cyber-sandbox-creator
Manage
Activity
Members
Labels
Plan
Issues
10
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MUNI-KYPO-CSC
cyber-sandbox-creator
Commits
80e9baba
Commit
80e9baba
authored
4 years ago
by
Attila Farkas
Browse files
Options
Downloads
Patches
Plain Diff
Create empty function for adding controller to topology
parent
a5507b08
No related branches found
No related tags found
1 merge request
!22
Resolve "Support Windows boxes"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/controller.py
+28
-0
28 additions, 0 deletions
modules/controller.py
modules/preprocessing.py
+8
-0
8 additions, 0 deletions
modules/preprocessing.py
with
36 additions
and
0 deletions
modules/controller.py
0 → 100644
+
28
−
0
View file @
80e9baba
"""
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
This diff is collapsed.
Click to expand it.
modules/preprocessing.py
+
8
−
0
View file @
80e9baba
...
...
@@ -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
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment