Skip to content

Instantly share code, notes, and snippets.

@idvoretskyi
Last active August 29, 2015 14:04
Show Gist options
  • Save idvoretskyi/66f2b112ea4aee07ddb8 to your computer and use it in GitHub Desktop.
Save idvoretskyi/66f2b112ea4aee07ddb8 to your computer and use it in GitHub Desktop.
import requests
TENANT_ID = 'Default'
API_URL = 'api.indigitus.ch'
# flavors delete
requests.delete('http://API_URL:8774/v2/TENANT_ID/flavors/m1.tiny')
requests.delete('http://API_URL:8774/v2/TENANT_ID/flavors/m1.small')
requests.delete('http://API_URL:8774/v2/TENANT_ID/flavors/m1.medium')
requests.delete('http://API_URL:8774/v2/TENANT_ID/flavors/m1.large')
requests.delete('http://API_URL:8774/v2/TENANT_ID/flavors/m1.xlarge')
# flavors create
requests.post('http://API_URL:8774/v2/TENANT_ID/flavors', params={ "flavor": { "name": "i1-standard-1-2", "ram": 2048, "vcpus": 1, "disk": 10 "id": "1" } })
requests.post('http://API_URL:8774/v2/TENANT_ID/flavors', params={ "flavor": { "name": "i1-standard-1-4", "ram": 4096, "vcpus": 1, "disk": 20 "id": "2" } })
requests.post('http://API_URL:8774/v2/TENANT_ID/flavors', params={ "flavor": { "name": "i1-standard-2-8", "ram": 8192, "vcpus": 2, "disk": 40 "id": "3" } })
requests.post('http://API_URL:8774/v2/TENANT_ID/flavors', params={ "flavor": { "name": "i1-standard-4-16", "ram": 16384, "vcpus": 4, "disk": 80 "id": "4" } })
requests.post('http://API_URL:8774/v2/TENANT_ID/flavors', params={ "flavor": { "name": "i1-standard-8-32", "ram": 32768, "vcpus": 8, "disk": 160 "id": "5" } })
# public network name change
NEW_NETWORK_NAME='External Network'
requests.post('http://API_URL:9696/v2.0/networks/{network_id}', params={ "network": { "name": NEW_NETWORK_NAME } })
# images supported list
requests.post('http://API_URL:9292/v2/images', params={"name": "Ubuntu 14.04 amd64"})
requests.put('http://API_URL:9292/v2/images/{image_id}/file', headers=('content-type': 'application/octet-stream') params={'file': {'https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img'})
requests.post('http://API_URL:9292/v2/images', params={"name": "Ubuntu 12.04 amd64"})
requests.put('http://API_URL:9292/v2/images/{image_id}/file', headers=('content-type': 'application/octet-stream') params={'file': {'https://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img'})
requests.post('http://API_URL:9292/v2/images', params={"name": "CentOS 6.5-x86_64"})
requests.put('http://API_URL:9292/v2/images/{image_id}/file', headers=('content-type': 'application/octet-stream') params={'file': {'http://repos.fedorapeople.org/repos/openstack/guest-images/centos-6.5-20140117.0.x86_64.qcow2'})
requests.post('http://API_URL:9292/v2/images', params={"name": "CirrOS 0.3.2-x86_64"})
requests.put('http://API_URL:9292/v2/images/{image_id}/file', headers=('content-type': 'application/octet-stream') params={'file': {'http://download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-disk.img'})
# nova availbility zone&aggregate
AGGREGATE_NAME='zurich-01'
AVAILABILITY_ZONE_NAME='zurich-01'
requests.post('http://API_URL:8774/v2/TENANT_ID/os-aggreagates', params={ "aggregate": { "name": AGGREGATE_NAME, "availability_zone": AVAILABILITY_ZONE_NAME } })
requests.post('http://API_URL:8774/v2/TENANT_ID/os-aggreagates/{aggregate_id}/action', params = { "add_host": { "host": "HOST_ID" } })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment