Merge "port test_services into nova v3 part2"
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index d9ede31..4d2bdbc 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -229,6 +229,7 @@
cls.servers_client = cls.os.servers_v3_client
cls.images_client = cls.os.image_client
+ cls.services_client = cls.os.services_v3_client
@classmethod
def create_image_from_server(cls, server_id, **kwargs):
@@ -288,3 +289,4 @@
cls.os_adm = os_adm
cls.severs_admin_client = cls.os_adm.servers_v3_client
+ cls.services_admin_client = cls.os_adm.services_v3_client
diff --git a/tempest/api/compute/v3/admin/__init__.py b/tempest/api/compute/v3/admin/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tempest/api/compute/v3/admin/__init__.py
diff --git a/tempest/api/compute/v3/admin/test_services.py b/tempest/api/compute/v3/admin/test_services.py
index 327d8b8..67f9947 100644
--- a/tempest/api/compute/v3/admin/test_services.py
+++ b/tempest/api/compute/v3/admin/test_services.py
@@ -21,7 +21,7 @@
from tempest.test import attr
-class ServicesAdminTestJSON(base.BaseV2ComputeAdminTest):
+class ServicesAdminV3TestJSON(base.BaseV3ComputeAdminTest):
"""
Tests Services API. List and Enable/Disable require admin privileges.
@@ -31,8 +31,8 @@
@classmethod
def setUpClass(cls):
- super(ServicesAdminTestJSON, cls).setUpClass()
- cls.client = cls.os_adm.services_client
+ super(ServicesAdminV3TestJSON, cls).setUpClass()
+ cls.client = cls.services_admin_client
cls.non_admin_client = cls.services_client
@attr(type='gate')
@@ -131,5 +131,5 @@
self.assertEqual('enabled', services[0]['status'])
-class ServicesAdminTestXML(ServicesAdminTestJSON):
+class ServicesAdminV3TestXML(ServicesAdminV3TestJSON):
_interface = 'xml'
diff --git a/tempest/clients.py b/tempest/clients.py
index 156df30..610a9aa 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -48,7 +48,11 @@
VolumesExtensionsClientJSON
from tempest.services.compute.v3.json.servers_client import \
ServersV3ClientJSON
+from tempest.services.compute.v3.json.services_client import \
+ ServicesV3ClientJSON
from tempest.services.compute.v3.xml.servers_client import ServersV3ClientXML
+from tempest.services.compute.v3.xml.services_client import \
+ ServicesV3ClientXML
from tempest.services.compute.xml.aggregates_client import AggregatesClientXML
from tempest.services.compute.xml.availability_zone_client import \
AvailabilityZoneClientXML
@@ -193,6 +197,7 @@
self.fixed_ips_client = FixedIPsClientXML(*client_args)
self.availability_zone_client = AvailabilityZoneClientXML(
*client_args)
+ self.services_v3_client = ServicesV3ClientXML(*client_args)
self.service_client = ServiceClientXML(*client_args)
self.aggregates_client = AggregatesClientXML(*client_args)
self.services_client = ServicesClientXML(*client_args)
@@ -232,6 +237,7 @@
self.fixed_ips_client = FixedIPsClientJSON(*client_args)
self.availability_zone_client = AvailabilityZoneClientJSON(
*client_args)
+ self.services_v3_client = ServicesV3ClientJSON(*client_args)
self.service_client = ServiceClientJSON(*client_args)
self.aggregates_client = AggregatesClientJSON(*client_args)
self.services_client = ServicesClientJSON(*client_args)
diff --git a/tempest/services/compute/v3/json/services_client.py b/tempest/services/compute/v3/json/services_client.py
index 4db7596..41564e5 100644
--- a/tempest/services/compute/v3/json/services_client.py
+++ b/tempest/services/compute/v3/json/services_client.py
@@ -22,12 +22,12 @@
from tempest.common.rest_client import RestClient
-class ServicesClientJSON(RestClient):
+class ServicesV3ClientJSON(RestClient):
def __init__(self, config, username, password, auth_url, tenant_name=None):
- super(ServicesClientJSON, self).__init__(config, username, password,
- auth_url, tenant_name)
- self.service = self.config.compute.catalog_type
+ super(ServicesV3ClientJSON, self).__init__(config, username, password,
+ auth_url, tenant_name)
+ self.service = self.config.compute.catalog_v3_type
def list_services(self, params=None):
url = 'os-services'
@@ -44,7 +44,12 @@
host_name: Name of host
binary: Service binary
"""
- post_body = json.dumps({'binary': binary, 'host': host_name})
+ post_body = json.dumps({
+ 'service': {
+ 'binary': binary,
+ 'host': host_name
+ }
+ })
resp, body = self.put('os-services/enable', post_body, self.headers)
body = json.loads(body)
return resp, body['service']
@@ -55,7 +60,12 @@
host_name: Name of host
binary: Service binary
"""
- post_body = json.dumps({'binary': binary, 'host': host_name})
+ post_body = json.dumps({
+ 'service': {
+ 'binary': binary,
+ 'host': host_name
+ }
+ })
resp, body = self.put('os-services/disable', post_body, self.headers)
body = json.loads(body)
return resp, body['service']
diff --git a/tempest/services/compute/v3/xml/services_client.py b/tempest/services/compute/v3/xml/services_client.py
index ac304e2..855641b 100644
--- a/tempest/services/compute/v3/xml/services_client.py
+++ b/tempest/services/compute/v3/xml/services_client.py
@@ -25,12 +25,12 @@
from tempest.services.compute.xml.common import xml_to_json
-class ServicesClientXML(RestClientXML):
+class ServicesV3ClientXML(RestClientXML):
def __init__(self, config, username, password, auth_url, tenant_name=None):
- super(ServicesClientXML, self).__init__(config, username, password,
- auth_url, tenant_name)
- self.service = self.config.compute.catalog_type
+ super(ServicesV3ClientXML, self).__init__(config, username, password,
+ auth_url, tenant_name)
+ self.service = self.config.compute.catalog_v3_type
def list_services(self, params=None):
url = 'os-services'