Skip to content

Instantly share code, notes, and snippets.

@cdent
Created August 30, 2016 08:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cdent/a9590764fbc7402d450fa36df14f35e0 to your computer and use it in GitHub Desktop.
Save cdent/a9590764fbc7402d450fa36df14f35e0 to your computer and use it in GitHub Desktop.
#!/bin/bash -e
# can't -u because of stuff within openrc
# Run the rp.yaml file against an already running placement-api.
# In devstack's local.conf 'enable_service placement-api' then:
#
# source PATH_TO_DEVSTACK/openrc admin admin
# ./placement.sh
export RP_NAME=${1:-$(uuidgen)}
export TOKEN=$(openstack token issue -f value -c id)
PLACEMENT_API=$(openstack endpoint show placement -f value -c publicurl)
gabbi-run $PLACEMENT_API < rp.yaml
defaults:
request_headers:
x-auth-token: $ENVIRON['TOKEN']
accept: application/json
content-type: application/json
verbose: true
tests:
- name: make an rp
POST: /resource_providers
data:
name: $ENVIRON['RP_NAME']
status: 201
- name: get rp
GET: $LOCATION
- name: add some inventory
POST: /resource_providers/$RESPONSE['$.uuid']/inventories
data:
resource_class: DISK_GB
total: 1024
status: 201
- name: get inventory
GET: $LOCATION
- name: update inventory
PUT: $LAST_URL
data:
total: 2048
reserved: 256
resource_provider_generation: 1
status: 200
- name: get inventory
GET: $LAST_URL
- name: list resource providers
GET: /resource_providers
- name: get usages
GET: /resource_providers/$RESPONSE['$.resource_providers[-1].uuid']/usages
- name: list resource providers
GET: /resource_providers
- name: get inventories
GET: /resource_providers/$RESPONSE['$.resource_providers[0].uuid']/inventories
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment