diff --git a/api-ref/source/v3/limits.inc b/api-ref/source/v3/limits.inc index 4c2db5fd539..ace9157f8dc 100644 --- a/api-ref/source/v3/limits.inc +++ b/api-ref/source/v3/limits.inc @@ -59,5 +59,5 @@ Response Parameters Response Example ---------------- -.. literalinclude:: ./samples/limits-show-response.json +.. literalinclude:: ./samples/limits/limits-show-response.json :language: javascript diff --git a/api-ref/source/v3/qos-specs-v3-qos-specs.inc b/api-ref/source/v3/qos-specs-v3-qos-specs.inc index 5bbdb09b44b..a9df2a3fd9b 100644 --- a/api-ref/source/v3/qos-specs-v3-qos-specs.inc +++ b/api-ref/source/v3/qos-specs-v3-qos-specs.inc @@ -61,7 +61,7 @@ Request Request Example --------------- -.. literalinclude:: ./samples/qos-unset-request.json +.. literalinclude:: ./samples/qos/qos-unset-request.json :language: javascript @@ -104,7 +104,7 @@ Response Response Example ---------------- -.. literalinclude:: ./samples/qos_show_response.json +.. literalinclude:: ./samples/qos/qos_show_response.json :language: javascript @@ -210,7 +210,7 @@ Response Parameters Response Example ---------------- -.. literalinclude:: ./samples/qos-show-response.json +.. literalinclude:: ./samples/qos/qos-show-response.json :language: javascript @@ -241,7 +241,7 @@ Request Request Example --------------- -.. literalinclude:: ./samples/qos-update-request.json +.. literalinclude:: ./samples/qos/qos-update-request.json :language: javascript Response @@ -255,7 +255,7 @@ Response Response Example ---------------- -.. literalinclude:: ./samples/qos-update-response.json +.. literalinclude:: ./samples/qos/qos-update-response.json :language: javascript @@ -314,7 +314,7 @@ Request Request Example --------------- -.. literalinclude:: ./samples/qos-create-request.json +.. literalinclude:: ./samples/qos/qos-create-request.json :language: javascript @@ -334,7 +334,7 @@ Response Parameters Response Example ---------------- -.. literalinclude:: ./samples/qos-create-response.json +.. literalinclude:: ./samples/qos/qos-create-response.json :language: javascript @@ -384,5 +384,5 @@ Response Parameters Response Example ---------------- -.. literalinclude:: ./samples/qos-list-response.json +.. literalinclude:: ./samples/qos/qos-list-response.json :language: javascript diff --git a/api-ref/source/v3/samples/limits-show-response.json b/api-ref/source/v3/samples/limits/limits-show-response.json similarity index 100% rename from api-ref/source/v3/samples/limits-show-response.json rename to api-ref/source/v3/samples/limits/limits-show-response.json diff --git a/api-ref/source/v3/samples/qos-create-response.json b/api-ref/source/v3/samples/qos-create-response.json deleted file mode 100644 index d743bb5453b..00000000000 --- a/api-ref/source/v3/samples/qos-create-response.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "qos_specs": { - "specs": { - "numberOfFailures": "0", - "availability": "100" - }, - "consumer": "back-end", - "name": "reliability-spec", - "id": "599ef437-1c99-42ec-9fc6-239d0519fef1" - }, - "links": [ - { - "href": "http://23.253.248.171:8776/v3/bab7d5c60cd041a0a36f7c4b6e1dd978/qos_specs/599ef437-1c99-42ec-9fc6-239d0519fef1", - "rel": "self" - }, - { - "href": "http://23.253.248.171:8776/bab7d5c60cd041a0a36f7c4b6e1dd978/qos_specs/599ef437-1c99-42ec-9fc6-239d0519fef1", - "rel": "bookmark" - } - ] -} diff --git a/api-ref/source/v3/samples/qos-list-response.json b/api-ref/source/v3/samples/qos-list-response.json deleted file mode 100644 index 92f2a6216ed..00000000000 --- a/api-ref/source/v3/samples/qos-list-response.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "qos_specs": [ - { - "specs": { - "availability": "100", - "numberOfFailures": "0" - }, - "consumer": "back-end", - "name": "reliability-spec", - "id": "0388d6c6-d5d4-42a3-b289-95205c50dd15" - }, - { - "specs": { - "delay": "0", - "throughput": "100" - }, - "consumer": "back-end", - "name": "performance-spec", - "id": "ecfc6e2e-7117-44a4-8eec-f84d04f531a8" - } - ] -} diff --git a/api-ref/source/v3/samples/qos-show-response.json b/api-ref/source/v3/samples/qos-show-response.json deleted file mode 100644 index 6cf22c817d6..00000000000 --- a/api-ref/source/v3/samples/qos-show-response.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "qos_specs": { - "specs": { - "availability": "100", - "numberOfFailures": "0" - }, - "consumer": "back-end", - "name": "reliability-spec", - "id": "0388d6c6-d5d4-42a3-b289-95205c50dd15" - }, - "links": [ - { - "href": "http://23.253.228.211:8776/v3/e1cf63117ae74309a5bcc2002a23be8b/qos_specs/0388d6c6-d5d4-42a3-b289-95205c50dd15", - "rel": "self" - }, - { - "href": "http://23.253.228.211:8776/e1cf63117ae74309a5bcc2002a23be8b/qos_specs/0388d6c6-d5d4-42a3-b289-95205c50dd15", - "rel": "bookmark" - } - ] -} diff --git a/api-ref/source/v3/samples/qos-create-request.json b/api-ref/source/v3/samples/qos/qos-create-request.json similarity index 100% rename from api-ref/source/v3/samples/qos-create-request.json rename to api-ref/source/v3/samples/qos/qos-create-request.json diff --git a/api-ref/source/v3/samples/qos/qos-create-response.json b/api-ref/source/v3/samples/qos/qos-create-response.json new file mode 100644 index 00000000000..2e6deae17e7 --- /dev/null +++ b/api-ref/source/v3/samples/qos/qos-create-response.json @@ -0,0 +1,18 @@ +{ + "qos_specs": { + "specs": {}, + "consumer": "back-end", + "name": "reliability-spec", + "id": "599ef437-1c99-42ec-9fc6-239d0519fef1" + }, + "links": [ + { + "href": "http://23.253.248.171:8776/v3/89afd400-b646-4bbc-b12b-c0a4d63e5bd3/qos-specs/599ef437-1c99-42ec-9fc6-239d0519fef1", + "rel": "self" + }, + { + "href": "http://23.253.248.171:8776/89afd400-b646-4bbc-b12b-c0a4d63e5bd3/qos-specs/599ef437-1c99-42ec-9fc6-239d0519fef1", + "rel": "bookmark" + } + ] +} diff --git a/api-ref/source/v3/samples/qos/qos-list-response.json b/api-ref/source/v3/samples/qos/qos-list-response.json new file mode 100644 index 00000000000..2e6ee04889e --- /dev/null +++ b/api-ref/source/v3/samples/qos/qos-list-response.json @@ -0,0 +1,10 @@ +{ + "qos_specs": [ + { + "consumer": "back-end", + "id": "62c17294-2e52-4877-a01f-a30388749d9d", + "name": "reliability-spec", + "specs": {} + } + ] +} \ No newline at end of file diff --git a/api-ref/source/v3/samples/qos/qos-show-response.json b/api-ref/source/v3/samples/qos/qos-show-response.json new file mode 100644 index 00000000000..4e60410ef3a --- /dev/null +++ b/api-ref/source/v3/samples/qos/qos-show-response.json @@ -0,0 +1,18 @@ +{ + "qos_specs": { + "specs": {}, + "consumer": "back-end", + "name": "reliability-spec", + "id": "0388d6c6-d5d4-42a3-b289-95205c50dd15" + }, + "links": [ + { + "href": "http://23.253.228.211:8776/v3/89afd400-b646-4bbc-b12b-c0a4d63e5bd3/qos-specs/0388d6c6-d5d4-42a3-b289-95205c50dd15", + "rel": "self" + }, + { + "href": "http://23.253.228.211:8776/89afd400-b646-4bbc-b12b-c0a4d63e5bd3/qos-specs/0388d6c6-d5d4-42a3-b289-95205c50dd15", + "rel": "bookmark" + } + ] +} diff --git a/api-ref/source/v3/samples/qos-unset-request.json b/api-ref/source/v3/samples/qos/qos-unset-request.json similarity index 100% rename from api-ref/source/v3/samples/qos-unset-request.json rename to api-ref/source/v3/samples/qos/qos-unset-request.json diff --git a/api-ref/source/v3/samples/qos-update-request.json b/api-ref/source/v3/samples/qos/qos-update-request.json similarity index 100% rename from api-ref/source/v3/samples/qos-update-request.json rename to api-ref/source/v3/samples/qos/qos-update-request.json diff --git a/api-ref/source/v3/samples/qos-update-response.json b/api-ref/source/v3/samples/qos/qos-update-response.json similarity index 100% rename from api-ref/source/v3/samples/qos-update-response.json rename to api-ref/source/v3/samples/qos/qos-update-response.json diff --git a/api-ref/source/v3/samples/qos/qos_show_response.json b/api-ref/source/v3/samples/qos/qos_show_response.json new file mode 100644 index 00000000000..8e386f1f5f7 --- /dev/null +++ b/api-ref/source/v3/samples/qos/qos_show_response.json @@ -0,0 +1,3 @@ +{ + "qos_associations": [] +} \ No newline at end of file diff --git a/api-ref/source/v3/samples/qos_show_response.json b/api-ref/source/v3/samples/qos_show_response.json deleted file mode 100644 index 4a5d9db6aae..00000000000 --- a/api-ref/source/v3/samples/qos_show_response.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "qos_associations": [ - { - "association_type": "volume_type", - "name": "reliability-type", - "id": "a12983c2-83bd-4afa-be9f-ad796573ead6" - } - ] -} diff --git a/cinder/tests/functional/api_sample_tests/samples/limits/limits-show-response.json.tpl b/cinder/tests/functional/api_sample_tests/samples/limits/limits-show-response.json.tpl new file mode 100644 index 00000000000..38d0ccd3c1b --- /dev/null +++ b/cinder/tests/functional/api_sample_tests/samples/limits/limits-show-response.json.tpl @@ -0,0 +1,17 @@ +{ + "limits": { + "rate": [], + "absolute": { + "totalSnapshotsUsed": 0, + "maxTotalBackups": 10, + "maxTotalVolumeGigabytes": 1000, + "maxTotalSnapshots": 10, + "maxTotalBackupGigabytes": 1000, + "totalBackupGigabytesUsed": 0, + "maxTotalVolumes": 10, + "totalVolumesUsed": 0, + "totalBackupsUsed": 0, + "totalGigabytesUsed": 0 + } + } +} diff --git a/cinder/tests/functional/api_sample_tests/samples/qos/qos-create-request.json.tpl b/cinder/tests/functional/api_sample_tests/samples/qos/qos-create-request.json.tpl new file mode 100644 index 00000000000..c5804651dad --- /dev/null +++ b/cinder/tests/functional/api_sample_tests/samples/qos/qos-create-request.json.tpl @@ -0,0 +1,5 @@ +{ + "qos_specs": { + "name": "reliability-spec" + } +} diff --git a/cinder/tests/functional/api_sample_tests/samples/qos/qos-create-response.json.tpl b/cinder/tests/functional/api_sample_tests/samples/qos/qos-create-response.json.tpl new file mode 100644 index 00000000000..53025181ee7 --- /dev/null +++ b/cinder/tests/functional/api_sample_tests/samples/qos/qos-create-response.json.tpl @@ -0,0 +1,18 @@ +{ + "links": [ + { + "href": "%(host)s/v3/89afd400-b646-4bbc-b12b-c0a4d63e5bd3/qos-specs/%(uuid)s", + "rel": "self" + }, + { + "href": "%(host)s/89afd400-b646-4bbc-b12b-c0a4d63e5bd3/qos-specs/%(uuid)s", + "rel": "bookmark" + } + ], + "qos_specs": { + "consumer": "back-end", + "id": "%(uuid)s", + "name": "reliability-spec", + "specs": {} + } +} \ No newline at end of file diff --git a/cinder/tests/functional/api_sample_tests/samples/qos/qos-list-response.json.tpl b/cinder/tests/functional/api_sample_tests/samples/qos/qos-list-response.json.tpl new file mode 100644 index 00000000000..5d7b0c64727 --- /dev/null +++ b/cinder/tests/functional/api_sample_tests/samples/qos/qos-list-response.json.tpl @@ -0,0 +1,10 @@ +{ + "qos_specs": [ + { + "consumer": "back-end", + "id": "%(uuid)s", + "name": "reliability-spec", + "specs": {} + } + ] +} \ No newline at end of file diff --git a/cinder/tests/functional/api_sample_tests/samples/qos/qos-show-response.json.tpl b/cinder/tests/functional/api_sample_tests/samples/qos/qos-show-response.json.tpl new file mode 100644 index 00000000000..53025181ee7 --- /dev/null +++ b/cinder/tests/functional/api_sample_tests/samples/qos/qos-show-response.json.tpl @@ -0,0 +1,18 @@ +{ + "links": [ + { + "href": "%(host)s/v3/89afd400-b646-4bbc-b12b-c0a4d63e5bd3/qos-specs/%(uuid)s", + "rel": "self" + }, + { + "href": "%(host)s/89afd400-b646-4bbc-b12b-c0a4d63e5bd3/qos-specs/%(uuid)s", + "rel": "bookmark" + } + ], + "qos_specs": { + "consumer": "back-end", + "id": "%(uuid)s", + "name": "reliability-spec", + "specs": {} + } +} \ No newline at end of file diff --git a/cinder/tests/functional/api_sample_tests/samples/qos/qos-update-request.json.tpl b/cinder/tests/functional/api_sample_tests/samples/qos/qos-update-request.json.tpl new file mode 100644 index 00000000000..1d398770584 --- /dev/null +++ b/cinder/tests/functional/api_sample_tests/samples/qos/qos-update-request.json.tpl @@ -0,0 +1,5 @@ +{ + "qos_specs": { + "delay": "1" + } +} diff --git a/cinder/tests/functional/api_sample_tests/samples/qos/qos-update-response.json.tpl b/cinder/tests/functional/api_sample_tests/samples/qos/qos-update-response.json.tpl new file mode 100644 index 00000000000..362308a7917 --- /dev/null +++ b/cinder/tests/functional/api_sample_tests/samples/qos/qos-update-response.json.tpl @@ -0,0 +1,5 @@ +{ + "qos_specs": { + "delay": "1" + } +} \ No newline at end of file diff --git a/cinder/tests/functional/api_sample_tests/samples/qos/qos_show_response.json.tpl b/cinder/tests/functional/api_sample_tests/samples/qos/qos_show_response.json.tpl new file mode 100644 index 00000000000..8e386f1f5f7 --- /dev/null +++ b/cinder/tests/functional/api_sample_tests/samples/qos/qos_show_response.json.tpl @@ -0,0 +1,3 @@ +{ + "qos_associations": [] +} \ No newline at end of file diff --git a/cinder/tests/functional/api_sample_tests/test_limits.py b/cinder/tests/functional/api_sample_tests/test_limits.py new file mode 100644 index 00000000000..fd77660ee65 --- /dev/null +++ b/cinder/tests/functional/api_sample_tests/test_limits.py @@ -0,0 +1,24 @@ +# 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 cinder.tests.functional.api_sample_tests import test_volumes + + +class LimitsSampleJsonTest(test_volumes.VolumesSampleBase): + sample_dir = "limits" + + def setUp(self): + super(LimitsSampleJsonTest, self).setUp() + + def test_limits_get(self): + response = self._do_get('limits') + self._verify_response('limits-show-response', {}, response, 200) diff --git a/cinder/tests/functional/api_sample_tests/test_qos.py b/cinder/tests/functional/api_sample_tests/test_qos.py new file mode 100644 index 00000000000..5f5b450018f --- /dev/null +++ b/cinder/tests/functional/api_sample_tests/test_qos.py @@ -0,0 +1,46 @@ +# 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 oslo_serialization import jsonutils + +from cinder.tests.functional.api_sample_tests import test_volumes + + +class QOSSampleJsonTest(test_volumes.VolumesSampleBase): + sample_dir = "qos" + + def setUp(self): + super(QOSSampleJsonTest, self).setUp() + self.response = self._do_post('qos-specs', 'qos-create-request') + + def test_qos_create(self): + self._verify_response('qos-create-response', {}, self.response, 200) + + def test_qos_list(self): + response = self._do_get('qos-specs') + self._verify_response('qos-list-response', {}, response, 200) + + def test_qos_show(self): + res = jsonutils.loads(self.response.content)['qos_specs'] + response = self._do_get('qos-specs/%s' % res['id']) + self._verify_response('qos-show-response', {}, response, 200) + + def test_qos_update(self): + res = jsonutils.loads(self.response.content)['qos_specs'] + response = self._do_put('qos-specs/%s' % res['id'], + 'qos-update-request') + self._verify_response('qos-update-response', {}, response, 200) + + def test_qos_show_associations(self): + res = jsonutils.loads(self.response.content)['qos_specs'] + response = self._do_get('qos-specs/%s/associations' % res['id']) + self._verify_response('qos_show_response', {}, response, 200)