summaryrefslogtreecommitdiffstats
path: root/resources/testscripts/F-version/ns
diff options
context:
space:
mode:
Diffstat (limited to 'resources/testscripts/F-version/ns')
-rw-r--r--resources/testscripts/F-version/ns/Instructions27
-rw-r--r--resources/testscripts/F-version/ns/ns_create.py4
-rw-r--r--resources/testscripts/F-version/ns/ns_delete.py4
-rw-r--r--resources/testscripts/F-version/ns/ns_download.py11
-rw-r--r--resources/testscripts/F-version/ns/ns_get.py4
-rw-r--r--resources/testscripts/F-version/ns/ns_get_one.py4
-rw-r--r--resources/testscripts/F-version/ns/ns_upload.py8
7 files changed, 56 insertions, 6 deletions
diff --git a/resources/testscripts/F-version/ns/Instructions b/resources/testscripts/F-version/ns/Instructions
new file mode 100644
index 00000000..6994dedd
--- /dev/null
+++ b/resources/testscripts/F-version/ns/Instructions
@@ -0,0 +1,27 @@
+
+# msb_create
+The Python script in this folder is used to register ns to msb.
+It mainly includes the creation, upload, query acquisition and deletion of msb.
+
+# msb_upload
+When you execute the msb_create script, you get an ID. At this time, you open the msb_upload script,
+change the file path to the path where you want to upload the ns CSAR package,
+then execute the msb_upload script and place the ID after executing the command,
+and the ID will be automatically passed in.
+
+# msb_download
+
+By executing this script, you can access the catalog parsing interface and get the parsing content of the
+ uploaded ns package
+
+# msb_get
+If you want to query the registration status in msb, you can execute the msb_get script directly.
+
+# msb_delete
+If you want to delete an MSB record, you can execute the msb_del script and put the ID generated
+at the time of creation after execution of the command.
+
+Note: You should configure the IP and CSAR file path of MSB in const file
+ IP address for MSB service
+ MSB cannot be created repeatedly
+ The request mode of MSB is HTTPS, and the port of public IP is 30283
diff --git a/resources/testscripts/F-version/ns/ns_create.py b/resources/testscripts/F-version/ns/ns_create.py
index 32f39f5b..eca0b68c 100644
--- a/resources/testscripts/F-version/ns/ns_create.py
+++ b/resources/testscripts/F-version/ns/ns_create.py
@@ -1,7 +1,9 @@
import json
import httplib2
-full_url = 'https://192.168.235.89:30283/api/nsd/v1/ns_descriptors'
+from testscripts.const import MSB_BASE_URL
+
+full_url = MSB_BASE_URL + '/api/nsd/v1/ns_descriptors'
ud_data = {'userDefinedData': {"key2": "value2"}}
headers = {'content-type': 'application/json', 'accept': 'application/json'}
ca_certs = None
diff --git a/resources/testscripts/F-version/ns/ns_delete.py b/resources/testscripts/F-version/ns/ns_delete.py
index aa3eb2b5..96385863 100644
--- a/resources/testscripts/F-version/ns/ns_delete.py
+++ b/resources/testscripts/F-version/ns/ns_delete.py
@@ -1,8 +1,10 @@
import requests
import sys
+from testscripts.const import MSB_BASE_URL
+
id = sys.argv[1]
requests.packages.urllib3.disable_warnings()
-resp = requests.delete('https://192.168.235.89:30283/api/nsd/v1/ns_descriptors/' + id, verify=False)
+resp = requests.delete(MSB_BASE_URL + '/api/nsd/v1/ns_descriptors/' + id, verify=False)
print(resp.status_code)
diff --git a/resources/testscripts/F-version/ns/ns_download.py b/resources/testscripts/F-version/ns/ns_download.py
new file mode 100644
index 00000000..5ad12d80
--- /dev/null
+++ b/resources/testscripts/F-version/ns/ns_download.py
@@ -0,0 +1,11 @@
+import requests
+import sys
+
+from testscripts.const import MSB_BASE_URL, NS_CSAR_PATH
+
+id = sys.argv[1]
+url = MSB_BASE_URL + '/api/nsd/v1/ns_descriptors/' + id + '/nsd_content'
+resp = requests.get(url)
+local_file = open(NS_CSAR_PATH, 'wb')
+local_file.write(resp.content)
+local_file.close()
diff --git a/resources/testscripts/F-version/ns/ns_get.py b/resources/testscripts/F-version/ns/ns_get.py
index 2ecb31bf..9403592b 100644
--- a/resources/testscripts/F-version/ns/ns_get.py
+++ b/resources/testscripts/F-version/ns/ns_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/nsd/v1/ns_descriptors', verify=False)
+resp = requests.get(MSB_BASE_URL + '/api/nsd/v1/ns_descriptors', verify=False)
print(resp.status_code, resp.json())
diff --git a/resources/testscripts/F-version/ns/ns_get_one.py b/resources/testscripts/F-version/ns/ns_get_one.py
index c4c484cd..79d9fdf4 100644
--- a/resources/testscripts/F-version/ns/ns_get_one.py
+++ b/resources/testscripts/F-version/ns/ns_get_one.py
@@ -1,8 +1,10 @@
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/nsd/v1/ns_descriptors/' + id, verify=False)
+resp = requests.get(MSB_BASE_URL + '/api/nsd/v1/ns_descriptors/' + id, verify=False)
print(resp.status_code, resp.json())
diff --git a/resources/testscripts/F-version/ns/ns_upload.py b/resources/testscripts/F-version/ns/ns_upload.py
index f91c80b3..d4e435b8 100644
--- a/resources/testscripts/F-version/ns/ns_upload.py
+++ b/resources/testscripts/F-version/ns/ns_upload.py
@@ -1,6 +1,10 @@
import requests
+import sys
+from testscripts.const import MSB_BASE_URL, NS_CSAR_PATH
+
+id = sys.argv[1]
requests.packages.urllib3.disable_warnings()
-url = 'https://192.168.235.89:30283/api/nsd/v1/ns_descriptors/84090010-6e67-4536-81cc-61ae7b0b4ecd/nsd_content'
-resp = requests.put(url, files={'file': open(r"C:\Users\86187\Desktop\vfc-tests\ns\ns-new\ns_vgw.csar", 'rb')}, verify=False)
+url = MSB_BASE_URL + '/api/nsd/v1/ns_descriptors/ + id /nsd_content'
+resp = requests.put(url, files={'file': open(NS_CSAR_PATH, 'rb')}, verify=False)
print(resp.status_code)