From 1f70912a80177b79905242dc7bd8c013625d85a5 Mon Sep 17 00:00:00 2001 From: Vincenzo Maffione Date: Thu, 13 Apr 2017 22:50:31 +0200 Subject: prototypes: rlite: implement create_ipcps() --- rumba/prototypes/rlite.py | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/rumba/prototypes/rlite.py b/rumba/prototypes/rlite.py index 0ff680d..387c502 100644 --- a/rumba/prototypes/rlite.py +++ b/rumba/prototypes/rlite.py @@ -27,8 +27,8 @@ class Experiment(mod.Experiment): def __init__(self, testbed, nodes=None): mod.Experiment.__init__(self, testbed, nodes) - def setup(self): - cmds = list() + def init(self): + cmds = [] if False: # ubuntu cmds.append("apt-get update") @@ -38,19 +38,46 @@ class Experiment(mod.Experiment): cmds.append("rm -rf ~/rlite") cmds.append("cd ~; git clone https://github.com/vmaffione/rlite") cmds.append("cd ~/rlite && ./configure && make && sudo make install") + + # Load kernel modules cmds.append("modprobe rlite") cmds.append("modprobe rlite-normal") cmds.append("modprobe rlite-shim-eth") cmds.append("modprobe rlite-shim-udp4") cmds.append("modprobe rlite-shim-loopback") - cmds.append("nohup rlite-uipcps -v DBG -k 0 -U -A &> uipcp.log &") + + # Start the uipcps daemon + cmds.append("rlite-uipcps -v DBG -k 0 &> uipcp.log &") for node in self.nodes: ssh.execute_commands(self.testbed, node.ssh_config, cmds, time_out=None) + def create_ipcps(self): + for node in self.nodes: + cmds = [] + for ipcp in node.ipcps: + + if type(ipcp.dif) is mod.NormalDIF: + ipcp_type = 'normal' + elif type(ipcp.dif) is mod.ShimEthDIF: + ipcp_type = 'shim-eth' + elif type(ipcp.dif) is mod.ShimUDPDIF: + ipcp_type = 'shim-udp4' + else: + print("unknown type for DIF %s, default to loopback" \ + % ipcp.dif.name) + ipcp_type = 'shim-loopback' + + cmds.append("rlite-ctl ipcp-create %s %s %s" % \ + (ipcp.name, ipcp_type, ipcp.dif.name)) + + ssh.execute_commands(self.testbed, node.ssh_config, cmds, + time_out = None) + def run_prototype(self): - print("[RLITE experiment] start") - print("Setting up rlite on the nodes...") - self.setup() - print("[RLITE experiment] end") + print("rlite: setting up") + self.init() + print("rlite: software initialized on all nodes") + self.create_ipcps() + print("rlite: IPCPs created on all nodes") -- cgit v1.2.3 From a39034893449360868041cd7e061143f6c77275d Mon Sep 17 00:00:00 2001 From: Vincenzo Maffione Date: Thu, 13 Apr 2017 22:55:39 +0200 Subject: prototype: rlite: configure shim-eth IPCPs --- rumba/prototypes/rlite.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rumba/prototypes/rlite.py b/rumba/prototypes/rlite.py index 387c502..4ab4f1f 100644 --- a/rumba/prototypes/rlite.py +++ b/rumba/prototypes/rlite.py @@ -58,6 +58,7 @@ class Experiment(mod.Experiment): cmds = [] for ipcp in node.ipcps: + # Generate the command to create the IPCP if type(ipcp.dif) is mod.NormalDIF: ipcp_type = 'normal' elif type(ipcp.dif) is mod.ShimEthDIF: @@ -72,6 +73,12 @@ class Experiment(mod.Experiment): cmds.append("rlite-ctl ipcp-create %s %s %s" % \ (ipcp.name, ipcp_type, ipcp.dif.name)) + # Generate the command to configure the interface + # name for the shim-eth + if type(ipcp.dif) is mod.ShimEthDIF: + cmds.append("rlite-ctl ipcp-config %s netdev %s" \ + % (ipcp.name, ipcp.ifname)) + ssh.execute_commands(self.testbed, node.ssh_config, cmds, time_out = None) -- cgit v1.2.3 From 3ad4844b0c289dbf08c7ee5287d6fe42effc8e91 Mon Sep 17 00:00:00 2001 From: Vincenzo Maffione Date: Thu, 13 Apr 2017 23:03:00 +0200 Subject: prototype: rlite: implement register_ipcps() --- rumba/prototypes/rlite.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/rumba/prototypes/rlite.py b/rumba/prototypes/rlite.py index 4ab4f1f..e1e3729 100644 --- a/rumba/prototypes/rlite.py +++ b/rumba/prototypes/rlite.py @@ -56,8 +56,8 @@ class Experiment(mod.Experiment): def create_ipcps(self): for node in self.nodes: cmds = [] - for ipcp in node.ipcps: + for ipcp in node.ipcps: # Generate the command to create the IPCP if type(ipcp.dif) is mod.NormalDIF: ipcp_type = 'normal' @@ -82,9 +82,23 @@ class Experiment(mod.Experiment): ssh.execute_commands(self.testbed, node.ssh_config, cmds, time_out = None) + def register_ipcps(self): + for node in self.nodes: + cmds = [] + + for ipcp in node.ipcps: + for lower in ipcp.registrations: + cmds.append("rlite-ctl ipcp-register %s %s" \ + % (ipcp.name, lower.name)) + + ssh.execute_commands(self.testbed, node.ssh_config, cmds, + time_out = None) + def run_prototype(self): print("rlite: setting up") self.init() print("rlite: software initialized on all nodes") self.create_ipcps() print("rlite: IPCPs created on all nodes") + self.register_ipcps() + print("rlite: IPCPs registered to their lower DIFs on all nodes") -- cgit v1.2.3 From c807556fcd39085c66136a8a628c60ea67f5d852 Mon Sep 17 00:00:00 2001 From: Vincenzo Maffione Date: Thu, 13 Apr 2017 23:05:56 +0200 Subject: prototype: rlite: add execute_commands() method to reuse code --- rumba/prototypes/rlite.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/rumba/prototypes/rlite.py b/rumba/prototypes/rlite.py index e1e3729..25ae943 100644 --- a/rumba/prototypes/rlite.py +++ b/rumba/prototypes/rlite.py @@ -1,7 +1,7 @@ # # Commands to setup and instruct rlite # -# Vincenzo Maffione +# Author: Vincenzo Maffione # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -22,11 +22,16 @@ import rumba.ssh_support as ssh import rumba.model as mod import time -# An experiment over the RLITE implementation +# An experiment over the rlite implementation class Experiment(mod.Experiment): + def __init__(self, testbed, nodes=None): mod.Experiment.__init__(self, testbed, nodes) + def execute_commands(self, node, cmds): + ssh.execute_commands(self.testbed, node.ssh_config, + cmds, time_out=None) + def init(self): cmds = [] @@ -50,8 +55,7 @@ class Experiment(mod.Experiment): cmds.append("rlite-uipcps -v DBG -k 0 &> uipcp.log &") for node in self.nodes: - ssh.execute_commands(self.testbed, node.ssh_config, - cmds, time_out=None) + self.execute_commands(node, cmds) def create_ipcps(self): for node in self.nodes: @@ -79,8 +83,7 @@ class Experiment(mod.Experiment): cmds.append("rlite-ctl ipcp-config %s netdev %s" \ % (ipcp.name, ipcp.ifname)) - ssh.execute_commands(self.testbed, node.ssh_config, cmds, - time_out = None) + self.execute_commands(node, cmds) def register_ipcps(self): for node in self.nodes: @@ -91,8 +94,7 @@ class Experiment(mod.Experiment): cmds.append("rlite-ctl ipcp-register %s %s" \ % (ipcp.name, lower.name)) - ssh.execute_commands(self.testbed, node.ssh_config, cmds, - time_out = None) + self.execute_commands(node, cmds) def run_prototype(self): print("rlite: setting up") -- cgit v1.2.3 From 50d708a09395fbed2d2d75dd07c0fa6a360f59c0 Mon Sep 17 00:00:00 2001 From: Vincenzo Maffione Date: Thu, 13 Apr 2017 23:21:39 +0200 Subject: prototype: rlite: implement enroll_ipcps() --- rumba/prototypes/rlite.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/rumba/prototypes/rlite.py b/rumba/prototypes/rlite.py index 25ae943..9568d7e 100644 --- a/rumba/prototypes/rlite.py +++ b/rumba/prototypes/rlite.py @@ -80,6 +80,7 @@ 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)) @@ -96,6 +97,18 @@ class Experiment(mod.Experiment): self.execute_commands(node, cmds) + def enroll_ipcps(self): + for el in self.enrollments: + for e in el: + d = {'enrollee': e['enrollee'].name, + 'dif': e['dif'].name, + 'lower_dif': e['lower_dif'].name, + 'enroller': e['enroller'].name + } + cmd = "rlite-ctl ipcp-enroll %(enrollee)s %(dif)s "\ + "%(lower_dif)s %(enroller)s" % d + self.execute_commands(e['enrollee'], [cmd]) + def run_prototype(self): print("rlite: setting up") self.init() @@ -104,3 +117,5 @@ class Experiment(mod.Experiment): print("rlite: IPCPs created on all nodes") self.register_ipcps() print("rlite: IPCPs registered to their lower DIFs on all nodes") + self.enroll_ipcps() + print("rlite: enrollment completed in all DIFs") -- cgit v1.2.3