aboutsummaryrefslogtreecommitdiffstats
path: root/tests/so
diff options
context:
space:
mode:
authorwaqas.ikram <waqas.ikram@est.tech>2023-03-13 15:08:30 +0000
committerwaqas.ikram <waqas.ikram@est.tech>2023-03-14 10:58:08 +0000
commit0ca039c5f7d9339607f138d560c553159b0092e2 (patch)
tree4e758fd819b73d0de4a9f1b0046f3a44bf6f4d72 /tests/so
parentc638f49099852aa68959846cba1d414d24e404ae (diff)
Adding CNF LCM test cases
Change-Id: I31f9d8abc8cdd7d7af70c6e7e1e9f3cc566370ce Issue-ID: SO-4087 Signed-off-by: waqas.ikram <waqas.ikram@est.tech>
Diffstat (limited to 'tests/so')
-rw-r--r--tests/so/integration-cnfm-testing/cnf_lcm_tests.robot148
-rw-r--r--tests/so/integration-cnfm-testing/data/cnfResourceDeleteRequest.json26
-rw-r--r--tests/so/integration-cnfm-testing/data/cnfResourceInstantiationRequest.json67
-rw-r--r--tests/so/integration-cnfm-testing/data/serviceDeleteRequest.json19
-rw-r--r--tests/so/integration-cnfm-testing/data/serviceInstantiationRequest.json33
5 files changed, 293 insertions, 0 deletions
diff --git a/tests/so/integration-cnfm-testing/cnf_lcm_tests.robot b/tests/so/integration-cnfm-testing/cnf_lcm_tests.robot
new file mode 100644
index 00000000..85838861
--- /dev/null
+++ b/tests/so/integration-cnfm-testing/cnf_lcm_tests.robot
@@ -0,0 +1,148 @@
+*** Settings ***
+Library Collections
+Library RequestsLibrary
+Library OperatingSystem
+Library json
+
+Documentation Test cases for CNF lifecycle management operations
+... Note, relies on:
+... -package being onboarded in cnf_package_onboarding_tests
+
+*** Variables ***
+${SLEEP_INTERVAL_SEC}= 10
+${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT}= 60 # Represents the maximum number of attempts that will be made before a timeout. It sleeps for SLEEP_INTERVAL_SEC seconds before retry.
+${BASIC_AUTH}= Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==
+${SERVICE_INSTANTIATION_TEMPLATE}= ${CURDIR}${/}data${/}serviceInstantiationRequest.json
+${CNF_RESOURCE_INSTANTIATION_TEMPLATE}= ${CURDIR}${/}data${/}cnfResourceInstantiationRequest.json
+${CNF_RESOURCE_DELETE_TEMPLATE}= ${CURDIR}${/}data${/}cnfResourceDeleteRequest.json
+${SERVICE_DELETE_TEMPLATE}= ${CURDIR}${/}data${/}serviceDeleteRequest.json
+
+*** Test Cases ***
+Invoke Service Instantiation
+ Create Session api_handler_session http://${REPO_IP}:8080
+ ${data}= Get Binary File ${SERVICE_INSTANTIATION_TEMPLATE}
+ &{headers}= Create Dictionary Authorization=${BASIC_AUTH} Content-Type=application/json Accept=application/json
+ ${service_instantiation_request}= Post On Session api_handler_session /onap/so/infra/serviceInstantiation/v7/serviceInstances data=${data} headers=${headers}
+ Log to Console \nStatus code received: ${service_instantiation_request.status_code}
+ Log to Console Content received: ${service_instantiation_request.content}
+ Should Be Equal As Strings '${service_instantiation_request.status_code}' '202'
+
+ ${service_instantiation_json_response}= Evaluate json.loads(r"""${service_instantiation_request.content}""", strict=False) json
+ ${request_ID}= Set Variable ${service_instantiation_json_response}[requestReferences][requestId]
+ ${service_instance_Id}= Set Variable ${service_instantiation_json_response}[requestReferences][instanceId]
+ Set Global Variable ${service_instance_Id}
+ ${actual_request_state}= Set Variable ""
+
+ FOR ${INDEX} IN RANGE ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT}
+ ${orchestration_status_request}= Get On Session api_handler_session /onap/so/infra/orchestrationRequests/v7/${request_ID}
+ Log to Console Orchestration status code received: ${orchestration_status_request.status_code}
+ Log to Console Orchestration Content received: ${orchestration_status_request.content}
+ ${orchestration_json_response}= Evaluate json.loads(r"""${orchestration_status_request.content}""", strict=False) json
+ ${actual_request_state}= Set Variable ${orchestration_json_response}[request][requestStatus][requestState]
+ Log To Console Received actual repsonse status:${actual_request_state}
+ 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
+ END
+
+ Log To Console Final repsonse status received: ${actual_request_state}
+ Should Be Equal As Strings '${actual_request_state}' 'COMPLETE'
+
+Invoke CNF Instantiation
+ Run Keyword If "${service_instance_Id}"!="${EMPTY}" Log to Console Service Instance ID :${service_instance_Id} received
+ ... ELSE Fail Log to Console Invalid Service Instance ID :${service_instance_Id} recieved
+
+ ${data}= Get Binary File ${CNF_RESOURCE_INSTANTIATION_TEMPLATE}
+ ${cnf_instantiate_request_json}= Evaluate json.loads(r'''${data}''', strict=False) json
+ Set To Dictionary ${cnf_instantiate_request_json}[requestDetails][relatedInstanceList][0][relatedInstance] instanceId=${service_instance_Id}
+ ${cnf_instantiate_request_string}= Evaluate json.dumps(${cnf_instantiate_request_json}) json
+
+ Create Session api_handler_session http://${REPO_IP}:8080
+ &{headers}= Create Dictionary Authorization=${BASIC_AUTH} Content-Type=application/json Accept=application/json
+ ${cnf_instantiate_request}= Post On Session api_handler_session /onap/so/infra/serviceInstantiation/v7/serviceInstances/${service_instance_Id}/cnfs data=${cnf_instantiate_request_string} headers=${headers}
+ Log to Console \nStatus code received: ${cnf_instantiate_request.status_code}
+ Log to Console Content received: ${cnf_instantiate_request.content}
+ Should Be Equal As Strings '${cnf_instantiate_request.status_code}' '202'
+
+ ${cnf_instantiate_json_response}= Evaluate json.loads(r"""${cnf_instantiate_request.content}""") json
+ ${request_ID}= Set Variable ${cnf_instantiate_json_response}[requestReferences][requestId]
+ ${actual_request_state}= Set Variable ""
+ ${cnf_instance_Id}= Set Variable ${cnf_instantiate_json_response}[requestReferences][instanceId]
+ SET GLOBAL VARIABLE ${cnf_instance_Id}
+
+ FOR ${INDEX} IN RANGE ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT}
+ ${orchestration_status_request}= Get On Session 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(r"""${orchestration_status_request.content}""", strict=False) 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
+ END
+
+ ${service_instance_Id}= Set Variable ${orchestration_json_response}[request][instanceReferences][serviceInstanceId]
+ Log To Console Final repsonse status received: ${actual_request_state}
+ Should Be Equal As Strings '${actual_request_state}' 'COMPLETE'
+
+Invoke CNF Delete
+ Run Keyword If "${cnf_instance_Id}" != "${EMPTY}" Log to Console CNF Instance ID :${cnf_instance_Id} received
+ ... ELSE Fail Log to Console Invalid CNF Instance ID :${cnf_instance_Id} recieved
+ Run Keyword If "${service_instance_Id}" != "${EMPTY}" Log to Console CNF Instance ID :${service_instance_Id} received
+ ... ELSE Fail Log to Console Invalid CNF Instance ID :${service_instance_Id} recieved
+
+ Create Session api_handler_session http://${REPO_IP}:8080
+ ${data}= Get Binary File ${CNF_RESOURCE_DELETE_TEMPLATE}
+ &{headers}= Create Dictionary Authorization=${BASIC_AUTH} Content-Type=application/json Accept=application/json
+ ${cnf_delete_request}= Delete On Session api_handler_session /onap/so/infra/serviceInstantiation/v7/serviceInstances/${service_instance_Id}/cnfs/${cnf_instance_Id} data=${data} headers=${headers}
+ Log to Console \nStatus code received: ${cnf_delete_request.status_code}
+ Log to Console Content received: ${cnf_delete_request.content}
+ Should Be Equal As Strings '${cnf_delete_request.status_code}' '202'
+
+ ${cnf_delete_json_response}= Evaluate json.loads(r"""${cnf_delete_request.content}""") json
+ ${request_ID}= Set Variable ${cnf_delete_json_response}[requestReferences][requestId]
+ ${actual_request_state}= Set Variable ""
+
+ FOR ${INDEX} IN RANGE ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT}
+ ${orchestration_status_request}= Get On Session 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(r"""${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
+ END
+
+ Log To Console Final repsonse status received: ${actual_request_state}
+ Should Be Equal As Strings '${actual_request_state}' 'COMPLETE'
+
+Delete Service Instance
+ Run Keyword If "${service_instance_Id}" != "${EMPTY}" Log to Console CNF Instance ID :${service_instance_Id} received
+ ... ELSE Fail Log to Console Invalid Service Instance ID :${service_instance_Id} recieved
+
+ Create Session api_handler_session http://${REPO_IP}:8080
+ ${data}= Get Binary File ${SERVICE_DELETE_TEMPLATE}
+ &{headers}= Create Dictionary Authorization=${BASIC_AUTH} Content-Type=application/json Accept=application/json
+ ${service_delete_request}= Delete On Session api_handler_session /onap/so/infra/serviceInstantiation/v7/serviceInstances/${service_instance_Id} data=${data} headers=${headers}
+ ${service_delete_json_response}= Evaluate json.loads(r"""${service_delete_request.content}""") json
+ Log to Console \nStatus code received: ${service_delete_request.status_code}
+ Log to Console Content received: ${service_delete_request.content}
+ Should Be Equal As Strings '${service_delete_request.status_code}' '202'
+
+ ${request_ID}= Set Variable ${service_delete_json_response}[requestReferences][requestId]
+ ${actual_request_state}= Set Variable ""
+
+ FOR ${INDEX} IN RANGE ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT}
+ ${orchestration_status_request}= Get On Session 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(r"""${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
+ END
+
+ Log To Console Final repsonse status received: ${actual_request_state}
+ Should Be Equal As Strings '${actual_request_state}' 'COMPLETE' \ No newline at end of file
diff --git a/tests/so/integration-cnfm-testing/data/cnfResourceDeleteRequest.json b/tests/so/integration-cnfm-testing/data/cnfResourceDeleteRequest.json
new file mode 100644
index 00000000..3c4c848d
--- /dev/null
+++ b/tests/so/integration-cnfm-testing/data/cnfResourceDeleteRequest.json
@@ -0,0 +1,26 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "cnf",
+ "modelInvariantId": "198ab85b-ad8d-42e5-889d-4bdf486dfc91",
+ "modelVersionId": "14dbe730-b3b9-4b51-9983-76a96233228c",
+ "modelName": "ericsson-vsp-cnf-1",
+ "modelVersion": "1.0",
+ "modelCustomizationId": "083a388f-a00b-403a-b8a2-a0f3167e94e1",
+ "modelCustomizationName": "ericsson-vsp-cnf-1 0"
+ },
+ "requestInfo": {
+ "source": "CSIT",
+ "requestorId": "demo"
+ },
+ "requestParameters": {
+ "testApi": "GR_API",
+ "aLaCarte": true
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "EtsiCloudRegion",
+ "cloudOwner": "CloudOwner",
+ "tenantId": "693c7729b2364a26a3ca602e6f66187d"
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/so/integration-cnfm-testing/data/cnfResourceInstantiationRequest.json b/tests/so/integration-cnfm-testing/data/cnfResourceInstantiationRequest.json
new file mode 100644
index 00000000..007b05f6
--- /dev/null
+++ b/tests/so/integration-cnfm-testing/data/cnfResourceInstantiationRequest.json
@@ -0,0 +1,67 @@
+{
+ "requestDetails": {
+ "requestInfo": {
+ "instanceName": "DemoCnfInstance",
+ "source": "CSIT",
+ "suppressRollback": false,
+ "requestorId": "demo",
+ "productFamilyId": "f13844f4-dbf8-4d0e-a979-45204f3ddb4e"
+ },
+ "modelInfo": {
+ "modelType": "cnf",
+ "modelInvariantId": "198ab85b-ad8d-42e5-889d-4bdf486dfc91",
+ "modelVersionId": "14dbe730-b3b9-4b51-9983-76a96233228c",
+ "modelName": "ericsson-vsp-cnf-1",
+ "modelVersion": "1.0",
+ "modelCustomizationName": "ericsson-vsp-cnf-1 0"
+ },
+ "requestParameters": {
+ "userParams": [{
+ "deploymentItems":[{
+ "deploymentItemsId": "1",
+ "lifecycleParameterKeyValues":{
+ "primary.service.ports.mysql": "3306",
+ "primary.service.nodePorts.mysql": "3306"
+ }
+ },
+ {
+ "deploymentItemsId": "2",
+ "lifecycleParameterKeyValues":{
+ "service.ports.http": "80",
+ "service.ports.https": "443",
+ "service.nodePorts.http": "30001",
+ "service.nodePorts.https": "30002"
+ }
+ }]
+ }
+ ],
+ "testApi": "GR_API",
+ "aLaCarte": true
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "EtsiCloudRegion",
+ "cloudOwner": "CloudOwner",
+ "tenantId": "693c7729b2364a26a3ca602e6f66187d"
+ },
+ "lineOfBusiness": {
+ "lineOfBusinessName": "EtsiCsitLineOfBusiness"
+ },
+ "platform": {
+ "platformName": "EtsiCsitPlatform"
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "",
+ "modelInfo": {
+ "modelType": "service",
+ "modelName": "ericsson-demo-service-1",
+ "modelVersion": "1.0",
+ "modelInvariantId": "ef54671d-31e4-43e0-86e2-c3ab73c2a5a7",
+ "modelVersionId": "8839a41e-8644-46c0-a08f-206d8b0edff2"
+ }
+ }
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/tests/so/integration-cnfm-testing/data/serviceDeleteRequest.json b/tests/so/integration-cnfm-testing/data/serviceDeleteRequest.json
new file mode 100644
index 00000000..edb132a6
--- /dev/null
+++ b/tests/so/integration-cnfm-testing/data/serviceDeleteRequest.json
@@ -0,0 +1,19 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "ef54671d-31e4-43e0-86e2-c3ab73c2a5a7",
+ "modelVersionId": "8839a41e-8644-46c0-a08f-206d8b0edff2",
+ "modelName": "ericsson-demo-service-1",
+ "modelVersion": "1.0"
+ },
+ "requestInfo": {
+ "source": "CSIT",
+ "requestorId": "demo"
+ },
+ "requestParameters": {
+ "testApi": "GR_API",
+ "aLaCarte": true
+ }
+ }
+}
diff --git a/tests/so/integration-cnfm-testing/data/serviceInstantiationRequest.json b/tests/so/integration-cnfm-testing/data/serviceInstantiationRequest.json
new file mode 100644
index 00000000..78fe0b81
--- /dev/null
+++ b/tests/so/integration-cnfm-testing/data/serviceInstantiationRequest.json
@@ -0,0 +1,33 @@
+{
+ "requestDetails": {
+ "requestInfo": {
+ "instanceName": "DemoServiceInstance",
+ "source": "CSIT",
+ "suppressRollback": false,
+ "requestorId": "demo"
+ },
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "ef54671d-31e4-43e0-86e2-c3ab73c2a5a7",
+ "modelVersionId": "8839a41e-8644-46c0-a08f-206d8b0edff2",
+ "modelName": "ericsson-demo-service-1",
+ "modelVersion": "1.0"
+ },
+ "requestParameters": {
+ "userParams": [],
+ "testApi": "GR_API",
+ "subscriptionServiceType": "vCPE",
+ "aLaCarte": true
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "DemoCustomer"
+ },
+ "project": {
+ "projectName": "etsiCsitProject"
+ },
+ "owningEntity": {
+ "owningEntityId": "f2e1071e-3d47-4a65-94d4-e473ec03326a",
+ "owningEntityName": "OE-Demonstration"
+ }
+ }
+} \ No newline at end of file