Merge "Run static account tests based on tempest-full-py3"
diff --git a/.zuul.yaml b/.zuul.yaml
index e3e0bbc..1e052bd 100644
--- a/.zuul.yaml
+++ b/.zuul.yaml
@@ -143,6 +143,25 @@
Base integration test with Neutron networking and py36.
voting: false
+- nodeset:
+ name: openstack-opensuse150-node
+ nodes:
+ - name: controller
+ label: opensuse-150
+ groups:
+ - name: tempest
+ nodes:
+ - controller
+
+- job:
+ name: tempest-full-py3-opensuse150
+ parent: tempest-full-py3
+ nodeset: openstack-opensuse150-node
+ description: |
+ Base integration test with Neutron networking and py36 running
+ on openSUSE Leap 15.0
+ voting: false
+
- job:
name: tempest-slow
parent: tempest-multinode-full
@@ -430,7 +449,7 @@
irrelevant-files: *tempest-irrelevant-files
- legacy-tempest-dsvm-neutron-pg-full:
irrelevant-files: *tempest-irrelevant-files
- - legacy-tempest-dsvm-neutron-full-opensuse-423:
+ - tempest-full-py3-opensuse150:
irrelevant-files: *tempest-irrelevant-files
periodic-stable:
jobs:
diff --git a/releasenotes/notes/agents-client-delete-method-de1a7fb3f845999c.yaml b/releasenotes/notes/agents-client-delete-method-de1a7fb3f845999c.yaml
new file mode 100644
index 0000000..21068ec
--- /dev/null
+++ b/releasenotes/notes/agents-client-delete-method-de1a7fb3f845999c.yaml
@@ -0,0 +1,7 @@
+---
+features:
+ - |
+ Adds the new method to AgentsClient that implements agent deletion
+ according to the API [0].
+ [0] https://developer.openstack.org/api-ref/network/v2/index.html#delete-agent
+
diff --git a/tempest/api/network/admin/test_agent_management.py b/tempest/api/network/admin/test_agent_management.py
index 5068fc4..30ed176 100644
--- a/tempest/api/network/admin/test_agent_management.py
+++ b/tempest/api/network/admin/test_agent_management.py
@@ -15,7 +15,9 @@
from tempest.api.network import base
from tempest.common import tempest_fixtures as fixtures
from tempest.common import utils
+from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
+from tempest.lib import exceptions as lib_exc
class AgentManagementTestJSON(base.BaseAdminNetworkTest):
@@ -86,3 +88,11 @@
origin_agent = {'description': description}
self.admin_agents_client.update_agent(agent_id=self.agent['id'],
agent=origin_agent)
+
+ @decorators.idempotent_id('b33af888-b6ac-4e68-a0ca-0444c2696cf9')
+ @decorators.attr(type=['negative'])
+ def test_delete_agent_negative(self):
+ non_existent_id = data_utils.rand_uuid()
+ self.assertRaises(
+ lib_exc.NotFound,
+ self.agents_client.delete_agent, non_existent_id)
diff --git a/tempest/api/network/test_routers.py b/tempest/api/network/test_routers.py
index 8b03631..be3cf65 100644
--- a/tempest/api/network/test_routers.py
+++ b/tempest/api/network/test_routers.py
@@ -27,22 +27,6 @@
class RoutersTest(base.BaseNetworkTest):
- def _cleanup_router(self, router):
- self.delete_router(router)
-
- def _create_router(self, name=None, admin_state_up=False,
- external_network_id=None, enable_snat=None):
- # associate a cleanup with created routers to avoid quota limits
- router = self.create_router(name, admin_state_up,
- external_network_id, enable_snat)
- self.addCleanup(self._cleanup_router, router)
- return router
-
- def _create_subnet(self, network, gateway='', cidr=None):
- subnet = self.create_subnet(network, gateway, cidr)
- self.addCleanup(self.subnets_client.delete_subnet, subnet['id'])
- return subnet
-
def _add_router_interface_with_subnet_id(self, router_id, subnet_id):
interface = self.routers_client.add_router_interface(
router_id, subnet_id=subnet_id)
@@ -70,10 +54,11 @@
def test_create_show_list_update_delete_router(self):
# Create a router
router_name = data_utils.rand_name(self.__class__.__name__ + '-router')
- router = self._create_router(
- name=router_name,
+ router = self.create_router(
+ router_name,
admin_state_up=False,
external_network_id=CONF.network.public_network_id)
+ self.addCleanup(self.delete_router, router)
self.assertEqual(router['name'], router_name)
self.assertEqual(router['admin_state_up'], False)
self.assertEqual(
@@ -106,8 +91,10 @@
name=network_name)['network']
self.addCleanup(self.networks_client.delete_network,
network['id'])
- subnet = self._create_subnet(network)
- router = self._create_router()
+ subnet = self.create_subnet(network)
+ self.addCleanup(self.subnets_client.delete_subnet, subnet['id'])
+ router = self.create_router()
+ self.addCleanup(self.delete_router, router)
# Add router interface with subnet id
interface = self.routers_client.add_router_interface(
router['id'], subnet_id=subnet['id'])
@@ -129,8 +116,10 @@
name=network_name)['network']
self.addCleanup(self.networks_client.delete_network,
network['id'])
- self._create_subnet(network)
- router = self._create_router()
+ subnet = self.create_subnet(network)
+ self.addCleanup(self.subnets_client.delete_subnet, subnet['id'])
+ router = self.create_router()
+ self.addCleanup(self.delete_router, router)
port_body = self.ports_client.create_port(
network_id=network['id'])
# add router interface to port created above
@@ -188,7 +177,8 @@
test_routes = []
routes_num = 4
# Create a router
- router = self._create_router(admin_state_up=True)
+ router = self.create_router(admin_state_up=True)
+ self.addCleanup(self.delete_router, router)
self.addCleanup(
self._delete_extra_routes,
router['id'])
@@ -201,6 +191,7 @@
self.addCleanup(self.networks_client.delete_network,
network['id'])
subnet = self.create_subnet(network, cidr=next_cidr)
+ self.addCleanup(self.subnets_client.delete_subnet, subnet['id'])
next_cidr = next_cidr.next()
# Add router interface with subnet id
@@ -247,7 +238,8 @@
@decorators.idempotent_id('a8902683-c788-4246-95c7-ad9c6d63a4d9')
def test_update_router_admin_state(self):
- router = self._create_router()
+ router = self.create_router()
+ self.addCleanup(self.delete_router, router)
self.assertFalse(router['admin_state_up'])
# Update router admin state
update_body = self.routers_client.update_router(router['id'],
@@ -264,14 +256,18 @@
name=network_name)['network']
self.addCleanup(self.networks_client.delete_network,
network01['id'])
+ network_name = data_utils.rand_name(self.__class__.__name__)
network02 = self.networks_client.create_network(
- name=data_utils.rand_name(self.__class__.__name__))['network']
+ name=network_name)['network']
self.addCleanup(self.networks_client.delete_network,
network02['id'])
- subnet01 = self._create_subnet(network01)
+ subnet01 = self.create_subnet(network01)
+ self.addCleanup(self.subnets_client.delete_subnet, subnet01['id'])
sub02_cidr = self.cidr.next()
- subnet02 = self._create_subnet(network02, cidr=sub02_cidr)
- router = self._create_router()
+ subnet02 = self.create_subnet(network02, cidr=sub02_cidr)
+ self.addCleanup(self.subnets_client.delete_subnet, subnet02['id'])
+ router = self.create_router()
+ self.addCleanup(self.delete_router, router)
interface01 = self._add_router_interface_with_subnet_id(router['id'],
subnet01['id'])
self._verify_router_interface(router['id'], subnet01['id'],
@@ -288,8 +284,10 @@
name=network_name)['network']
self.addCleanup(self.networks_client.delete_network,
network['id'])
- subnet = self._create_subnet(network)
- router = self._create_router()
+ subnet = self.create_subnet(network)
+ self.addCleanup(self.subnets_client.delete_subnet, subnet['id'])
+ router = self.create_router()
+ self.addCleanup(self.delete_router, router)
fixed_ip = [{'subnet_id': subnet['id']}]
interface = self._add_router_interface_with_subnet_id(router['id'],
subnet['id'])
diff --git a/tempest/lib/services/network/agents_client.py b/tempest/lib/services/network/agents_client.py
index 5068121..9fa4672 100644
--- a/tempest/lib/services/network/agents_client.py
+++ b/tempest/lib/services/network/agents_client.py
@@ -37,6 +37,16 @@
uri = '/agents/%s' % agent_id
return self.show_resource(uri, **fields)
+ def delete_agent(self, agent_id):
+ """Delete agent.
+
+ For a full list of available parameters, please refer to the official
+ API reference:
+ https://developer.openstack.org/api-ref/network/v2/index.html#delete-agent
+ """
+ uri = '/agents/%s' % agent_id
+ return self.delete_resource(uri)
+
def list_agents(self, **filters):
"""List all agents.
diff --git a/tempest/tests/lib/services/network/test_agents_client.py b/tempest/tests/lib/services/network/test_agents_client.py
new file mode 100644
index 0000000..aabc6ce
--- /dev/null
+++ b/tempest/tests/lib/services/network/test_agents_client.py
@@ -0,0 +1,37 @@
+# Copyright 2018 AT&T Corporation.
+# All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest.lib.services.network import agents_client
+from tempest.tests.lib import fake_auth_provider
+from tempest.tests.lib.services import base
+
+
+class TestAgentsClient(base.BaseServiceTest):
+
+ FAKE_AGENT_ID = "d32019d3-bc6e-4319-9c1d-6123f4135a88"
+
+ def setUp(self):
+ super(TestAgentsClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.agents_client = agents_client.AgentsClient(
+ fake_auth, "network", "regionOne")
+
+ def test_delete_agent(self):
+ self.check_service_client_function(
+ self.agents_client.delete_agent,
+ "tempest.lib.common.rest_client.RestClient.delete",
+ {},
+ status=204,
+ agent_id=self.FAKE_AGENT_ID)