From 7bab86ff1683f32d739f1da9565f83bef5ff7e3b Mon Sep 17 00:00:00 2001 From: Marco Capitani Date: Wed, 10 May 2017 17:43:28 +0200 Subject: jfed-irati small fixes for compatibility --- rumba/prototypes/enroll.py | 8 ++++---- rumba/prototypes/irati.py | 21 +++++++++++---------- rumba/testbeds/jfed.py | 33 +++++++++++++++++++++++++++++---- 3 files changed, 44 insertions(+), 18 deletions(-) diff --git a/rumba/prototypes/enroll.py b/rumba/prototypes/enroll.py index 458736a..99b49a6 100755 --- a/rumba/prototypes/enroll.py +++ b/rumba/prototypes/enroll.py @@ -78,8 +78,8 @@ if connected: get_response(s) # Send the IPCP list command - cmd = 'list-ipcps\n' - s.sendall(bytes(cmd, 'ascii')) + cmd = u'list-ipcps\n' + s.sendall(cmd.encode('ascii')) # Get the list of IPCPs and parse it to look for the enroller ID print('Looking up identifier for IPCP %s' % args.enrollee_name) @@ -98,11 +98,11 @@ if connected: raise Exception() # Send the enroll command - cmd = 'enroll-to-dif %s %s %s %s 1\n' \ + cmd = u'enroll-to-dif %s %s %s %s 1\n' \ % (enrollee_id, args.dif, args.lower_dif, args.enroller_name) print(cmd) - s.sendall(bytes(cmd, 'ascii')) + s.sendall(cmd.encode('ascii')) # Get the enroll command answer lines = get_response(s) diff --git a/rumba/prototypes/irati.py b/rumba/prototypes/irati.py index b2f54d9..c630a94 100644 --- a/rumba/prototypes/irati.py +++ b/rumba/prototypes/irati.py @@ -21,8 +21,6 @@ import copy import json -import subprocess - import os import time @@ -69,14 +67,17 @@ class Experiment(mod.Experiment): def install(self): """Installs IRATI on the nodes.""" - cmds = list() - - cmds.append("sudo apt-get update") - cmds.append("sudo apt-get install g++ gcc " - "protobuf-compiler libprotobuf-dev git --yes") - cmds.append("sudo rm -rf ~/irati") - cmds.append("cd && git clone https://github.com/IRATI/stack irati") - cmds.append("cd ~/irati && sudo ./install-from-scratch") + cmds = ["sudo apt-get update", + "export https_proxy=\"https://proxy.atlantis.ugent.be:8080\"; " + "sudo apt-get install g++ gcc " + "protobuf-compiler libprotobuf-dev git --yes", + "sudo rm -rf ~/irati", + "cd ~; " + "export https_proxy=\"https://proxy.atlantis.ugent.be:8080\"; " + "git clone https://github.com/IRATI/stack irati", + "cd ~/irati; git checkout arcfire", + "cd ~/irati; cp linux/config-IRATI linux/.config", + "cd ~/irati && sudo ./install-from-scratch"] for node in self.nodes: ssh.execute_commands(self.testbed, node.ssh_config, diff --git a/rumba/testbeds/jfed.py b/rumba/testbeds/jfed.py index 5394146..60d6605 100644 --- a/rumba/testbeds/jfed.py +++ b/rumba/testbeds/jfed.py @@ -27,7 +27,7 @@ import tarfile import rumba.model as mod import rumba.log as log - +from rumba import ssh_support logger = log.get_logger(__name__) @@ -164,22 +164,47 @@ class Testbed(mod.Testbed): rspec = xml.parse(self.manifest) xml_nodes = rspec.getElementsByTagName("node") + dir_path = os.path.dirname(os.path.abspath(__file__)) + # Complete details of the nodes after swapin for xml_node in xml_nodes: n_name = xml_node.getAttribute("client_id") intfs = xml_node.getElementsByTagName("interface") + got = False for node in experiment.nodes: if node.name == n_name: node_n = node + got = True + if not got: + logger.error("Not found node %s", n_name) for intf in intfs: + aux_mac_address = intf.getAttribute("mac_address") + mac = ":".join( + [aux_mac_address[i:i+2] for i in range(0, 12, 2)] + ) + ssh_support.copy_path_to_testbed( + self, + node_n.ssh_config, + os.path.join(dir_path, 'mac2ifname.sh'), + '') + ssh_support.execute_command( + self, + node_n.ssh_config, + 'cd ~ && chmod a+x mac2ifname.sh') + ifname = ssh_support.execute_command( + self, + node_n.ssh_config, + './mac2ifname.sh ' + mac + ) i_name = intf.getAttribute("client_id") for ipcp in node_n.ipcps: if isinstance(ipcp, mod.ShimEthIPCP): if self.if_id[ipcp] == i_name: - comp_id = intf.getAttribute("component_id") - comp_arr = comp_id.split(":") - ipcp.ifname = comp_arr[-1] + ipcp.ifname = ifname + # comp_id = intf.getAttribute("component_id") + # comp_arr = comp_id.split(":") + # ipcp.ifname = comp_arr[-1] # xml_ip = intf.getElementsByTagName("ip") # interface.ip = xml_ip[0].getAttribute("address") -- cgit v1.2.3 From 49c09c68da6b99c1c3b9b61df5547fbaf5ada712 Mon Sep 17 00:00:00 2001 From: Marco Capitani Date: Wed, 31 May 2017 17:31:02 +0200 Subject: jfed-irati: fixes after rumba image --- rumba/prototypes/irati.py | 18 ++++++++++-------- rumba/testbeds/jfed.py | 2 +- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/rumba/prototypes/irati.py b/rumba/prototypes/irati.py index c630a94..7004831 100644 --- a/rumba/prototypes/irati.py +++ b/rumba/prototypes/irati.py @@ -67,17 +67,19 @@ class Experiment(mod.Experiment): def install(self): """Installs IRATI on the nodes.""" - cmds = ["sudo apt-get update", + cmds = [self.sudo("apt-get update"), "export https_proxy=\"https://proxy.atlantis.ugent.be:8080\"; " - "sudo apt-get install g++ gcc " - "protobuf-compiler libprotobuf-dev git --yes", - "sudo rm -rf ~/irati", + + self.sudo("apt-get install g++ gcc " + "protobuf-compiler libprotobuf-dev git --yes" + "pkg-config " + "libnl-3-dev libnl-genl-3-dev"), + self.sudo("rm -rf ~/irati"), "cd ~; " "export https_proxy=\"https://proxy.atlantis.ugent.be:8080\"; " - "git clone https://github.com/IRATI/stack irati", - "cd ~/irati; git checkout arcfire", - "cd ~/irati; cp linux/config-IRATI linux/.config", - "cd ~/irati && sudo ./install-from-scratch"] + + "git clone https://github.com/IRATI/stack irati", + "cd ~/irati && git checkout arcfire", + "cd ~/irati && " + + self.sudo("./install-from-scratch")] for node in self.nodes: ssh.execute_commands(self.testbed, node.ssh_config, diff --git a/rumba/testbeds/jfed.py b/rumba/testbeds/jfed.py index 60d6605..53a812f 100644 --- a/rumba/testbeds/jfed.py +++ b/rumba/testbeds/jfed.py @@ -49,7 +49,7 @@ class Testbed(mod.Testbed): self.jfed_jar = "jfed_cli/experimenter-cli.jar" if image is not None: self.image = "urn:publicid:IDN+" + authority + \ - "+image+GeniSlices:" + image + "+image+wall2-ilabt-iminds-be:" + image else: self.image = None -- cgit v1.2.3 From 1e6c9587497793709866703f85e97649e797f75b Mon Sep 17 00:00:00 2001 From: Marco Capitani Date: Thu, 1 Jun 2017 15:18:54 +0200 Subject: jfed-irati absolute'ed paths, added mac2ifname.sh --- rumba/prototypes/irati.py | 3 +-- rumba/testbeds/jfed.py | 2 ++ rumba/testbeds/mac2ifname.sh | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100755 rumba/testbeds/mac2ifname.sh diff --git a/rumba/prototypes/irati.py b/rumba/prototypes/irati.py index b5f8f6b..f36b59b 100644 --- a/rumba/prototypes/irati.py +++ b/rumba/prototypes/irati.py @@ -147,7 +147,6 @@ class Experiment(mod.Experiment): 'genfiles': gen_files, 'genfilesconf': ' '.join(gen_files_conf), 'genfilesbin': gen_files_bin, - 'installpath': '/usr', 'verb': 'DBG', 'ipcmcomps': ipcm_components} @@ -167,7 +166,7 @@ class Experiment(mod.Experiment): cmds += [self.sudo('modprobe rina-default-plugin'), self.sudo('modprobe shim-eth-vlan'), self.sudo('modprobe normal-ipcp'), - self.sudo('%(installpath)s/bin/ipcm -a \"%(ipcmcomps)s\" ' + self.sudo('ipcm -a \"%(ipcmcomps)s\" ' '-c /etc/%(name)s.ipcm.conf -l %(verb)s &> log &' % format_args)] diff --git a/rumba/testbeds/jfed.py b/rumba/testbeds/jfed.py index 53a812f..54ad860 100644 --- a/rumba/testbeds/jfed.py +++ b/rumba/testbeds/jfed.py @@ -203,6 +203,8 @@ class Testbed(mod.Testbed): if isinstance(ipcp, mod.ShimEthIPCP): if self.if_id[ipcp] == i_name: ipcp.ifname = ifname + logger.debug("Node %s interface %s has name %s." + % (node_n.name, mac, ifname)) # comp_id = intf.getAttribute("component_id") # comp_arr = comp_id.split(":") # ipcp.ifname = comp_arr[-1] diff --git a/rumba/testbeds/mac2ifname.sh b/rumba/testbeds/mac2ifname.sh new file mode 100755 index 0000000..5a87ee1 --- /dev/null +++ b/rumba/testbeds/mac2ifname.sh @@ -0,0 +1,2 @@ +mac="$1" +cd / && ./sbin/ifconfig -a | awk '/^[a-z]/ { if ( "'"$mac"'" == $5 ) print $1}' -- cgit v1.2.3 From 77dccda7380679447fd8ad3176d239901301ba16 Mon Sep 17 00:00:00 2001 From: Marco Capitani Date: Thu, 1 Jun 2017 15:25:07 +0200 Subject: Typo fix in package installations --- rumba/prototypes/irati.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rumba/prototypes/irati.py b/rumba/prototypes/irati.py index f36b59b..c47d0d2 100644 --- a/rumba/prototypes/irati.py +++ b/rumba/prototypes/irati.py @@ -70,7 +70,7 @@ class Experiment(mod.Experiment): cmds = [self.sudo("apt-get update"), "export https_proxy=\"https://proxy.atlantis.ugent.be:8080\"; " + self.sudo("apt-get install g++ gcc " - "protobuf-compiler libprotobuf-dev git --yes" + "protobuf-compiler libprotobuf-dev git --yes " "pkg-config " "libnl-3-dev libnl-genl-3-dev"), self.sudo("rm -rf ~/irati"), -- cgit v1.2.3 From 8432191cf9ed370aaf2a2e9792b546202dae0d07 Mon Sep 17 00:00:00 2001 From: Marco Capitani Date: Wed, 7 Jun 2017 11:44:24 +0200 Subject: qemu: fix for devices permission --- rumba/testbeds/qemu.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rumba/testbeds/qemu.py b/rumba/testbeds/qemu.py index b7ebef9..df02ab6 100644 --- a/rumba/testbeds/qemu.py +++ b/rumba/testbeds/qemu.py @@ -111,6 +111,13 @@ class Testbed(mod.Testbed): if os.geteuid() != 0: try: subprocess.check_call(["sudo", "-v"]) + if not os.access("/dev/vhost-net", os.R_OK) \ + or not os.access("/dev/vhost-net", os.W_OK) \ + or not os.access("/dev/kvm", os.R_OK) \ + or not os.access("/dev/kvm", os.W_OK): + raise Exception('Cannot open vhost device. Make sure it is' + 'available and you have rw permissions ' + 'on /dev/vhost-net') except subprocess.CalledProcessError: raise Exception('Not authenticated') -- cgit v1.2.3 From fcdbe20a05764f84a7c95c4bf916a7569e373270 Mon Sep 17 00:00:00 2001 From: Marco Capitani Date: Thu, 8 Jun 2017 16:37:16 +0200 Subject: tools: democonf updated; irati: added sleep after ipcm start --- rumba/prototypes/irati.py | 10 ++-------- tools/democonf2rumba.py | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/rumba/prototypes/irati.py b/rumba/prototypes/irati.py index 1e75efc..2ae4723 100644 --- a/rumba/prototypes/irati.py +++ b/rumba/prototypes/irati.py @@ -88,12 +88,6 @@ class Experiment(mod.Experiment): ssh.execute_proxy_commands(self.testbed, node.ssh_config, cmds, time_out=None) - def setup(self): - for node in self.nodes: - ssh.execute_command(self.testbed, node.ssh_config, - "sudo nohup ipcm &> ipcm.log &", - time_out=None) - def bootstrap_network(self): """Creates the network by enrolling and configuring the nodes""" for node in self.nodes: @@ -107,8 +101,6 @@ class Experiment(mod.Experiment): def bootstrap_prototype(self): logger.info("setting up") - self.setup() - logger.info("software initialized on all nodes") self.conf_files = self.write_conf() logger.info("configuration files generated for all nodes") self.bootstrap_network() @@ -178,6 +170,8 @@ class Experiment(mod.Experiment): def enroll_nodes(self): """Runs the enrollments one by one, respecting dependencies""" + time.sleep(5) + logger.info("Waiting 5 seconds for the ipcm to start.") for enrollment_list in self.enrollments: for e in enrollment_list: logger.info( diff --git a/tools/democonf2rumba.py b/tools/democonf2rumba.py index 9c6d64f..dc2f0a4 100755 --- a/tools/democonf2rumba.py +++ b/tools/democonf2rumba.py @@ -210,7 +210,7 @@ if __name__ == '__main__': required=True, help='Certificate file') jfed_p.add_argument('-H', '--exp_hours', metavar='HOURS', type=str, - default=2, help='Experiment hours') + default="2", help='Experiment hours') jfed_p.add_argument('-A', '--authority', metavar='AUTH', type=str, default="wall2.ilabt.iminds.be", help='Authority') -- cgit v1.2.3 From 57218e2bd37d32a9dafedde90a62b46955ac5e8f Mon Sep 17 00:00:00 2001 From: Marco Capitani Date: Fri, 9 Jun 2017 10:44:56 +0200 Subject: jfed: build mac2ifname; model: added flags to testbed --- rumba/model.py | 1 + rumba/ssh_support.py | 10 +++++----- rumba/testbeds/jfed.py | 17 ++++++++++++----- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/rumba/model.py b/rumba/model.py index 941cba8..c1c6f5d 100644 --- a/rumba/model.py +++ b/rumba/model.py @@ -49,6 +49,7 @@ class Testbed: self.proj_name = proj_name self.exp_name = exp_name self.http_proxy = http_proxy + self.flags = {'no_vlan_offload': False} @abc.abstractmethod def swap_in(self, experiment): diff --git a/rumba/ssh_support.py b/rumba/ssh_support.py index f8ba03b..a1e1ba4 100644 --- a/rumba/ssh_support.py +++ b/rumba/ssh_support.py @@ -275,9 +275,9 @@ def setup_vlan(testbed, node, vlan_id, int_name): % args), sudo("ifconfig %(ifname)s.%(vlan)s up" % args)] - # TODO: is ethtool needed? Should install or check if it is present. - # cmds += [sudo("ethtool -K %(ifname)s rxvlan off" - # % args), - # sudo("ethtool -K %(ifname)s txvlan off" - # % args)] + if testbed.flags['no_vlan_offload']: + cmds += [sudo("ethtool -K %(ifname)s rxvlan off" + % args), + sudo("ethtool -K %(ifname)s txvlan off" + % args)] execute_commands(testbed, node.ssh_config, cmds) diff --git a/rumba/testbeds/jfed.py b/rumba/testbeds/jfed.py index 1e1c732..83fbce7 100644 --- a/rumba/testbeds/jfed.py +++ b/rumba/testbeds/jfed.py @@ -68,6 +68,7 @@ class Testbed(mod.Testbed): tar.close() logger.info("Extracted in current directory") os.remove(tarball) + self.flags['no_vlan_offload'] = True def create_rspec(self, experiment): impl = xml.getDOMImplementation() @@ -189,11 +190,17 @@ class Testbed(mod.Testbed): mac = ":".join( [aux_mac_address[i:i+2] for i in range(0, 12, 2)] ) - ssh_support.copy_path_to_testbed( - self, - node_n.ssh_config, - os.path.join(dir_path, 'mac2ifname.sh'), - '') + command = ( + 'echo "mac=\\"\$1\\"; cd / && ./sbin/ifconfig -a | ' + 'awk \'/^[a-z]/ { if ( \\"\'\\"\$mac\\"\'\\" == \$5 )' + ' print \$1}\'" > mac2ifname.sh') + ssh_support.execute_command(self, node_n.ssh_config, command) + + # ssh_support.copy_path_to_testbed( + # self, + # node_n.ssh_config, + # os.path.join(dir_path, 'mac2ifname.sh'), + # '') ssh_support.execute_command( self, node_n.ssh_config, -- cgit v1.2.3 From 28c2d4015aa90454683473c23d11ae7fad9cc27b Mon Sep 17 00:00:00 2001 From: Marco Capitani Date: Tue, 13 Jun 2017 09:51:31 +0200 Subject: IRATI switched wait and log --- rumba/prototypes/irati.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rumba/prototypes/irati.py b/rumba/prototypes/irati.py index 2ae4723..42afe3b 100644 --- a/rumba/prototypes/irati.py +++ b/rumba/prototypes/irati.py @@ -170,8 +170,8 @@ class Experiment(mod.Experiment): def enroll_nodes(self): """Runs the enrollments one by one, respecting dependencies""" - time.sleep(5) logger.info("Waiting 5 seconds for the ipcm to start.") + time.sleep(5) for enrollment_list in self.enrollments: for e in enrollment_list: logger.info( -- cgit v1.2.3 From 8e455f04cbb524e50e17ce87a88aa386febe0bea Mon Sep 17 00:00:00 2001 From: Marco Capitani Date: Tue, 13 Jun 2017 09:52:51 +0200 Subject: JFed: removed mac2ifname.sh --- rumba/testbeds/mac2ifname.sh | 2 -- 1 file changed, 2 deletions(-) delete mode 100755 rumba/testbeds/mac2ifname.sh diff --git a/rumba/testbeds/mac2ifname.sh b/rumba/testbeds/mac2ifname.sh deleted file mode 100755 index 5a87ee1..0000000 --- a/rumba/testbeds/mac2ifname.sh +++ /dev/null @@ -1,2 +0,0 @@ -mac="$1" -cd / && ./sbin/ifconfig -a | awk '/^[a-z]/ { if ( "'"$mac"'" == $5 ) print $1}' -- cgit v1.2.3