diff options
Diffstat (limited to 'resources/testscripts/F-version/vnf')
7 files changed, 55 insertions, 6 deletions
diff --git a/resources/testscripts/F-version/vnf/Instruticons b/resources/testscripts/F-version/vnf/Instruticons new file mode 100644 index 00000000..52c2c6eb --- /dev/null +++ b/resources/testscripts/F-version/vnf/Instruticons @@ -0,0 +1,27 @@ + +# msb_create +The Python script in this folder is used to register vnf to msb. +It mainly includes the creation, upload, query acquisition and deletion of msb. + +# msb_upload +When the msb_create script is executed, an ID is obtained. +At this time, the msb_upload script is opened, the file path is changed to the path of the CSAR package +you want to upload vnf. Then the msb_upload script is executed and the ID is placed after the +command is executed, and the ID is automatically passed in. + +# msb_download + +By executing this script, you can access the catalog parsing interface and get the parsing content of the + uploaded vnf 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
\ No newline at end of file diff --git a/resources/testscripts/F-version/vnf/vnf_create.py b/resources/testscripts/F-version/vnf/vnf_create.py index 1bc9e391..537aa3b6 100644 --- a/resources/testscripts/F-version/vnf/vnf_create.py +++ b/resources/testscripts/F-version/vnf/vnf_create.py @@ -1,7 +1,9 @@ import json import httplib2 -full_url = 'https://192.168.235.89:30283/api/vnfpkgm/v1/vnf_packages' +from testscripts.const import MSB_BASE_URL + +full_url = MSB_BASE_URL + '/api/vnfpkgm/v1/vnf_packages' ud_data = {'userDefinedData': {"key2": "value2"}} headers = {'content-type': 'application/json', 'accept': 'application/json'} ca_certs = None diff --git a/resources/testscripts/F-version/vnf/vnf_delete.py b/resources/testscripts/F-version/vnf/vnf_delete.py index cd85ddf8..7857878e 100644 --- a/resources/testscripts/F-version/vnf/vnf_delete.py +++ b/resources/testscripts/F-version/vnf/vnf_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/vnfpkgm/v1/vnf_packages/' + id, verify=False) +resp = requests.delete(MSB_BASE_URL + '/api/vnfpkgm/v1/vnf_packages/' + id, verify=False) print(resp.status_code) diff --git a/resources/testscripts/F-version/vnf/vnf_download.py b/resources/testscripts/F-version/vnf/vnf_download.py new file mode 100644 index 00000000..0f599880 --- /dev/null +++ b/resources/testscripts/F-version/vnf/vnf_download.py @@ -0,0 +1,12 @@ +import requests +import sys + +from testscripts.const import MSB_BASE_URL, VNF_CSAR_PATH + +requests.packages.urllib3.disable_warnings() +id = sys.argv[1] +url = MSB_BASE_URL + '/api/vnfpkgm/v1/vnf_packages/' + id + '/package_content' +resp = requests.get(url, verify=False) +local_file = open(VNF_CSAR_PATH, 'wb') +local_file.write(resp.content) +local_file.close() diff --git a/resources/testscripts/F-version/vnf/vnf_get.py b/resources/testscripts/F-version/vnf/vnf_get.py index 107b7dd8..df14bd76 100644 --- a/resources/testscripts/F-version/vnf/vnf_get.py +++ b/resources/testscripts/F-version/vnf/vnf_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/vnfpkgm/v1/vnf_packages', verify=False) +resp = requests.get(MSB_BASE_URL + '/api/vnfpkgm/v1/vnf_packages', verify=False) print(resp.status_code, resp.json()) diff --git a/resources/testscripts/F-version/vnf/vnf_get_one.py b/resources/testscripts/F-version/vnf/vnf_get_one.py index 56998fdf..a0b0be6c 100644 --- a/resources/testscripts/F-version/vnf/vnf_get_one.py +++ b/resources/testscripts/F-version/vnf/vnf_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/vnfpkgm/v1/vnf_packages/' + id, verify=False) +resp = requests.get(MSB_BASE_URL + '/api/vnfpkgm/v1/vnf_packages/' + id, verify=False) print(resp.status_code, resp.json()) diff --git a/resources/testscripts/F-version/vnf/vnf_upload.py b/resources/testscripts/F-version/vnf/vnf_upload.py index 074f298c..33b39dff 100644 --- a/resources/testscripts/F-version/vnf/vnf_upload.py +++ b/resources/testscripts/F-version/vnf/vnf_upload.py @@ -1,9 +1,11 @@ import requests import sys +from testscripts.const import MSB_BASE_URL, VNF_CSAR_PATH + id = sys.argv[1] requests.packages.urllib3.disable_warnings() -url = 'https://192.168.235.89:30283/api/vnfpkgm/v1/vnf_packages/' + id + '/package_content' -resp = requests.put(url, files={'file': open(r"C:\Users\86187\Desktop\vfc-tests\vgw.csar", 'rb')}, verify=False) +url = MSB_BASE_URL + '/api/vnfpkgm/v1/vnf_packages/' + id + '/package_content' +resp = requests.put(url, files={'file': open(VNF_CSAR_PATH, 'rb')}, verify=False) print(resp.status_code) |