summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSoniya Vyas <svyas@redhat.com>2021-07-09 12:30:36 +0530
committerSoniya Vyas <svyas@redhat.com>2021-08-16 17:57:40 +0530
commit5a3de3e4984336ada58b231cbb752d40e7966364 (patch)
treeb5307af569e1e87c2434b16f0620fd676a05c2a5
parenta45828bf92c991cbcd8749ebd7f839e0cb66cbd4 (diff)
downloadtempest-5a3de3e4984336ada58b231cbb752d40e7966364.tar.gz
Add loggable resource client
This patch creates the network v2.0 loggable-resource client. https://docs.openstack.org/api-ref/network/v2/index.html#list-loggable-resources Signed-off by: Soniya Vyas<svyas@redhat.com> Change-Id: I37b9397834fbb7f4ebf540dc5f8aece356ddf749
-rw-r--r--releasenotes/notes/loggable-resource-client-5977d46a7ea52199.yaml5
-rw-r--r--tempest/api/network/base.py1
-rw-r--r--tempest/clients.py1
-rw-r--r--tempest/lib/services/network/__init__.py5
-rw-r--r--tempest/lib/services/network/loggable_resource_client.py29
-rw-r--r--tempest/tests/lib/services/network/test_loggable_resource_client.py53
6 files changed, 93 insertions, 1 deletions
diff --git a/releasenotes/notes/loggable-resource-client-5977d46a7ea52199.yaml b/releasenotes/notes/loggable-resource-client-5977d46a7ea52199.yaml
new file mode 100644
index 000000000..ac83eaf67
--- /dev/null
+++ b/releasenotes/notes/loggable-resource-client-5977d46a7ea52199.yaml
@@ -0,0 +1,5 @@
+---
+features:
+ - |
+ Lists neutron's Loggable resources API service clients are available in
+ ``tempest/lib/services/network/loggable_resource_client.py`` module. \ No newline at end of file
diff --git a/tempest/api/network/base.py b/tempest/api/network/base.py
index 260ba7404..47a859077 100644
--- a/tempest/api/network/base.py
+++ b/tempest/api/network/base.py
@@ -85,6 +85,7 @@ class BaseNetworkTest(tempest.test.BaseTestCase):
cls.service_providers_client = cls.os_primary.service_providers_client
cls.tags_client = cls.os_primary.tags_client
cls.log_resource_client = cls.os_primary.log_resource_client
+ cls.loggable_resource_client = cls.os_primary.loggable_resource_client
@classmethod
def resource_setup(cls):
diff --git a/tempest/clients.py b/tempest/clients.py
index ebf254044..bf98e0373 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -74,6 +74,7 @@ class Manager(clients.ServiceClients):
self.segments_client = self.network.SegmentsClient()
self.trunks_client = self.network.TrunksClient()
self.log_resource_client = self.network.LogResourceClient()
+ self.loggable_resource_client = self.network.LoggableResourceClient()
def _set_image_clients(self):
if CONF.service_available.glance:
diff --git a/tempest/lib/services/network/__init__.py b/tempest/lib/services/network/__init__.py
index fc85140d1..d55337386 100644
--- a/tempest/lib/services/network/__init__.py
+++ b/tempest/lib/services/network/__init__.py
@@ -16,6 +16,8 @@ from tempest.lib.services.network.agents_client import AgentsClient
from tempest.lib.services.network.extensions_client import ExtensionsClient
from tempest.lib.services.network.floating_ips_client import FloatingIPsClient
from tempest.lib.services.network.log_resource_client import LogResourceClient
+from tempest.lib.services.network.loggable_resource_client import \
+ LoggableResourceClient
from tempest.lib.services.network.metering_label_rules_client import \
MeteringLabelRulesClient
from tempest.lib.services.network.metering_labels_client import \
@@ -46,4 +48,5 @@ __all__ = ['AgentsClient', 'ExtensionsClient', 'FloatingIPsClient',
'QosClient', 'QosMinimumBandwidthRulesClient', 'QuotasClient',
'RoutersClient', 'SecurityGroupRulesClient', 'SecurityGroupsClient',
'SegmentsClient', 'ServiceProvidersClient', 'SubnetpoolsClient',
- 'SubnetsClient', 'TagsClient', 'TrunksClient', 'LogResourceClient']
+ 'SubnetsClient', 'TagsClient', 'TrunksClient', 'LogResourceClient',
+ 'LoggableResourceClient']
diff --git a/tempest/lib/services/network/loggable_resource_client.py b/tempest/lib/services/network/loggable_resource_client.py
new file mode 100644
index 000000000..774046fe4
--- /dev/null
+++ b/tempest/lib/services/network/loggable_resource_client.py
@@ -0,0 +1,29 @@
+# Copyright 2021 Red Hat, Inc.
+# 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 base
+
+
+class LoggableResourceClient(base.BaseNetworkClient):
+
+ def list_loggable_resources(self, **filters):
+ """List Loggable resources.
+
+ For a full list of available parameters, please refer to the official
+ API reference:
+ https://docs.openstack.org/api-ref/network/v2/index.html#list-loggable-resources
+ """
+ uri = '/log/loggable-resources'
+ return self.list_resources(uri, **filters)
diff --git a/tempest/tests/lib/services/network/test_loggable_resource_client.py b/tempest/tests/lib/services/network/test_loggable_resource_client.py
new file mode 100644
index 000000000..232775b61
--- /dev/null
+++ b/tempest/tests/lib/services/network/test_loggable_resource_client.py
@@ -0,0 +1,53 @@
+# Copyright 2021 Red Hat, Inc.
+# 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 loggable_resource_client
+from tempest.tests.lib import fake_auth_provider
+from tempest.tests.lib.services import base
+
+
+class TestLoggableResourceClient(base.BaseServiceTest):
+
+ FAKE_LOGS = {
+ "loggable_resources": [
+ {
+ "type": "security_group"
+ },
+ {
+ "type": "none"
+ }
+ ]
+ }
+
+ def setUp(self):
+ super(TestLoggableResourceClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.loggable_resource_client = \
+ loggable_resource_client.LoggableResourceClient(
+ fake_auth, "network", "regionOne")
+
+ def _test_list_loggable_resources(self, bytes_body=False):
+ self.check_service_client_function(
+ self.loggable_resource_client.list_loggable_resources,
+ "tempest.lib.common.rest_client.RestClient.get",
+ self.FAKE_LOGS,
+ bytes_body,
+ 200)
+
+ def test_list_loggable_resources_with_str_body(self):
+ self._test_list_loggable_resources()
+
+ def test_list_loggable_resources_with_bytes_body(self):
+ self._test_list_loggable_resources(bytes_body=True)