Merge "Removed RestClientXML class"

This commit is contained in:
Jenkins 2014-02-24 10:19:43 +00:00 committed by Gerrit Code Review
commit 173476fe7f
35 changed files with 109 additions and 87 deletions

View File

@ -502,24 +502,6 @@ class RestClient(object):
raise NotImplementedError(message)
class RestClientXML(RestClient):
# NOTE(vponomaryov): This is deprecated class
# and should be removed after excluding it
# from all service clients
TYPE = "xml"
def _parse_resp(self, body):
return xml_to_json(etree.fromstring(body))
def is_absolute_limit(self, resp, resp_body):
if (not isinstance(resp_body, collections.Mapping) or
'retry-after' not in resp):
return True
return 'exceed' in resp_body.get('message', 'blabla')
class NegativeRestClient(RestClient):
"""
Version of RestClient that does not raise exceptions.

View File

@ -15,7 +15,7 @@
from lxml import etree
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest import config
from tempest import exceptions
from tempest.services.compute.xml.common import Document
@ -26,7 +26,8 @@ from tempest.services.compute.xml.common import xml_to_json
CONF = config.CONF
class AggregatesClientXML(RestClientXML):
class AggregatesClientXML(rest_client.RestClient):
TYPE = "xml"
def __init__(self, auth_provider):
super(AggregatesClientXML, self).__init__(auth_provider)

View File

@ -15,14 +15,15 @@
from lxml import etree
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest import config
from tempest.services.compute.xml.common import xml_to_json
CONF = config.CONF
class AvailabilityZoneClientXML(RestClientXML):
class AvailabilityZoneClientXML(rest_client.RestClient):
TYPE = "xml"
def __init__(self, auth_provider):
super(AvailabilityZoneClientXML, self).__init__(

View File

@ -14,13 +14,14 @@
# under the License.
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest import config
CONF = config.CONF
class CertificatesClientXML(RestClientXML):
class CertificatesClientXML(rest_client.RestClient):
TYPE = "xml"
def __init__(self, auth_provider):
super(CertificatesClientXML, self).__init__(auth_provider)

View File

@ -15,14 +15,15 @@
from lxml import etree
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest import config
from tempest.services.compute.xml.common import xml_to_json
CONF = config.CONF
class ExtensionsClientXML(RestClientXML):
class ExtensionsClientXML(rest_client.RestClient):
TYPE = "xml"
def __init__(self, auth_provider):
super(ExtensionsClientXML, self).__init__(auth_provider)

View File

@ -14,7 +14,7 @@
# under the License.
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest import config
from tempest.services.compute.xml.common import Document
from tempest.services.compute.xml.common import Element
@ -23,7 +23,8 @@ from tempest.services.compute.xml.common import Text
CONF = config.CONF
class FixedIPsClientXML(RestClientXML):
class FixedIPsClientXML(rest_client.RestClient):
TYPE = "xml"
def __init__(self, auth_provider):
super(FixedIPsClientXML, self).__init__(auth_provider)

View File

@ -17,7 +17,7 @@ import urllib
from lxml import etree
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest import config
from tempest.services.compute.xml.common import Document
from tempest.services.compute.xml.common import Element
@ -33,7 +33,8 @@ XMLNS_OS_FLV_ACCESS = \
"http://docs.openstack.org/compute/ext/flavor_access/api/v2"
class FlavorsClientXML(RestClientXML):
class FlavorsClientXML(rest_client.RestClient):
TYPE = "xml"
def __init__(self, auth_provider):
super(FlavorsClientXML, self).__init__(auth_provider)

View File

@ -16,7 +16,7 @@
from lxml import etree
import urllib
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest import config
from tempest import exceptions
from tempest.services.compute.xml.common import Document
@ -27,7 +27,9 @@ from tempest.services.compute.xml.common import xml_to_json
CONF = config.CONF
class FloatingIPsClientXML(RestClientXML):
class FloatingIPsClientXML(rest_client.RestClient):
TYPE = "xml"
def __init__(self, auth_provider):
super(FloatingIPsClientXML, self).__init__(auth_provider)
self.service = CONF.compute.catalog_type

View File

@ -15,7 +15,7 @@
import urllib
from lxml import etree
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest import config
from tempest.services.compute.xml.common import Document
from tempest.services.compute.xml.common import Element
@ -24,7 +24,8 @@ from tempest.services.compute.xml.common import xml_to_json
CONF = config.CONF
class HostsClientXML(RestClientXML):
class HostsClientXML(rest_client.RestClient):
TYPE = "xml"
def __init__(self, auth_provider):
super(HostsClientXML, self).__init__(auth_provider)

View File

@ -15,14 +15,15 @@
from lxml import etree
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest import config
from tempest.services.compute.xml.common import xml_to_json
CONF = config.CONF
class HypervisorClientXML(RestClientXML):
class HypervisorClientXML(rest_client.RestClient):
TYPE = "xml"
def __init__(self, auth_provider):
super(HypervisorClientXML, self).__init__(auth_provider)

View File

@ -17,7 +17,7 @@ import urllib
from lxml import etree
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest.common import waiters
from tempest import config
from tempest import exceptions
@ -30,7 +30,8 @@ from tempest.services.compute.xml.common import XMLNS_11
CONF = config.CONF
class ImagesClientXML(RestClientXML):
class ImagesClientXML(rest_client.RestClient):
TYPE = "xml"
def __init__(self, auth_provider):
super(ImagesClientXML, self).__init__(auth_provider)

View File

@ -15,14 +15,15 @@
from lxml import etree
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest import config
from tempest.services.compute.xml.common import xml_to_json
CONF = config.CONF
class InstanceUsagesAuditLogClientXML(RestClientXML):
class InstanceUsagesAuditLogClientXML(rest_client.RestClient):
TYPE = "xml"
def __init__(self, auth_provider):
super(InstanceUsagesAuditLogClientXML, self).__init__(

View File

@ -17,7 +17,7 @@ import time
from lxml import etree
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest import config
from tempest import exceptions
from tempest.services.compute.xml.common import Document
@ -28,7 +28,8 @@ from tempest.services.compute.xml.common import xml_to_json
CONF = config.CONF
class InterfacesClientXML(RestClientXML):
class InterfacesClientXML(rest_client.RestClient):
TYPE = "xml"
def __init__(self, auth_provider):
super(InterfacesClientXML, self).__init__(auth_provider)

View File

@ -16,7 +16,7 @@
from lxml import etree
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest import config
from tempest.services.compute.xml.common import Document
from tempest.services.compute.xml.common import Element
@ -26,7 +26,8 @@ from tempest.services.compute.xml.common import xml_to_json
CONF = config.CONF
class KeyPairsClientXML(RestClientXML):
class KeyPairsClientXML(rest_client.RestClient):
TYPE = "xml"
def __init__(self, auth_provider):
super(KeyPairsClientXML, self).__init__(auth_provider)

View File

@ -15,7 +15,7 @@
from lxml import objectify
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest import config
CONF = config.CONF
@ -23,7 +23,8 @@ CONF = config.CONF
NS = "{http://docs.openstack.org/common/api/v1.0}"
class LimitsClientXML(RestClientXML):
class LimitsClientXML(rest_client.RestClient):
TYPE = "xml"
def __init__(self, auth_provider):
super(LimitsClientXML, self).__init__(auth_provider)

View File

@ -15,7 +15,7 @@
from lxml import etree
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest import config
from tempest.services.compute.xml.common import Document
from tempest.services.compute.xml.common import Element
@ -25,7 +25,8 @@ from tempest.services.compute.xml.common import XMLNS_11
CONF = config.CONF
class QuotasClientXML(RestClientXML):
class QuotasClientXML(rest_client.RestClient):
TYPE = "xml"
def __init__(self, auth_provider):
super(QuotasClientXML, self).__init__(auth_provider)

View File

@ -16,7 +16,7 @@
from lxml import etree
import urllib
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest import config
from tempest import exceptions
from tempest.services.compute.xml.common import Document
@ -28,7 +28,8 @@ from tempest.services.compute.xml.common import XMLNS_11
CONF = config.CONF
class SecurityGroupsClientXML(RestClientXML):
class SecurityGroupsClientXML(rest_client.RestClient):
TYPE = "xml"
def __init__(self, auth_provider):
super(SecurityGroupsClientXML, self).__init__(auth_provider)

View File

@ -19,7 +19,7 @@ import urllib
from lxml import etree
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest.common import waiters
from tempest import config
from tempest import exceptions
@ -139,7 +139,8 @@ def _translate_server_xml_to_json(xml_dom):
return json
class ServersClientXML(RestClientXML):
class ServersClientXML(rest_client.RestClient):
TYPE = "xml"
def __init__(self, auth_provider):
super(ServersClientXML, self).__init__(auth_provider)

View File

@ -18,7 +18,7 @@ import urllib
from lxml import etree
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest import config
from tempest.services.compute.xml.common import Document
from tempest.services.compute.xml.common import Element
@ -27,7 +27,8 @@ from tempest.services.compute.xml.common import xml_to_json
CONF = config.CONF
class ServicesClientXML(RestClientXML):
class ServicesClientXML(rest_client.RestClient):
TYPE = "xml"
def __init__(self, auth_provider):
super(ServicesClientXML, self).__init__(auth_provider)

View File

@ -17,14 +17,15 @@ import urllib
from lxml import etree
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest import config
from tempest.services.compute.xml.common import xml_to_json
CONF = config.CONF
class TenantUsagesClientXML(RestClientXML):
class TenantUsagesClientXML(rest_client.RestClient):
TYPE = "xml"
def __init__(self, auth_provider):
super(TenantUsagesClientXML, self).__init__(auth_provider)

View File

@ -18,7 +18,7 @@ import urllib
from lxml import etree
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest import config
from tempest import exceptions
from tempest.services.compute.xml.common import Document
@ -30,7 +30,8 @@ from tempest.services.compute.xml.common import XMLNS_11
CONF = config.CONF
class VolumesExtensionsClientXML(RestClientXML):
class VolumesExtensionsClientXML(rest_client.RestClient):
TYPE = "xml"
def __init__(self, auth_provider):
super(VolumesExtensionsClientXML, self).__init__(

View File

@ -17,7 +17,7 @@ import json
from lxml import etree
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest import config
from tempest.services.compute.xml.common import Document
from tempest.services.compute.xml.common import Element
@ -29,7 +29,8 @@ CONF = config.CONF
XMLNS = "http://docs.openstack.org/identity/api/v3"
class CredentialsClientXML(RestClientXML):
class CredentialsClientXML(rest_client.RestClient):
TYPE = "xml"
def __init__(self, auth_provider):
super(CredentialsClientXML, self).__init__(auth_provider)

View File

@ -16,7 +16,7 @@
from lxml import etree
from tempest.common import http
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest import config
from tempest.services.compute.xml.common import Document
from tempest.services.compute.xml.common import Element
@ -27,7 +27,8 @@ CONF = config.CONF
XMLNS = "http://docs.openstack.org/identity/api/v3"
class EndPointClientXML(RestClientXML):
class EndPointClientXML(rest_client.RestClient):
TYPE = "xml"
def __init__(self, auth_provider):
super(EndPointClientXML, self).__init__(auth_provider)

View File

@ -17,7 +17,7 @@ import json
from lxml import etree
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest import config
from tempest import exceptions
from tempest.services.compute.xml.common import Document
@ -30,7 +30,8 @@ CONF = config.CONF
XMLNS = "http://docs.openstack.org/identity/api/v3"
class IdentityV3ClientXML(RestClientXML):
class IdentityV3ClientXML(rest_client.RestClient):
TYPE = "xml"
def __init__(self, auth_provider):
super(IdentityV3ClientXML, self).__init__(auth_provider)
@ -426,7 +427,8 @@ class IdentityV3ClientXML(RestClientXML):
return resp, body
class V3TokenClientXML(RestClientXML):
class V3TokenClientXML(rest_client.RestClient):
TYPE = "xml"
def __init__(self):
super(V3TokenClientXML, self).__init__(None)

View File

@ -16,7 +16,7 @@
from lxml import etree
from tempest.common import http
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest import config
from tempest.services.compute.xml.common import Document
from tempest.services.compute.xml.common import Element
@ -27,7 +27,8 @@ CONF = config.CONF
XMLNS = "http://docs.openstack.org/identity/api/v3"
class PolicyClientXML(RestClientXML):
class PolicyClientXML(rest_client.RestClient):
TYPE = "xml"
def __init__(self, auth_provider):
super(PolicyClientXML, self).__init__(auth_provider)

View File

@ -15,7 +15,7 @@
from lxml import etree
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest import config
from tempest.services.compute.xml.common import Document
from tempest.services.compute.xml.common import Element
@ -26,7 +26,8 @@ CONF = config.CONF
XMLNS = "http://docs.openstack.org/identity/api/v3"
class ServiceClientXML(RestClientXML):
class ServiceClientXML(rest_client.RestClient):
TYPE = "xml"
def __init__(self, auth_provider):
super(ServiceClientXML, self).__init__(auth_provider)

View File

@ -13,7 +13,7 @@
from lxml import etree
import xml.etree.ElementTree as ET
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest.services.compute.xml.common import deep_dict_to_xml
from tempest.services.compute.xml.common import Document
from tempest.services.compute.xml.common import Element
@ -23,13 +23,16 @@ from tempest.services.network import network_client_base as client_base
class NetworkClientXML(client_base.NetworkClientBase):
TYPE = "xml"
# list of plurals used for xml serialization
PLURALS = ['dns_nameservers', 'host_routes', 'allocation_pools',
'fixed_ips', 'extensions', 'extra_dhcp_opts']
def get_rest_client(self, auth_provider):
return RestClientXML(auth_provider)
rc = rest_client.RestClient(auth_provider)
rc.TYPE = self.TYPE
return rc
def _parse_array(self, node):
array = []

View File

@ -15,16 +15,19 @@
from lxml import etree
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest.services.compute.xml.common import Document
from tempest.services.compute.xml.common import xml_to_json
import tempest.services.telemetry.telemetry_client_base as client
class TelemetryClientXML(client.TelemetryClientBase):
TYPE = "xml"
def get_rest_client(self, auth_provider):
return RestClientXML(auth_provider)
rc = rest_client.RestClient(auth_provider)
rc.TYPE = self.TYPE
return rc
def _parse_array(self, body):
array = []

View File

@ -18,7 +18,7 @@ import urllib
from lxml import etree
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest import config
from tempest import exceptions
from tempest.services.compute.xml.common import Document
@ -30,10 +30,11 @@ from tempest.services.compute.xml.common import XMLNS_11
CONF = config.CONF
class VolumesV2ClientXML(RestClientXML):
class VolumesV2ClientXML(rest_client.RestClient):
"""
Client class to send CRUD Volume API requests to a Cinder endpoint
"""
TYPE = "xml"
def __init__(self, auth_provider):
super(VolumesV2ClientXML, self).__init__(auth_provider)

View File

@ -17,17 +17,18 @@ import urllib
from lxml import etree
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest import config
from tempest.services.compute.xml.common import xml_to_json
CONF = config.CONF
class VolumeHostsClientXML(RestClientXML):
class VolumeHostsClientXML(rest_client.RestClient):
"""
Client class to send CRUD Volume Hosts API requests to a Cinder endpoint
"""
TYPE = "xml"
def __init__(self, auth_provider):
super(VolumeHostsClientXML, self).__init__(auth_provider)

View File

@ -17,7 +17,7 @@ import urllib
from lxml import etree
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest import config
from tempest import exceptions
from tempest.services.compute.xml.common import Document
@ -29,10 +29,11 @@ from tempest.services.compute.xml.common import XMLNS_11
CONF = config.CONF
class VolumeTypesClientXML(RestClientXML):
class VolumeTypesClientXML(rest_client.RestClient):
"""
Client class to send CRUD Volume Types API requests to a Cinder endpoint
"""
TYPE = "xml"
def __init__(self, auth_provider):
super(VolumeTypesClientXML, self).__init__(auth_provider)

View File

@ -13,13 +13,14 @@
# License for the specific language governing permissions and limitations
# under the License.
from tempest.common.rest_client import RestClientXML
from tempest.services.volume.json import backups_client
class BackupsClientXML(RestClientXML):
class BackupsClientXML(backups_client.BackupsClientJSON):
"""
Client class to send CRUD Volume Backup API requests to a Cinder endpoint
"""
TYPE = "xml"
#TODO(gfidente): XML client isn't yet implemented because of bug 1270589
pass

View File

@ -15,14 +15,15 @@
from lxml import etree
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest import config
from tempest.services.compute.xml.common import xml_to_json
CONF = config.CONF
class ExtensionsClientXML(RestClientXML):
class ExtensionsClientXML(rest_client.RestClient):
TYPE = "xml"
def __init__(self, auth_provider):
super(ExtensionsClientXML, self).__init__(auth_provider)

View File

@ -15,7 +15,7 @@ import urllib
from lxml import etree
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest import config
from tempest import exceptions
from tempest.openstack.common import log as logging
@ -30,8 +30,9 @@ CONF = config.CONF
LOG = logging.getLogger(__name__)
class SnapshotsClientXML(RestClientXML):
class SnapshotsClientXML(rest_client.RestClient):
"""Client class to send CRUD Volume API requests."""
TYPE = "xml"
def __init__(self, auth_provider):
super(SnapshotsClientXML, self).__init__(auth_provider)

View File

@ -19,7 +19,7 @@ import urllib
from lxml import etree
from xml.sax.saxutils import escape
from tempest.common.rest_client import RestClientXML
from tempest.common import rest_client
from tempest import config
from tempest import exceptions
from tempest.services.compute.xml.common import Document
@ -31,10 +31,11 @@ from tempest.services.compute.xml.common import XMLNS_11
CONF = config.CONF
class VolumesClientXML(RestClientXML):
class VolumesClientXML(rest_client.RestClient):
"""
Client class to send CRUD Volume API requests to a Cinder endpoint
"""
TYPE = "xml"
def __init__(self, auth_provider):
super(VolumesClientXML, self).__init__(auth_provider)