From 1de6ffb71eb7995fa090ebcb807ec599e9931565 Mon Sep 17 00:00:00 2001 From: "Olivia.Zhan" Date: Tue, 16 Jul 2019 10:40:16 +0800 Subject: [PATCH] Add csit case for PNFD Content Issue-ID: INT-1015 Signed-off-by: Olivia.Zhan Change-Id: I7da0adb1028a1fd7a6b347fd82b6ba6a3234d3bb --- plans/vfc-nfvo-catalog/sanity-check/testplan.txt | 1 + tests/vfc/nfvo-catalog/PNFDContent.robot | 96 +++++++++++++++++++++++ tests/vfc/nfvo-catalog/files/ran-du.csar | Bin 0 -> 2688 bytes 3 files changed, 97 insertions(+) create mode 100644 tests/vfc/nfvo-catalog/PNFDContent.robot create mode 100644 tests/vfc/nfvo-catalog/files/ran-du.csar diff --git a/plans/vfc-nfvo-catalog/sanity-check/testplan.txt b/plans/vfc-nfvo-catalog/sanity-check/testplan.txt index 56c96d38..10c4036c 100644 --- a/plans/vfc-nfvo-catalog/sanity-check/testplan.txt +++ b/plans/vfc-nfvo-catalog/sanity-check/testplan.txt @@ -8,6 +8,7 @@ vfc/nfvo-catalog/IndividualVNFPackage.robot vfc/nfvo-catalog/VNFPackageContent.robot vfc/nfvo-catalog/PNFDescriptors.robot vfc/nfvo-catalog/IndividualPnfDescriptor.robot +vfc/nfvo-catalog/PNFDContent.robot vfc/nfvo-catalog/NSDescriptors.robot vfc/nfvo-catalog/IndividualNSDescriptor.robot vfc/nfvo-catalog/NSDContent.robot diff --git a/tests/vfc/nfvo-catalog/PNFDContent.robot b/tests/vfc/nfvo-catalog/PNFDContent.robot new file mode 100644 index 00000000..3552e5bb --- /dev/null +++ b/tests/vfc/nfvo-catalog/PNFDContent.robot @@ -0,0 +1,96 @@ +*** Settings *** +Resource ../../common.robot +Library Collections +Library RequestsLibrary +Library OperatingSystem +Library json +Library HttpLibrary.HTTP + +*** Variables *** +${catalog_port} 8806 +${pnf_descriptors_url} /api/nsd/v1/pnf_descriptors + +#json files +${request_json} ${SCRIPTS}/../tests/vfc/nfvo-catalog/jsons/CreatePnfdInfoRequest.json +${request_csar} ${SCRIPTS}/../tests/vfc/nfvo-catalog/files/ran-du.csar + +#global variables +${pnfdId} + +*** Test Cases *** +Create new PNF Descriptor Resource for pre-condition + Log Create new PNF Descriptor Resource for pre-condition + ${json_value}= json_from_file ${request_json} + ${json_string}= string_from_json ${json_value} + ${headers} Create Dictionary Content-Type=application/json Accept=application/json + Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers} + Set Request Body ${json_string} + ${resp}= Post Request web_session ${pnf_descriptors_url} ${json_string} + Should Be Equal As Strings 201 ${resp.status_code} + ${response_json} json.loads ${resp.content} + Should Be Equal As Strings CREATED ${response_json['pnfdOnboardingState']} + ${pnfdId}= Convert To String ${response_json['id']} + Set Global Variable ${pnfdId} + +Upload PNFD Content + Log Upload PNFD Content + [Documentation] The objective is to test the upload of a PNFD Content + Create Session web_session http://${CATALOG_IP}:${catalog_port} + ${headers} Create Dictionary Accept=application/json + &{fileParts}= Create Dictionary + Create Multi Part ${fileParts} file ${request_csar} + Log ${fileParts} + ${resp}= Put Request web_session ${pnf_descriptors_url}/${pnfdId}/pnfd_content files=${fileParts} headers=${headers} + Log ${resp.status_code} + Should Be Equal As Strings 204 ${resp.status_code} + Log Received 204 Accepted as expected + +Get PNFD Content + Log Get PNFD Content + [Documentation] The objective is to test the retrieval of the PNFD Content + ${headers} Create Dictionary Content-Type=application/json + Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers} + ${resp}= Get Request web_session ${pnf_descriptors_url}/${pnfdId}/pnfd_content + Should Be Equal As Strings 200 ${resp.status_code} + +Check Postcondition + Log Check Postcondition + ${headers} Create Dictionary Content-Type=application/json Accept=application/json + Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers} + ${resp}= Get Request web_session ${pnf_descriptors_url}/${pnfdId} + Should Be Equal As Strings 200 ${resp.status_code} + ${response_json} json.loads ${resp.content} + Should Be Equal As Strings ONBOARDED ${response_json['pnfdOnboardingState']} + +POST PNFD Content - Method not implemented + Log POST PNFD Content - Method not implemented + [Documentation] The objective is to test that POST method is not allowed to create new PNF Descriptor content + ${headers} Create Dictionary Content-Type=application/json Accept=application/json + Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers} + ${resp}= Post Request web_session ${pnf_descriptors_url}/${pnfdId}/pnfd_content + Should Be Equal As Strings 405 ${resp.status_code} + +PATCH PNFD Content - Method not implemented + Log PATCH PNFD Content - Method not implemented + [Documentation] The objective is to test that PATCH method is not allowed to update a PNF Descriptor content + ${headers} Create Dictionary Content-Type=application/json Accept=application/json + Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers} + ${resp}= Patch Request web_session ${pnf_descriptors_url}/${pnfdId}/pnfd_content + Should Be Equal As Strings 405 ${resp.status_code} + +DELETE PNFD Content - Method not implemented + Log DELETE PNFD Content - Method not implemented + [Documentation] The objective is to test that DELETE method is not allowed to delete a PNF Descriptor content + ${headers} Create Dictionary Content-Type=application/json Accept=application/json + Create Session web_session http://${CATALOG_IP}:${catalog_port} headers=${headers} + ${resp}= Delete Request web_session ${pnf_descriptors_url}/${pnfdId}/pnfd_content + Should Be Equal As Strings 405 ${resp.status_code} + +*** Keywords *** +Create Multi Part + [Arguments] ${addTo} ${partName} ${filePath} ${contentType}=${None} ${content}=${None} + ${fileData}= Run Keyword If '''${content}''' != '''${None}''' Set Variable ${content} + ... ELSE Get Binary File ${filePath} + ${fileDir} ${fileName}= Split Path ${filePath} + ${partData}= Create List ${fileName} ${fileData} ${contentType} + Set To Dictionary ${addTo} ${partName}=${partData} \ No newline at end of file diff --git a/tests/vfc/nfvo-catalog/files/ran-du.csar b/tests/vfc/nfvo-catalog/files/ran-du.csar new file mode 100644 index 0000000000000000000000000000000000000000..45168a96465d3d8feb46e00361664f075cc7e122 GIT binary patch literal 2688 zcmZuz2{=^iAD*#}Df_M@Ym=R#Fc=}Cv5v?-jBzb9YK(o~O2`t5B5Na}DA|oj*9^%J zTEV|oT2!0r)?gTVK0{=I-{5sAZl zppm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