diff options
author | Marco Capitani <m.capitani@nextworks.it> | 2018-04-12 14:56:15 +0200 |
---|---|---|
committer | Marco Capitani <m.capitani@nextworks.it> | 2018-04-12 14:56:15 +0200 |
commit | 4bc964d576e17c268b8cf80f1be53a8d974ba4e6 (patch) | |
tree | 4e9c4c939d65cf514149b3db6926be2282b35061 | |
parent | 3be4baa7e19133f0c41188bb1c2ee6ae3a82d470 (diff) | |
download | rumba-4bc964d576e17c268b8cf80f1be53a8d974ba4e6.tar.gz rumba-4bc964d576e17c268b8cf80f1be53a8d974ba4e6.zip |
model: add parameter for not adding default cubes
-rw-r--r-- | rumba/elements/topology.py | 9 | ||||
-rw-r--r-- | rumba/prototypes/irati.py | 16 |
2 files changed, 17 insertions, 8 deletions
diff --git a/rumba/elements/topology.py b/rumba/elements/topology.py index 0ff1957..f717a5a 100644 --- a/rumba/elements/topology.py +++ b/rumba/elements/topology.py @@ -202,17 +202,24 @@ class NormalDIF(DIF): """ Normal DIF. """ - def __init__(self, name, members=None, policy=None): + def __init__(self, + name, + members=None, + policy=None, + add_default_qos_cubes=True): """ :param name: The name of the DIF. :param members: The list of members. :param policy: Policies of the normal DIF. + :param add_default_qos_cubes: should the prototype-dependant default + QoS cubes be added to this DIF? """ DIF.__init__(self, name, members) if policy is None: policy = Policy(self) self.policy = policy self.qos_cubes = [] + self.add_default_qos_cubes = add_default_qos_cubes self._last_cube_id = 0 def add_policy(self, comp, pol, **params): diff --git a/rumba/prototypes/irati.py b/rumba/prototypes/irati.py index 37f7ae7..2914662 100644 --- a/rumba/prototypes/irati.py +++ b/rumba/prototypes/irati.py @@ -325,13 +325,15 @@ class Experiment(mod.Experiment): dif_conf["qosCubes"].append( irati_templates.generate_qos_cube(**cube) ) - # Add basic cubes - unreliable = copy.deepcopy(irati_templates.qos_cube_u_base) - unreliable["id"] = len(dif_conf["qosCubes"]) + 1 - dif_conf["qosCubes"].append(unreliable) - reliable = copy.deepcopy(irati_templates.qos_cube_r_base) - reliable["id"] = len(dif_conf["qosCubes"]) + 1 - dif_conf["qosCubes"].append(reliable) + if dif.add_default_qos_cubes: + # Add basic cubes + unreliable = copy.deepcopy(irati_templates.qos_cube_u_base) + unreliable["id"] = len(dif_conf["qosCubes"]) + 1 + dif_conf["qosCubes"].append(unreliable) + reliable = copy.deepcopy(irati_templates.qos_cube_r_base) + reliable["id"] = len(dif_conf["qosCubes"]) + 1 + dif_conf["qosCubes"].append(reliable) + for node in dif.members: difconfs[dif.name][node.name] = copy.deepcopy( dif_conf |