diff --git a/doc/v3/api_samples/consoles/consoles-create-req.json b/doc/v3/api_samples/consoles/consoles-create-req.json
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/doc/v3/api_samples/consoles/consoles-create-req.xml b/doc/v3/api_samples/consoles/consoles-create-req.xml
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/doc/v3/api_samples/consoles/consoles-get-resp.json b/doc/v3/api_samples/consoles/consoles-get-resp.json
new file mode 100644
index 000000000000..9cdbbd485d55
--- /dev/null
+++ b/doc/v3/api_samples/consoles/consoles-get-resp.json
@@ -0,0 +1,10 @@
+{
+ "console": {
+ "console_type": "fake",
+ "host": "fake",
+ "id": 1,
+ "instance_name": "instance-00000001",
+ "password": "C4jBpJ6x",
+ "port": 5999
+ }
+}
\ No newline at end of file
diff --git a/doc/v3/api_samples/consoles/consoles-get-resp.xml b/doc/v3/api_samples/consoles/consoles-get-resp.xml
new file mode 100644
index 000000000000..c16bd9235692
--- /dev/null
+++ b/doc/v3/api_samples/consoles/consoles-get-resp.xml
@@ -0,0 +1,9 @@
+
+
+ fake
+ 5999
+ instance-00000001
+ fake
+ qM3ZwY5a
+ 1
+
\ No newline at end of file
diff --git a/doc/v3/api_samples/consoles/consoles-list-get-resp.json b/doc/v3/api_samples/consoles/consoles-list-get-resp.json
new file mode 100644
index 000000000000..af8ea95a6d00
--- /dev/null
+++ b/doc/v3/api_samples/consoles/consoles-list-get-resp.json
@@ -0,0 +1,8 @@
+{
+ "consoles": [
+ {
+ "console_type": "fake",
+ "id": 1
+ }
+ ]
+}
\ No newline at end of file
diff --git a/doc/v3/api_samples/consoles/consoles-list-get-resp.xml b/doc/v3/api_samples/consoles/consoles-list-get-resp.xml
new file mode 100644
index 000000000000..d2f22cb27418
--- /dev/null
+++ b/doc/v3/api_samples/consoles/consoles-list-get-resp.xml
@@ -0,0 +1,7 @@
+
+
+
+ fake
+ 1
+
+
\ No newline at end of file
diff --git a/doc/v3/api_samples/consoles/server-post-req.json b/doc/v3/api_samples/consoles/server-post-req.json
new file mode 100644
index 000000000000..d41985a1bc39
--- /dev/null
+++ b/doc/v3/api_samples/consoles/server-post-req.json
@@ -0,0 +1,16 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "image_ref" : "http://openstack.example.com/openstack/images/70a599e0-31e7-49b7-b260-868f441e862b",
+ "flavor_ref" : "http://openstack.example.com/openstack/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ },
+ "personality" : [
+ {
+ "path" : "/etc/banner.txt",
+ "contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/doc/v3/api_samples/consoles/server-post-req.xml b/doc/v3/api_samples/consoles/server-post-req.xml
new file mode 100644
index 000000000000..598839cf6a3a
--- /dev/null
+++ b/doc/v3/api_samples/consoles/server-post-req.xml
@@ -0,0 +1,19 @@
+
+
+
+ Apache1
+
+
+
+ ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBp
+ dCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5k
+ IGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVs
+ c2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4g
+ QnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRo
+ ZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlv
+ dSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vy
+ c2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6
+ b25zLiINCg0KLVJpY2hhcmQgQmFjaA==
+
+
+
\ No newline at end of file
diff --git a/doc/v3/api_samples/consoles/server-post-resp.json b/doc/v3/api_samples/consoles/server-post-resp.json
new file mode 100644
index 000000000000..05e324d40df6
--- /dev/null
+++ b/doc/v3/api_samples/consoles/server-post-resp.json
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "admin_pass": "C3r5xKS73Y7S",
+ "id": "3f19c120-f64a-4faf-848e-33900b752f83",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/servers/3f19c120-f64a-4faf-848e-33900b752f83",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/servers/3f19c120-f64a-4faf-848e-33900b752f83",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/doc/v3/api_samples/consoles/server-post-resp.xml b/doc/v3/api_samples/consoles/server-post-resp.xml
new file mode 100644
index 000000000000..d2f495148c44
--- /dev/null
+++ b/doc/v3/api_samples/consoles/server-post-resp.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/nova/tests/integrated/v3/api_samples/consoles/consoles-create-req.json.tpl b/nova/tests/integrated/v3/api_samples/consoles/consoles-create-req.json.tpl
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/nova/tests/integrated/v3/api_samples/consoles/consoles-create-req.xml.tpl b/nova/tests/integrated/v3/api_samples/consoles/consoles-create-req.xml.tpl
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/nova/tests/integrated/v3/api_samples/consoles/consoles-get-resp.json.tpl b/nova/tests/integrated/v3/api_samples/consoles/consoles-get-resp.json.tpl
new file mode 100644
index 000000000000..a2a6de6ed452
--- /dev/null
+++ b/nova/tests/integrated/v3/api_samples/consoles/consoles-get-resp.json.tpl
@@ -0,0 +1 @@
+{"console": {"console_type": "fake", "port": 5999, "instance_name": "instance-00000001", "host": "fake", "password": "%(password)s", "id": 1}}
\ No newline at end of file
diff --git a/nova/tests/integrated/v3/api_samples/consoles/consoles-get-resp.xml.tpl b/nova/tests/integrated/v3/api_samples/consoles/consoles-get-resp.xml.tpl
new file mode 100644
index 000000000000..6db62d070acd
--- /dev/null
+++ b/nova/tests/integrated/v3/api_samples/consoles/consoles-get-resp.xml.tpl
@@ -0,0 +1,9 @@
+
+
+ 1
+ 5999
+ fake
+ %(password)s
+ fake
+ instance-00000001
+
\ No newline at end of file
diff --git a/nova/tests/integrated/v3/api_samples/consoles/consoles-list-get-resp.json.tpl b/nova/tests/integrated/v3/api_samples/consoles/consoles-list-get-resp.json.tpl
new file mode 100644
index 000000000000..9d908ad12399
--- /dev/null
+++ b/nova/tests/integrated/v3/api_samples/consoles/consoles-list-get-resp.json.tpl
@@ -0,0 +1 @@
+{"consoles": [{"console_type": "fake", "id": 1}]}
\ No newline at end of file
diff --git a/nova/tests/integrated/v3/api_samples/consoles/consoles-list-get-resp.xml.tpl b/nova/tests/integrated/v3/api_samples/consoles/consoles-list-get-resp.xml.tpl
new file mode 100644
index 000000000000..efe96c23a897
--- /dev/null
+++ b/nova/tests/integrated/v3/api_samples/consoles/consoles-list-get-resp.xml.tpl
@@ -0,0 +1,7 @@
+
+
+
+ 1
+ fake
+
+
\ No newline at end of file
diff --git a/nova/tests/integrated/v3/api_samples/consoles/server-post-req.json.tpl b/nova/tests/integrated/v3/api_samples/consoles/server-post-req.json.tpl
new file mode 100644
index 000000000000..1dcb63e3b2ae
--- /dev/null
+++ b/nova/tests/integrated/v3/api_samples/consoles/server-post-req.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server" : {
+ "name" : "new-server-test",
+ "image_ref" : "%(host)s/openstack/images/%(image_id)s",
+ "flavor_ref" : "%(host)s/openstack/flavors/1",
+ "metadata" : {
+ "My Server Name" : "Apache1"
+ },
+ "personality" : [
+ {
+ "path" : "/etc/banner.txt",
+ "contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
+ }
+ ]
+ }
+}
diff --git a/nova/tests/integrated/v3/api_samples/consoles/server-post-req.xml.tpl b/nova/tests/integrated/v3/api_samples/consoles/server-post-req.xml.tpl
new file mode 100644
index 000000000000..ddb5ea78c4b5
--- /dev/null
+++ b/nova/tests/integrated/v3/api_samples/consoles/server-post-req.xml.tpl
@@ -0,0 +1,19 @@
+
+
+
+ Apache1
+
+
+
+ ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBp
+ dCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5k
+ IGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVs
+ c2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4g
+ QnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRo
+ ZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlv
+ dSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vy
+ c2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6
+ b25zLiINCg0KLVJpY2hhcmQgQmFjaA==
+
+
+
diff --git a/nova/tests/integrated/v3/api_samples/consoles/server-post-resp.json.tpl b/nova/tests/integrated/v3/api_samples/consoles/server-post-resp.json.tpl
new file mode 100644
index 000000000000..6c3100fbec86
--- /dev/null
+++ b/nova/tests/integrated/v3/api_samples/consoles/server-post-resp.json.tpl
@@ -0,0 +1,16 @@
+{
+ "server": {
+ "admin_pass": "%(password)s",
+ "id": "%(id)s",
+ "links": [
+ {
+ "href": "http://openstack.example.com/v3/servers/%(uuid)s",
+ "rel": "self"
+ },
+ {
+ "href": "http://openstack.example.com/servers/%(uuid)s",
+ "rel": "bookmark"
+ }
+ ]
+ }
+}
diff --git a/nova/tests/integrated/v3/api_samples/consoles/server-post-resp.xml.tpl b/nova/tests/integrated/v3/api_samples/consoles/server-post-resp.xml.tpl
new file mode 100644
index 000000000000..3470373e171f
--- /dev/null
+++ b/nova/tests/integrated/v3/api_samples/consoles/server-post-resp.xml.tpl
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/nova/tests/integrated/v3/test_consoles.py b/nova/tests/integrated/v3/test_consoles.py
new file mode 100644
index 000000000000..59d19514dc65
--- /dev/null
+++ b/nova/tests/integrated/v3/test_consoles.py
@@ -0,0 +1,60 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+# Copyright 2012 Nebula, Inc.
+# Copyright 2013 IBM Corp.
+#
+# 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 nova.tests.integrated.v3 import test_servers
+
+
+class ConsolesSamplesJsonTest(test_servers.ServersSampleBase):
+ sample_dir = "consoles"
+
+ def setUp(self):
+ super(ConsolesSamplesJsonTest, self).setUp()
+ self.flags(console_public_hostname='fake')
+ self.flags(console_host='fake')
+ self.flags(console_driver='nova.console.fake.FakeConsoleProxy')
+ self.console = self.start_service('console', host='fake')
+
+ def _create_consoles(self, server_uuid):
+ response = self._do_post('servers/%s/consoles' % server_uuid,
+ 'consoles-create-req', {})
+ self.assertEqual(response.status, 201)
+
+ def test_create_consoles(self):
+ uuid = self._post_server()
+ self._create_consoles(uuid)
+
+ def test_list_consoles(self):
+ uuid = self._post_server()
+ self._create_consoles(uuid)
+ response = self._do_get('servers/%s/consoles' % uuid)
+ self._verify_response('consoles-list-get-resp', {}, response, 200)
+
+ def test_console_get(self):
+ uuid = self._post_server()
+ self._create_consoles(uuid)
+ response = self._do_get('servers/%s/consoles/1' % uuid)
+ subs = self._get_regexes()
+ self._verify_response('consoles-get-resp', subs, response, 200)
+
+ def test_console_delete(self):
+ uuid = self._post_server()
+ self._create_consoles(uuid)
+ response = self._do_delete('servers/%s/consoles/1' % uuid)
+ self.assertEqual(response.status, 202)
+
+
+class ConsolesSamplesXmlTest(ConsolesSamplesJsonTest):
+ ctype = 'xml'