Add dhcp_client argument to renew_lease()
renew_lease() is used in test_network_basic_ops only and it is not
necessary to have a config value of dhcp_client in RemoteClient.
This patch adds dhcp_client argument to renew_lease() with the same
default value as the config.
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/vmware-nsx only needs to follow this change.
Change-Id: I55f7cfb004169369ca63d1a691811eaed3155414
diff --git a/tempest/common/utils/linux/remote_client.py b/tempest/common/utils/linux/remote_client.py
index ba81f8a..e0ebce4 100644
--- a/tempest/common/utils/linux/remote_client.py
+++ b/tempest/common/utils/linux/remote_client.py
@@ -81,7 +81,6 @@
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.dhcp_client = CONF.scenario.dhcp_client
self.ping_count = CONF.validation.ping_count
self.ping_size = CONF.validation.ping_size
@@ -214,7 +213,7 @@
cmd = "sudo /sbin/dhclient -r && sudo /sbin/dhclient"
self.exec_command(cmd)
- def renew_lease(self, fixed_ip=None):
+ def renew_lease(self, fixed_ip=None, dhcp_client='udhcpc'):
"""Wrapper method for renewing DHCP lease via given client
Supporting:
@@ -223,7 +222,6 @@
"""
# TODO(yfried): add support for dhcpcd
supported_clients = ['udhcpc', 'dhclient']
- dhcp_client = self.dhcp_client
if dhcp_client not in supported_clients:
raise tempest.lib.exceptions.InvalidConfiguration(
'%s DHCP client unsupported' % dhcp_client)
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index e6a2e9d..7dacc4c 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -596,7 +596,8 @@
# NOTE(amuller): we are renewing the lease as part of the retry
# because Neutron updates dnsmasq asynchronously after the
# subnet-update API call returns.
- ssh_client.renew_lease(fixed_ip=floating_ip['fixed_ip_address'])
+ ssh_client.renew_lease(fixed_ip=floating_ip['fixed_ip_address'],
+ dhcp_client=CONF.scenario.dhcp_client)
if ssh_client.get_dns_servers() != [alt_dns_server]:
LOG.debug("Failed to update DNS nameservers")
return False