CSIT Support for ServiceLevel PNF Software Upgrade
[integration/csit.git] / tests / usecases-pnf-sw-upgrade / pnf-sw-upgrade / pnf-sw-upgrade.robot
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 ${SDNC_MOUNT_PATH2}    /restconf/config/network-topology:network-topology/topology/topology-netconf/node/PNFDemo1
12 ${PNFSIM_MOUNT_PATH}    /restconf/config/network-topology:network-topology/topology/topology-netconf/node/PNFDemo/yang-ext:mount/pnf-sw-upgrade:software-upgrade
13 ${PNFSIM_MOUNT_PATH2}    /restconf/config/network-topology:network-topology/topology/topology-netconf/node/PNFDemo1/yang-ext:mount/pnf-sw-upgrade:software-upgrade
14 ${PNFSIM_DELETE_PATH}    /restconf/config/network-topology:network-topology/topology/topology-netconf/node/PNFDemo
15 ${BP_UPLOAD_URL}    /api/v1/blueprint-model/publish
16 ${BP_PROCESS_URL}    /api/v1/execution-service/process
17 ${BP_ARCHIVE_PATH}    ${CURDIR}/data/blueprint_archive.zip
18 ${SLEEP_INTERVAL_SEC}=   5
19 ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT}=     20   
20
21
22 *** Test Cases ***
23 Test SDNC Keystore
24     [Documentation]    Checking keystore after SDNC installation
25     Create Session   sdnc  http://${REPO_IP}:8282
26     &{headers}=  Create Dictionary    Authorization=Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==    Content-Type=application/json    Accept=application/json
27     ${resp}=    Get Request    sdnc    ${SDNC_KEYSTORE_CONFIG_PATH}    headers=${headers}
28     Should Be Equal As Strings    ${resp.status_code}    200
29     ${keystoreContent}=    Convert To String    ${resp.content}
30     Log to console  *************************
31     Log to console  ${resp.content}
32     Log to console  *************************
33
34 Test BP-PROC upload blueprint archive
35      [Documentation]    Upload Blueprint archive to BP processor
36      Create Session   blueprint  http://${REPO_IP}:8000
37      ${bp_archive}=    Get Binary File    ${BP_ARCHIVE_PATH}
38      &{bp_file}=    create Dictionary    file    ${bp_archive}
39      &{headers}=  Create Dictionary    Authorization=Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==
40      ${resp}=    Post Request    blueprint    ${BP_UPLOAD_URL}    files=${bp_file}    headers=${headers}
41      Should Be Equal As Strings    ${resp.status_code}    200
42
43 Distribute Service Template
44     Create Session   sdc_controller_session  http://${REPO_IP}:8085
45     ${data}=    Get Binary File     ${CURDIR}${/}data${/}distributeServiceTemplate.json
46     &{headers}=  Create Dictionary    Authorization=Basic bXNvX2FkbWluOnBhc3N3b3JkMSQ=    resource-location=/app/distribution-test-zip/unzipped/    Content-Type=application/json    Accept=application/json
47     ${resp}=    Post Request    sdc_controller_session    /test/treatNotification/v1    data=${data}    headers=${headers}
48     Run Keyword If  '${resp.status_code}' == '200'  log to console  \nexecuted with expected result
49     Should Be Equal As Strings    '${resp.status_code}'    '200'
50     ${serviceInstanceId}=    Set Variable    cd4decf6-4f27-4775-9561-0e683ed43635
51     SET GLOBAL VARIABLE     ${serviceInstanceId}
52     ${pnfName}=    Set Variable    PNFDemo
53     SET GLOBAL VARIABLE      ${pnfName}
54     ${pnfName1}=    Set Variable    PNFDemo1
55     SET GLOBAL VARIABLE      ${pnfName1}
56
57 Get pnf workflow
58     Create Session   api_handler_session  http://${REPO_IP}:8080
59     &{headers}=  Create Dictionary    Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==    Content-Type=application/json    Accept=application/json
60     ${get_pnfworkflows_request}=    Get Request    api_handler_session    /onap/so/infra/workflowSpecifications/v1/workflows     headers=${headers}
61     Run Keyword If  '${get_pnfworkflows_request.status_code}' == '200'  log to console   \nexecuted with expected result
62     log to console      ${get_pnfworkflows_request.content}
63     ${pnfworkflows_json_response}=    Evaluate     json.loads(r"""${get_pnfworkflows_request.content}""", strict=False)    json
64     ${all_wf_members}=    Set Variable     ${pnfworkflows_json_response['workflowSpecificationList']}
65     ${activate_workflow_uuid}=    Set Variable    ""
66     ${activate_workflow_name}=    Set Variable    ""
67     ${download_workflow_uuid}=    Set Variable    ""
68     ${download_workflow_name}=    Set Variable    ""
69     ${serviceLevel_workflow_uuid}=    Set Variable    ""
70     ${serviceLevel_workflow_name}=    Set Variable    ""
71     FOR    ${member}     IN      @{all_wf_members}
72        ${workflow_uuid}=          Set Variable        ${member}[workflowSpecification][artifactInfo][artifactUuid]
73        ${workflow_name}=          Set Variable        ${member}[workflowSpecification][artifactInfo][artifactName]
74        Log to console   The workflow ${workflow_name} has uuid : ${workflow_uuid}
75        ${activate_workflow_uuid}=    Set Variable If  '${workflow_name}' == 'GenericPnfSoftwareUpgrade'    ${workflow_uuid}   ${activate_workflow_uuid}
76        ${activate_workflow_name}=    Set Variable If  '${workflow_name}' == 'GenericPnfSoftwareUpgrade'    ${workflow_name}   ${activate_workflow_name}
77        ${download_workflow_uuid}=    Set Variable If  '${workflow_name}' == 'GenericPnfSWUPDownload'       ${workflow_uuid}   ${download_workflow_uuid}
78        ${download_workflow_name}=    Set Variable If  '${workflow_name}' == 'GenericPnfSWUPDownload'       ${workflow_name}   ${download_workflow_name}
79        ${serviceLevel_workflow_uuid}=    Set Variable If  '${workflow_name}' == 'ServiceLevelUpgrade'      ${workflow_uuid}   ${serviceLevel_workflow_uuid}
80        ${serviceLevel_workflow_name}=    Set Variable If  '${workflow_name}' == 'ServiceLevelUpgrade'      ${workflow_name}   ${serviceLevel_workflow_name}
81     END
82
83     SET GLOBAL VARIABLE       ${activate_workflow_uuid}
84     SET GLOBAL VARIABLE       ${download_workflow_uuid}
85     SET GLOBAL VARIABLE       ${serviceLevel_workflow_uuid}
86     Run Keyword If  '${activate_workflow_name}' == 'GenericPnfSoftwareUpgrade'  log to console   \nexecuted with expected result
87     Run Keyword If  '${download_workflow_name}' == 'GenericPnfSWUPDownload'  log to console   \nexecuted with expected result
88     Run Keyword If  '${serviceLevel_workflow_name}' == 'ServiceLevelUpgrade'  log to console   \nexecuted with expected result
89     Should Be Equal As Strings    '${activate_workflow_name}'    'GenericPnfSoftwareUpgrade'
90     Should Be Equal As Strings    '${download_workflow_name}'    'GenericPnfSWUPDownload'
91     Should Be Equal As Strings    '${serviceLevel_workflow_name}'    'ServiceLevelUpgrade'
92
93 Invoke Service Instantiation for pnf software download
94     Create Session   api_handler_session  http://${REPO_IP}:8080
95     ${data}=    Get Binary File     ${CURDIR}${/}data${/}serviceInstantiationDownloadRequest.json
96     &{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
97     ${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}
98     Run Keyword If  '${service_instantiation_request.status_code}' == '200'  log to console   \nexecuted with expected result
99     log to console      ${service_instantiation_request.content}
100     ${service_instantiation_json_response}=    Evaluate     json.loads(r"""${service_instantiation_request.content}""", strict=False)    json
101     ${request_ID}=          Set Variable         ${service_instantiation_json_response}[requestReferences][requestId]
102     ${actual_request_state}=    Set Variable    ""
103      FOR    ${INDEX}    IN RANGE    ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT}
104        ${orchestration_status_request}=   Get Request  api_handler_session   /onap/so/infra/orchestrationRequests/v7/${request_ID}
105        Run Keyword If  '${orchestration_status_request.status_code}' == '200'  log to console   \nexecuted with expected result
106        log to console      ${orchestration_status_request.content}
107        ${orchestration_json_response}=    Evaluate     json.loads(r"""${orchestration_status_request.content}""", strict=False)    json
108        ${actual_request_state}=     SET VARIABLE       ${orchestration_json_response}[request][requestStatus][requestState]
109        Log To Console    Received actual repsonse status:${actual_request_state}
110        RUN KEYWORD IF   '${actual_request_state}' == 'COMPLETE' or '${actual_request_state}' == 'FAILED'      Exit For Loop
111        log to console  Will try again after ${SLEEP_INTERVAL_SEC} seconds
112        SLEEP   ${SLEEP_INTERVAL_SEC}s
113      END
114     Log To Console     final repsonse status received: ${actual_request_state}
115     Run Keyword If  '${actual_request_state}' == 'COMPLETE'  log to console   \nexecuted with expected result
116     Should Be Equal As Strings    '${actual_request_state}'    'COMPLETE'
117
118 Test verify PNF Configuration for software download
119      [Documentation]    Checking PNF configuration params
120      Create Session   sdnc  http://${REPO_IP}:8282
121      &{headers}=  Create Dictionary    Authorization=Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==    Content-Type=application/json
122      ${mount}=    Get File     ${CURDIR}${/}data${/}mount.json
123      Log to console  ${mount}
124      ${pnf_mount_resp}=    Put Request    sdnc    ${SDNC_MOUNT_PATH}    data=${mount}    headers=${headers}
125      Should Be Equal As Strings    ${pnf_mount_resp.status_code}    201
126      SLEEP   10
127      ${pnfsim_software_resp}=    Get Request    sdnc    ${PNFSIM_MOUNT_PATH}    headers=${headers}
128      Should Be Equal As Strings    ${pnfsim_software_resp.status_code}    200
129      Log to console  ${pnfsim_software_resp.content}
130      ${pnfsim_software_resp_json}=    Evaluate     json.loads(r"""${pnfsim_software_resp.content}""", strict=False)    json
131      ${all_upgp_members}=    Set Variable     ${pnfsim_software_resp_json['software-upgrade']['upgrade-package']}
132      FOR    ${member}     IN      @{all_upgp_members}
133         ${soft_ver}=    Get From Dictionary   ${member}     software-version
134         ${soft_status}=    Get From Dictionary   ${member}     current-status
135         Log to console   The node ${pnfName} has software version ${soft_ver} : ${soft_status}
136         Run Keyword If  '${soft_ver}' == 'pnf_sw_version-2.0.0'   Exit For Loop
137      END
138      Run Keyword If  '${soft_ver}' == 'pnf_sw_version-2.0.0'  log to console   \nexecuted with expected result
139      Should Be Equal As Strings    '${soft_ver}'    'pnf_sw_version-2.0.0'
140      Should Be Equal As Strings    '${soft_status}'    'DOWNLOAD_COMPLETED'
141
142 Invoke Service Instantiation for pnf software activation
143     Create Session   api_handler_session  http://${REPO_IP}:8080
144     ${data}=    Get Binary File     ${CURDIR}${/}data${/}serviceInstantiationActivationRequest.json
145     &{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
146     ${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}
147     Run Keyword If  '${service_instantiation_request.status_code}' == '200'  log to console   \nexecuted with expected result
148     log to console      ${service_instantiation_request.content}
149     ${service_instantiation_json_response}=    Evaluate     json.loads(r"""${service_instantiation_request.content}""", strict=False)    json
150     ${request_ID}=          Set Variable         ${service_instantiation_json_response}[requestReferences][requestId]
151     ${actual_request_state}=    Set Variable    ""
152      FOR    ${INDEX}    IN RANGE    ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT}
153        ${orchestration_status_request}=   Get Request  api_handler_session   /onap/so/infra/orchestrationRequests/v7/${request_ID}
154        Run Keyword If  '${orchestration_status_request.status_code}' == '200'  log to console   \nexecuted with expected result
155        log to console      ${orchestration_status_request.content}
156        ${orchestration_json_response}=    Evaluate     json.loads(r"""${orchestration_status_request.content}""", strict=False)    json
157        ${actual_request_state}=     SET VARIABLE       ${orchestration_json_response}[request][requestStatus][requestState]
158        Log To Console    Received actual repsonse status:${actual_request_state}
159        RUN KEYWORD IF   '${actual_request_state}' == 'COMPLETE' or '${actual_request_state}' == 'FAILED'      Exit For Loop
160        log to console  Will try again after ${SLEEP_INTERVAL_SEC} seconds
161        SLEEP   ${SLEEP_INTERVAL_SEC}s
162      END
163     Log To Console     final repsonse status received: ${actual_request_state}
164     Run Keyword If  '${actual_request_state}' == 'COMPLETE'  log to console   \nexecuted with expected result
165     Should Be Equal As Strings    '${actual_request_state}'    'COMPLETE'
166
167 Test verify PNF Configuration for software activate
168      [Documentation]    Checking PNF configuration params
169      Create Session   sdnc  http://${REPO_IP}:8282
170      &{headers}=  Create Dictionary    Authorization=Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==    Content-Type=application/json
171      ${mount}=    Get File     ${CURDIR}${/}data${/}mount.json
172      Log to console  ${mount}
173      ${pnf_mount_resp}=    Put Request    sdnc    ${SDNC_MOUNT_PATH}    data=${mount}    headers=${headers}
174      Should Be Equal As Strings    ${pnf_mount_resp.status_code}    201
175      SLEEP   10
176      ${pnfsim_software_resp}=    Get Request    sdnc    ${PNFSIM_MOUNT_PATH}    headers=${headers}
177      Should Be Equal As Strings    ${pnfsim_software_resp.status_code}    200
178      Log to console  ${pnfsim_software_resp.content}
179      ${pnfsim_software_resp_json}=    Evaluate     json.loads(r"""${pnfsim_software_resp.content}""", strict=False)    json
180      ${all_upgp_members}=    Set Variable     ${pnfsim_software_resp_json['software-upgrade']['upgrade-package']}
181      FOR    ${member}     IN      @{all_upgp_members}
182         ${soft_ver}=    Get From Dictionary   ${member}     software-version
183         ${soft_status}=    Get From Dictionary   ${member}     current-status
184         Log to console   The node ${pnfName} has software version ${soft_ver} : ${soft_status}
185         Run Keyword If  '${soft_ver}' == 'pnf_sw_version-3.0.0'   Exit For Loop
186      END
187      Run Keyword If  '${soft_ver}' == 'pnf_sw_version-3.0.0'  log to console   \nexecuted with expected result
188      Should Be Equal As Strings    '${soft_ver}'    'pnf_sw_version-3.0.0'
189      Should Be Equal As Strings    '${soft_status}'    'ACTIVATION_COMPLETED'
190
191 Test AAI-update for target software version verify
192     Create Session   aai_simulator_session  https://${REPO_IP}:9993
193     &{headers}=  Create Dictionary    Authorization=Basic YWFpOmFhaS5vbmFwLm9yZzpkZW1vMTIzNDU2IQ==    Content-Type=application/json    Accept=application/json    verify=False
194     FOR    ${INDEX}    IN RANGE    ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT}
195        ${get_pnf_request}=    Get Request    aai_simulator_session    aai/v11/network/pnfs/pnf/${pnfName}     headers=${headers}
196        Run Keyword If  '${get_pnf_request.status_code}' == '200'  log to console   \nexecuted with expected result
197        ${get_pnf_json_response}=    Evaluate     json.loads(r"""${get_pnf_request.content}""", strict=False)    json
198        Log to console  ${get_pnf_json_response}
199        ${sw_version}=          Set Variable         ${get_pnf_json_response}[sw-version]
200        Log to console  ${sw_version}
201        Run Keyword If  '${sw_version}' == 'pnf_sw_version-3.0.0'   Exit For Loop
202        log to console  Will try again after ${SLEEP_INTERVAL_SEC} seconds
203        SLEEP   ${SLEEP_INTERVAL_SEC}s
204     END
205     Log To Console     final target software version received: ${sw_version}
206     Run Keyword If  '${sw_version}' == 'pnf_sw_version-3.0.0'  log to console   \nexecuted with expected result
207     Should Be Equal As Strings    '${sw_version}'    'pnf_sw_version-3.0.0'
208
209 Distribute ServiceLevel Upgrade Template
210     Create Session   sdc_controller_session  http://${REPO_IP}:8085
211     ${data}=    Get Binary File     ${CURDIR}${/}data${/}distributeServiceTemplate_2.0.json
212     &{headers}=  Create Dictionary    Authorization=Basic bXNvX2FkbWluOnBhc3N3b3JkMSQ=    resource-location=/app/distribution-test-zip/unzipped/    Content-Type=application/json    Accept=application/json
213     ${resp}=    Post Request    sdc_controller_session    /test/treatNotification/v1    data=${data}    headers=${headers}
214     Run Keyword If  '${resp.status_code}' == '200'  log to console  \nexecuted with expected result
215     Should Be Equal As Strings    '${resp.status_code}'    '200'
216     ${model_version_id_2}=    Set Variable    8351245d-50da-4695-8756-3a22618377f7
217     SET GLOBAL VARIABLE     ${model_version_id_2}
218
219 Get Service-Model-Version From AAI Using Service-Model-InVariant-UUId
220     Create Session   aai_simulator_session  https://${REPO_IP}:9993
221     &{headers}=  Create Dictionary    Authorization=Basic YWFpOmFhaS5vbmFwLm9yZzpkZW1vMTIzNDU2IQ==    Content-Type=application/xml    Accept=application/xml    verify=False
222     ${model-invariant-id}=    Set Variable    a51e2bef-961c-496f-b235-b4540400e885
223     ${get_serviceVersion}=    Get Request    aai_simulator_session    aai/v11/service-design-and-creation/models/model/${model-invariant-id}/model-vers     headers=${headers}
224     Run Keyword If  '${get_serviceVersion.status_code}' == '200'  log to console   \nExecuted with expected
225     Log to console  ${get_serviceVersion.content}
226     Should Be Equal As Strings    ${get_serviceVersion.status_code}    200
227     ${serviceVersion_json_response}=    Evaluate    json.loads(r"""${get_serviceVersion.content}""", strict=False)    json
228     ${all_service_version}=    Set Variable    ${serviceVersion_json_response['model-vers']['model-ver']}
229     ${model-version-id_1}=    Set Variable    ""
230     ${model-version-id_2}=    Set Variable    ""
231     FOR    ${member}    IN    @{all_service_version}
232        ${model-version}=    Set Variable    ${member}[model-version]
233        ${model-version-id}=    Set Variable    ${member}[model-version-id]
234        Log to console    The ServiceModel Version ${model-version} has ModelVersion Id : ${model-version-id}
235        ${model-version-id_1}=    Set Variable If  '${model-version}' == '1.0'    ${model-version-id}   ${model-version-id_1}
236        ${model-version-id_2}=    Set Variable If  '${model-version}' == '2.0'    ${model-version-id}   ${model-version-id_2}
237     END
238     SET GLOBAL VARIABLE    ${model-version-id_1}
239     SET GLOBAL VARIABLE    ${model-version-id_2}
240
241 Invoke Service Instantiation for ServiceLevel Upgrade
242     Create Session   api_handler_session  http://${REPO_IP}:8080
243     ${data}=    Get Binary File     ${CURDIR}${/}data${/}serviceLevelUpgradeRequest.json
244     ${serviceInstanceId}=    Set Variable    ${model-version-id_1}
245     &{headers}=  Create Dictionary    Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==    Content-Type=application/json    Accept=application/json    X-ONAP-RequestID=0ffc559c-5513-44bc-8b02-5759d84600f4    X-ONAP-PartnerName=ONAP    X-RequestorID=VID
246     ${service_instantiation_request}=    Post Request    api_handler_session    /onap/so/infra/instanceManagement/v1/serviceInstances/${serviceInstanceId}/workflows/${serviceLevel_workflow_uuid}    data=${data}    headers=${headers}
247     Run Keyword If  '${service_instantiation_request.status_code}' == '200'  log to console   \nexecuted with expected result
248     log to console      ${service_instantiation_request.content}
249     ${service_instantiation_json_response}=    Evaluate     json.loads(r"""${service_instantiation_request.content}""", strict=False)    json
250     ${request_ID}=          Set Variable         ${service_instantiation_json_response}[requestReferences][requestId]
251     ${actual_service_request_state}=    Set Variable    ""
252      FOR    ${INDEX}    IN RANGE    ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT}
253        ${orchestration_status_service_request}=   Get Request  api_handler_session   /onap/so/infra/orchestrationRequests/v7/${request_ID}
254        Run Keyword If  '${orchestration_status_service_request.status_code}' == '200'  log to console   \nexecuted with expected result
255        log to console      ${orchestration_status_service_request.content}
256        ${orchestration_json_service_response}=    Evaluate     json.loads(r"""${orchestration_status_service_request.content}""", strict=False)    json
257        ${actual_service_request_state}=     SET VARIABLE       ${orchestration_json_service_response}[request][requestStatus][requestState]
258        Log To Console    Received actual repsonse status:${actual_service_request_state}
259        RUN KEYWORD IF   '${actual_service_request_state}' == 'COMPLETE' or '${actual_service_request_state}' == 'FAILED'      Exit For Loop
260        log to console  Will try again after ${SLEEP_INTERVAL_SEC} seconds
261        SLEEP   ${SLEEP_INTERVAL_SEC}s
262      END
263     Log To Console     final repsonse status received: ${actual_service_request_state}
264     Run Keyword If  '${actual_service_request_state}' == 'COMPLETE'  log to console   \nexecuted with expected result
265     Should Be Equal As Strings    '${actual_service_request_state}'    'COMPLETE'
266
267 Test Verify PNF-1 Configuration for Service Level Upgrade
268      [Documentation]    Checking PNF configuration params
269      Create Session   sdnc  http://${REPO_IP}:8282
270      &{headers}=  Create Dictionary    Authorization=Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==    Content-Type=application/json
271      ${mount}=    Get File     ${CURDIR}${/}data${/}mount.json
272      Log to console  ${mount}
273      ${pnf_mount_resp}=    Put Request    sdnc    ${SDNC_MOUNT_PATH}    data=${mount}    headers=${headers}
274      Should Be Equal As Strings    ${pnf_mount_resp.status_code}    201
275      SLEEP   10
276      ${pnfsim_software_resp}=    Get Request    sdnc    ${PNFSIM_MOUNT_PATH}    headers=${headers}
277      Should Be Equal As Strings    ${pnfsim_software_resp.status_code}    200
278      Log to console  ${pnfsim_software_resp.content}
279      ${pnfsim_software_resp_json}=    Evaluate     json.loads(r"""${pnfsim_software_resp.content}""", strict=False)    json
280      ${all_upgp_members}=    Set Variable     ${pnfsim_software_resp_json['software-upgrade']['upgrade-package']}
281      FOR    ${member}     IN      @{all_upgp_members}
282         ${soft_ver}=    Get From Dictionary   ${member}     software-version
283         ${soft_status}=    Get From Dictionary   ${member}     current-status
284         Log to console   The node ${pnfName} has software version ${soft_ver} : ${soft_status}
285         Run Keyword If  '${soft_ver}' == 'pnf_sw_version-4.0.0'   Exit For Loop
286      END
287      Run Keyword If  '${soft_ver}' == 'pnf_sw_version-4.0.0'  log to console   \nexecuted with expected result
288      Should Be Equal As Strings    '${soft_ver}'    'pnf_sw_version-4.0.0'
289      Should Be Equal As Strings    '${soft_status}'    'ACTIVATION_COMPLETED'
290
291 Test AAI-Update for PNF-1 Target Software Version after Service Level Upgrade
292     Create Session   aai_simulator_session  https://${REPO_IP}:9993
293     &{headers}=  Create Dictionary    Authorization=Basic YWFpOmFhaS5vbmFwLm9yZzpkZW1vMTIzNDU2IQ==    Content-Type=application/json    Accept=application/json    verify=False
294     FOR    ${INDEX}    IN RANGE    ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT}
295        ${get_pnf_request}=    Get Request    aai_simulator_session    aai/v11/network/pnfs/pnf/${pnfName}     headers=${headers}
296        Run Keyword If  '${get_pnf_request.status_code}' == '200'  log to console   \nexecuted with expected result
297        ${get_pnf_json_response}=    Evaluate     json.loads(r"""${get_pnf_request.content}""", strict=False)    json
298        Log to console  ${get_pnf_json_response}
299        ${sw_version}=          Set Variable         ${get_pnf_json_response}[sw-version]
300        Log to console  ${sw_version}
301        Run Keyword If  '${sw_version}' == 'pnf_sw_version-4.0.0'   Exit For Loop
302        log to console  Will try again after ${SLEEP_INTERVAL_SEC} seconds
303        SLEEP   ${SLEEP_INTERVAL_SEC}s
304     END
305     Log To Console     final target software version received: ${sw_version}
306     Run Keyword If  '${sw_version}' == 'pnf_sw_version-4.0.0'  log to console   \nexecuted with expected result
307     Should Be Equal As Strings    '${sw_version}'    'pnf_sw_version-4.0.0'
308
309 Test Verify PNF-2 Configuration for Service Level Upgrade
310      [Documentation]    Checking PNF configuration params
311      Create Session   sdnc  http://${REPO_IP}:8282
312      &{headers}=  Create Dictionary    Authorization=Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==    Content-Type=application/json
313      ${mount}=    Get File     ${CURDIR}${/}data${/}mount2.json
314      Log to console  ${mount}
315      ${pnf_mount_resp}=    Put Request    sdnc    ${SDNC_MOUNT_PATH2}    data=${mount}    headers=${headers}
316      Should Be Equal As Strings    ${pnf_mount_resp.status_code}    201
317      SLEEP   10
318      ${pnfsim_software_resp}=    Get Request    sdnc    ${PNFSIM_MOUNT_PATH2}    headers=${headers}
319      Should Be Equal As Strings    ${pnfsim_software_resp.status_code}    200
320      Log to console  ${pnfsim_software_resp.content}
321      ${pnfsim_software_resp_json}=    Evaluate     json.loads(r"""${pnfsim_software_resp.content}""", strict=False)    json
322      ${all_upgp_members}=    Set Variable     ${pnfsim_software_resp_json['software-upgrade']['upgrade-package']}
323      FOR    ${member}     IN      @{all_upgp_members}
324         ${soft_ver}=    Get From Dictionary   ${member}     software-version
325         ${soft_status}=    Get From Dictionary   ${member}     current-status
326         Log to console   The node ${pnfName1} has software version ${soft_ver} : ${soft_status}
327         Run Keyword If  '${soft_ver}' == 'pnf_sw_version-4.0.0'   Exit For Loop
328      END
329      Run Keyword If  '${soft_ver}' == 'pnf_sw_version-4.0.0'  log to console   \nexecuted with expected result
330      Should Be Equal As Strings    '${soft_ver}'    'pnf_sw_version-4.0.0'
331      Should Be Equal As Strings    '${soft_status}'    'ACTIVATION_COMPLETED'
332
333 Test AAI-Update for PNF-2 Target Software Version after Service Level Upgrade
334     Create Session   aai_simulator_session  https://${REPO_IP}:9993
335     &{headers}=  Create Dictionary    Authorization=Basic YWFpOmFhaS5vbmFwLm9yZzpkZW1vMTIzNDU2IQ==    Content-Type=application/json    Accept=application/json    verify=False
336     FOR    ${INDEX}    IN RANGE    ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT}
337        ${get_pnf_request}=    Get Request    aai_simulator_session    aai/v11/network/pnfs/pnf/${pnfName1}     headers=${headers}
338        Run Keyword If  '${get_pnf_request.status_code}' == '200'  log to console   \nexecuted with expected result
339        ${get_pnf_json_response}=    Evaluate     json.loads(r"""${get_pnf_request.content}""", strict=False)    json
340        Log to console  ${get_pnf_json_response}
341        ${sw_version}=          Set Variable         ${get_pnf_json_response}[sw-version]
342        Log to console  ${sw_version}
343        Run Keyword If  '${sw_version}' == 'pnf_sw_version-4.0.0'   Exit For Loop
344        log to console  Will try again after ${SLEEP_INTERVAL_SEC} seconds
345        SLEEP   ${SLEEP_INTERVAL_SEC}s
346     END
347     Log To Console     final target software version received: ${sw_version}
348     Run Keyword If  '${sw_version}' == 'pnf_sw_version-4.0.0'  log to console   \nexecuted with expected result
349     Should Be Equal As Strings    '${sw_version}'    'pnf_sw_version-4.0.0'
350
351 Test AAI-Update for ServiceInstance after Service Level Upgrade
352     ${globalSubscriberId}=    Set Variable    807c7a02-249c-4db8-9fa9-bee973fe08ce
353     Create Session   aai_simulator_session  https://${REPO_IP}:9993
354     &{headers}=  Create Dictionary    Authorization=Basic YWFpOmFhaS5vbmFwLm9yZzpkZW1vMTIzNDU2IQ==    Content-Type=application/json    Accept=application/json    verify=False
355     ${get_service_request}=    Get Request    aai_simulator_session    aai/v17/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/pNF/service-instances/service-instance/${model_version_id_2}     headers=${headers}
356     Run Keyword If  '${get_service_request.status_code}' == '200'  log to console   \nexecuted with expected result
357     ${get_service_json_response}=    Evaluate     json.loads(r"""${get_service_request.content}""", strict=False)    json
358     Log to console  ${get_service_json_response}
359     ${service_instance_id}=    Set Variable    ${get_service_json_response}[service-instance-id]
360     Should Be Equal As Strings    '${service_instance_id}'    'df4decf6-h727-8875-8761-89683ed43645'
361     ${model_version_id}=    Set Variable    ${get_service_json_response}[model-version-id]
362     Should Be Equal As Strings    '${model_version_id}'    '${model_version_id_2}'