diff options
-rw-r--r-- | rumba/model.py | 21 | ||||
-rw-r--r-- | rumba/prototypes/irati.py | 13 | ||||
-rw-r--r-- | rumba/prototypes/ouroboros.py | 39 | ||||
-rw-r--r-- | rumba/prototypes/rlite.py | 6 |
4 files changed, 47 insertions, 32 deletions
diff --git a/rumba/model.py b/rumba/model.py index 68c6c51..9187fcb 100644 --- a/rumba/model.py +++ b/rumba/model.py @@ -173,6 +173,11 @@ class Node: self._validate() + def get_ipcp_by_dif(self, dif): + for ipcp in self.ipcps: + if ipcp.dif == dif: + return ipcp + def _undeclared_dif(self, dif): if dif not in self.difs: raise Exception("Invalid registration: node %s is not declared " @@ -458,9 +463,13 @@ class Experiment: 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) self.enrollments[-1].append({'dif': dif, - 'enrollee': edge[0], - 'enroller': cur, + 'enrollee': enrollee, + 'enroller': enroller, 'lower_dif': edge[1]}) frontier.add(edge[0]) @@ -468,9 +477,13 @@ class Experiment: 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.enrollments[-1].append({'dif': dif, - 'enrollee': cur, - 'enroller': edge[0], + 'enrollee': enrollee, + 'enroller': enroller, 'lower_dif': edge[1]}) else: diff --git a/rumba/prototypes/irati.py b/rumba/prototypes/irati.py index 35e9ddf..b2f54d9 100644 --- a/rumba/prototypes/irati.py +++ b/rumba/prototypes/irati.py @@ -184,16 +184,17 @@ class Experiment(mod.Experiment): e_args = {'ldif': self.dif_name(e['lower_dif']), 'dif': e['dif'].name, - 'name': e['enrollee'].name, - 'o_name': e['enroller'].name} + 'nname': e['enrollee'].node.name, + 'iname': e['enrollee'].name, + 'o_iname': e['enroller'].name} cmd = self.sudo('enroll.py --lower-dif %(ldif)s --dif %(dif)s ' - '--ipcm-conf /etc/%(name)s.ipcm.conf ' - '--enrollee-name %(dif)s.%(name)s.IPCP ' - '--enroller-name %(dif)s.%(o_name)s.IPCP' + '--ipcm-conf /etc/%(nname)s.ipcm.conf ' + '--enrollee-name %(iname)s.IPCP ' + '--enroller-name %(o_iname)s.IPCP' % e_args) ssh.execute_command(self.testbed, - e['enrollee'].ssh_config, + e['enrollee'].node.ssh_config, cmd) def dif_name(self, dif): diff --git a/rumba/prototypes/ouroboros.py b/rumba/prototypes/ouroboros.py index bbf8c75..9c164e7 100644 --- a/rumba/prototypes/ouroboros.py +++ b/rumba/prototypes/ouroboros.py @@ -119,26 +119,25 @@ class Experiment(mod.Experiment): def enroll_ipcps(self): for el in self.enrollments: for e in el: - for ipcp in e['enrollee'].ipcps: - if ipcp.dif == e['dif']: - cmds = list() - cmd = "irm i e n " + ipcp.name + " dif " + e['dif'].name - cmds.append(cmd) - cmd = "irm b i " + ipcp.name + " name " + ipcp.dif.name - cmds.append(cmd) - cmd = "irm r n " + ipcp.name - for dif_b in e['enrollee'].dif_registrations[ipcp.dif]: - cmd += " dif " + dif_b.name - cmds.append(cmd) - cmd = "irm r n " + ipcp.dif.name - for dif_b in e['enrollee'].dif_registrations[ipcp.dif]: - cmd += " dif " + dif_b.name - cmds.append(cmd) - - ssh.execute_commands(self.testbed, - e['enrollee'].ssh_config, - cmds, time_out=None) - time.sleep(2) + ipcp = e['enrollee'] + cmds = list() + cmd = "irm i e n " + ipcp.name + " dif " + e['dif'].name + cmds.append(cmd) + cmd = "irm b i " + ipcp.name + " name " + ipcp.dif.name + cmds.append(cmd) + cmd = "irm r n " + ipcp.name + for dif_b in e['enrollee'].node.dif_registrations[ipcp.dif]: + cmd += " dif " + dif_b.name + cmds.append(cmd) + cmd = "irm r n " + ipcp.dif.name + for dif_b in e['enrollee'].node.dif_registrations[ipcp.dif]: + cmd += " dif " + dif_b.name + cmds.append(cmd) + + ssh.execute_commands(self.testbed, + e['enrollee'].node.ssh_config, + cmds, time_out=None) + time.sleep(2) def install_prototype(self): logger.info("Installing Ouroboros...") diff --git a/rumba/prototypes/rlite.py b/rumba/prototypes/rlite.py index 8da4616..8a06b44 100644 --- a/rumba/prototypes/rlite.py +++ b/rumba/prototypes/rlite.py @@ -22,6 +22,8 @@ import rumba.ssh_support as ssh import rumba.model as mod import rumba.log as log +import time + logger = log.get_logger(__name__) @@ -75,7 +77,6 @@ class Experiment(mod.Experiment): # Generate the command to configure the interface # name for the shim-eth if type(ipcp.dif) is mod.ShimEthDIF: - ipcp.ifname = 'eth1' cmds.append("rlite-ctl ipcp-config %s netdev %s" % (ipcp.name, ipcp.ifname)) @@ -102,7 +103,8 @@ class Experiment(mod.Experiment): } cmd = "rlite-ctl ipcp-enroll %(enrollee)s %(dif)s "\ "%(lower_dif)s %(enroller)s" % d - self.execute_commands(e['enrollee'], [cmd]) + self.execute_commands(e['enrollee'].node, [cmd]) + time.sleep(1) def install_prototype(self): logger.info("installing rlite on all nodes") |