Merge "Automate generation of qos specs api-ref samples"

This commit is contained in:
Zuul 2020-03-11 21:19:02 +00:00 committed by Gerrit Code Review
commit 1d96403454
25 changed files with 209 additions and 82 deletions

View File

@ -59,5 +59,5 @@ Response Parameters
Response Example
----------------
.. literalinclude:: ./samples/limits-show-response.json
.. literalinclude:: ./samples/limits/limits-show-response.json
:language: javascript

View File

@ -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

View File

@ -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"
}
]
}

View File

@ -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"
}
]
}

View File

@ -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"
}
]
}

View File

@ -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"
}
]
}

View File

@ -0,0 +1,10 @@
{
"qos_specs": [
{
"consumer": "back-end",
"id": "62c17294-2e52-4877-a01f-a30388749d9d",
"name": "reliability-spec",
"specs": {}
}
]
}

View File

@ -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"
}
]
}

View File

@ -0,0 +1,3 @@
{
"qos_associations": []
}

View File

@ -1,9 +0,0 @@
{
"qos_associations": [
{
"association_type": "volume_type",
"name": "reliability-type",
"id": "a12983c2-83bd-4afa-be9f-ad796573ead6"
}
]
}

View File

@ -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
}
}
}

View File

@ -0,0 +1,5 @@
{
"qos_specs": {
"name": "reliability-spec"
}
}

View File

@ -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": {}
}
}

View File

@ -0,0 +1,10 @@
{
"qos_specs": [
{
"consumer": "back-end",
"id": "%(uuid)s",
"name": "reliability-spec",
"specs": {}
}
]
}

View File

@ -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": {}
}
}

View File

@ -0,0 +1,5 @@
{
"qos_specs": {
"delay": "1"
}
}

View File

@ -0,0 +1,5 @@
{
"qos_specs": {
"delay": "1"
}
}

View File

@ -0,0 +1,3 @@
{
"qos_associations": []
}

View File

@ -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)

View File

@ -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)