summaryrefslogtreecommitdiffstats
path: root/resources/testscripts/F-version/ns_instance
diff options
context:
space:
mode:
Diffstat (limited to 'resources/testscripts/F-version/ns_instance')
-rw-r--r--resources/testscripts/F-version/ns_instance/create.py14
-rw-r--r--resources/testscripts/F-version/ns_instance/del.py5
-rw-r--r--resources/testscripts/F-version/ns_instance/get.py4
-rw-r--r--resources/testscripts/F-version/ns_instance/get_job_id.py4
-rw-r--r--resources/testscripts/F-version/ns_instance/get_one.py4
-rw-r--r--resources/testscripts/F-version/ns_instance/instance.py9
-rw-r--r--resources/testscripts/F-version/ns_instance/instructions51
-rw-r--r--resources/testscripts/F-version/ns_instance/terminate.py4
8 files changed, 81 insertions, 14 deletions
diff --git a/resources/testscripts/F-version/ns_instance/create.py b/resources/testscripts/F-version/ns_instance/create.py
index e3fa51ef..852dbc32 100644
--- a/resources/testscripts/F-version/ns_instance/create.py
+++ b/resources/testscripts/F-version/ns_instance/create.py
@@ -1,17 +1,19 @@
import json
import httplib2
+from testscripts.const import MSB_BASE_URL, GLOBAL_CUSTOMER_Id, SERVICE_TYPE, CSAR_ID, NS_NAME, DESCRIPTION
+
data = {
"context": {
- "globalCustomerId": "global-customer-id-test1",
- "serviceType": "service-type-test1"
+ "globalCustomerId": GLOBAL_CUSTOMER_Id,
+ "serviceType": SERVICE_TYPE
},
- "csarId": "d5d678dc-80ef-461e-8630-d105f43b0a18",
- "nsName": "ns_vsn",
- "description": "description"
+ "csarId": CSAR_ID,
+ "nsName": NS_NAME,
+ "description": DESCRIPTION
}
-full_url = 'https://192.168.235.89:30283/api/nslcm/v1/ns'
+full_url = MSB_BASE_URL + '/api/nslcm/v1/ns'
headers = {'content-type': 'application/json', 'accept': 'application/json'}
ca_certs = None
auth_type = "rest_no_auth"
diff --git a/resources/testscripts/F-version/ns_instance/del.py b/resources/testscripts/F-version/ns_instance/del.py
index 04e3b2e5..5b64384e 100644
--- a/resources/testscripts/F-version/ns_instance/del.py
+++ b/resources/testscripts/F-version/ns_instance/del.py
@@ -1,6 +1,9 @@
import requests
import sys
+from testscripts.const import MSB_BASE_URL
+
+requests.packages.urllib3.disable_warnings()
id = sys.argv[1]
-resp = requests.delete('https://192.168.235.89:30283/api/nslcm/v1/ns/' + id, verify=False)
+resp = requests.delete(MSB_BASE_URL + '/api/nslcm/v1/ns/' + id, verify=False)
print(resp.status_code)
diff --git a/resources/testscripts/F-version/ns_instance/get.py b/resources/testscripts/F-version/ns_instance/get.py
index ab741c35..984ea9c1 100644
--- a/resources/testscripts/F-version/ns_instance/get.py
+++ b/resources/testscripts/F-version/ns_instance/get.py
@@ -1,5 +1,7 @@
import requests
+from testscripts.const import MSB_BASE_URL
+
requests.packages.urllib3.disable_warnings()
-resp = requests.get('https://192.168.235.89:30283/api/nslcm/v1/ns', verify=False)
+resp = requests.get(MSB_BASE_URL + '/api/nslcm/v1/ns', verify=False)
print(resp.status_code, resp.json())
diff --git a/resources/testscripts/F-version/ns_instance/get_job_id.py b/resources/testscripts/F-version/ns_instance/get_job_id.py
index 4fbf7c90..3ed9991e 100644
--- a/resources/testscripts/F-version/ns_instance/get_job_id.py
+++ b/resources/testscripts/F-version/ns_instance/get_job_id.py
@@ -1,9 +1,11 @@
import requests
import sys
+from testscripts.const import MSB_BASE_URL
+
requests.packages.urllib3.disable_warnings()
jobId = '1'
if len(sys.argv) > 1:
jobId = sys.argv[1]
-resp = requests.get('https://192.168.235.89:30283/api/nslcm/v1/jobs/%s' % jobId, verify=False)
+resp = requests.get(MSB_BASE_URL + '/api/nslcm/v1/jobs/%s' % jobId, verify=False)
print(resp.status_code, resp.json())
diff --git a/resources/testscripts/F-version/ns_instance/get_one.py b/resources/testscripts/F-version/ns_instance/get_one.py
index 63de7d52..5fbc83cc 100644
--- a/resources/testscripts/F-version/ns_instance/get_one.py
+++ b/resources/testscripts/F-version/ns_instance/get_one.py
@@ -1,7 +1,9 @@
import requests
import sys
+from testscripts.const import MSB_BASE_URL
+
id = sys.argv[1]
requests.packages.urllib3.disable_warnings()
-resp = requests.get('https://192.168.235.89:30283/api/nslcm/v1/ns/' + id, verify=False)
+resp = requests.get(MSB_BASE_URL + '/api/nslcm/v1/ns/' + id, verify=False)
print(resp.status_code, resp.json())
diff --git a/resources/testscripts/F-version/ns_instance/instance.py b/resources/testscripts/F-version/ns_instance/instance.py
index 43e81e8b..f202e189 100644
--- a/resources/testscripts/F-version/ns_instance/instance.py
+++ b/resources/testscripts/F-version/ns_instance/instance.py
@@ -1,15 +1,18 @@
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": "45711f40-3f43-415b-bb45-46e5c6940735",
+ "vnfProfileId": VNF_PROFILE_ID,
"locationConstraints": {
- "vimId": "CPE-DC_RegionOne"
+ "vimId": VIM_ID
}
}]
}
@@ -18,6 +21,6 @@ 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('https://192.168.235.89:30283/api/nslcm/v1/ns/' + ns_instance_Id + '/instantiate',
+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)
diff --git a/resources/testscripts/F-version/ns_instance/instructions b/resources/testscripts/F-version/ns_instance/instructions
new file mode 100644
index 00000000..af96eb4b
--- /dev/null
+++ b/resources/testscripts/F-version/ns_instance/instructions
@@ -0,0 +1,51 @@
+This process is ns instantiation process
+When the NS and vnf packages are uploaded and the MSB is registered successfully.
+the instantiation operation begins.
+This process mainly includes ns creation, instantiation, information query acquisition,
+instance termination and data deletion after termination.
+
+# create
+
+Prepare the data before instance creation according to your needs,
+and replace the CSAR ID generated after uploading package management.
+When the execution is completed, an instance ID and other data are returned.
+
+# instance
+
+This process also prepares the data according to the requirement of creating the instance itself,
+returns the instance ID after executing the create script,
+and then executes the script after executing the script command. At this point,
+the instance ID will be passed into the script, and a series of instantiation operations will be started,
+and the virtual machine will be created.
+
+# get
+
+If you want to get some data generated during instance creation, you can execute the script
+The script can query all the instance information in the database.
+
+# get_one
+
+If you want to get some instance data during instance creation, you can execute the script
+The script only queries the content of an instance information,
+executes the script command and puts the created instance ID after the command,
+then the query can be completed.
+
+# terminate
+
+After the instantiation process is successfully created,
+if you want to terminate the instantiation, execute the script.
+The virtual machine generated after the script execution will also stop,
+as well as some data deletion, termination of services.
+After the script command is executed, the instance ID needs to be added after the command.
+
+# delete
+
+Some data will remain after termination. Execute the script to clear the data in the database.
+The instance ID is also required to execute this process.
+The completion of this process indicates the end of an instance creation termination process.
+
+Note: You should configure the IP and CSAR file path of MSB in const file
+ IP address for MSB service
+ NS cannot be created repeatedly
+ Update test scripts of ns_instance
+ The request mode of MSB is HTTPS, and the port of public IP is 30283
diff --git a/resources/testscripts/F-version/ns_instance/terminate.py b/resources/testscripts/F-version/ns_instance/terminate.py
index 9d214c8c..4b1ca31c 100644
--- a/resources/testscripts/F-version/ns_instance/terminate.py
+++ b/resources/testscripts/F-version/ns_instance/terminate.py
@@ -2,6 +2,8 @@ import json
import httplib2
import sys
+from testscripts.const import MSB_BASE_URL
+
id = sys.argv[1]
data = {
"gracefulTerminationTimeout": 600,
@@ -12,7 +14,7 @@ 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('https://192.168.235.89:30283/api/nslcm/v1/ns/' + id + '/terminate',
+resp, resp_content = http.request(MSB_BASE_URL + '/api/nslcm/v1/ns/' + id + '/terminate',
method="POST",
body=json.dumps(data),
headers=headers)