Merge "Remove set_nic_state from old remote_client"
diff --git a/tempest/common/utils/linux/remote_client.py b/tempest/common/utils/linux/remote_client.py
index 414c016..9e1b61e 100644
--- a/tempest/common/utils/linux/remote_client.py
+++ b/tempest/common/utils/linux/remote_client.py
@@ -82,10 +82,10 @@
return self.exec_command(cmd)
def set_mac_address(self, nic, address):
- self.set_nic_state(nic=nic, state="down")
+ self.exec_command("sudo ip link set %s down" % nic)
cmd = "sudo ip link set dev {0} address {1}".format(nic, address)
self.exec_command(cmd)
- self.set_nic_state(nic=nic, state="up")
+ self.exec_command("sudo ip link set %s up" % nic)
def get_mac_address(self, nic=""):
show_nic = "show {nic} ".format(nic=nic) if nic else ""
@@ -107,10 +107,6 @@
ip=addr, mask=network_mask_bits, nic=nic)
return self.exec_command(cmd)
- def set_nic_state(self, nic, state="up"):
- cmd = "sudo ip link set {nic} {state}".format(nic=nic, state=state)
- return self.exec_command(cmd)
-
def get_dns_servers(self):
cmd = 'cat /etc/resolv.conf'
resolve_file = self.exec_command(cmd).strip().split('\n')
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index 15a0a70..e3b27d0 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -289,7 +289,7 @@
ssh_client.assign_static_ip(
nic=new_nic, addr=new_port['fixed_ips'][0]['ip_address'],
network_mask_bits=CONF.network.project_network_mask_bits)
- ssh_client.set_nic_state(nic=new_nic)
+ ssh_client.exec_command("sudo ip link set %s up" % new_nic)
def _get_server_nics(self, ssh_client):
reg = re.compile(r'(?P<num>\d+): (?P<nic_name>\w+):')
diff --git a/tempest/scenario/test_network_v6.py b/tempest/scenario/test_network_v6.py
index cfd83d0..4e8b004 100644
--- a/tempest/scenario/test_network_v6.py
+++ b/tempest/scenario/test_network_v6.py
@@ -153,7 +153,8 @@
"ports: %s")
% (network_id, ports))
mac6 = ports[0]
- ssh.set_nic_state(ssh.get_nic_name_by_mac(mac6))
+ nic = ssh.get_nic_name_by_mac(mac6)
+ ssh.exec_command("sudo ip link set %s up" % nic)
def _prepare_and_test(self, address6_mode, n_subnets6=1, dualnet=False):
net_list = self.prepare_network(address6_mode=address6_mode,
diff --git a/tempest/tests/common/utils/linux/test_remote_client.py b/tempest/tests/common/utils/linux/test_remote_client.py
index 48cb86b..7af719c 100644
--- a/tempest/tests/common/utils/linux/test_remote_client.py
+++ b/tempest/tests/common/utils/linux/test_remote_client.py
@@ -147,15 +147,6 @@
self._assert_exec_called_with(
"sudo ip addr add %s/%s dev %s" % (ip, '28', nic))
- def test_set_nic_state(self):
- nic = 'eth0'
- self.conn.set_nic_state(nic)
- self._assert_exec_called_with(
- 'sudo ip link set %s up' % nic)
- self.conn.set_nic_state(nic, "down")
- self._assert_exec_called_with(
- 'sudo ip link set %s down' % nic)
-
class TestRemoteClientWithServer(base.TestCase):