test_so.py 1.29 KB
Newer Older
Balazs's avatar
Balazs committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
import requests
import time

# token to be updated regularly
token = '7786d2441fe440a1b5cb4efa70f8e514'
heads = {'X-Auth-Token':token, 'X-Tenant-Name':'mcntub', 'Content-Type':'text/occi', 'Accept':'text/occi'}
host = 'http://127.0.0.1:8080'
# host = 'http://10.88.88.128:8080'  # for use with docker executed images

start=time.time(); r = requests.get(host+'/-/', headers=heads); r.headers; stop=time.time(); stop-start

heads['Category']='orchestrator; scheme="http://schemas.mobile-cloud-networking.eu/occi/service#"'
start=time.time(); r = requests.put(host+'/orchestrator/default', headers=heads); r.headers; stop=time.time(); stop-start

heads['Category']='deploy; scheme="http://schemas.mobile-cloud-networking.eu/occi/service#"'
start=time.time(); r = requests.post(host+'/orchestrator/default?action=deploy', headers=heads); r.headers; stop=time.time(); stop-start

r = requests.get(host+'/orchestrator/default', headers=heads); r.headers

heads['Category']='provision; scheme="http://schemas.mobile-cloud-networking.eu/occi/service#"'
start=time.time(); r = requests.post(host+'/orchestrator/default?action=provision', headers=heads); r.headers; stop=time.time(); stop-start

r = requests.get(host+'/orchestrator/default', headers=heads); r.headers

r = requests.delete(host+'/orchestrator/default', headers=heads)