aboutsummaryrefslogtreecommitdiffstats
path: root/vicn/bin/vicn.py
diff options
context:
space:
mode:
authorMarcel Enguehard <mengueha+fdio@cisco.com>2017-05-23 10:50:17 +0200
committerMarcel Enguehard <mengueha+fdio@cisco.com>2017-05-23 08:57:12 +0000
commitbe0b435d307173598c30fcacc421b17112137099 (patch)
treeed8aae7eef796eb7381d21937b095a036733789a /vicn/bin/vicn.py
parent895a6328d6e64948ed213e8fbbb3ab15aca0df43 (diff)
Introduced groups + lxd profiles + diverted control network handling to lxd + misc bug fixes
Change-Id: Iae26bc2994ac9704dde7dfa8fbe4be1b74cf9e6f Signed-off-by: Marcel Enguehard <mengueha+fdio@cisco.com>
Diffstat (limited to 'vicn/bin/vicn.py')
-rwxr-xr-xvicn/bin/vicn.py40
1 files changed, 19 insertions, 21 deletions
diff --git a/vicn/bin/vicn.py b/vicn/bin/vicn.py
index 9a43cf6d..7ece629b 100755
--- a/vicn/bin/vicn.py
+++ b/vicn/bin/vicn.py
@@ -46,36 +46,34 @@ class VICNDaemon(Daemon):
n_times = 1
background = False
setup = False
- scenario = None
- node_list, net, ndn, mob, cluster = None, None, None, None, None
parser = ArgumentParser(description=textcolor('green', "Batch usage of VICN."))
- parser.add_argument('-s', metavar='configuration_file_path',
- help="JSON file containing the topology")
- parser.add_argument('-n', metavar='n_times', type=int, help='Execute the test multiple times')
- parser.add_argument('-x', action='store_false', help='No automatic execution')
+ parser.add_argument('-s', '--scenario', metavar='configuration_file_path',
+ action='append',
+ help="JSON file containing the topology")
+ parser.add_argument('-z', '--identifier', metavar='identifier', type=str, help='Experiment identifier')
+ parser.add_argument('-x', '--no-execute', action='store_false', help='Configure only, no automatic execution')
+ parser.add_argument('-c', '--clean', action='store_true', help='Clean deployment before setup')
+ parser.add_argument('-C', '--clean-only', action='store_true', help='Clean only')
arguments = parser.parse_args()
- args = vars(arguments)
+ scenario = arguments.scenario
+ if not scenario:
+ log.error('No scenario specified')
+ sys.exit(-1)
- for option in args.keys():
- if args[option] is not None:
- if option == "s":
- print(" * Loading the configuration file at {0}".format(args[option]))
- scenario = args[option]
- elif option == "t" and args[option] is True:
- background = True
- elif option == "x" and args[option] is True:
- setup = True
- elif option == "n":
- n_times = args[option]
+ identifier = arguments.identifier or "default"
+ clean = arguments.clean or arguments.clean_only
+ execute = not arguments.clean_only or arguments.no_execute
self._api = API()
- self._api.configure(scenario, setup)
+ self._api.configure(scenario)
- if node_list is not None:
- ResourceManager().set(node_list)
+ if clean:
+ self._api.teardown()
+ if execute:
+ self._api.setup(commit = True)
def main(self):
"""