aboutsummaryrefslogtreecommitdiff
path: root/rumba/prototypes
diff options
context:
space:
mode:
authorMarco Capitani <m.capitani@nextworks.it>2018-04-05 10:29:02 +0200
committerSander Vrijders <sander.vrijders@ugent.be>2018-04-05 08:49:14 +0000
commit6aabea0e5d184397c5536c40d68cd2a2a4550d8f (patch)
tree8a7b5f23d7a9683d0191f14b25d79d2749391ef1 /rumba/prototypes
parent0b82eadc6e949f564bbb4835a2f8a0a25893e7dc (diff)
downloadrumba-6aabea0e5d184397c5536c40d68cd2a2a4550d8f.tar.gz
rumba-6aabea0e5d184397c5536c40d68cd2a2a4550d8f.zip
irati: add app_mappings argument to experiment
previously it was impossible to change the `da.map` configuration. Now it can be specified via the app_mappings argument in the constructor and the self.app_mappings of `irati.Experiment` Fixes #49
Diffstat (limited to 'rumba/prototypes')
-rw-r--r--rumba/prototypes/irati.py24
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: