diff options
-rw-r--r-- | rumba/prototypes/irati.py | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/rumba/prototypes/irati.py b/rumba/prototypes/irati.py index 4619785..120a72e 100644 --- a/rumba/prototypes/irati.py +++ b/rumba/prototypes/irati.py @@ -61,9 +61,13 @@ class Experiment(mod.Experiment): def fake_sudo(s): return s - def __init__(self, testbed, nodes=None, + def __init__(self, testbed, + nodes=None, git_repo='https://github.com/IRATI/stack', - git_branch='arcfire', installpath=None, varpath=None): + git_branch='arcfire', + installpath=None, + varpath=None, + app_mappings=None): """ Initializes the experiment class. @@ -73,6 +77,10 @@ class Experiment(mod.Experiment): :param git_branch: The branch of the git repository to use. :param installpath: The installation path of IRATI. :param varpath: The /var path of IRATI. + :param app_mappings: a list of application -> dif mapping containing + all application which will register to + any given dif. + :type app_mappings: `List[(str, str)]` """ mod.Experiment.__init__(self, testbed, @@ -90,6 +98,10 @@ class Experiment(mod.Experiment): self.conf_files = None self.shim2vlan = {} + if app_mappings is None: + app_mappings = [] + self.app_mappings = app_mappings + if self.testbed.username == 'root': self.sudo = self.fake_sudo else: @@ -263,7 +275,7 @@ class Experiment(mod.Experiment): # If some app directives were specified, use those to build da.map. # Otherwise, assume the standard applications are to be mapped in # the DIF with the highest rank. - app_mappings = [] + app_mappings = self.app_mappings if len(app_mappings) == 0: if len(self.dif_ordering) > 0: for adm in \ @@ -271,10 +283,10 @@ class Experiment(mod.Experiment): adm["difName"] = "%s" % (self.dif_ordering[-1].name,) else: # not yet supported irati_templates.da_map_base["applicationToDIFMappings"] = [] - for apm in app_mappings: + for app, dif in app_mappings: irati_templates.da_map_base["applicationToDIFMappings"]\ - .append({"encodedAppName": apm['name'], - "difName": "%s" % (apm['dif']) + .append({"encodedAppName": app, + "difName": dif }) if self.manager: |