Add network_mask_bits argument to assign_static_ip()
assign_static_ip() is used in test_network_basic_ops only and it is
not necessary to have a config value of project_network_mask_bits in
RemoteClient.
This patch adds network_mask_bits argument to assign_static_ip() with
the same default value as the config, and it removes the configuration
dependency from RemoteClient()
This is a step for making remote_client stable interface(tempest.lib)
and we need to remove CONF dependency from such module as possible
before defining stable interface.
NOTE: openstack/congress only needs to follow this change.
Change-Id: I430424cc776cb12906c7890cf584797ebea1cd41
diff --git a/tempest/common/utils/linux/remote_client.py b/tempest/common/utils/linux/remote_client.py
index e0ebce4..1aa09e6 100644
--- a/tempest/common/utils/linux/remote_client.py
+++ b/tempest/common/utils/linux/remote_client.py
@@ -80,7 +80,6 @@
connect_timeout = CONF.validation.connect_timeout
self.log_console = CONF.compute_feature_enabled.console_output
self.ssh_shell_prologue = CONF.validation.ssh_shell_prologue
- self.project_network_mask_bits = CONF.network.project_network_mask_bits
self.ping_count = CONF.validation.ping_count
self.ping_size = CONF.validation.ping_size
@@ -171,11 +170,9 @@
cmd = "ip address"
return self.exec_command(cmd)
- def assign_static_ip(self, nic, addr):
+ def assign_static_ip(self, nic, addr, network_mask_bits=28):
cmd = "sudo ip addr add {ip}/{mask} dev {nic}".format(
- ip=addr, mask=self.project_network_mask_bits,
- nic=nic
- )
+ ip=addr, mask=network_mask_bits, nic=nic)
return self.exec_command(cmd)
def set_nic_state(self, nic, state="up"):
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index 7dacc4c..85d7e37 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -285,9 +285,9 @@
% 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'])
+ 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)
def _get_server_nics(self, ssh_client):