From: eHanan Date: Fri, 20 Sep 2019 15:56:04 +0000 (+0100) Subject: Create CSIT test for VNF delete X-Git-Tag: 6.0.0-ONAP~126^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=3cc3d465b11670eccb34b7602a650974cbc58281;p=integration%2Fcsit.git Create CSIT test for VNF delete Change-Id: I008f336753aff45938931e1b42e15b0c2ec32098 Issue-ID: SO-2342 Signed-off-by: eHanan --- diff --git a/plans/so/integration-etsi-testing/config/override-files/vnfm-simulator/onapheat/override.yaml b/plans/so/integration-etsi-testing/config/override-files/vnfm-simulator/onapheat/override.yaml index 89e39698..05cb1e56 100644 --- a/plans/so/integration-etsi-testing/config/override-files/vnfm-simulator/onapheat/override.yaml +++ b/plans/so/integration-etsi-testing/config/override-files/vnfm-simulator/onapheat/override.yaml @@ -34,7 +34,7 @@ server: vnfds: vnfdlist: - - vnfdid: 1 + - vnfdid: sgsn-mme_12df452s04131 vnfclist: - vnfcid: VNFC1 resourceTemplateId: vnfd1_vnfc1 diff --git a/tests/so/etsi/data/vnfDeleteRequest.json b/tests/so/etsi/data/vnfDeleteRequest.json new file mode 100644 index 00000000..08862ea8 --- /dev/null +++ b/tests/so/etsi/data/vnfDeleteRequest.json @@ -0,0 +1,25 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "vnf", + "modelInvariantId": "b0f14066-2b65-40d2-b5a4-c8f2116fb5fc", + "modelVersionId": "84b9649a-4eb9-4967-9abe-e8702f55518b", + "modelName": "Sol004Zip3VSP", + "modelCustomizationName": "Sol004Zip3VSP 0", + "modelCustomizationId": "ff0860ac-fa9a-4fff-956b-80eeb7a330bc", + "modelVersion": "1.0" + }, + "requestInfo": { + "source": "VID", + "requestorId": "demo" + }, + "requestParameters": { + "testApi": "GR_API" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "nordixcloud", + "cloudOwner": "CloudOwner", + "tenantId": "693c7729b2364a26a3ca602e6f66187d" + } + } +} \ No newline at end of file diff --git a/tests/so/etsi/etsi_tests.robot b/tests/so/etsi/etsi_tests.robot index 5a38eee9..89843b6a 100644 --- a/tests/so/etsi/etsi_tests.robot +++ b/tests/so/etsi/etsi_tests.robot @@ -54,14 +54,14 @@ Invoke VNF Instantiation ${vnf_instantiate_request_json}= evaluate json.loads('''${data}''', strict=False) json set to dictionary ${vnf_instantiate_request_json}[requestDetails][relatedInstanceList][0][relatedInstance] instanceId=${service_instance_Id} ${vnf_instantiate_request_string}= evaluate json.dumps(${vnf_instantiate_request_json}) json - &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json ${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} Run Keyword If '${vnf_instantiate_request.status_code}' == '200' log to console \nexecuted with expected result - ${vnf_instantiate_json_response}= Evaluate json.loads("""${vnf_instantiate_request.content}""", strict=False) json - + ${vnf_instantiate_json_response}= Evaluate json.loads("""${vnf_instantiate_request.content}""") json ${request_ID}= Set Variable ${vnf_instantiate_json_response}[requestReferences][requestId] ${actual_request_state}= SET VARIABLE "" + ${vnf_instance_Id}= Set Variable ${vnf_instantiate_json_response}[requestReferences][instanceId] + SET GLOBAL VARIABLE ${vnf_instance_Id} : FOR ${INDEX} IN RANGE ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT} \ ${orchestration_status_request}= Get Request api_handler_session /onap/so/infra/orchestrationRequests/v7/${request_ID} @@ -69,7 +69,36 @@ Invoke VNF Instantiation \ Log To Console ${orchestration_status_request.content} \ ${orchestration_json_response}= Evaluate json.loads("""${orchestration_status_request.content}""", strict=False) json \ ${actual_request_state}= SET VARIABLE ${orchestration_json_response}[request][requestStatus][requestState] - \ ${service_instance_Id}= SET VARIABLE ${orchestration_json_response}[request][instanceReferences][serviceInstanceId] + \ RUN KEYWORD IF '${actual_request_state}' == 'COMPLETE' or '${actual_request_state}' == 'FAILED' Exit For Loop + \ Log To Console Will try again after ${SLEEP_INTERVAL_SEC} seconds + \ SLEEP ${SLEEP_INTERVAL_SEC}s + + ${service_instance_Id}= SET VARIABLE ${orchestration_json_response}[request][instanceReferences][serviceInstanceId] + Log To Console final repsonse status received: ${actual_request_state} + Run Keyword If '${actual_request_state}' == 'COMPLETE' log to console \nexecuted with expected result + Should Be Equal As Strings '${actual_request_state}' 'COMPLETE' + +Delete VNF Instance + Run Keyword If "${vnf_instance_Id}" != "${EMPTY}" Log to Console VNF Instance ID :${vnf_instance_Id} received + ... ELSE Fail Log to Console Invalid VNF Instance ID :${vnf_instance_Id} recieved + Run Keyword If "${service_instance_Id}" != "${EMPTY}" Log to Console VNF Instance ID :${service_instance_Id} received + ... ELSE Fail Log to Console Invalid VNF Instance ID :${service_instance_Id} recieved + + Create Session api_handler_session http://${REPO_IP}:8080 + ${data}= Get Binary File ${CURDIR}${/}data${/}vnfDeleteRequest.json + &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json + ${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} + ${vnf_delete_json_response}= Evaluate json.loads("""${vnf_delete_request.content}""") json + Log to Console ${vnf_delete_json_response} + ${request_ID}= Set Variable ${vnf_delete_json_response}[requestReferences][requestId] + ${actual_request_state}= Set Variable "" + + : FOR ${INDEX} IN RANGE ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT} + \ ${orchestration_status_request}= Get Request api_handler_session /onap/so/infra/orchestrationRequests/v7/${request_ID} + \ Run Keyword If '${orchestration_status_request.status_code}' == '200' log to console \nexecuted with expected result + \ Log To Console ${orchestration_status_request.content} + \ ${orchestration_json_response}= Evaluate json.loads("""${orchestration_status_request.content}""") json + \ ${actual_request_state}= SET VARIABLE ${orchestration_json_response}[request][requestStatus][requestState] \ RUN KEYWORD IF '${actual_request_state}' == 'COMPLETE' or '${actual_request_state}' == 'FAILED' Exit For Loop \ Log To Console Will try again after ${SLEEP_INTERVAL_SEC} seconds \ SLEEP ${SLEEP_INTERVAL_SEC}s