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