f202e189b6a39e2fe521526b7baafe7ea7c83f4b
[vfc/nfvo/lcm.git] / resources / testscripts / F-version / ns_instance / instance.py
1 import json
2 import httplib2
3 import sys
4
5 from testscripts.const import VNF_PROFILE_ID, VIM_ID, MSB_BASE_URL
6
7 ns_instance_Id = sys.argv[1]
8 data = {
9     "additionalParamForNs": {
10         "sdnControllerId": "2"
11     },
12     "locationConstraints": [{
13         "vnfProfileId": VNF_PROFILE_ID,
14         "locationConstraints": {
15             "vimId": VIM_ID
16         }
17     }]
18 }
19 headers = {'content-type': 'application/json', 'accept': 'application/json'}
20 ca_certs = None
21 auth_type = "rest_no_auth"
22 http = httplib2.Http(ca_certs=ca_certs, disable_ssl_certificate_validation=(auth_type == "rest_no_auth"))
23 http.follow_all_redirects = True
24 resp, resp_content = http.request(MSB_BASE_URL + '/api/nslcm/v1/ns/' + ns_instance_Id + '/instantiate',
25                                   method="POST", body=json.dumps(data), headers=headers)
26 print(resp['status'], resp_content)