aboutsummaryrefslogtreecommitdiffstats
path: root/resources/testscripts/F-version/ns_instance/instance.py
blob: f202e189b6a39e2fe521526b7baafe7ea7c83f4b (plain)
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
26
import json
import httplib2
import sys

from testscripts.const import VNF_PROFILE_ID, VIM_ID, MSB_BASE_URL

ns_instance_Id = sys.argv[1]
data = {
    "additionalParamForNs": {
        "sdnControllerId": "2"
    },
    "locationConstraints": [{
        "vnfProfileId": VNF_PROFILE_ID,
        "locationConstraints": {
            "vimId": VIM_ID
        }
    }]
}
headers = {'content-type': 'application/json', 'accept': 'application/json'}
ca_certs = None
auth_type = "rest_no_auth"
http = httplib2.Http(ca_certs=ca_certs, disable_ssl_certificate_validation=(auth_type == "rest_no_auth"))
http.follow_all_redirects = True
resp, resp_content = http.request(MSB_BASE_URL + '/api/nslcm/v1/ns/' + ns_instance_Id + '/instantiate',
                                  method="POST", body=json.dumps(data), headers=headers)
print(resp['status'], resp_content)