Add additional tests for ETSI NFVO NS LCM CSIT Tests 68/117868/3
authorrope252 <gareth.roper@est.tech>
Mon, 15 Feb 2021 10:12:10 +0000 (10:12 +0000)
committerrope252 <gareth.roper@est.tech>
Wed, 17 Feb 2021 16:19:36 +0000 (16:19 +0000)
Change-Id: I18f0c2cad663914a2147b97d048ba29fd8fc17a7
Issue-ID: INT-1839
Signed-off-by: rope252 <gareth.roper@est.tech>
tests/so/etsi/data/instantiateNetworkServiceRequest.json [new file with mode: 0644]
tests/so/etsi/etsi_nfvo_ns_lcm_tests.robot

diff --git a/tests/so/etsi/data/instantiateNetworkServiceRequest.json b/tests/so/etsi/data/instantiateNetworkServiceRequest.json
new file mode 100644 (file)
index 0000000..44a5d43
--- /dev/null
@@ -0,0 +1,14 @@
+{
+    "nsFlavourId": "default",
+    "locationConstraints": [{
+        "vnfProfileId": "b1bb0ce7-2222-4fa7-95ed-4840d70a1177"
+    }],
+    "additionalParamsForVnf": [{
+            "vnfProfileId": "b1bb0ce7-2222-4fa7-95ed-4840d70a1177",
+            "vnfInstanceName": "etsiNsVnfCsit1",
+            "vnfInstanceDescription": "test",
+            "additionalParams": {
+                "vim_id": "CloudOwner_EtsiCloudRegion_693c7729b2364a26a3ca602e6f66187d"
+            }
+    }]
+}
index e931b3c..91bbe6e 100644 (file)
@@ -16,12 +16,55 @@ Invoke Create Network Service
     ${data}=    Get Binary File     ${CURDIR}${/}data${/}createNetworkServiceRequest.json
     &{headers}=  Create Dictionary    Authorization=${BASIC_AUTH}    Content-Type=application/json    Accept=application/json    HTTP_GLOBALCUSTOMERID=DemoCustomer
     ${create_network_service_request}=    POST On Session    etsi_nfvo_ns_lcm_session    ${NFVO_NS_LCM_BASE_URL}/ns_instances    data=${data}    headers=${headers}
-    log to console      ${create_network_service_request.content}
-    ${create_network_service_json_response}=    Evaluate     json.loads(r"""${create_network_service_request.content}""", strict=False)    json
-    ${request_Id}=          Set Variable         ${create_network_service_json_response}[id]
-    SET GLOBAL VARIABLE       ${request_Id}
+    log to console    ${create_network_service_request.content}
+    ${create_network_service_json_response}=    Evaluate    json.loads(r"""${create_network_service_request.content}""", strict=False)    json
+    ${request_Id}=    Set Variable   ${create_network_service_json_response}[id]
+    SET GLOBAL VARIABLE    ${request_Id}
 
-    Run Keyword If  '${create_network_service_request.status_code}' == '201'  log to console  \nexecuted with expected result
-    log to console      \nCreate Network Service Response Status Code: ${create_network_service_request.status_code}
     Should Be Equal As Strings    '${create_network_service_request.status_code}'    '201'
 
+Invoke Instantiate Network Service
+    Run Keyword If    "${request_Id}"!="${EMPTY}"   Log to Console    Network Service ID :${request_Id}
+    ...    ELSE    Fail    \nInvalid Network Service ID :${request_Id} received
+    Create Session   etsi_nfvo_ns_lcm_session  http://${REPO_IP}:9095
+    ${data}=    Get Binary File     ${CURDIR}${/}data${/}instantiateNetworkServiceRequest.json
+    &{headers}=  Create Dictionary    Authorization=${BASIC_AUTH}    Content-Type=application/json    Accept=application/json
+    ${instantiate_network_service_request}=    POST On Session    etsi_nfvo_ns_lcm_session    ${NFVO_NS_LCM_BASE_URL}/ns_instances/${request_Id}/instantiate    data=${data}    headers=${headers}
+    Run Keyword If  '${instantiate_network_service_request.status_code}' == '202'  log to console   \nexecuted with expected result
+    ...    ELSE    Fail    \nInstantiate Network Service Request Received Response: ${instantiate_network_service_request.status_code}
+    log to console    \n${instantiate_network_service_request.content}
+
+    Wait Until Keyword Succeeds    3 min    5 secs    Get NS LCM OP OCCs
+
+Invoke Terminate Network Service
+    Run Keyword If    "${actual_request_state}"=="COMPLETED"    Log to Console    NS LCM OP OCCs State: ${actual_request_state}
+    ...    ELSE    Fail    \nTerminate Network Service Failed to Start. Instantiate Network Service Request State: ${actual_request_state}
+    Create Session   etsi_nfvo_ns_lcm_session  http://${REPO_IP}:9095
+    &{headers}=  Create Dictionary    Authorization=${BASIC_AUTH}    Content-Type=application/json    Accept=application/json
+    ${terminate_network_service_request}=    POST On Session    etsi_nfvo_ns_lcm_session    ${NFVO_NS_LCM_BASE_URL}/ns_instances/${request_Id}/terminate    headers=${headers}
+    Run Keyword If  '${terminate_network_service_request.status_code}' == '202'  log to console   \nexecuted with expected result
+    ...    ELSE    Fail    \nTerminate Network Service Request Received Response: ${terminate_network_service_request.status_code}
+    log to console    \n${terminate_network_service_request.content}
+
+    Wait Until Keyword Succeeds    3 min    5 secs    Get NS LCM OP OCCs
+
+Invoke Delete Network Service
+    Run Keyword If    "${actual_request_state}"=="COMPLETED"    Log to Console    NS LCM OP OCCs State: ${actual_request_state}
+    ...    ELSE    Fail    \nDelete Network Service Failed to Start. Invalid Previous Request State Received: ${actual_request_state}
+    Create Session   etsi_nfvo_ns_lcm_session  http://${REPO_IP}:9095
+    &{headers}=  Create Dictionary    Authorization=${BASIC_AUTH}    Content-Type=application/json    Accept=application/json
+    ${delete_network_service_request}=    DELETE On Session    etsi_nfvo_ns_lcm_session    ${NFVO_NS_LCM_BASE_URL}/ns_instances/${request_Id}    headers=${headers}
+    log to console    \n${delete_network_service_request.content}
+
+    Should Be Equal As Strings    '${delete_network_service_request.status_code}'    '204'
+
+*** Keywords ***
+
+Get NS LCM OP OCCs
+    ${ns_lcm_status_request}=   GET On Session  etsi_nfvo_ns_lcm_session   ${NFVO_NS_LCM_BASE_URL}/ns_lcm_op_occs/${request_Id}
+    log to console      \n${ns_lcm_status_request.content}
+    ${ns_lcm_request_json_response}=    Evaluate     json.loads(r"""${ns_lcm_status_request.content}""", strict=False)    json
+    ${actual_request_state}=     SET VARIABLE       ${ns_lcm_request_json_response}[operationState]
+    SET GLOBAL VARIABLE    ${actual_request_state}
+    Should Be Equal As Strings    ${ns_lcm_status_request.status_code}    200
+    Should Be Equal As Strings    ${actual_request_state}    COMPLETED