diff options
author | Sander Vrijders <sander.vrijders@ugent.be> | 2017-09-12 10:22:08 +0200 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@ugent.be> | 2017-09-12 10:22:08 +0200 |
commit | 6d11410513a7e3de447d509af34984a681e2e68f (patch) | |
tree | b52db9f8f5265fd7cbe126306db5f41482b782c0 | |
parent | 715292ba092ea12c1fdad8a369608e348bec26ce (diff) | |
download | rumba-6d11410513a7e3de447d509af34984a681e2e68f.tar.gz rumba-6d11410513a7e3de447d509af34984a681e2e68f.zip |
model: Perform split between different flows
This performs a split between enrollment, data transfer and management
flows.
-rw-r--r-- | rumba/model.py | 76 | ||||
-rw-r--r-- | rumba/prototypes/ouroboros.py | 22 |
2 files changed, 71 insertions, 27 deletions
diff --git a/rumba/model.py b/rumba/model.py index 6303799..eeb684a 100644 --- a/rumba/model.py +++ b/rumba/model.py @@ -516,9 +516,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() @@ -609,6 +616,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() @@ -638,6 +647,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 @@ -651,40 +662,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!") |