diff options
author | Marco Capitani <m.capitani@nextworks.it> | 2017-04-12 15:56:37 +0200 |
---|---|---|
committer | Marco Capitani <m.capitani@nextworks.it> | 2017-04-12 15:56:37 +0200 |
commit | c83ea6f4b791cd85cd248b039b353c522f2f1f3e (patch) | |
tree | cf3ffb203f0ada7bef09301aa3f3d5400b2d8c7b /rumba/prototypes | |
parent | 46310717c3293054324cc6a0271d855b638df0ff (diff) | |
parent | 6d8d0d30d75b318650034470b376a57a37b57944 (diff) | |
download | rumba-c83ea6f4b791cd85cd248b039b353c522f2f1f3e.tar.gz rumba-c83ea6f4b791cd85cd248b039b353c522f2f1f3e.zip |
Merge branch 'master' into master-marco
Updating with ssh changes (and other)
Diffstat (limited to 'rumba/prototypes')
-rw-r--r-- | rumba/prototypes/irati.py | 2 | ||||
-rw-r--r-- | rumba/prototypes/ouroboros.py | 100 | ||||
-rw-r--r-- | rumba/prototypes/rlite.py | 25 |
3 files changed, 109 insertions, 18 deletions
diff --git a/rumba/prototypes/irati.py b/rumba/prototypes/irati.py index 9c8b004..e06610d 100644 --- a/rumba/prototypes/irati.py +++ b/rumba/prototypes/irati.py @@ -42,7 +42,7 @@ class Experiment(mod.Experiment): cmds.append("sudo nohup ipcm &> ipcm.log &") for node in self.nodes: - ssh.execute_commands(self.testbed, node.full_name, + ssh.execute_commands(self.testbed, node.ssh_config, cmds, time_out=None) def run_prototype(self): diff --git a/rumba/prototypes/ouroboros.py b/rumba/prototypes/ouroboros.py index 4f78361..4fdacd6 100644 --- a/rumba/prototypes/ouroboros.py +++ b/rumba/prototypes/ouroboros.py @@ -20,6 +20,7 @@ import rumba.ssh_support as ssh import rumba.model as mod +import time # An experiment over the Ouroboros implementation class Experiment(mod.Experiment): @@ -32,11 +33,11 @@ class Experiment(mod.Experiment): cmds.append("sudo apt-get update") cmds.append("sudo apt-get install cmake protobuf-c-compiler git --yes") cmds.append("sudo rm -r ~/ouroboros/build") - cmds.append("cd ~/ouroboros; sudo ./install_release.sh") + cmds.append("cd ~/ouroboros; sudo ./install_debug.sh /") cmds.append("sudo nohup irmd > /dev/null &") for node in self.nodes: - ssh.execute_commands(self.testbed, node.full_name, + ssh.execute_commands(self.testbed, node.ssh_config, cmds, time_out=None) return @@ -46,14 +47,99 @@ class Experiment(mod.Experiment): for name, ap in node.bindings.items(): cmds.append("irm b ap " + ap + " n " + name) - ssh.execute_commands(self.testbed, node.full_name, - cmds, time_out=None) + ssh.execute_commands(self.testbed, node.ssh_config, + cmds, time_out = None) + + def reg_names(self): + for node in self.nodes: + cmds = list() + for name, difs in node.registrations.items(): + cmd = "irm r n " + name + for dif in difs: + cmd += " dif " + dif.name + cmds.append(cmd) + + ssh.execute_commands(self.testbed, node.ssh_config, cmds, + time_out = None) + + def create_ipcps(self): + for node in self.nodes: + cmds = list() + for ipcp in node.ipcps: + cmds2 = list() + if ipcp.dif_bootstrapper == True: + cmd = "irm i b n " + ipcp.name + else: + cmd = "irm i c n " + ipcp.name + + if type(ipcp.dif) is mod.ShimEthDIF: + # NOTE: Here to test with fake testbed + if ipcp.ifname is None: + ipcp.ifname = "eth0" + cmd += " type shim-eth-llc if_name " + ipcp.ifname + cmd += " dif " + ipcp.dif.name + elif type(ipcp.dif) is mod.NormalDIF: + cmd += " type normal" + if ipcp.dif_bootstrapper == True: + cmd += " dif " + ipcp.dif.name + cmd2 = "irm b i " + ipcp.name + " name " + ipcp.dif.name + cmds2.append(cmd2) + cmd2 = "irm r n " + ipcp.name + for dif_b in node.dif_registrations[ipcp.dif]: + cmd2 += " dif " + dif_b.name + cmds2.append(cmd2) + cmd2 = "irm r n " + ipcp.dif.name + for dif_b in node.dif_registrations[ipcp.dif]: + cmd2 += " dif " + dif_b.name + cmds2.append(cmd2) + elif type(ipcp.dif) is mod.ShimUDPDIF: + # FIXME: Will fail, since we don't keep IPs yet + cmd += " type shim-udp" + cmd += " dif " + ipcp.dif.name + else: + print("Unsupported IPCP type") + continue + + cmds.append(cmd) + for cmd in cmds2: + cmds.append(cmd) + + ssh.execute_commands(self.testbed, node.ssh_config, cmds, + time_out = None) + + 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) def run_prototype(self): - print("[Ouroboros experiment] start") - print("Creating resources...") print("Setting up Ouroboros...") self.setup_ouroboros() print("Binding names...") self.bind_names() - print("[Ouroboros experiment] end") + print("Creating IPCPs") + self.create_ipcps() + print("Enrolling IPCPs...") + self.enroll_ipcps() + print("Registering names...") + self.reg_names() + print("All done, have fun!") diff --git a/rumba/prototypes/rlite.py b/rumba/prototypes/rlite.py index f4ff825..0ff680d 100644 --- a/rumba/prototypes/rlite.py +++ b/rumba/prototypes/rlite.py @@ -30,22 +30,27 @@ class Experiment(mod.Experiment): def setup(self): cmds = list() - cmds.append("sudo apt-get update") - cmds.append("sudo apt-get install g++ gcc cmake " - "linux-headers-$(uname -r) " - "protobuf-compiler libprotobuf-dev git --yes") - cmds.append("sudo rm -rf ~/rlite") - cmds.append("cd ~; git clone https://github.com/vmaffione/rlite") - cmds.append("cd ~/rlite && ./configure && make && sudo make install") - cmds.append("sudo nohup rlite-uipcps -v DBG -k 0 -U -A &> uipcp.log &") + if False: # ubuntu + cmds.append("apt-get update") + cmds.append("apt-get install g++ gcc cmake " + "linux-headers-$(uname -r) " + "protobuf-compiler libprotobuf-dev git --yes") + cmds.append("rm -rf ~/rlite") + cmds.append("cd ~; git clone https://github.com/vmaffione/rlite") + cmds.append("cd ~/rlite && ./configure && make && sudo make install") + 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 &") for node in self.nodes: - ssh.execute_commands(self.testbed, node.full_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() - time.sleep(20) print("[RLITE experiment] end") |