tragait | 9bbcb1b | 2020-02-24 16:33:50 +0000 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Library Collections |
| 3 | Library RequestsLibrary |
| 4 | Library OperatingSystem |
| 5 | Library json |
| 6 | Library String |
| 7 | |
| 8 | *** Variables *** |
| 9 | ${SDNC_KEYSTORE_CONFIG_PATH} /restconf/config/netconf-keystore:keystore |
| 10 | ${SDNC_MOUNT_PATH} /restconf/config/network-topology:network-topology/topology/topology-netconf/node/PNFDemo |
| 11 | ${PNFSIM_MOUNT_PATH} /restconf/config/network-topology:network-topology/topology/topology-netconf/node/PNFDemo/yang-ext:mount/pnf-sw-upgrade:software-upgrade |
| 12 | ${PNFSIM_DELETE_PATH} /restconf/config/network-topology:network-topology/topology/topology-netconf/node/PNFDemo |
| 13 | ${BP_UPLOAD_URL} /api/v1/blueprint-model/publish |
| 14 | ${BP_PROCESS_URL} /api/v1/execution-service/process |
| 15 | ${BP_ARCHIVE_PATH} ${CURDIR}/data/blueprint_archive.zip |
| 16 | ${SLEEP_INTERVAL_SEC}= 5 |
| 17 | ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT}= 20 |
| 18 | |
| 19 | |
| 20 | *** Test Cases *** |
| 21 | Test SDNC Keystore |
| 22 | [Documentation] Checking keystore after SDNC installation |
| 23 | Create Session sdnc http://${REPO_IP}:8282 |
| 24 | &{headers}= Create Dictionary Authorization=Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ== Content-Type=application/json Accept=application/json |
| 25 | ${resp}= Get Request sdnc ${SDNC_KEYSTORE_CONFIG_PATH} headers=${headers} |
| 26 | Should Be Equal As Strings ${resp.status_code} 200 |
| 27 | ${keystoreContent}= Convert To String ${resp.content} |
| 28 | Log to console ************************* |
| 29 | Log to console ${resp.content} |
| 30 | Log to console ************************* |
| 31 | |
| 32 | Test BP-PROC upload blueprint archive |
| 33 | [Documentation] Upload Blueprint archive to BP processor |
| 34 | Create Session blueprint http://${REPO_IP}:8000 |
| 35 | ${bp_archive}= Get Binary File ${BP_ARCHIVE_PATH} |
| 36 | &{bp_file}= create Dictionary file ${bp_archive} |
| 37 | &{headers}= Create Dictionary Authorization=Basic Y2NzZGthcHBzOmNjc2RrYXBwcw== |
| 38 | ${resp}= Post Request blueprint ${BP_UPLOAD_URL} files=${bp_file} headers=${headers} |
| 39 | Should Be Equal As Strings ${resp.status_code} 200 |
| 40 | |
| 41 | Distribute Service Template |
| 42 | Create Session sdc_controller_session http://${REPO_IP}:8085 |
| 43 | ${data}= Get Binary File ${CURDIR}${/}data${/}distributeServiceTemplate.json |
| 44 | &{headers}= Create Dictionary Authorization=Basic bXNvX2FkbWluOnBhc3N3b3JkMSQ= resource-location=/app/distribution-test-zip/unzipped/ Content-Type=application/json Accept=application/json |
| 45 | ${resp}= Post Request sdc_controller_session /test/treatNotification/v1 data=${data} headers=${headers} |
| 46 | Run Keyword If '${resp.status_code}' == '200' log to console \nexecuted with expected result |
| 47 | Should Be Equal As Strings '${resp.status_code}' '200' |
| 48 | ${serviceInstanceId}= Set Variable cd4decf6-4f27-4775-9561-0e683ed43635 |
| 49 | SET GLOBAL VARIABLE ${serviceInstanceId} |
| 50 | ${pnfName}= Set Variable PNFDemo |
| 51 | SET GLOBAL VARIABLE ${pnfName} |
| 52 | |
| 53 | Get pnf workflow |
| 54 | Create Session api_handler_session http://${REPO_IP}:8080 |
| 55 | &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json |
| 56 | ${get_pnfworkflows_request}= Get Request api_handler_session /onap/so/infra/workflowSpecifications/v1/pnfWorkflows headers=${headers} |
| 57 | Run Keyword If '${get_pnfworkflows_request.status_code}' == '200' log to console \nexecuted with expected result |
| 58 | log to console ${get_pnfworkflows_request.content} |
| 59 | ${pnfworkflows_json_response}= Evaluate json.loads(r"""${get_pnfworkflows_request.content}""", strict=False) json |
| 60 | ${all_wf_members}= Set Variable ${pnfworkflows_json_response['workflowSpecificationList']} |
| 61 | ${activate_workflow_uuid}= Set Variable "" |
| 62 | ${activate_workflow_name}= Set Variable "" |
| 63 | ${download_workflow_uuid}= Set Variable "" |
| 64 | ${download_workflow_name}= Set Variable "" |
| 65 | |
| 66 | :FOR ${member} IN @{all_wf_members} |
| 67 | \ ${workflow_uuid}= Set Variable ${member}[workflowSpecification][artifactInfo][artifactUuid] |
| 68 | \ ${workflow_name}= Set Variable ${member}[workflowSpecification][artifactInfo][artifactName] |
| 69 | \ Log to console The workflow ${workflow_name} has uuid : ${workflow_uuid} |
| 70 | \ ${activate_workflow_uuid}= Set Variable If '${workflow_name}' == 'PNFSoftwareUpgrade' ${workflow_uuid} ${activate_workflow_uuid} |
| 71 | \ ${activate_workflow_name}= Set Variable If '${workflow_name}' == 'PNFSoftwareUpgrade' ${workflow_name} ${activate_workflow_name} |
| 72 | \ ${download_workflow_uuid}= Set Variable If '${workflow_name}' == 'PNFSWUPDownload' ${workflow_uuid} ${download_workflow_uuid} |
| 73 | \ ${download_workflow_name}= Set Variable If '${workflow_name}' == 'PNFSWUPDownload' ${workflow_name} ${download_workflow_name} |
| 74 | |
| 75 | SET GLOBAL VARIABLE ${activate_workflow_uuid} |
| 76 | SET GLOBAL VARIABLE ${download_workflow_uuid} |
| 77 | |
| 78 | Run Keyword If '${activate_workflow_name}' == 'PNFSoftwareUpgrade' log to console \nexecuted with expected result |
| 79 | Run Keyword If '${download_workflow_name}' == 'PNFSWUPDownload' log to console \nexecuted with expected result |
| 80 | Should Be Equal As Strings '${activate_workflow_name}' 'PNFSoftwareUpgrade' |
| 81 | Should Be Equal As Strings '${download_workflow_name}' 'PNFSWUPDownload' |
| 82 | |
| 83 | Invoke Service Instantiation for pnf software download |
| 84 | Create Session api_handler_session http://${REPO_IP}:8080 |
| 85 | ${data}= Get Binary File ${CURDIR}${/}data${/}serviceInstantiationDownloadRequest.json |
| 86 | &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json X-ONAP-RequestID=0ddc448d-5513-44bc-8b02-5759d84600d5 X-ONAP-PartnerName=ONAP X-RequestorID=VID |
| 87 | ${service_instantiation_request}= Post Request api_handler_session /onap/so/infra/instanceManagement/v1/serviceInstances/${serviceInstanceId}/pnfs/${pnfName}/workflows/${download_workflow_uuid} data=${data} headers=${headers} |
| 88 | Run Keyword If '${service_instantiation_request.status_code}' == '200' log to console \nexecuted with expected result |
| 89 | log to console ${service_instantiation_request.content} |
| 90 | ${service_instantiation_json_response}= Evaluate json.loads(r"""${service_instantiation_request.content}""", strict=False) json |
| 91 | ${request_ID}= Set Variable ${service_instantiation_json_response}[requestReferences][requestId] |
| 92 | ${actual_request_state}= Set Variable "" |
| 93 | |
| 94 | : FOR ${INDEX} IN RANGE ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT} |
| 95 | \ ${orchestration_status_request}= Get Request api_handler_session /onap/so/infra/orchestrationRequests/v7/${request_ID} |
| 96 | \ Run Keyword If '${orchestration_status_request.status_code}' == '200' log to console \nexecuted with expected result |
| 97 | \ log to console ${orchestration_status_request.content} |
| 98 | \ ${orchestration_json_response}= Evaluate json.loads(r"""${orchestration_status_request.content}""", strict=False) json |
| 99 | \ ${actual_request_state}= SET VARIABLE ${orchestration_json_response}[request][requestStatus][requestState] |
| 100 | \ Log To Console Received actual repsonse status:${actual_request_state} |
| 101 | \ RUN KEYWORD IF '${actual_request_state}' == 'COMPLETED' or '${actual_request_state}' == 'FAILED' Exit For Loop |
| 102 | \ log to console Will try again after ${SLEEP_INTERVAL_SEC} seconds |
| 103 | \ SLEEP ${SLEEP_INTERVAL_SEC}s |
| 104 | |
| 105 | Log To Console final repsonse status received: ${actual_request_state} |
| 106 | Run Keyword If '${actual_request_state}' == 'COMPLETED' log to console \nexecuted with expected result |
| 107 | Should Be Equal As Strings '${actual_request_state}' 'COMPLETED' |
| 108 | |
| 109 | Test verify PNF Configuration for software download |
| 110 | [Documentation] Checking PNF configuration params |
| 111 | |
| 112 | Create Session sdnc http://${REPO_IP}:8282 |
| 113 | &{headers}= Create Dictionary Authorization=Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ== Content-Type=application/json |
| 114 | ${mount}= Get File ${CURDIR}${/}data${/}mount.json |
| 115 | Log to console ${mount} |
| 116 | ${pnf_mount_resp}= Put Request sdnc ${SDNC_MOUNT_PATH} data=${mount} headers=${headers} |
| 117 | Should Be Equal As Strings ${pnf_mount_resp.status_code} 201 |
| 118 | SLEEP 10 |
| 119 | ${pnfsim_software_resp}= Get Request sdnc ${PNFSIM_MOUNT_PATH} headers=${headers} |
| 120 | Should Be Equal As Strings ${pnfsim_software_resp.status_code} 200 |
| 121 | Log to console ${pnfsim_software_resp.content} |
| 122 | ${pnfsim_software_resp_json}= Evaluate json.loads(r"""${pnfsim_software_resp.content}""", strict=False) json |
| 123 | ${all_upgp_members}= Set Variable ${pnfsim_software_resp_json['software-upgrade']['upgrade-package']} |
| 124 | |
| 125 | :FOR ${member} IN @{all_upgp_members} |
| 126 | \ ${soft_ver}= Get From Dictionary ${member} software-version |
| 127 | \ ${soft_status}= Get From Dictionary ${member} current-status |
| 128 | \ Log to console The node ${pnfName} has software version ${soft_ver} : ${soft_status} |
| 129 | \ Run Keyword If '${soft_ver}' == 'pnf_sw_version-2.0.0' Exit For Loop |
| 130 | |
| 131 | Run Keyword If '${soft_ver}' == 'pnf_sw_version-2.0.0' log to console \nexecuted with expected result |
| 132 | Should Be Equal As Strings '${soft_ver}' 'pnf_sw_version-2.0.0' |
| 133 | Should Be Equal As Strings '${soft_status}' 'DOWNLOAD_COMPLETED' |
| 134 | |
| 135 | Invoke Service Instantiation for pnf software activation |
| 136 | Create Session api_handler_session http://${REPO_IP}:8080 |
| 137 | ${data}= Get Binary File ${CURDIR}${/}data${/}serviceInstantiationActivationRequest.json |
| 138 | &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json X-ONAP-RequestID=4e104e12-5539-4557-b31e-00369398c214 X-ONAP-PartnerName=ONAP X-RequestorID=VID |
| 139 | ${service_instantiation_request}= Post Request api_handler_session /onap/so/infra/instanceManagement/v1/serviceInstances/${serviceInstanceId}/pnfs/${pnfName}/workflows/${activate_workflow_uuid} data=${data} headers=${headers} |
| 140 | Run Keyword If '${service_instantiation_request.status_code}' == '200' log to console \nexecuted with expected result |
| 141 | log to console ${service_instantiation_request.content} |
| 142 | ${service_instantiation_json_response}= Evaluate json.loads(r"""${service_instantiation_request.content}""", strict=False) json |
| 143 | ${request_ID}= Set Variable ${service_instantiation_json_response}[requestReferences][requestId] |
| 144 | ${actual_request_state}= Set Variable "" |
| 145 | : FOR ${INDEX} IN RANGE ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT} |
| 146 | \ ${orchestration_status_request}= Get Request api_handler_session /onap/so/infra/orchestrationRequests/v7/${request_ID} |
| 147 | \ Run Keyword If '${orchestration_status_request.status_code}' == '200' log to console \nexecuted with expected result |
| 148 | \ log to console ${orchestration_status_request.content} |
| 149 | \ ${orchestration_json_response}= Evaluate json.loads(r"""${orchestration_status_request.content}""", strict=False) json |
| 150 | \ ${actual_request_state}= SET VARIABLE ${orchestration_json_response}[request][requestStatus][requestState] |
| 151 | \ Log To Console Received actual repsonse status:${actual_request_state} |
| 152 | \ RUN KEYWORD IF '${actual_request_state}' == 'COMPLETED' or '${actual_request_state}' == 'FAILED' Exit For Loop |
| 153 | \ log to console Will try again after ${SLEEP_INTERVAL_SEC} seconds |
| 154 | \ SLEEP ${SLEEP_INTERVAL_SEC}s |
| 155 | |
| 156 | Log To Console final repsonse status received: ${actual_request_state} |
| 157 | Run Keyword If '${actual_request_state}' == 'COMPLETED' log to console \nexecuted with expected result |
| 158 | Should Be Equal As Strings '${actual_request_state}' 'COMPLETED' |
| 159 | |
| 160 | Test verify PNF Configuration for software activate |
| 161 | [Documentation] Checking PNF configuration params |
| 162 | |
| 163 | Create Session sdnc http://${REPO_IP}:8282 |
| 164 | &{headers}= Create Dictionary Authorization=Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ== Content-Type=application/json |
| 165 | ${mount}= Get File ${CURDIR}${/}data${/}mount.json |
| 166 | Log to console ${mount} |
| 167 | ${pnf_mount_resp}= Put Request sdnc ${SDNC_MOUNT_PATH} data=${mount} headers=${headers} |
| 168 | Should Be Equal As Strings ${pnf_mount_resp.status_code} 201 |
| 169 | SLEEP 10 |
| 170 | ${pnfsim_software_resp}= Get Request sdnc ${PNFSIM_MOUNT_PATH} headers=${headers} |
| 171 | Should Be Equal As Strings ${pnfsim_software_resp.status_code} 200 |
| 172 | Log to console ${pnfsim_software_resp.content} |
| 173 | ${pnfsim_software_resp_json}= Evaluate json.loads(r"""${pnfsim_software_resp.content}""", strict=False) json |
| 174 | ${all_upgp_members}= Set Variable ${pnfsim_software_resp_json['software-upgrade']['upgrade-package']} |
| 175 | |
| 176 | :FOR ${member} IN @{all_upgp_members} |
| 177 | \ ${soft_ver}= Get From Dictionary ${member} software-version |
| 178 | \ ${soft_status}= Get From Dictionary ${member} current-status |
| 179 | \ Log to console The node ${pnfName} has software version ${soft_ver} : ${soft_status} |
| 180 | \ Run Keyword If '${soft_ver}' == 'pnf_sw_version-3.0.0' Exit For Loop |
| 181 | |
| 182 | Run Keyword If '${soft_ver}' == 'pnf_sw_version-3.0.0' log to console \nexecuted with expected result |
| 183 | Should Be Equal As Strings '${soft_ver}' 'pnf_sw_version-3.0.0' |
| 184 | Should Be Equal As Strings '${soft_status}' 'ACTIVATION_COMPLETED' |
| 185 | |
| 186 | Test AAI-update for target software version verify |
| 187 | Create Session aai_simulator_session https://${REPO_IP}:9993 |
| 188 | &{headers}= Create Dictionary Authorization=Basic YWFpOmFhaS5vbmFwLm9yZzpkZW1vMTIzNDU2IQ== Content-Type=application/json Accept=application/json verify=False |
| 189 | : FOR ${INDEX} IN RANGE ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT} |
| 190 | \ ${get_pnf_request}= Get Request aai_simulator_session aai/v11/network/pnfs/pnf/${pnfName} headers=${headers} |
| 191 | \ Run Keyword If '${get_pnf_request.status_code}' == '200' log to console \nexecuted with expected result |
| 192 | \ ${get_pnf_json_response}= Evaluate json.loads(r"""${get_pnf_request.content}""", strict=False) json |
| 193 | \ Log to console ${get_pnf_json_response} |
| 194 | \ ${sw_version}= Set Variable ${get_pnf_json_response}[sw-version] |
| 195 | \ Log to console ${sw_version} |
| 196 | \ Run Keyword If '${sw_version}' == 'pnf_sw_version-3.0.0' Exit For Loop |
| 197 | \ log to console Will try again after ${SLEEP_INTERVAL_SEC} seconds |
| 198 | \ SLEEP ${SLEEP_INTERVAL_SEC}s |
| 199 | |
| 200 | Log To Console final target software version received: ${sw_version} |
| 201 | Run Keyword If '${sw_version}' == 'pnf_sw_version-3.0.0' log to console \nexecuted with expected result |
| 202 | Should Be Equal As Strings '${sw_version}' 'pnf_sw_version-3.0.0' |