Browse Source

Add the provider service client.

This patch adds the provider service client to the Octavia tempest plugin.

Change-Id: I8ad4f8d5ff5b28ea4c2f2e38d267c91d278c920f
Michael Johnson 3 months ago
parent
commit
08a0ef50bb

+ 4
- 0
octavia_tempest_plugin/clients.py View File

@@ -35,6 +35,8 @@ from octavia_tempest_plugin.services.load_balancer.v2 import (
35 35
     member_client)
36 36
 from octavia_tempest_plugin.services.load_balancer.v2 import (
37 37
     pool_client)
38
+from octavia_tempest_plugin.services.load_balancer.v2 import (
39
+    provider_client)
38 40
 
39 41
 CONF = config.CONF
40 42
 SERVICE_TYPE = 'load-balancer'
@@ -65,3 +67,5 @@ class ManagerV2(clients.Manager):
65 67
             self.auth_provider, SERVICE_TYPE, CONF.identity.region)
66 68
         self.flavor_client = flavor_client.FlavorClient(
67 69
             self.auth_provider, SERVICE_TYPE, CONF.identity.region)
70
+        self.provider_client = provider_client.ProviderClient(
71
+            self.auth_provider, SERVICE_TYPE, CONF.identity.region)

+ 61
- 0
octavia_tempest_plugin/services/load_balancer/v2/provider_client.py View File

@@ -0,0 +1,61 @@
1
+#   Copyright 2019 Rackspace US Inc.  All rights reserved.
2
+#
3
+#   Licensed under the Apache License, Version 2.0 (the "License"); you may
4
+#   not use this file except in compliance with the License. You may obtain
5
+#   a copy of the License at
6
+#
7
+#        http://www.apache.org/licenses/LICENSE-2.0
8
+#
9
+#   Unless required by applicable law or agreed to in writing, software
10
+#   distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
+#   WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
+#   License for the specific language governing permissions and limitations
13
+#   under the License.
14
+#
15
+
16
+from octavia_tempest_plugin.services.load_balancer.v2 import base_client
17
+
18
+Unset = base_client.Unset
19
+
20
+
21
+class ProviderClient(base_client.BaseLBaaSClient):
22
+
23
+    list_root_tag = 'providers'
24
+
25
+    def list_providers(self, query_params=None, return_object_only=True):
26
+        """Get a list of provider objects.
27
+
28
+        :param query_params: The optional query parameters to append to the
29
+                             request. Ex. fields=id&fields=name
30
+        :param return_object_only: If True, the response returns the object
31
+                                   inside the root tag. False returns the full
32
+                                   response from the API.
33
+        :raises AssertionError: if the expected_code isn't a valid http success
34
+                                response code
35
+        :raises BadRequest: If a 400 response code is received
36
+        :raises Conflict: If a 409 response code is received
37
+        :raises Forbidden: If a 403 response code is received
38
+        :raises Gone: If a 410 response code is received
39
+        :raises InvalidContentType: If a 415 response code is received
40
+        :raises InvalidHTTPResponseBody: The response body wasn't valid JSON
41
+        :raises InvalidHttpSuccessCode: if the read code isn't an expected
42
+                                        http success code
43
+        :raises NotFound: If a 404 response code is received
44
+        :raises NotImplemented: If a 501 response code is received
45
+        :raises OverLimit: If a 413 response code is received and over_limit is
46
+                           not in the response body
47
+        :raises RateLimitExceeded: If a 413 response code is received and
48
+                                   over_limit is in the response body
49
+        :raises ServerFault: If a 500 response code is received
50
+        :raises Unauthorized: If a 401 response code is received
51
+        :raises UnexpectedContentType: If the content-type of the response
52
+                                       isn't an expect type
53
+        :raises UnexpectedResponseCode: If a response code above 400 is
54
+                                        received and it doesn't fall into any
55
+                                        of the handled checks
56
+        :raises UnprocessableEntity: If a 422 response code is received and
57
+                                     couldn't be parsed
58
+        :returns: A list of provider objects.
59
+        """
60
+        return self._list_objects(query_params=query_params,
61
+                                  return_object_only=return_object_only)

Loading…
Cancel
Save