From bb9004b851dbea68a3cec57a957593c730119fe8 Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Fri, 13 Jul 2018 11:15:27 +0200 Subject: elements: Remove distinction between mgmt and dt flows This will remove the distinction between mgmt and dt flows since Rumba allows setting up connections between IPCP at a very high level anyway. --- rumba/elements/experimentation.py | 63 +++++++++++++-------------------------- rumba/prototypes/ouroboros.py | 21 ++++++------- 2 files changed, 29 insertions(+), 55 deletions(-) diff --git a/rumba/elements/experimentation.py b/rumba/elements/experimentation.py index 5a86b6f..92d39f5 100644 --- a/rumba/elements/experimentation.py +++ b/rumba/elements/experimentation.py @@ -114,7 +114,7 @@ class Experiment(object): log_dir=None, prototype_logs=None, enrollment_strategy='minimal', - dt_strategy='full-mesh', + flows_strategy='full-mesh', server_decorator=None): """ :param testbed: The testbed of the experiment. @@ -144,18 +144,17 @@ class Experiment(object): self.enrollment_strategy = enrollment_strategy # 'full-mesh', 'manual' # the strategy employed for setting up the data transfer # network in the DIFs after enrollment - self.dt_strategy = dt_strategy + self.flows_strategy = flows_strategy 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 + self.flows = [] # a list of per-DIF lists of flows if self.enrollment_strategy not in ['full-mesh', 'minimal', 'manual']: raise Exception('Unknown enrollment strategy "%s"' % self.enrollment_strategy) - if self.dt_strategy not in ['full-mesh', 'minimal', 'manual']: - raise Exception('Unknown dt strategy "%s"' - % self.dt_strategy) + if self.flows_strategy not in ['full-mesh', 'minimal', 'manual']: + raise Exception('Unknown flows strategy "%s"' + % self.flows_strategy) # Determine log directory if log_dir is None: @@ -272,8 +271,7 @@ class Experiment(object): def compute_enrollments(self): dif_graphs = dict() self.enrollments = [] - self.mgmt_flows = [] - self.dt_flows = [] + self.flows = [] for dif in self.dif_ordering: neighsets = dict() @@ -303,8 +301,7 @@ class Experiment(object): dif_graphs[dif][node1].append((node2, lower_dif)) self.enrollments.append([]) - self.dt_flows.append([]) - self.mgmt_flows.append([]) + self.flows.append([]) if first is None: # This is a shim DIF, nothing to do @@ -318,8 +315,8 @@ class Experiment(object): edge[0].name)) logger.debug("DIF graph for %s: %s", dif, ', '.join(er)) - # To generate the list of mgmt flows, minimal enrollments - # and minimal dt flows, we simulate it, using + # To generate the list of minimal enrollments + # and minimal flows, we simulate it, using # breadth-first traversal. enrolled = {first} frontier = {first} @@ -338,10 +335,8 @@ class Experiment(object): 'enrollee': enrollee, 'enroller': enroller, 'lower_dif': edge[1]}) - self.mgmt_flows[-1].append({'src': enrollee, - 'dst': enroller}) - self.dt_flows[-1].append({'src': enrollee, - 'dst': enroller}) + self.flows[-1].append({'src': enrollee, + 'dst': enroller}) frontier.add(edge[0]) if len(dif.members) != len(enrolled): raise Exception("Disconnected DIF found: %s" % (dif,)) @@ -361,13 +356,13 @@ class Experiment(object): 'enrollee': enrollee, 'enroller': enroller, 'lower_dif': edge[1]}) - if self.dt_strategy == 'full-mesh': - self.dt_flows[-1].append({'src': enrollee, + if self.flows_strategy == 'full-mesh': + self.flows[-1].append({'src': enrollee, 'dst': enroller}) edges_covered.add((enrollee, enroller)) - if not (self.dt_strategy == 'minimal' - or self.dt_strategy == 'full-mesh') \ + if not (self.flows_strategy == 'minimal' + or self.flows_strategy == 'full-mesh') \ or not (self.enrollment_strategy == 'full-mesh' or self.enrollment_strategy == 'minimal'): # This is a bug @@ -383,16 +378,8 @@ class Experiment(object): e['lower_dif'])) logger.debug(log_string) - log_string = "Mgmt flows:\n" - for el in self.mgmt_flows: - for e in el: - log_string += (" %s --> %s \n" - % (e['src'].name, - e['dst'].name)) - logger.debug(log_string) - - log_string = "Dt flows:\n" - for el in self.dt_flows: + log_string = "Flows:\n" + for el in self.flows: for e in el: log_string += (" %s --> %s \n" % (e['src'].name, @@ -647,9 +634,8 @@ class Experiment(object): return try: - for enroll, mgmt, dt in zip(self.enrollments, - self.mgmt_flows, - self.dt_flows): + for enroll, dt in zip(self.enrollments, + self.flows): for e in enroll: if e['dif'] is not dif: continue @@ -659,15 +645,6 @@ class Experiment(object): color='black') gvizg.add_edge(edge) - for e in mgmt: - if e['src'].dif is not dif: - continue - - edge = pydot.Edge(e['src'].node.name, - e['dst'].node.name, - color='blue') - gvizg.add_edge(edge) - for e in dt: if e['src'].dif is not dif: continue diff --git a/rumba/prototypes/ouroboros.py b/rumba/prototypes/ouroboros.py index 5556d42..03f94eb 100644 --- a/rumba/prototypes/ouroboros.py +++ b/rumba/prototypes/ouroboros.py @@ -94,7 +94,7 @@ class Experiment(mod.Experiment): git_repo='git://ouroboros.ilabt.imec.be/ouroboros', git_branch='master', enrollment_strategy='minimal', - dt_strategy='full-mesh'): + flows_strategy='full-mesh'): """ Initializes the experiment class. @@ -103,7 +103,7 @@ class Experiment(mod.Experiment): :param git_repo: The git repository to use for installation. :param git_branch: The branch of the git repository to use. :param enrollment_strategy: Can be 'full-mesh', 'minimal' or 'manual'. - :param dt_strategy: For data flows, 'full-mesh', 'minimal' or 'manual'. + :param strategy: For flows, 'full-mesh', 'minimal' or 'manual'. """ mod.Experiment.__init__( self, @@ -112,7 +112,7 @@ class Experiment(mod.Experiment): git_repo, git_branch, enrollment_strategy=enrollment_strategy, - dt_strategy=dt_strategy, + flows_strategy=flows_strategy, server_decorator=OurServer ) self.r_ipcps = dict() @@ -263,11 +263,10 @@ class Experiment(mod.Experiment): e['enrollee'].node.execute_commands(cmds, time_out=None) - def setup_flows(self, el, comp): + def setup_flows(self, el): for e in el: ipcp = e['src'] - cmd = "irm i conn n " + ipcp.name + " comp " + \ - comp + " dst " + e['dst'].name + cmd = "irm i conn n " + ipcp.name + " dst " + e['dst'].name ipcp.node.execute_command(cmd, time_out=None) @@ -288,12 +287,10 @@ class Experiment(mod.Experiment): self.create_ipcps() logger.info("Enrolling IPCPs...") - for element, mgmt, dt in zip(self.enrollments, - self.mgmt_flows, - self.dt_flows): - self.enroll_dif(element) - self.setup_flows(mgmt, comp="mgmt") - self.setup_flows(dt, comp="dt") + for enrolls, flows in zip(self.enrollments, + self.flows): + self.enroll_dif(enrolls) + self.setup_flows(flows) logger.info("All done, have fun!") -- cgit v1.2.3