Merge "Remove the ec2 api tests from tempest"
diff --git a/tempest/api/image/base.py b/tempest/api/image/base.py
index da0ce83..c3205ce 100644
--- a/tempest/api/image/base.py
+++ b/tempest/api/image/base.py
@@ -70,8 +70,10 @@
container_format = kwargs.pop('container_format')
disk_format = kwargs.pop('disk_format')
- image = cls.client.create_image(name, container_format,
- disk_format, **kwargs)
+ image = cls.client.create_image(name=name,
+ container_format=container_format,
+ disk_format=disk_format,
+ **kwargs)
# Image objects returned by the v1 client have the image
# data inside a dict that is keyed against 'image'.
if 'image' in image:
@@ -156,7 +158,7 @@
def _create_image(self):
name = data_utils.rand_name('image')
- image = self.os_img_client.create_image(name,
+ image = self.os_img_client.create_image(name=name,
container_format='bare',
disk_format='raw')
image_id = image['id']
diff --git a/tempest/api/image/v2/test_images_negative.py b/tempest/api/image/v2/test_images_negative.py
index 71c8c7a..485942e 100644
--- a/tempest/api/image/v2/test_images_negative.py
+++ b/tempest/api/image/v2/test_images_negative.py
@@ -90,10 +90,12 @@
def test_register_with_invalid_container_format(self):
# Negative tests for invalid data supplied to POST /images
self.assertRaises(lib_exc.BadRequest, self.client.create_image,
- 'test', 'wrong', 'vhd')
+ name='test', container_format='wrong',
+ disk_format='vhd')
@test.attr(type=['negative'])
@test.idempotent_id('70c6040c-5a97-4111-9e13-e73665264ce1')
def test_register_with_invalid_disk_format(self):
self.assertRaises(lib_exc.BadRequest, self.client.create_image,
- 'test', 'bare', 'wrong')
+ name='test', container_format='bare',
+ disk_format='wrong')
diff --git a/tempest/api/network/admin/test_agent_management.py b/tempest/api/network/admin/test_agent_management.py
index c5d0d57..64802aa 100644
--- a/tempest/api/network/admin/test_agent_management.py
+++ b/tempest/api/network/admin/test_agent_management.py
@@ -63,7 +63,7 @@
# one to avoid the negative effect.
agent_status = {'admin_state_up': origin_status}
body = self.admin_client.update_agent(agent_id=self.agent['id'],
- agent_info=agent_status)
+ agent=agent_status)
updated_status = body['agent']['admin_state_up']
self.assertEqual(origin_status, updated_status)
@@ -73,7 +73,7 @@
description = 'description for update agent.'
agent_description = {'description': description}
body = self.admin_client.update_agent(agent_id=self.agent['id'],
- agent_info=agent_description)
+ agent=agent_description)
self.addCleanup(self._restore_agent)
updated_description = body['agent']['description']
self.assertEqual(updated_description, description)
@@ -84,4 +84,4 @@
description = self.agent['description'] or ''
origin_agent = {'description': description}
self.admin_client.update_agent(agent_id=self.agent['id'],
- agent_info=origin_agent)
+ agent=origin_agent)
diff --git a/tempest/api/network/test_routers.py b/tempest/api/network/test_routers.py
index ed191b6..406ad44 100644
--- a/tempest/api/network/test_routers.py
+++ b/tempest/api/network/test_routers.py
@@ -301,7 +301,7 @@
test_routes.sort(key=lambda x: x['destination'])
extra_route = self.client.update_extra_routes(router['id'],
- test_routes)
+ routes=test_routes)
show_body = self.client.show_router(router['id'])
# Assert the number of routes
self.assertEqual(routes_num, len(extra_route['router']['routes']))
diff --git a/tempest/api/telemetry/base.py b/tempest/api/telemetry/base.py
index bbd01f0..8b617ac 100644
--- a/tempest/api/telemetry/base.py
+++ b/tempest/api/telemetry/base.py
@@ -77,7 +77,7 @@
@classmethod
def create_image(cls, client):
body = client.create_image(
- data_utils.rand_name('image'), container_format='bare',
+ name=data_utils.rand_name('image'), container_format='bare',
disk_format='raw', visibility='private')
# TODO(jswarren) Move ['image'] up to initial body value assignment
# once both v1 and v2 glance clients include the full response
diff --git a/tempest/cmd/account_generator.py b/tempest/cmd/account_generator.py
index 297a066..b90ee04 100755
--- a/tempest/cmd/account_generator.py
+++ b/tempest/cmd/account_generator.py
@@ -357,7 +357,7 @@
resources['users'].append({
'tenant': tenant,
'name': user,
- 'pass': data_utils.rand_name(),
+ 'pass': data_utils.rand_password(),
'prefix': user_group['prefix'],
'roles': user_group['roles']
})
diff --git a/tempest/common/utils/linux/remote_client.py b/tempest/common/utils/linux/remote_client.py
index 6150b4d..b76c356 100644
--- a/tempest/common/utils/linux/remote_client.py
+++ b/tempest/common/utils/linux/remote_client.py
@@ -73,7 +73,7 @@
return output.split()[1]
def get_number_of_vcpus(self):
- output = self.exec_command('grep -c processor /proc/cpuinfo')
+ output = self.exec_command('grep -c ^processor /proc/cpuinfo')
return int(output)
def get_partitions(self):
diff --git a/tempest/config.py b/tempest/config.py
index b2f0baf..b847c06 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -17,9 +17,10 @@
import logging as std_logging
import os
+import tempfile
+from oslo_concurrency import lockutils
from oslo_config import cfg
-
from oslo_log import log as logging
from tempest.test_discover import plugins
@@ -1397,6 +1398,8 @@
def __getattr__(self, attr):
if not self._config:
self._fix_log_levels()
+ lock_dir = os.path.join(tempfile.gettempdir(), 'tempest-lock')
+ lockutils.set_defaults(lock_dir)
self._config = TempestConfigPrivate(config_path=self._path)
return getattr(self._config, attr)
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index a304081..44942b0 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -744,15 +744,23 @@
def test_port_security_macspoofing_port(self):
"""Tests port_security extension enforces mac spoofing
- 1. create a new network
- 2. connect VM to new network
- 4. check VM can ping new network DHCP port
- 5. spoof mac on new new network interface
- 6. check Neutron enforces mac spoofing and blocks pings via spoofed
- interface
- 7. disable port-security on the spoofed port
- 8. check Neutron allows pings via spoofed interface
+ Neutron security groups always apply anti-spoof rules on the VMs. This
+ allows traffic to originate and terminate at the VM as expected, but
+ prevents traffic to pass through the VM. Anti-spoof rules are not
+ required in cases where the VM routes traffic through it.
+
+ The test steps are :
+ 1. Create a new network.
+ 2. Connect (hotplug) the VM to a new network.
+ 3. Check the VM can ping the DHCP interface of this network.
+ 4. Spoof the mac address of the new VM interface.
+ 5. Check the Security Group enforces mac spoofing and blocks pings via
+ spoofed interface (VM cannot ping the DHCP interface).
+ 6. Disable port-security of the spoofed port- set the flag to false.
+ 7. Retest 3rd step and check that the Security Group allows pings via
+ the spoofed interface.
"""
+
spoof_mac = "00:00:00:00:00:01"
# Create server
diff --git a/tempest/services/image/v2/json/images_client.py b/tempest/services/image/v2/json/images_client.py
index 44062ea..72b203a 100644
--- a/tempest/services/image/v2/json/images_client.py
+++ b/tempest/services/image/v2/json/images_client.py
@@ -55,6 +55,11 @@
return self._http
def update_image(self, image_id, patch):
+ """Update an image.
+
+ Available params: see http://developer.openstack.org/
+ api-ref-image-v2.html#updateImage-v2
+ """
data = json.dumps(patch)
headers = {"Content-Type": "application/openstack-images-v2.0"
"-json-patch"}
@@ -63,21 +68,13 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def create_image(self, name, container_format, disk_format, **kwargs):
- params = {
- "name": name,
- "container_format": container_format,
- "disk_format": disk_format,
- }
+ def create_image(self, **kwargs):
+ """Create an image.
- for option in kwargs:
- value = kwargs.get(option)
- if isinstance(value, dict) or isinstance(value, tuple):
- params.update(value)
- else:
- params[option] = value
-
- data = json.dumps(params)
+ Available params: see http://developer.openstack.org/
+ api-ref-image-v2.html#createImage-v2
+ """
+ data = json.dumps(kwargs)
resp, body = self.post('v2/images', data)
self.expected_success(201, resp.status)
body = json.loads(body)
diff --git a/tempest/services/network/json/network_client.py b/tempest/services/network/json/network_client.py
index 459891f..6e3b0fe 100644
--- a/tempest/services/network/json/network_client.py
+++ b/tempest/services/network/json/network_client.py
@@ -240,15 +240,18 @@
uri = '/ports?device_id=%s' % uuid
return self.list_resources(uri)
- def update_agent(self, agent_id, agent_info):
+ def update_agent(self, agent_id, **kwargs):
"""Update agent
:param agent_info: Agent update information.
E.g {"admin_state_up": True}
"""
+ # TODO(piyush): Current api-site doesn't contain this API description.
+ # After fixing the api-site, we need to fix here also for putting the
+ # link to api-site.
+ # LP: https://bugs.launchpad.net/openstack-api-site/+bug/1526673
uri = '/agents/%s' % agent_id
- agent = {"agent": agent_info}
- return self.update_resource(uri, agent)
+ return self.update_resource(uri, kwargs)
def show_agent(self, agent_id, **fields):
uri = '/agents/%s' % agent_id
@@ -270,6 +273,7 @@
# TODO(piyush): Current api-site doesn't contain this API description.
# After fixing the api-site, we need to fix here also for putting the
# link to api-site.
+ # LP: https://bugs.launchpad.net/openstack-api-site/+bug/1526670
uri = '/agents/%s/l3-routers' % agent_id
return self.create_resource(uri, kwargs)
@@ -290,13 +294,14 @@
network_id)
return self.delete_resource(uri)
- def update_extra_routes(self, router_id, routes):
+ def update_extra_routes(self, router_id, **kwargs):
+ """Update Extra routes.
+
+ Available params: see http://developer.openstack.org/
+ api-ref-networking-v2-ext.html#updateExtraRoutes
+ """
uri = '/routers/%s' % router_id
- put_body = {
- 'router': {
- 'routes': routes
- }
- }
+ put_body = {'router': kwargs}
return self.update_resource(uri, put_body)
def delete_extra_routes(self, router_id):
diff --git a/tempest/tests/common/utils/linux/test_remote_client.py b/tempest/tests/common/utils/linux/test_remote_client.py
index 6b02d02..9c2b99e 100644
--- a/tempest/tests/common/utils/linux/test_remote_client.py
+++ b/tempest/tests/common/utils/linux/test_remote_client.py
@@ -79,7 +79,7 @@
def test_get_number_of_vcpus(self):
self.ssh_mock.mock.exec_command.return_value = '16'
self.assertEqual(self.conn.get_number_of_vcpus(), 16)
- self._assert_exec_called_with('grep -c processor /proc/cpuinfo')
+ self._assert_exec_called_with('grep -c ^processor /proc/cpuinfo')
def test_get_partitions(self):
proc_partitions = """major minor #blocks name