rope252 | 1537edf | 2019-07-25 16:04:10 +0000 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Library Collections |
| 3 | Library RequestsLibrary |
| 4 | Library OperatingSystem |
| 5 | Library json |
| 6 | |
| 7 | *** Variables *** |
eHanan | 75c1171 | 2019-08-13 15:44:16 +0000 | [diff] [blame] | 8 | |
rope252 | 1537edf | 2019-07-25 16:04:10 +0000 | [diff] [blame] | 9 | |
| 10 | *** Test Cases *** |
rope252 | 1537edf | 2019-07-25 16:04:10 +0000 | [diff] [blame] | 11 | Distribute Service Template |
eHanan | 75c1171 | 2019-08-13 15:44:16 +0000 | [diff] [blame] | 12 | Create Session sdc_controller_session http://${REPO_IP}:8085 |
rope252 | 1537edf | 2019-07-25 16:04:10 +0000 | [diff] [blame] | 13 | ${data}= Get Binary File ${CURDIR}${/}data${/}distributeServiceTemplate.json |
| 14 | &{headers}= Create Dictionary Authorization=Basic bXNvX2FkbWluOnBhc3N3b3JkMSQ= resource-location=/distribution-test-zip/unzipped Content-Type=application/json Accept=application/json |
eHanan | 75c1171 | 2019-08-13 15:44:16 +0000 | [diff] [blame] | 15 | ${resp}= Post Request sdc_controller_session /test/treatNotification/v1 data=${data} headers=${headers} |
rope252 | 1537edf | 2019-07-25 16:04:10 +0000 | [diff] [blame] | 16 | Run Keyword If '${resp.status_code}' == '200' log to console \nexecuted with expected result |
waqas.ikram | cb3218e | 2019-08-22 10:25:24 +0000 | [diff] [blame] | 17 | Should Be Equal As Strings '${resp.status_code}' '200' |
rope252 | 1537edf | 2019-07-25 16:04:10 +0000 | [diff] [blame] | 18 | |
eHanan | 75c1171 | 2019-08-13 15:44:16 +0000 | [diff] [blame] | 19 | Invoke Service Instantiation |
| 20 | Create Session api_handler_session http://${REPO_IP}:8080 |
| 21 | ${data}= Get Binary File ${CURDIR}${/}data${/}serviceInstantiationRequest.json |
| 22 | &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json |
| 23 | ${service_instantiation_request}= Post Request api_handler_session /onap/so/infra/serviceInstantiation/v7/serviceInstances data=${data} headers=${headers} |
| 24 | Run Keyword If '${service_instantiation_request.status_code}' == '200' log to console \nexecuted with expected result |
| 25 | log to console ${service_instantiation_request.content} |
| 26 | ${service_instantiation_json_responce}= Evaluate json.loads("""${service_instantiation_request.content}""") json |
| 27 | |
| 28 | ${actual_request_state}= SET VARIABLE "" |
| 29 | |
| 30 | : FOR ${INDEX} IN RANGE 48 |
| 31 | \ ${orchestration_status_request}= Get Request api_handler_session /onap/so/infra/orchestrationRequests/v7/${service_instantiation_json_responce}[requestReferences][requestId] |
| 32 | \ Run Keyword If '${orchestration_status_request.status_code}' == '200' log to console \nexecuted with expected result |
| 33 | \ log to console ${orchestration_status_request.content} |
| 34 | \ ${orchestration_json_responce}= Evaluate json.loads("""${orchestration_status_request.content}""") json |
| 35 | \ ${actual_request_state}= SET VARIABLE ${orchestration_json_responce}[request][requestStatus][requestState] |
waqas.ikram | cb3218e | 2019-08-22 10:25:24 +0000 | [diff] [blame] | 36 | \ Log To Console Received actual repsonse status:${actual_request_state} |
eHanan | 75c1171 | 2019-08-13 15:44:16 +0000 | [diff] [blame] | 37 | \ RUN KEYWORD IF '${actual_request_state}' == 'COMPLETE' or '${actual_request_state}' == 'FAILED' Exit For Loop |
eHanan | 75c1171 | 2019-08-13 15:44:16 +0000 | [diff] [blame] | 38 | \ log to console Will try again after 5 seconds |
| 39 | \ SLEEP 5s |
waqas.ikram | cb3218e | 2019-08-22 10:25:24 +0000 | [diff] [blame] | 40 | Log To Console final repsonse status received: ${actual_request_state} |
eHanan | 75c1171 | 2019-08-13 15:44:16 +0000 | [diff] [blame] | 41 | Run Keyword If '${actual_request_state}' == 'COMPLETE' log to console \nexecuted with expected result |
waqas.ikram | cb3218e | 2019-08-22 10:25:24 +0000 | [diff] [blame] | 42 | Should Be Equal As Strings '${actual_request_state}' 'COMPLETE' |