aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMCapitani <m.capitani@nextworks.it>2017-09-13 15:27:12 +0000
committerMCapitani <m.capitani@nextworks.it>2017-09-13 15:27:12 +0000
commite93a3a734362034b45b775cbd968abc8ee994e74 (patch)
tree66d202ee166c64feef543d62727ef09f0fb4a6b8
parent3a9a3a8a84b0db5825af1d510d37825c9231149a (diff)
parent6d11410513a7e3de447d509af34984a681e2e68f (diff)
downloadrumba-e93a3a734362034b45b775cbd968abc8ee994e74.tar.gz
rumba-e93a3a734362034b45b775cbd968abc8ee994e74.zip
Merge branch 'dt-mgmt-enroll-split' into 'master'
model: Perform split between different flows See merge request !64
-rw-r--r--rumba/model.py76
-rw-r--r--rumba/prototypes/ouroboros.py22
2 files changed, 71 insertions, 27 deletions
diff --git a/rumba/model.py b/rumba/model.py
index 06d45ec..094babc 100644
--- a/rumba/model.py
+++ b/rumba/model.py
@@ -522,9 +522,16 @@ class Experiment:
nodes = list()
self.nodes = nodes
self.testbed = testbed
+ # the strategy employed for completing the enrollment phase in
+ # the different DIFs
self.enrollment_strategy = 'minimal' # 'full-mesh', 'manual'
+ # the strategy employed for setting up the data transfer
+ # networks in the DIFs after enrollment
+ self.dt_strategy = 'full-mesh' # 'minimal', 'manual'
self.dif_ordering = []
self.enrollments = [] # a list of per-DIF lists of enrollments
+ self.dt_flows = [] # a list of per-DIF lists of data transfer flows
+ self.mgmt_flows = [] # a list of per-DIF lists of management flows
# Generate missing information
self.generate()
@@ -615,6 +622,8 @@ class Experiment:
def compute_enrollments(self):
dif_graphs = dict()
self.enrollments = []
+ self.mgmt_flows = []
+ self.dt_flows = []
for dif in self.dif_ordering:
neighsets = dict()
@@ -644,6 +653,8 @@ class Experiment:
dif_graphs[dif][node1].append((node2, lower_dif))
self.enrollments.append([])
+ self.dt_flows.append([])
+ self.mgmt_flows.append([])
if first is None:
# This is a shim DIF, nothing to do
@@ -657,40 +668,53 @@ class Experiment:
edge[0].name))
logger.debug("DIF graph for %s: %s", dif, ', '.join(er))
- if self.enrollment_strategy == 'minimal':
- # To generate the list of enrollments, we simulate one,
- # using breadth-first trasversal.
- enrolled = {first}
- frontier = {first}
- while len(frontier):
- cur = frontier.pop()
- for edge in dif_graphs[dif][cur]:
- if edge[0] not in enrolled:
- enrolled.add(edge[0])
- enrollee = edge[0].get_ipcp_by_dif(dif)
- assert(enrollee is not None)
- enroller = cur.get_ipcp_by_dif(dif)
- assert(enroller is not None)
+ # To generate the list of mgmt flows, minimal enrollments
+ # and minimal dt flows, we simulate it, using
+ # breadth-first traversal.
+ enrolled = {first}
+ frontier = {first}
+ while len(frontier):
+ cur = frontier.pop()
+ for edge in dif_graphs[dif][cur]:
+ if edge[0] not in enrolled:
+ enrolled.add(edge[0])
+ enrollee = edge[0].get_ipcp_by_dif(dif)
+ assert(enrollee is not None)
+ enroller = cur.get_ipcp_by_dif(dif)
+ assert(enroller is not None)
+ if self.enrollment_strategy == 'minimal':
self.enrollments[-1].append({'dif': dif,
'enrollee': enrollee,
'enroller': enroller,
'lower_dif': edge[1]})
- frontier.add(edge[0])
-
- elif self.enrollment_strategy == 'full-mesh':
- for cur in dif_graphs[dif]:
- for edge in dif_graphs[dif][cur]:
- if cur < edge[0]:
- enrollee = cur.get_ipcp_by_dif(dif)
- assert(enrollee is not None)
- enroller = edge[0].get_ipcp_by_dif(dif)
- assert(enroller is not None)
+ self.mgmt_flows[-1].append({'src': enrollee,
+ 'dst': enroller})
+ if self.dt_strategy == 'minimal':
+ self.dt_flows[-1].append({'src': enrollee,
+ 'dst': enroller})
+ frontier.add(edge[0])
+
+ # In case of a full mesh enrollment or dt flows
+ for cur in dif_graphs[dif]:
+ for edge in dif_graphs[dif][cur]:
+ if cur.name < edge[0].name:
+ enrollee = cur.get_ipcp_by_dif(dif)
+ assert(enrollee is not None)
+ enroller = edge[0].get_ipcp_by_dif(dif)
+ assert(enroller is not None)
+ if self.enrollment_strategy == 'full-mesh':
self.enrollments[-1].append({'dif': dif,
'enrollee': enrollee,
'enroller': enroller,
'lower_dif': edge[1]})
-
- else:
+ if self.dt_strategy == 'full-mesh':
+ self.dt_flows[-1].append({'src': enrollee,
+ 'dst': enroller})
+
+ if not (self.dt_strategy == 'minimal'
+ or self.dt_strategy == 'full-mesh') \
+ or not (self.enrollment_strategy == 'full-mesh'
+ or self.enrollment_strategy == 'minimal'):
# This is a bug
assert False
diff --git a/rumba/prototypes/ouroboros.py b/rumba/prototypes/ouroboros.py
index afc80d3..49323c5 100644
--- a/rumba/prototypes/ouroboros.py
+++ b/rumba/prototypes/ouroboros.py
@@ -124,7 +124,23 @@ class Experiment(mod.Experiment):
ssh.execute_commands(self.testbed,
e['enrollee'].node.ssh_config,
cmds, time_out=None)
- time.sleep(2)
+
+ def setup_flows(self, flows):
+ for el in flows:
+ for e in el:
+ ipcp = e['src']
+ if flows == self.mgmt_flows:
+ comp = 'mgmt'
+ elif flows == self.dt_flows:
+ comp = 'dt'
+ else:
+ assert(False)
+
+ cmd = "irm i conn n " + ipcp.name + " comp " + \
+ comp + " dst " + e['dst'].name
+ ssh.execute_command(self.testbed,
+ ipcp.node.ssh_config,
+ cmd, time_out=None)
def install_prototype(self):
logger.info("Installing Ouroboros...")
@@ -138,4 +154,8 @@ class Experiment(mod.Experiment):
self.create_ipcps()
logger.info("Enrolling IPCPs...")
self.enroll_ipcps()
+ logger.info("Setting up management flows...")
+ self.setup_flows(self.mgmt_flows)
+ logger.info("Setting up data transfer flows...")
+ self.setup_flows(self.dt_flows)
logger.info("All done, have fun!")