blob: 738a4311d63e375eb8c1aef9ae0014dfc0331c16 [file] [log] [blame]
tragait9bbcb1b2020-02-24 16:33:50 +00001*** Settings ***
2Library Collections
3Library RequestsLibrary
4Library OperatingSystem
5Library json
6Library 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 ***
21Test SDNC Keystore
efiacor125390b2020-05-06 01:14:00 +010022 [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 *************************
tragait9bbcb1b2020-02-24 16:33:50 +000031
32Test 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}
efiacor125390b2020-05-06 01:14:00 +010036 &{bp_file}= create Dictionary file ${bp_archive}
tragait9bbcb1b2020-02-24 16:33:50 +000037 &{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
41Distribute 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
53Get 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 ""
efiacor125390b2020-05-06 01:14:00 +010065 FOR ${member} IN @{all_wf_members}
66 ${workflow_uuid}= Set Variable ${member}[workflowSpecification][artifactInfo][artifactUuid]
67 ${workflow_name}= Set Variable ${member}[workflowSpecification][artifactInfo][artifactName]
68 Log to console The workflow ${workflow_name} has uuid : ${workflow_uuid}
69 ${activate_workflow_uuid}= Set Variable If '${workflow_name}' == 'PNFSoftwareUpgrade' ${workflow_uuid} ${activate_workflow_uuid}
70 ${activate_workflow_name}= Set Variable If '${workflow_name}' == 'PNFSoftwareUpgrade' ${workflow_name} ${activate_workflow_name}
71 ${download_workflow_uuid}= Set Variable If '${workflow_name}' == 'PNFSWUPDownload' ${workflow_uuid} ${download_workflow_uuid}
72 ${download_workflow_name}= Set Variable If '${workflow_name}' == 'PNFSWUPDownload' ${workflow_name} ${download_workflow_name}
73 END
tragait9bbcb1b2020-02-24 16:33:50 +000074
tragait9bbcb1b2020-02-24 16:33:50 +000075 SET GLOBAL VARIABLE ${activate_workflow_uuid}
76 SET GLOBAL VARIABLE ${download_workflow_uuid}
tragait9bbcb1b2020-02-24 16:33:50 +000077 Run Keyword If '${activate_workflow_name}' == 'PNFSoftwareUpgrade' log to console \nexecuted with expected result
78 Run Keyword If '${download_workflow_name}' == 'PNFSWUPDownload' log to console \nexecuted with expected result
79 Should Be Equal As Strings '${activate_workflow_name}' 'PNFSoftwareUpgrade'
80 Should Be Equal As Strings '${download_workflow_name}' 'PNFSWUPDownload'
81
82Invoke Service Instantiation for pnf software download
83 Create Session api_handler_session http://${REPO_IP}:8080
84 ${data}= Get Binary File ${CURDIR}${/}data${/}serviceInstantiationDownloadRequest.json
85 &{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
86 ${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}
87 Run Keyword If '${service_instantiation_request.status_code}' == '200' log to console \nexecuted with expected result
88 log to console ${service_instantiation_request.content}
89 ${service_instantiation_json_response}= Evaluate json.loads(r"""${service_instantiation_request.content}""", strict=False) json
90 ${request_ID}= Set Variable ${service_instantiation_json_response}[requestReferences][requestId]
91 ${actual_request_state}= Set Variable ""
efiacor125390b2020-05-06 01:14:00 +010092 FOR ${INDEX} IN RANGE ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT}
93 ${orchestration_status_request}= Get Request api_handler_session /onap/so/infra/orchestrationRequests/v7/${request_ID}
94 Run Keyword If '${orchestration_status_request.status_code}' == '200' log to console \nexecuted with expected result
95 log to console ${orchestration_status_request.content}
96 ${orchestration_json_response}= Evaluate json.loads(r"""${orchestration_status_request.content}""", strict=False) json
97 ${actual_request_state}= SET VARIABLE ${orchestration_json_response}[request][requestStatus][requestState]
98 Log To Console Received actual repsonse status:${actual_request_state}
99 RUN KEYWORD IF '${actual_request_state}' == 'COMPLETE' or '${actual_request_state}' == 'FAILED' Exit For Loop
100 log to console Will try again after ${SLEEP_INTERVAL_SEC} seconds
101 SLEEP ${SLEEP_INTERVAL_SEC}s
102 END
tragait9bbcb1b2020-02-24 16:33:50 +0000103 Log To Console final repsonse status received: ${actual_request_state}
efiacor125390b2020-05-06 01:14:00 +0100104 Run Keyword If '${actual_request_state}' == 'COMPLETE' log to console \nexecuted with expected result
105 Should Be Equal As Strings '${actual_request_state}' 'COMPLETE'
tragait9bbcb1b2020-02-24 16:33:50 +0000106
107Test verify PNF Configuration for software download
108 [Documentation] Checking PNF configuration params
tragait9bbcb1b2020-02-24 16:33:50 +0000109 Create Session sdnc http://${REPO_IP}:8282
110 &{headers}= Create Dictionary Authorization=Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ== Content-Type=application/json
111 ${mount}= Get File ${CURDIR}${/}data${/}mount.json
112 Log to console ${mount}
113 ${pnf_mount_resp}= Put Request sdnc ${SDNC_MOUNT_PATH} data=${mount} headers=${headers}
114 Should Be Equal As Strings ${pnf_mount_resp.status_code} 201
115 SLEEP 10
116 ${pnfsim_software_resp}= Get Request sdnc ${PNFSIM_MOUNT_PATH} headers=${headers}
117 Should Be Equal As Strings ${pnfsim_software_resp.status_code} 200
118 Log to console ${pnfsim_software_resp.content}
119 ${pnfsim_software_resp_json}= Evaluate json.loads(r"""${pnfsim_software_resp.content}""", strict=False) json
120 ${all_upgp_members}= Set Variable ${pnfsim_software_resp_json['software-upgrade']['upgrade-package']}
efiacor125390b2020-05-06 01:14:00 +0100121 FOR ${member} IN @{all_upgp_members}
122 ${soft_ver}= Get From Dictionary ${member} software-version
123 ${soft_status}= Get From Dictionary ${member} current-status
124 Log to console The node ${pnfName} has software version ${soft_ver} : ${soft_status}
125 Run Keyword If '${soft_ver}' == 'pnf_sw_version-2.0.0' Exit For Loop
126 END
tragait9bbcb1b2020-02-24 16:33:50 +0000127 Run Keyword If '${soft_ver}' == 'pnf_sw_version-2.0.0' log to console \nexecuted with expected result
128 Should Be Equal As Strings '${soft_ver}' 'pnf_sw_version-2.0.0'
129 Should Be Equal As Strings '${soft_status}' 'DOWNLOAD_COMPLETED'
130
131Invoke Service Instantiation for pnf software activation
132 Create Session api_handler_session http://${REPO_IP}:8080
133 ${data}= Get Binary File ${CURDIR}${/}data${/}serviceInstantiationActivationRequest.json
134 &{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
135 ${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}
136 Run Keyword If '${service_instantiation_request.status_code}' == '200' log to console \nexecuted with expected result
137 log to console ${service_instantiation_request.content}
138 ${service_instantiation_json_response}= Evaluate json.loads(r"""${service_instantiation_request.content}""", strict=False) json
139 ${request_ID}= Set Variable ${service_instantiation_json_response}[requestReferences][requestId]
140 ${actual_request_state}= Set Variable ""
efiacor125390b2020-05-06 01:14:00 +0100141 FOR ${INDEX} IN RANGE ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT}
142 ${orchestration_status_request}= Get Request api_handler_session /onap/so/infra/orchestrationRequests/v7/${request_ID}
143 Run Keyword If '${orchestration_status_request.status_code}' == '200' log to console \nexecuted with expected result
144 log to console ${orchestration_status_request.content}
145 ${orchestration_json_response}= Evaluate json.loads(r"""${orchestration_status_request.content}""", strict=False) json
146 ${actual_request_state}= SET VARIABLE ${orchestration_json_response}[request][requestStatus][requestState]
147 Log To Console Received actual repsonse status:${actual_request_state}
148 RUN KEYWORD IF '${actual_request_state}' == 'COMPLETE' or '${actual_request_state}' == 'FAILED' Exit For Loop
149 log to console Will try again after ${SLEEP_INTERVAL_SEC} seconds
150 SLEEP ${SLEEP_INTERVAL_SEC}s
151 END
tragait9bbcb1b2020-02-24 16:33:50 +0000152 Log To Console final repsonse status received: ${actual_request_state}
efiacor125390b2020-05-06 01:14:00 +0100153 Run Keyword If '${actual_request_state}' == 'COMPLETE' log to console \nexecuted with expected result
154 Should Be Equal As Strings '${actual_request_state}' 'COMPLETE'
tragait9bbcb1b2020-02-24 16:33:50 +0000155
efiacor125390b2020-05-06 01:14:00 +0100156Test verify PNF Configuration for software activate
157 [Documentation] Checking PNF configuration params
tragait9bbcb1b2020-02-24 16:33:50 +0000158 Create Session sdnc http://${REPO_IP}:8282
159 &{headers}= Create Dictionary Authorization=Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ== Content-Type=application/json
160 ${mount}= Get File ${CURDIR}${/}data${/}mount.json
161 Log to console ${mount}
162 ${pnf_mount_resp}= Put Request sdnc ${SDNC_MOUNT_PATH} data=${mount} headers=${headers}
163 Should Be Equal As Strings ${pnf_mount_resp.status_code} 201
164 SLEEP 10
165 ${pnfsim_software_resp}= Get Request sdnc ${PNFSIM_MOUNT_PATH} headers=${headers}
166 Should Be Equal As Strings ${pnfsim_software_resp.status_code} 200
167 Log to console ${pnfsim_software_resp.content}
168 ${pnfsim_software_resp_json}= Evaluate json.loads(r"""${pnfsim_software_resp.content}""", strict=False) json
169 ${all_upgp_members}= Set Variable ${pnfsim_software_resp_json['software-upgrade']['upgrade-package']}
efiacor125390b2020-05-06 01:14:00 +0100170 FOR ${member} IN @{all_upgp_members}
171 ${soft_ver}= Get From Dictionary ${member} software-version
172 ${soft_status}= Get From Dictionary ${member} current-status
173 Log to console The node ${pnfName} has software version ${soft_ver} : ${soft_status}
174 Run Keyword If '${soft_ver}' == 'pnf_sw_version-3.0.0' Exit For Loop
175 END
tragait9bbcb1b2020-02-24 16:33:50 +0000176 Run Keyword If '${soft_ver}' == 'pnf_sw_version-3.0.0' log to console \nexecuted with expected result
177 Should Be Equal As Strings '${soft_ver}' 'pnf_sw_version-3.0.0'
178 Should Be Equal As Strings '${soft_status}' 'ACTIVATION_COMPLETED'
179
180Test AAI-update for target software version verify
181 Create Session aai_simulator_session https://${REPO_IP}:9993
182 &{headers}= Create Dictionary Authorization=Basic YWFpOmFhaS5vbmFwLm9yZzpkZW1vMTIzNDU2IQ== Content-Type=application/json Accept=application/json verify=False
efiacor125390b2020-05-06 01:14:00 +0100183 FOR ${INDEX} IN RANGE ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT}
184 ${get_pnf_request}= Get Request aai_simulator_session aai/v11/network/pnfs/pnf/${pnfName} headers=${headers}
185 Run Keyword If '${get_pnf_request.status_code}' == '200' log to console \nexecuted with expected result
186 ${get_pnf_json_response}= Evaluate json.loads(r"""${get_pnf_request.content}""", strict=False) json
187 Log to console ${get_pnf_json_response}
188 ${sw_version}= Set Variable ${get_pnf_json_response}[sw-version]
189 Log to console ${sw_version}
190 Run Keyword If '${sw_version}' == 'pnf_sw_version-3.0.0' Exit For Loop
191 log to console Will try again after ${SLEEP_INTERVAL_SEC} seconds
192 SLEEP ${SLEEP_INTERVAL_SEC}s
193 END
tragait9bbcb1b2020-02-24 16:33:50 +0000194 Log To Console final target software version received: ${sw_version}
195 Run Keyword If '${sw_version}' == 'pnf_sw_version-3.0.0' log to console \nexecuted with expected result
196 Should Be Equal As Strings '${sw_version}' 'pnf_sw_version-3.0.0'