diff --git a/io/net/ethtool_test.py b/io/net/ethtool_test.py index 957d879ee..b6472b10a 100755 --- a/io/net/ethtool_test.py +++ b/io/net/ethtool_test.py @@ -148,7 +148,7 @@ def test_ethtool(self): "-l", self.interface, self.elapse) output = process.run(cmd_l, shell=True, verbose=True, ignore_status=True).stdout_text \ - .splitlines()[2:6] + .splitlines()[7:11] for i in range(len(output)): default.append(output[i].split(':')[1]) if 'n/a' in output[i]: @@ -201,6 +201,15 @@ def test_ethtool(self): ignore_status=True) if ret.exit_status != 0: self.fail("%s %s" % (self.args, ret.stderr_text)) + # Set queue values to original values + cmd = "ethtool %s %s %s %s %s %s %s %s %s %s" % ( + self.args, self.interface, self.param[0], self.default_set[0], + self.param[1], self.default_set[1], self.param[2], + self.default_set[2], self.param[3], self.default_set[3]) + ret = process.run(cmd, shell=True, verbose=True, + ignore_status=True) + if ret.exit_status != 0: + self.fail("%s %s" % (self.args, ret.stderr_text)) else: cmd = "ethtool %s %s %s" % ( self.args, self.interface, self.elapse) @@ -252,22 +261,12 @@ def tearDown(self): ''' Set the interface up at the end of test. ''' - if self.interface: - if self.args == "-L": - cmd = "ethtool %s %s %s %s %s %s %s %s %s %s" % ( - self.args, self.interface, self.param[0], self.default_set[0], - self.param[1], self.default_set[1], self.param[2], - self.default_set[2], self.param[3], self.default_set[3]) - ret = process.run(cmd, shell=True, verbose=True, - ignore_status=True) - if ret.exit_status != 0: - self.fail("%s %s" % (self.args, ret.stderr_text)) - self.interface_state_change(self.interface, "up", "yes") - self.networkinterface.remove_ipaddr(self.ipaddr, self.netmask) - try: - self.networkinterface.restore_from_backup() - except Exception: - self.networkinterface.remove_cfg_file() - self.log.info("backup file not availbale, could not restore file.") - if self.hbond: - self.networkinterface.restore_slave_cfg_file() + self.interface_state_change(self.interface, "up", "yes") + self.networkinterface.remove_ipaddr(self.ipaddr, self.netmask) + try: + self.networkinterface.restore_from_backup() + except Exception: + self.networkinterface.remove_cfg_file() + self.log.info("backup file not availbale, could not restore file.") + if self.hbond: + self.networkinterface.restore_slave_cfg_file()