Remove assign_static_ip from old remote_client
assign_static_ip was just one-line command wrapper method and it
was not worth to keep it as a common method. That made stacktrace
deep unnecessarily.
This patch removes assign_static_ip for the cleanup.
NOTE: This method is used in Congress, it is better to switch it
on Congress side before this patch. The congress patch is
Ie527ca8f163faa69792c78791878feee9f1e3956
Depends-On: Ie527ca8f163faa69792c78791878feee9f1e3956
Change-Id: Ie03d54f876b10b2546a1406ac944b4d09f82b510
diff --git a/tempest/common/utils/linux/remote_client.py b/tempest/common/utils/linux/remote_client.py
index 52d47a5..0caca00 100644
--- a/tempest/common/utils/linux/remote_client.py
+++ b/tempest/common/utils/linux/remote_client.py
@@ -100,11 +100,6 @@
nic = self.exec_command(cmd)
return nic.strip().strip(":").lower()
- def assign_static_ip(self, nic, addr, network_mask_bits=28):
- cmd = "sudo ip addr add {ip}/{mask} dev {nic}".format(
- ip=addr, mask=network_mask_bits, nic=nic)
- 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 e3b27d0..91b863c 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -286,9 +286,10 @@
% CONF.network.build_timeout)
num, new_nic = self.diff_list[0]
- 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.exec_command("sudo ip addr add %s/%s dev %s" % (
+ new_port['fixed_ips'][0]['ip_address'],
+ CONF.network.project_network_mask_bits,
+ new_nic))
ssh_client.exec_command("sudo ip link set %s up" % new_nic)
def _get_server_nics(self, ssh_client):
diff --git a/tempest/tests/common/utils/linux/test_remote_client.py b/tempest/tests/common/utils/linux/test_remote_client.py
index 7af719c..ecb8e64 100644
--- a/tempest/tests/common/utils/linux/test_remote_client.py
+++ b/tempest/tests/common/utils/linux/test_remote_client.py
@@ -139,14 +139,6 @@
self._assert_exec_called_with(
"ip addr | awk '/ether/ {print $2}'")
- def test_assign_static_ip(self):
- self.ssh_mock.mock.exec_command.return_value = ''
- ip = '10.0.0.2'
- nic = 'eth0'
- self.assertEqual(self.conn.assign_static_ip(nic, ip), '')
- self._assert_exec_called_with(
- "sudo ip addr add %s/%s dev %s" % (ip, '28', nic))
-
class TestRemoteClientWithServer(base.TestCase):