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 | 319d0ad | 2019-09-03 13:45:18 +0000 | [diff] [blame] | 8 | ${SLEEP_INTERVAL_SEC}= 5 |
| 9 | ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT}= 48 # Represents the maximum number of attempts that will be made before a timeout. It sleeps for SLEEP_INTERVAL_SEC seconds before retry. |
rope252 | 1537edf | 2019-07-25 16:04:10 +0000 | [diff] [blame] | 10 | |
| 11 | *** Test Cases *** |
rope252 | 1537edf | 2019-07-25 16:04:10 +0000 | [diff] [blame] | 12 | Distribute Service Template |
eHanan | 75c1171 | 2019-08-13 15:44:16 +0000 | [diff] [blame] | 13 | Create Session sdc_controller_session http://${REPO_IP}:8085 |
rope252 | 1537edf | 2019-07-25 16:04:10 +0000 | [diff] [blame] | 14 | ${data}= Get Binary File ${CURDIR}${/}data${/}distributeServiceTemplate.json |
eHanan | 2ae0ac0 | 2019-09-16 12:25:40 +0100 | [diff] [blame] | 15 | &{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] | 16 | ${resp}= Post Request sdc_controller_session /test/treatNotification/v1 data=${data} headers=${headers} |
rope252 | 1537edf | 2019-07-25 16:04:10 +0000 | [diff] [blame] | 17 | 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] | 18 | Should Be Equal As Strings '${resp.status_code}' '200' |
rope252 | 1537edf | 2019-07-25 16:04:10 +0000 | [diff] [blame] | 19 | |
eHanan | 75c1171 | 2019-08-13 15:44:16 +0000 | [diff] [blame] | 20 | Invoke Service Instantiation |
| 21 | Create Session api_handler_session http://${REPO_IP}:8080 |
| 22 | ${data}= Get Binary File ${CURDIR}${/}data${/}serviceInstantiationRequest.json |
| 23 | &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json |
| 24 | ${service_instantiation_request}= Post Request api_handler_session /onap/so/infra/serviceInstantiation/v7/serviceInstances data=${data} headers=${headers} |
| 25 | Run Keyword If '${service_instantiation_request.status_code}' == '200' log to console \nexecuted with expected result |
| 26 | log to console ${service_instantiation_request.content} |
waqas.ikram | ed69953 | 2019-10-15 15:06:06 +0100 | [diff] [blame] | 27 | ${service_instantiation_json_response}= Evaluate json.loads(r"""${service_instantiation_request.content}""", strict=False) json |
eHanan | 319d0ad | 2019-09-03 13:45:18 +0000 | [diff] [blame] | 28 | ${request_ID}= Set Variable ${service_instantiation_json_response}[requestReferences][requestId] |
| 29 | ${service_instance_Id}= Set Variable ${service_instantiation_json_response}[requestReferences][instanceId] |
| 30 | SET GLOBAL VARIABLE ${service_instance_Id} |
| 31 | ${actual_request_state}= Set Variable "" |
eHanan | 75c1171 | 2019-08-13 15:44:16 +0000 | [diff] [blame] | 32 | |
eHanan | 319d0ad | 2019-09-03 13:45:18 +0000 | [diff] [blame] | 33 | : FOR ${INDEX} IN RANGE ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT} |
| 34 | \ ${orchestration_status_request}= Get Request api_handler_session /onap/so/infra/orchestrationRequests/v7/${request_ID} |
eHanan | 75c1171 | 2019-08-13 15:44:16 +0000 | [diff] [blame] | 35 | \ Run Keyword If '${orchestration_status_request.status_code}' == '200' log to console \nexecuted with expected result |
| 36 | \ log to console ${orchestration_status_request.content} |
waqas.ikram | ed69953 | 2019-10-15 15:06:06 +0100 | [diff] [blame] | 37 | \ ${orchestration_json_response}= Evaluate json.loads(r"""${orchestration_status_request.content}""", strict=False) json |
eHanan | 319d0ad | 2019-09-03 13:45:18 +0000 | [diff] [blame] | 38 | \ ${actual_request_state}= SET VARIABLE ${orchestration_json_response}[request][requestStatus][requestState] |
waqas.ikram | cb3218e | 2019-08-22 10:25:24 +0000 | [diff] [blame] | 39 | \ Log To Console Received actual repsonse status:${actual_request_state} |
eHanan | 75c1171 | 2019-08-13 15:44:16 +0000 | [diff] [blame] | 40 | \ RUN KEYWORD IF '${actual_request_state}' == 'COMPLETE' or '${actual_request_state}' == 'FAILED' Exit For Loop |
eHanan | 319d0ad | 2019-09-03 13:45:18 +0000 | [diff] [blame] | 41 | \ log to console Will try again after ${SLEEP_INTERVAL_SEC} seconds |
| 42 | \ SLEEP ${SLEEP_INTERVAL_SEC}s |
| 43 | |
waqas.ikram | cb3218e | 2019-08-22 10:25:24 +0000 | [diff] [blame] | 44 | Log To Console final repsonse status received: ${actual_request_state} |
eHanan | 75c1171 | 2019-08-13 15:44:16 +0000 | [diff] [blame] | 45 | 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] | 46 | Should Be Equal As Strings '${actual_request_state}' 'COMPLETE' |
eHanan | 319d0ad | 2019-09-03 13:45:18 +0000 | [diff] [blame] | 47 | |
| 48 | Invoke VNF Instantiation |
| 49 | Run Keyword If "${service_instance_Id}"!="${EMPTY}" Log to Console Service Instance ID :${service_instance_Id} received |
| 50 | ... ELSE Fail Log to Console Invalid Service Instance ID :${service_instance_Id} recieved |
| 51 | |
| 52 | Create Session api_handler_session http://${REPO_IP}:8080 |
| 53 | ${data}= Get Binary File ${CURDIR}${/}data${/}vnfInstantiationRequest.json |
waqas.ikram | ed69953 | 2019-10-15 15:06:06 +0100 | [diff] [blame] | 54 | ${vnf_instantiate_request_json}= evaluate json.loads(r'''${data}''', strict=False) json |
eHanan | 319d0ad | 2019-09-03 13:45:18 +0000 | [diff] [blame] | 55 | set to dictionary ${vnf_instantiate_request_json}[requestDetails][relatedInstanceList][0][relatedInstance] instanceId=${service_instance_Id} |
| 56 | ${vnf_instantiate_request_string}= evaluate json.dumps(${vnf_instantiate_request_json}) json |
eHanan | 319d0ad | 2019-09-03 13:45:18 +0000 | [diff] [blame] | 57 | &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json |
| 58 | ${vnf_instantiate_request}= Post Request api_handler_session /onap/so/infra/serviceInstantiation/v7/serviceInstances/${service_instance_Id}/vnfs data=${vnf_instantiate_request_string} headers=${headers} |
| 59 | Run Keyword If '${vnf_instantiate_request.status_code}' == '200' log to console \nexecuted with expected result |
waqas.ikram | ed69953 | 2019-10-15 15:06:06 +0100 | [diff] [blame] | 60 | ${vnf_instantiate_json_response}= Evaluate json.loads(r"""${vnf_instantiate_request.content}""") json |
eHanan | 319d0ad | 2019-09-03 13:45:18 +0000 | [diff] [blame] | 61 | ${request_ID}= Set Variable ${vnf_instantiate_json_response}[requestReferences][requestId] |
| 62 | ${actual_request_state}= SET VARIABLE "" |
eHanan | 3cc3d46 | 2019-09-20 16:56:04 +0100 | [diff] [blame] | 63 | ${vnf_instance_Id}= Set Variable ${vnf_instantiate_json_response}[requestReferences][instanceId] |
| 64 | SET GLOBAL VARIABLE ${vnf_instance_Id} |
eHanan | 319d0ad | 2019-09-03 13:45:18 +0000 | [diff] [blame] | 65 | |
| 66 | : FOR ${INDEX} IN RANGE ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT} |
| 67 | \ ${orchestration_status_request}= Get Request api_handler_session /onap/so/infra/orchestrationRequests/v7/${request_ID} |
| 68 | \ Run Keyword If '${orchestration_status_request.status_code}' == '200' log to console \nexecuted with expected result |
| 69 | \ Log To Console ${orchestration_status_request.content} |
waqas.ikram | ed69953 | 2019-10-15 15:06:06 +0100 | [diff] [blame] | 70 | \ ${orchestration_json_response}= Evaluate json.loads(r"""${orchestration_status_request.content}""", strict=False) json |
eHanan | 319d0ad | 2019-09-03 13:45:18 +0000 | [diff] [blame] | 71 | \ ${actual_request_state}= SET VARIABLE ${orchestration_json_response}[request][requestStatus][requestState] |
eHanan | 3cc3d46 | 2019-09-20 16:56:04 +0100 | [diff] [blame] | 72 | \ RUN KEYWORD IF '${actual_request_state}' == 'COMPLETE' or '${actual_request_state}' == 'FAILED' Exit For Loop |
| 73 | \ Log To Console Will try again after ${SLEEP_INTERVAL_SEC} seconds |
| 74 | \ SLEEP ${SLEEP_INTERVAL_SEC}s |
| 75 | |
| 76 | ${service_instance_Id}= SET VARIABLE ${orchestration_json_response}[request][instanceReferences][serviceInstanceId] |
| 77 | Log To Console final repsonse status received: ${actual_request_state} |
| 78 | Run Keyword If '${actual_request_state}' == 'COMPLETE' log to console \nexecuted with expected result |
| 79 | Should Be Equal As Strings '${actual_request_state}' 'COMPLETE' |
| 80 | |
Piotr Borelowski | f8d78f8 | 2020-06-25 17:05:53 +0200 | [diff] [blame^] | 81 | Invoke VNF Notification for SOL002 |
| 82 | Create Session ve-vnfm-adapter-session http://${REPO_IP}:9098 |
| 83 | ${data}= Get Binary File ${CURDIR}${/}data${/}notification.json |
| 84 | &{headers}= Create Dictionary Content-Type=application/json Accept=application/json Authorization=Basic YWRtaW46YTRiM2MyZDE= |
| 85 | ${notification_request}= Post Request ve-vnfm-adapter-session /lcm/v1/vnf/instances/notifications data=${data} headers=${headers} |
| 86 | Log To Console ${notification_request} |
| 87 | Run Keyword If '${notification_request.status_code}' == '200' Log To Console \nexecuted with expected result |
| 88 | Should Be Equal As Strings '${notification_request.status_code}' '200' |
| 89 | |
eHanan | 3cc3d46 | 2019-09-20 16:56:04 +0100 | [diff] [blame] | 90 | Delete VNF Instance |
| 91 | Run Keyword If "${vnf_instance_Id}" != "${EMPTY}" Log to Console VNF Instance ID :${vnf_instance_Id} received |
| 92 | ... ELSE Fail Log to Console Invalid VNF Instance ID :${vnf_instance_Id} recieved |
| 93 | Run Keyword If "${service_instance_Id}" != "${EMPTY}" Log to Console VNF Instance ID :${service_instance_Id} received |
| 94 | ... ELSE Fail Log to Console Invalid VNF Instance ID :${service_instance_Id} recieved |
| 95 | |
| 96 | Create Session api_handler_session http://${REPO_IP}:8080 |
| 97 | ${data}= Get Binary File ${CURDIR}${/}data${/}vnfDeleteRequest.json |
| 98 | &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json |
| 99 | ${vnf_delete_request}= Delete Request api_handler_session /onap/so/infra/serviceInstantiation/v7/serviceInstances/${service_instance_Id}/vnfs/${vnf_instance_Id} data=${data} headers=${headers} |
waqas.ikram | ed69953 | 2019-10-15 15:06:06 +0100 | [diff] [blame] | 100 | ${vnf_delete_json_response}= Evaluate json.loads(r"""${vnf_delete_request.content}""") json |
eHanan | 3cc3d46 | 2019-09-20 16:56:04 +0100 | [diff] [blame] | 101 | Log to Console ${vnf_delete_json_response} |
| 102 | ${request_ID}= Set Variable ${vnf_delete_json_response}[requestReferences][requestId] |
| 103 | ${actual_request_state}= Set Variable "" |
| 104 | |
| 105 | : FOR ${INDEX} IN RANGE ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT} |
| 106 | \ ${orchestration_status_request}= Get Request api_handler_session /onap/so/infra/orchestrationRequests/v7/${request_ID} |
| 107 | \ Run Keyword If '${orchestration_status_request.status_code}' == '200' log to console \nexecuted with expected result |
| 108 | \ Log To Console ${orchestration_status_request.content} |
waqas.ikram | ed69953 | 2019-10-15 15:06:06 +0100 | [diff] [blame] | 109 | \ ${orchestration_json_response}= Evaluate json.loads(r"""${orchestration_status_request.content}""") json |
eHanan | 3cc3d46 | 2019-09-20 16:56:04 +0100 | [diff] [blame] | 110 | \ ${actual_request_state}= SET VARIABLE ${orchestration_json_response}[request][requestStatus][requestState] |
eHanan | 319d0ad | 2019-09-03 13:45:18 +0000 | [diff] [blame] | 111 | \ RUN KEYWORD IF '${actual_request_state}' == 'COMPLETE' or '${actual_request_state}' == 'FAILED' Exit For Loop |
| 112 | \ Log To Console Will try again after ${SLEEP_INTERVAL_SEC} seconds |
| 113 | \ SLEEP ${SLEEP_INTERVAL_SEC}s |
| 114 | |
| 115 | Log To Console final repsonse status received: ${actual_request_state} |
| 116 | Run Keyword If '${actual_request_state}' == 'COMPLETE' log to console \nexecuted with expected result |
waqas.ikram | bba9cee | 2019-09-19 15:40:46 +0100 | [diff] [blame] | 117 | Should Be Equal As Strings '${actual_request_state}' 'COMPLETE' |
eHanan | 6bd3f6c | 2019-09-25 15:24:32 +0100 | [diff] [blame] | 118 | |
| 119 | |
| 120 | Delete Service Instance |
| 121 | Run Keyword If "${service_instance_Id}" != "${EMPTY}" Log to Console VNF Instance ID :${service_instance_Id} received |
| 122 | ... ELSE Fail Log to Console Invalid Service Instance ID :${service_instance_Id} recieved |
| 123 | |
| 124 | Create Session api_handler_session http://${REPO_IP}:8080 |
| 125 | ${data}= Get Binary File ${CURDIR}${/}data${/}serviceDeleteRequest.json |
| 126 | &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json |
| 127 | ${service_delete_request}= Delete Request api_handler_session /onap/so/infra/serviceInstantiation/v7/serviceInstances/${service_instance_Id} data=${data} headers=${headers} |
waqas.ikram | ed69953 | 2019-10-15 15:06:06 +0100 | [diff] [blame] | 128 | ${service_delete_json_response}= Evaluate json.loads(r"""${service_delete_request.content}""") json |
eHanan | 6bd3f6c | 2019-09-25 15:24:32 +0100 | [diff] [blame] | 129 | Log to Console ${service_delete_json_response} |
| 130 | ${request_ID}= Set Variable ${service_delete_json_response}[requestReferences][requestId] |
| 131 | ${actual_request_state}= Set Variable "" |
| 132 | |
| 133 | : FOR ${INDEX} IN RANGE ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT} |
| 134 | \ ${orchestration_status_request}= Get Request api_handler_session /onap/so/infra/orchestrationRequests/v7/${request_ID} |
| 135 | \ Run Keyword If '${orchestration_status_request.status_code}' == '200' log to console \nexecuted with expected result |
| 136 | \ Log To Console ${orchestration_status_request.content} |
waqas.ikram | ed69953 | 2019-10-15 15:06:06 +0100 | [diff] [blame] | 137 | \ ${orchestration_json_response}= Evaluate json.loads(r"""${orchestration_status_request.content}""") json |
eHanan | 6bd3f6c | 2019-09-25 15:24:32 +0100 | [diff] [blame] | 138 | \ ${actual_request_state}= SET VARIABLE ${orchestration_json_response}[request][requestStatus][requestState] |
| 139 | \ RUN KEYWORD IF '${actual_request_state}' == 'COMPLETE' or '${actual_request_state}' == 'FAILED' Exit For Loop |
| 140 | \ Log To Console Will try again after ${SLEEP_INTERVAL_SEC} seconds |
| 141 | \ SLEEP ${SLEEP_INTERVAL_SEC}s |
| 142 | |
| 143 | Log To Console final repsonse status received: ${actual_request_state} |
| 144 | Run Keyword If '${actual_request_state}' == 'COMPLETE' log to console \nexecuted with expected result |
| 145 | Should Be Equal As Strings '${actual_request_state}' 'COMPLETE' |