nova/nova/tests/functional/api/openstack/placement/gabbits/inventory.yaml

813 lines
22 KiB
YAML

fixtures:
- APIFixture
defaults:
request_headers:
x-auth-token: admin
accept: application/json
tests:
- name: inventories for missing provider
GET: /resource_providers/7260669a-e3d4-4867-aaa7-683e2ab6958c/inventories
status: 404
response_strings:
- No resource provider with uuid 7260669a-e3d4-4867-aaa7-683e2ab6958c found
response_json_paths:
$.errors[0].title: Not Found
- name: delete all inventory for missing resource provider
DELETE: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
openstack-api-version: placement 1.5
status: 404
- name: post new resource provider
POST: /resource_providers
request_headers:
content-type: application/json
data:
name: $ENVIRON['RP_NAME']
uuid: $ENVIRON['RP_UUID']
status: 201
response_headers:
location: //resource_providers/[a-f0-9-]+/
- name: get empty inventories
GET: /resource_providers/$ENVIRON['RP_UUID']/inventories
response_json_paths:
$.resource_provider_generation: 0
$.inventories: {}
- name: post a conflicting capacity inventory
POST: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
content-type: application/json
data:
resource_class: DISK_GB
total: 256
reserved: 512
status: 400
response_strings:
- Unable to create inventory for resource provider
response_json_paths:
$.errors[0].title: Bad Request
- name: post an inventory with no total specified
POST: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
content-type: application/json
data:
resource_class: DISK_GB
status: 400
response_strings:
- JSON does not validate
- "'total' is a required property"
- name: post a negative inventory
POST: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
content-type: application/json
data:
resource_class: DISK_GB
total: -1
status: 400
response_strings:
- JSON does not validate
- -1 is less than the minimum of 1
- name: post an inventory with invalid total
POST: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
content-type: application/json
data:
resource_class: DISK_GB
total: 0
reserved: 512
min_unit: 1
max_unit: 1024
step_size: 10
allocation_ratio: 1.0
status: 400
response_strings:
- "JSON does not validate: 0 is less than the minimum of 1"
- "Failed validating 'minimum' in schema['properties']['total']"
- name: post an inventory invalid min_unit
POST: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
content-type: application/json
data:
resource_class: DISK_GB
total: 2048
reserved: 512
min_unit: 0
max_unit: 1024
step_size: 10
allocation_ratio: 1.0
status: 400
response_strings:
- "JSON does not validate: 0 is less than the minimum of 1"
- "Failed validating 'minimum' in schema['properties']['min_unit']"
- name: post an inventory invalid max_unit
POST: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
content-type: application/json
data:
resource_class: DISK_GB
total: 2048
reserved: 512
min_unit: 10
max_unit: 0
step_size: 10
allocation_ratio: 1.0
status: 400
response_strings:
- "JSON does not validate: 0 is less than the minimum of 1"
- "Failed validating 'minimum' in schema['properties']['max_unit']"
- name: post an inventory invalid step_size
POST: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
content-type: application/json
data:
resource_class: DISK_GB
total: 2048
reserved: 512
min_unit: 10
max_unit: 1024
step_size: 0
allocation_ratio: 1.0
status: 400
response_strings:
- "JSON does not validate: 0 is less than the minimum of 1"
- "Failed validating 'minimum' in schema['properties']['step_size']"
- name: post an inventory
POST: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
content-type: application/json
data:
resource_class: DISK_GB
total: 2048
reserved: 512
min_unit: 10
max_unit: 1024
step_size: 10
allocation_ratio: 1.0
status: 201
response_headers:
location: $SCHEME://$NETLOC/resource_providers/$ENVIRON['RP_UUID']/inventories/DISK_GB
response_json_paths:
$.resource_provider_generation: 1
$.total: 2048
$.reserved: 512
- name: get that inventory
GET: $LOCATION
status: 200
request_headers:
# set microversion to 1.15 to get timestamp headers
openstack-api-version: placement 1.15
response_headers:
cache-control: no-cache
# Does last-modified look like a legit timestamp?
last-modified: /^\w+, \d+ \w+ \d{4} [\d:]+ GMT$/
response_json_paths:
$.resource_provider_generation: 1
$.total: 2048
$.reserved: 512
$.min_unit: 10
$.max_unit: 1024
$.step_size: 10
$.allocation_ratio: 1.0
- name: get inventory v1.14 no cache headers
GET: $LAST_URL
status: 200
request_headers:
openstack-api-version: placement 1.14
response_forbidden_headers:
- cache-control
- last-modified
- name: modify the inventory
PUT: $LAST_URL
request_headers:
content-type: application/json
data:
resource_provider_generation: 1
total: 2048
reserved: 1024
min_unit: 10
max_unit: 1024
step_size: 10
allocation_ratio: 1.0
status: 200
response_headers:
content-type: /application/json/
response_json_paths:
$.reserved: 1024
- name: confirm inventory change
GET: $LAST_URL
response_json_paths:
$.resource_provider_generation: 2
$.total: 2048
$.reserved: 1024
- name: modify inventory invalid generation
PUT: $LAST_URL
request_headers:
content-type: application/json
openstack-api-version: placement 1.23
data:
resource_provider_generation: 5
total: 2048
status: 409
response_strings:
- resource provider generation conflict
response_json_paths:
$.errors[0].title: Conflict
$.errors[0].code: placement.concurrent_update
- name: modify inventory no such resource class in inventory
PUT: /resource_providers/$ENVIRON['RP_UUID']/inventories/MEMORY_MB
request_headers:
content-type: application/json
data:
resource_provider_generation: 2
total: 2048
status: 400
response_strings:
- No inventory record with resource class
response_json_paths:
$.errors[0].title: Bad Request
- name: modify inventory invalid data
desc: This should 400 because reserved is greater than total
PUT: $LAST_URL
request_headers:
content-type: application/json
data:
resource_provider_generation: 2
total: 2048
reserved: 4096
min_unit: 10
max_unit: 1024
step_size: 10
allocation_ratio: 1.0
status: 400
response_strings:
- Unable to update inventory for resource provider $ENVIRON['RP_UUID']
response_json_paths:
$.errors[0].title: Bad Request
- name: put inventory bad form
desc: This should 400 because reserved is greater than total
PUT: $LAST_URL
request_headers:
content-type: application/json
data:
house: red
car: blue
status: 400
response_strings:
- JSON does not validate
response_json_paths:
$.errors[0].title: Bad Request
- name: post inventory malformed json
POST: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
content-type: application/json
data: '{"foo": }'
status: 400
response_strings:
- Malformed JSON
response_json_paths:
$.errors[0].title: Bad Request
- name: post inventory bad syntax schema
POST: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
content-type: application/json
data:
resource_class: bad_class
total: 2048
status: 400
response_json_paths:
$.errors[0].title: Bad Request
- name: post inventory bad resource class
POST: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
content-type: application/json
data:
resource_class: NO_CLASS_14
total: 2048
status: 400
response_strings:
- No such resource class NO_CLASS_14
response_json_paths:
$.errors[0].title: Bad Request
- name: post inventory duplicated resource class
desc: DISK_GB was already created above
POST: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
content-type: application/json
data:
resource_class: DISK_GB
total: 2048
status: 409
response_strings:
- Update conflict
response_json_paths:
$.errors[0].title: Conflict
- name: get list of inventories
GET: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
# set microversion to 1.15 to get timestamp headers
openstack-api-version: placement 1.15
response_headers:
cache-control: no-cache
# Does last-modified look like a legit timestamp?
last-modified: /^\w+, \d+ \w+ \d{4} [\d:]+ GMT$/
response_json_paths:
$.resource_provider_generation: 2
$.inventories.DISK_GB.total: 2048
$.inventories.DISK_GB.reserved: 1024
- name: delete the inventory
DELETE: /resource_providers/$ENVIRON['RP_UUID']/inventories/DISK_GB
status: 204
- name: get now empty inventories
GET: /resource_providers/$ENVIRON['RP_UUID']/inventories
response_json_paths:
$.resource_provider_generation: 3
$.inventories: {}
- name: post new disk inventory
POST: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
content-type: application/json
data:
resource_class: DISK_GB
total: 1024
status: 201
- name: post new ipv4 address inventory
POST: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
content-type: application/json
data:
resource_class: IPV4_ADDRESS
total: 255
reserved: 2
status: 201
- name: list both those inventories
GET: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
content-type: application/json
response_json_paths:
$.resource_provider_generation: 5
$.inventories.DISK_GB.total: 1024
$.inventories.IPV4_ADDRESS.total: 255
- name: post ipv4 address inventory again
POST: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
content-type: application/json
data:
resource_class: IPV4_ADDRESS
total: 255
reserved: 2
status: 409
response_json_paths:
$.errors[0].title: Conflict
- name: delete inventory
DELETE: /resource_providers/$ENVIRON['RP_UUID']/inventories/IPV4_ADDRESS
status: 204
response_forbidden_headers:
- content-type
- name: delete inventory again
DELETE: /resource_providers/$ENVIRON['RP_UUID']/inventories/IPV4_ADDRESS
status: 404
response_strings:
- No inventory of class IPV4_ADDRESS found for delete
response_json_paths:
$.errors[0].title: Not Found
- name: get missing inventory class
GET: /resource_providers/$ENVIRON['RP_UUID']/inventories/IPV4_ADDRESS
status: 404
response_strings:
- No inventory of class IPV4_ADDRESS for $ENVIRON['RP_UUID']
response_json_paths:
$.errors[0].title: Not Found
- name: get invalid inventory class
GET: /resource_providers/$ENVIRON['RP_UUID']/inventories/HOUSE
status: 404
response_strings:
- No inventory of class HOUSE for $ENVIRON['RP_UUID']
response_json_paths:
$.errors[0].title: Not Found
- name: get missing resource provider inventory
GET: /resource_providers/2e1dda56-8b18-4fb9-8c5c-3125891b7143/inventories/VCPU
status: 404
- name: create another resource provider
POST: /resource_providers
request_headers:
content-type: application/json
data:
name: disk-network
status: 201
- name: put all inventory
PUT: $LOCATION/inventories
request_headers:
content-type: application/json
# set microversion to 1.15 to get timestamp headers
openstack-api-version: placement 1.15
data:
resource_provider_generation: 0
inventories:
IPV4_ADDRESS:
total: 253
DISK_GB:
total: 1024
status: 200
response_headers:
cache-control: no-cache
# Does last-modified look like a legit timestamp?
last-modified: /^\w+, \d+ \w+ \d{4} [\d:]+ GMT$/
response_json_paths:
$.resource_provider_generation: 1
$.inventories.IPV4_ADDRESS.total: 253
$.inventories.IPV4_ADDRESS.reserved: 0
$.inventories.DISK_GB.total: 1024
$.inventories.DISK_GB.allocation_ratio: 1.0
- name: check both inventory classes
GET: $LAST_URL
response_json_paths:
$.resource_provider_generation: 1
$.inventories.DISK_GB.total: 1024
$.inventories.IPV4_ADDRESS.total: 253
- name: check one inventory class
GET: $LAST_URL/DISK_GB
response_json_paths:
$.total: 1024
- name: put all inventory bad generation
PUT: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
content-type: application/json
openstack-api-version: placement 1.23
data:
resource_provider_generation: 99
inventories:
IPV4_ADDRESS:
total: 253
status: 409
response_strings:
- resource provider generation conflict
response_json_paths:
$.errors[0].title: Conflict
$.errors[0].code: placement.concurrent_update
- name: put all inventory unknown resource class
PUT: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
content-type: application/json
data:
resource_provider_generation: 6
inventories:
HOUSE:
total: 253
status: 400
response_strings:
- Unknown resource class in inventory
response_json_paths:
$.errors[0].title: Bad Request
- name: post an inventory with total exceed max limit
POST: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
content-type: application/json
data:
resource_class: DISK_GB
total: 2147483648
reserved: 512
min_unit: 10
max_unit: 1024
step_size: 10
allocation_ratio: 1.0
status: 400
response_strings:
- "Failed validating 'maximum'"
response_json_paths:
$.errors[0].title: Bad Request
- name: post an inventory with reserved exceed max limit
POST: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
content-type: application/json
data:
resource_class: DISK_GB
total: 1024
reserved: 2147483648
min_unit: 10
max_unit: 1024
step_size: 10
allocation_ratio: 1.0
status: 400
response_strings:
- "Failed validating 'maximum'"
response_json_paths:
$.errors[0].title: Bad Request
- name: post an inventory with min_unit exceed max limit
POST: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
content-type: application/json
data:
resource_class: DISK_GB
total: 1024
reserved: 512
min_unit: 2147483648
max_unit: 1024
step_size: 10
allocation_ratio: 1.0
status: 400
response_strings:
- "Failed validating 'maximum'"
response_json_paths:
$.errors[0].title: Bad Request
- name: post an inventory with max_unit exceed max limit
POST: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
content-type: application/json
data:
resource_class: DISK_GB
total: 1024
reserved: 512
min_unit: 10
max_unit: 2147483648
step_size: 10
allocation_ratio: 1.0
status: 400
response_strings:
- "Failed validating 'maximum'"
response_json_paths:
$.errors[0].title: Bad Request
- name: post an inventory with step_size exceed max limit
POST: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
content-type: application/json
data:
resource_class: DISK_GB
total: 1024
reserved: 512
min_unit: 10
max_unit: 1024
step_size: 2147483648
allocation_ratio: 1.0
status: 400
response_strings:
- "Failed validating 'maximum'"
response_json_paths:
$.errors[0].title: Bad Request
- name: post an inventory with allocation_ratio exceed max limit
POST: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
content-type: application/json
data:
resource_class: DISK_GB
total: 1024
reserved: 512
min_unit: 10
max_unit: 1024
step_size: 10
allocation_ratio: 3.40282e+39
status: 400
response_strings:
- "Failed validating 'maximum'"
response_json_paths:
$.errors[0].title: Bad Request
- name: modify the inventory with total exceed max limit
PUT: $LAST_URL
request_headers:
content-type: application/json
data:
resource_provider_generation: 1
inventories:
DISK_GB:
total: 2147483648
reserved: 512
status: 400
response_strings:
- "Failed validating 'maximum'"
response_json_paths:
$.errors[0].title: Bad Request
- name: modify the inventory with allocation_ratio exceed max limit
PUT: $LAST_URL
request_headers:
content-type: application/json
data:
resource_provider_generation: 1
inventories:
DISK_GB:
total: 1024
reserved: 512
allocation_ratio: 3.40282e+39
status: 400
response_strings:
- "Failed validating 'maximum'"
response_json_paths:
$.errors[0].title: Bad Request
# NOTE(cdent): The generation is 6 now, based on the activity at
# the start of this file.
- name: put all inventory bad capacity
PUT: $LAST_URL
request_headers:
content-type: application/json
data:
resource_provider_generation: 6
inventories:
IPV4_ADDRESS:
total: 253
reserved: 512
status: 400
response_strings:
- Unable to update inventory
- greater than or equal to total
response_json_paths:
$.errors[0].title: Bad Request
- name: put all inventory zero capacity old microversion
PUT: $LAST_URL
request_headers:
content-type: application/json
data:
resource_provider_generation: 6
inventories:
IPV4_ADDRESS:
total: 253
reserved: 253
status: 400
response_strings:
- Unable to update inventory
- greater than or equal to total
response_json_paths:
$.errors[0].title: Bad Request
- name: put inventory with reserved equal to total
PUT: $LAST_URL
request_headers:
content-type: application/json
openstack-api-version: placement 1.26
data:
resource_provider_generation: 6
inventories:
IPV4_ADDRESS:
total: 253
reserved: 253
status: 200
- name: put all inventory bad capacity in new microversion
PUT: $LAST_URL
request_headers:
content-type: application/json
openstack-api-version: placement 1.26
data:
resource_provider_generation: 7
inventories:
IPV4_ADDRESS:
total: 253
reserved: 512
status: 400
response_strings:
- Unable to update inventory
- greater than total
response_json_paths:
$.errors[0].title: Bad Request
- name: put one inventory zero capacity old microversion
PUT: /resource_providers/$ENVIRON['RP_UUID']/inventories/IPV4_ADDRESS
request_headers:
content-type: application/json
data:
resource_provider_generation: 7
total: 253
reserved: 253
status: 400
response_strings:
- Unable to update inventory
- greater than or equal to total
response_json_paths:
$.errors[0].title: Bad Request
- name: put one inventory with reserved equal to total new microversion
PUT: $LAST_URL
request_headers:
content-type: application/json
openstack-api-version: placement 1.26
data:
resource_provider_generation: 7
total: 512
reserved: 512
status: 200
- name: delete all inventory bad generation
PUT: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
content-type: application/json
data:
resource_provider_generation: 99
inventories:
IPV4_ADDRESS:
total: 253
status: 409
response_strings:
- resource provider generation conflict
- name: delete all inventory
DELETE: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
openstack-api-version: placement 1.5
status: 204
- name: delete empty inventories
DELETE: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
openstack-api-version: placement 1.5
status: 204
- name: get inventories after deletions
GET: /resource_providers/$ENVIRON['RP_UUID']/inventories
response_json_paths:
$.resource_provider_generation: 10
$.inventories: {}
- name: post an inventory again
POST: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
content-type: application/json
data:
resource_class: DISK_GB
total: 2048
reserved: 512
min_unit: 10
max_unit: 1024
step_size: 10
allocation_ratio: 1.0
status: 201
response_headers:
location: $SCHEME://$NETLOC/resource_providers/$ENVIRON['RP_UUID']/inventories/DISK_GB
response_json_paths:
$.resource_provider_generation: 11
$.total: 2048
$.reserved: 512
- name: delete all inventory with put
PUT: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
content-type: application/json
openstack-api-version: placement 1.4
data:
resource_provider_generation: 11
inventories: {}
response_json_paths:
$.resource_provider_generation: 12
$.inventories: {}
status: 200
- name: get generation after deletion
GET: /resource_providers/$ENVIRON['RP_UUID']/inventories
response_json_paths:
$.resource_provider_generation: 12
$.inventories: {}
- name: delete inventories earlier version
DELETE: /resource_providers/$ENVIRON['RP_UUID']/inventories
request_headers:
openstack-api-version: placement 1.4
status: 405