blob: bfa233179c398a1bc403a2dd3379c12dccd83983 [file] [log] [blame]
rope2521537edf2019-07-25 16:04:10 +00001*** Settings ***
2Library Collections
3Library RequestsLibrary
4Library OperatingSystem
5Library json
6
7*** Variables ***
eHanan319d0ad2019-09-03 13:45:18 +00008${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.
rope2521537edf2019-07-25 16:04:10 +000010
11*** Test Cases ***
rope2521537edf2019-07-25 16:04:10 +000012Distribute Service Template
eHanan75c11712019-08-13 15:44:16 +000013 Create Session sdc_controller_session http://${REPO_IP}:8085
rope2521537edf2019-07-25 16:04:10 +000014 ${data}= Get Binary File ${CURDIR}${/}data${/}distributeServiceTemplate.json
eHanan2ae0ac02019-09-16 12:25:40 +010015 &{headers}= Create Dictionary Authorization=Basic bXNvX2FkbWluOnBhc3N3b3JkMSQ= resource-location=/distribution-test-zip/unzipped/ Content-Type=application/json Accept=application/json
eHanan75c11712019-08-13 15:44:16 +000016 ${resp}= Post Request sdc_controller_session /test/treatNotification/v1 data=${data} headers=${headers}
rope2521537edf2019-07-25 16:04:10 +000017 Run Keyword If '${resp.status_code}' == '200' log to console \nexecuted with expected result
waqas.ikramcb3218e2019-08-22 10:25:24 +000018 Should Be Equal As Strings '${resp.status_code}' '200'
rope2521537edf2019-07-25 16:04:10 +000019
eHanan75c11712019-08-13 15:44:16 +000020Invoke 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}
eHanan319d0ad2019-09-03 13:45:18 +000027 ${service_instantiation_json_response}= Evaluate json.loads("""${service_instantiation_request.content}""") json
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 ""
eHanan75c11712019-08-13 15:44:16 +000032
eHanan319d0ad2019-09-03 13:45:18 +000033 : FOR ${INDEX} IN RANGE ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT}
34 \ ${orchestration_status_request}= Get Request api_handler_session /onap/so/infra/orchestrationRequests/v7/${request_ID}
eHanan75c11712019-08-13 15:44:16 +000035 \ Run Keyword If '${orchestration_status_request.status_code}' == '200' log to console \nexecuted with expected result
36 \ log to console ${orchestration_status_request.content}
eHanan319d0ad2019-09-03 13:45:18 +000037 \ ${orchestration_json_response}= Evaluate json.loads("""${orchestration_status_request.content}""") json
38 \ ${actual_request_state}= SET VARIABLE ${orchestration_json_response}[request][requestStatus][requestState]
waqas.ikramcb3218e2019-08-22 10:25:24 +000039 \ Log To Console Received actual repsonse status:${actual_request_state}
eHanan75c11712019-08-13 15:44:16 +000040 \ RUN KEYWORD IF '${actual_request_state}' == 'COMPLETE' or '${actual_request_state}' == 'FAILED' Exit For Loop
eHanan319d0ad2019-09-03 13:45:18 +000041 \ log to console Will try again after ${SLEEP_INTERVAL_SEC} seconds
42 \ SLEEP ${SLEEP_INTERVAL_SEC}s
43
waqas.ikramcb3218e2019-08-22 10:25:24 +000044 Log To Console final repsonse status received: ${actual_request_state}
eHanan75c11712019-08-13 15:44:16 +000045 Run Keyword If '${actual_request_state}' == 'COMPLETE' log to console \nexecuted with expected result
waqas.ikramcb3218e2019-08-22 10:25:24 +000046 Should Be Equal As Strings '${actual_request_state}' 'COMPLETE'
eHanan319d0ad2019-09-03 13:45:18 +000047
48Invoke 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
54 ${vnf_instantiate_request_json}= evaluate json.loads('''${data}''') json
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
57
58 &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json
59 ${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}
60 Run Keyword If '${vnf_instantiate_request.status_code}' == '200' log to console \nexecuted with expected result
61 ${vnf_instantiate_json_response}= Evaluate json.loads("""${vnf_instantiate_request.content}""") json
62 ${request_ID}= Set Variable ${vnf_instantiate_json_response}[requestReferences][requestId]
63 ${actual_request_state}= SET VARIABLE ""
64
65 : FOR ${INDEX} IN RANGE ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT}
66 \ ${orchestration_status_request}= Get Request api_handler_session /onap/so/infra/orchestrationRequests/v7/${request_ID}
67 \ Run Keyword If '${orchestration_status_request.status_code}' == '200' log to console \nexecuted with expected result
68 \ Log To Console ${orchestration_status_request.content}
69 \ ${orchestration_json_response}= Evaluate json.loads("""${orchestration_status_request.content}""") json
70 \ ${actual_request_state}= SET VARIABLE ${orchestration_json_response}[request][requestStatus][requestState]
71 \ ${service_instance_Id}= SET VARIABLE ${orchestration_json_response}[request][instanceReferences][serviceInstanceId]
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 Log To Console final repsonse status received: ${actual_request_state}
77 Run Keyword If '${actual_request_state}' == 'COMPLETE' log to console \nexecuted with expected result
78 Should Be Equal As Strings '${actual_request_state}' 'COMPLETE'