Merge "Merge console_output_client to server_client"
diff --git a/tempest/clients.py b/tempest/clients.py
index 7a7ea13..32bf2c3 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -35,8 +35,6 @@
from tempest.services.compute.json.quotas_client import QuotasClientJSON
from tempest.services.compute.json.volumes_extensions_client import \
VolumesExtensionsClientJSON
-from tempest.services.compute.json.console_output_client import \
- ConsoleOutputsClientJSON
from tempest.services.compute.xml.extensions_client import ExtensionsClientXML
from tempest.services.compute.xml.flavors_client import FlavorsClientXML
from tempest.services.compute.xml.floating_ips_client import \
@@ -50,8 +48,6 @@
from tempest.services.compute.xml.servers_client import ServersClientXML
from tempest.services.compute.xml.volumes_extensions_client import \
VolumesExtensionsClientXML
-from tempest.services.compute.xml.console_output_client import \
- ConsoleOutputsClientXML
from tempest.services.identity.json.identity_client import IdentityClientJSON
from tempest.services.identity.json.identity_client import TokenClientJSON
from tempest.services.identity.xml.identity_client import IdentityClientXML
@@ -135,11 +131,6 @@
"xml": SecurityGroupsClientXML,
}
-CONSOLE_OUTPUT_CLIENT = {
- "json": ConsoleOutputsClientJSON,
- "xml": ConsoleOutputsClientXML,
-}
-
class Manager(object):
@@ -198,8 +189,6 @@
self.token_client = TOKEN_CLIENT[interface](self.config)
self.security_groups_client = \
SECURITY_GROUPS_CLIENT[interface](*client_args)
- self.console_outputs_client = \
- CONSOLE_OUTPUT_CLIENT[interface](*client_args)
except KeyError:
msg = "Unsupported interface type `%s'" % interface
raise exceptions.InvalidConfiguration(msg)
diff --git a/tempest/manager.py b/tempest/manager.py
index cb1e52d..344b8fb 100644
--- a/tempest/manager.py
+++ b/tempest/manager.py
@@ -29,7 +29,6 @@
import tempest.config
from tempest import exceptions
# Tempest REST Fuzz testing client libs
-from tempest.services.compute.json import console_output_client
from tempest.services.compute.json import extensions_client
from tempest.services.compute.json import flavors_client
from tempest.services.compute.json import floating_ips_client
@@ -54,7 +53,6 @@
KeyPairsClient = keypairs_client.KeyPairsClientJSON
VolumesExtensionsClient = volumes_extensions_client.VolumesExtensionsClientJSON
VolumesClient = volumes_client.VolumesClientJSON
-ConsoleOutputsClient = console_output_client.ConsoleOutputsClientJSON
QuotasClient = quotas_client.QuotasClientJSON
LOG = logging.getLogger(__name__)
@@ -254,7 +252,6 @@
self.floating_ips_client = FloatingIPsClient(*client_args)
self.volumes_extensions_client = VolumesExtensionsClient(*client_args)
self.volumes_client = VolumesClient(*client_args)
- self.console_outputs_client = ConsoleOutputsClient(*client_args)
self.quotas_client = QuotasClient(*client_args)
self.network_client = NetworkClient(*client_args)
diff --git a/tempest/services/compute/json/console_output_client.py b/tempest/services/compute/json/console_output_client.py
deleted file mode 100644
index 9d37de7..0000000
--- a/tempest/services/compute/json/console_output_client.py
+++ /dev/null
@@ -1,37 +0,0 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
-# Copyright 2012 OpenStack, LLC
-# 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.
-
-import json
-
-from tempest.common.rest_client import RestClient
-
-
-class ConsoleOutputsClientJSON(RestClient):
-
- def __init__(self, config, username, password, auth_url, tenant_name=None):
- super(ConsoleOutputsClientJSON, self).__init__(config, username,
- password,
- auth_url, tenant_name)
- self.service = self.config.compute.catalog_type
-
- def get_console_output(self, server_id, length):
- post_body = {'os-getConsoleOutput': {'length': length}}
- url = "/servers/%s/action" % server_id
- post_body = json.dumps(post_body)
- resp, body = self.post(url, post_body, self.headers)
- body = json.loads(body)
- return resp, body['output']
diff --git a/tempest/services/compute/json/servers_client.py b/tempest/services/compute/json/servers_client.py
index b832af0..2116e1e 100644
--- a/tempest/services/compute/json/servers_client.py
+++ b/tempest/services/compute/json/servers_client.py
@@ -490,3 +490,11 @@
resp, body = self.post('servers/%s/action' % server_id,
post_body, self.headers)
return resp, body
+
+ def get_console_output(self, server_id, length):
+ post_body = {'os-getConsoleOutput': {'length': length}}
+ url = "/servers/%s/action" % server_id
+ post_body = json.dumps(post_body)
+ resp, body = self.post(url, post_body, self.headers)
+ body = json.loads(body)
+ return resp, body['output']
diff --git a/tempest/services/compute/xml/console_output_client.py b/tempest/services/compute/xml/console_output_client.py
deleted file mode 100644
index e618d63..0000000
--- a/tempest/services/compute/xml/console_output_client.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-#
-# Copyright 2012 IBM
-# 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 lxml import etree
-from tempest.common.rest_client import RestClientXML
-from tempest.services.compute.xml.common import Document
-from tempest.services.compute.xml.common import Element
-from tempest.services.compute.xml.common import Text
-from tempest.services.compute.xml.common import xml_to_json
-
-
-class ConsoleOutputsClientXML(RestClientXML):
-
- def __init__(self, config, username, password, auth_url, tenant_name=None):
- super(ConsoleOutputsClientXML, self).__init__(config, username,
- password,
- auth_url, tenant_name)
- self.service = self.config.compute.catalog_type
-
- def get_console_output(self, server_id, length):
- post_body = Element("os-getConsoleOutput", length=length)
- resp, body = self.post("/servers/%s/action" % server_id,
- headers=self.headers,
- body=str(Document(post_body)))
- body = xml_to_json(etree.fromstring(body))
- return resp, body
diff --git a/tempest/services/compute/xml/servers_client.py b/tempest/services/compute/xml/servers_client.py
index 4a84646..8be342d 100644
--- a/tempest/services/compute/xml/servers_client.py
+++ b/tempest/services/compute/xml/servers_client.py
@@ -385,3 +385,11 @@
secgrp = Element('removeSecurityGroup', name=security_group_name)
return self.post('servers/%s/action' % server_id,
str(Document(secgrp)), self.headers)
+
+ def get_console_output(self, server_id, length):
+ post_body = Element("os-getConsoleOutput", length=length)
+ resp, body = self.post("/servers/%s/action" % server_id,
+ headers=self.headers,
+ body=str(Document(post_body)))
+ body = xml_to_json(etree.fromstring(body))
+ return resp, body
diff --git a/tempest/tests/compute/base.py b/tempest/tests/compute/base.py
index 2312931..3810046 100644
--- a/tempest/tests/compute/base.py
+++ b/tempest/tests/compute/base.py
@@ -62,7 +62,6 @@
cls.floating_ips_client = os.floating_ips_client
cls.keypairs_client = os.keypairs_client
cls.security_groups_client = os.security_groups_client
- cls.console_outputs_client = os.console_outputs_client
cls.quotas_client = os.quotas_client
cls.limits_client = os.limits_client
cls.volumes_extensions_client = os.volumes_extensions_client
diff --git a/tempest/tests/compute/servers/test_console_output.py b/tempest/tests/compute/servers/test_console_output.py
index b26220b..1eadbb5 100644
--- a/tempest/tests/compute/servers/test_console_output.py
+++ b/tempest/tests/compute/servers/test_console_output.py
@@ -27,9 +27,8 @@
@classmethod
def setUpClass(self, cls):
- cls.client = cls.console_outputs_client
- cls.servers_client = cls.servers_client
cls.name = rand_name('server')
+ cls.client = cls.servers_client
resp, server = cls.servers_client.create_server(cls.name,
cls.image_ref,
cls.flavor_ref)
diff --git a/tempest/tests/compute/test_authorization.py b/tempest/tests/compute/test_authorization.py
index 4d3b553..fdc97ea 100644
--- a/tempest/tests/compute/test_authorization.py
+++ b/tempest/tests/compute/test_authorization.py
@@ -41,7 +41,6 @@
cls.images_client = cls.os.images_client
cls.keypairs_client = cls.os.keypairs_client
cls.security_client = cls.os.security_groups_client
- cls.console_outputs_client = cls.os.console_outputs_client
if cls.config.compute.allow_tenant_isolation:
creds = cls._get_isolated_creds()
@@ -57,7 +56,6 @@
cls.alt_images_client = cls.alt_manager.images_client
cls.alt_keypairs_client = cls.alt_manager.keypairs_client
cls.alt_security_client = cls.alt_manager.security_groups_client
- cls.alt_console_outputs_client = cls.alt_manager.console_outputs_client
cls.alt_security_client._set_auth()
name = rand_name('server')
@@ -401,5 +399,4 @@
@attr(type='negative')
def test_get_console_output_of_alt_account_server_fails(self):
# A Get Console Output for another user's server should fail
- self.alt_console_outputs_client.get_console_output(self.server['id'],
- 10)
+ self.alt_client.get_console_output(self.server['id'], 10)
diff --git a/tempest/whitebox.py b/tempest/whitebox.py
index b7a1e68..d5fa023 100644
--- a/tempest/whitebox.py
+++ b/tempest/whitebox.py
@@ -73,7 +73,6 @@
cls.floating_ips_client = cls.manager.floating_ips_client
cls.keypairs_client = cls.manager.keypairs_client
cls.security_groups_client = cls.manager.security_groups_client
- cls.console_outputs_client = cls.manager.console_outputs_client
cls.limits_client = cls.manager.limits_client
cls.volumes_client = cls.manager.volumes_client
cls.build_interval = cls.config.compute.build_interval