Merge "Use UPPER_CONSTRAINTS_FILE for stable/wallaby testing"
diff --git a/tempest/cmd/cleanup.py b/tempest/cmd/cleanup.py
index 0b96d9e..a8a344a 100644
--- a/tempest/cmd/cleanup.py
+++ b/tempest/cmd/cleanup.py
@@ -90,7 +90,6 @@
from tempest import clients
from tempest.cmd import cleanup_service
from tempest.common import credentials_factory as credentials
-from tempest.common import identity
from tempest import config
from tempest.lib import exceptions
@@ -140,11 +139,6 @@
self.dry_run_data = {}
self.json_data = {}
- self.admin_id = ""
- self.admin_role_id = ""
- self.admin_project_id = ""
- self._init_admin_ids()
-
# available services
self.project_associated_services = (
cleanup_service.get_project_associated_cleanup_services())
@@ -227,26 +221,6 @@
svc = service(self.admin_mgr, **kwargs)
svc.run()
- def _init_admin_ids(self):
- pr_cl = self.admin_mgr.projects_client
- rl_cl = self.admin_mgr.roles_v3_client
- rla_cl = self.admin_mgr.role_assignments_client
- us_cl = self.admin_mgr.users_v3_client
-
- project = identity.get_project_by_name(pr_cl,
- CONF.auth.admin_project_name)
- self.admin_project_id = project['id']
- user = identity.get_user_by_project(us_cl, rla_cl,
- self.admin_project_id,
- CONF.auth.admin_username)
- self.admin_id = user['id']
-
- roles = rl_cl.list_roles()['roles']
- for role in roles:
- if role['name'] == CONF.identity.admin_role:
- self.admin_role_id = role['id']
- break
-
def get_parser(self, prog_name):
parser = super(TempestCleanup, self).get_parser(prog_name)
parser.add_argument('--init-saved-state', action="store_true",
diff --git a/tempest/common/utils/linux/remote_client.py b/tempest/common/utils/linux/remote_client.py
index 7c55115..4fdf6a4 100644
--- a/tempest/common/utils/linux/remote_client.py
+++ b/tempest/common/utils/linux/remote_client.py
@@ -109,6 +109,15 @@
LOG.debug('(get_nic_name_by_ip) Command result: %s', nic)
return nic.strip().strip(":").split('@')[0].lower()
+ def get_nic_ip_addresses(self, nic_name, ip_version=None):
+ cmd = "ip "
+ if ip_version:
+ cmd += "-%s " % ip_version
+ cmd += "-o addr | awk '/%s/ {print $4}'" % nic_name
+ ip_addresses = self.exec_command(cmd)
+ LOG.debug('(get_nic_ip_address): Command result: %s', ip_addresses)
+ return ip_addresses.strip().split()
+
def _get_dns_servers(self):
cmd = 'cat /etc/resolv.conf'
resolve_file = self.exec_command(cmd).strip().split('\n')
diff --git a/tempest/config.py b/tempest/config.py
index f1eb647..00b394e 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -1200,7 +1200,6 @@
help='Image container format'),
cfg.DictOpt('img_properties', help='Glance image properties. '
'Use for custom images which require them'),
- # TODO(yfried): add support for dhcpcd
cfg.StrOpt('dhcp_client',
default='udhcpc',
choices=["udhcpc", "dhclient", "dhcpcd", ""],
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index cbe8c20..cbe4122 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -897,10 +897,17 @@
self.check_remote_connectivity(ssh_client, dest=peer_address,
nic=spoof_nic, should_succeed=True)
# Set a mac address by making nic down temporary
+ spoof_ip_addresses = ssh_client.get_nic_ip_addresses(spoof_nic)
cmd = ("sudo ip link set {nic} down;"
"sudo ip link set dev {nic} address {mac};"
- "sudo ip link set {nic} up").format(nic=spoof_nic,
- mac=spoof_mac)
+ "sudo ip link set {nic} up;"
+ "sudo ip address flush dev {nic};").format(nic=spoof_nic,
+ mac=spoof_mac)
+ for ip_address in spoof_ip_addresses:
+ cmd += (
+ "sudo ip addr add {ip_address} dev {nic};"
+ ).format(ip_address=ip_address, nic=spoof_nic)
+
ssh_client.exec_command(cmd)
new_mac = ssh_client.get_mac_address(nic=spoof_nic)