3 Library RequestsLibrary
4 Library OperatingSystem
9 ${NFVO_NS_LCM_BASE_URL}= /so/so-etsi-nfvo-ns-lcm/v1/api/nslcm/v1
10 ${BASIC_AUTH}= Basic c28tZXRzaS1uZnZvLW5zLWxjbTpwYXNzd29yZDEk
12 Documentation Test cases for ETSI NFVO NS Lifecycle Management Operations
13 ... Create and Delete tests are synchronous
14 ... Instantiate and Terminate tests are asynchronous, test status checked through request to NS_LCM_OP_OCCs endpoint
16 ... -Network Service package being onboarded in etsi_package_onboarding_tests
20 Invoke Create Network Service
21 Create Session etsi_nfvo_ns_lcm_session http://${REPO_IP}:9095
22 ${data}= Get Binary File ${CURDIR}${/}data${/}createNetworkServiceRequest.json
23 &{headers}= Create Dictionary Authorization=${BASIC_AUTH} Content-Type=application/json Accept=application/json HTTP_GLOBALCUSTOMERID=DemoCustomer
24 ${create_network_service_request}= POST On Session etsi_nfvo_ns_lcm_session ${NFVO_NS_LCM_BASE_URL}/ns_instances data=${data} headers=${headers}
25 log to console ${create_network_service_request.content}
26 ${create_network_service_json_response}= Evaluate json.loads(r"""${create_network_service_request.content}""", strict=False) json
27 ${request_Id}= Set Variable ${create_network_service_json_response}[id]
28 SET GLOBAL VARIABLE ${request_Id}
30 Should Be Equal As Strings '${create_network_service_request.status_code}' '201'
32 Invoke Instantiate Network Service
33 Run Keyword If "${request_Id}"!="${EMPTY}" Log to Console Network Service ID :${request_Id}
34 ... ELSE Fail \nInvalid Network Service ID :${request_Id} received
35 Create Session etsi_nfvo_ns_lcm_session http://${REPO_IP}:9095
36 ${data}= Get Binary File ${CURDIR}${/}data${/}instantiateNetworkServiceRequest.json
37 &{headers}= Create Dictionary Authorization=${BASIC_AUTH} Content-Type=application/json Accept=application/json
38 ${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}
39 Run Keyword If '${instantiate_network_service_request.status_code}' == '202' log to console \nexecuted with expected result
40 ... ELSE Fail \nInstantiate Network Service Request Received Response: ${instantiate_network_service_request.status_code}
41 log to console \n${instantiate_network_service_request.content}
43 Wait Until Keyword Succeeds 3 min 5 secs Get NS LCM OP OCCs
45 Invoke Terminate Network Service
46 Run Keyword If "${actual_request_state}"=="COMPLETED" Log to Console NS LCM OP OCCs State: ${actual_request_state}
47 ... ELSE Fail \nTerminate Network Service Failed to Start. Instantiate Network Service Request State: ${actual_request_state}
48 Create Session etsi_nfvo_ns_lcm_session http://${REPO_IP}:9095
49 &{headers}= Create Dictionary Authorization=${BASIC_AUTH} Content-Type=application/json Accept=application/json
50 ${terminate_network_service_request}= POST On Session etsi_nfvo_ns_lcm_session ${NFVO_NS_LCM_BASE_URL}/ns_instances/${request_Id}/terminate headers=${headers}
51 Run Keyword If '${terminate_network_service_request.status_code}' == '202' log to console \nexecuted with expected result
52 ... ELSE Fail \nTerminate Network Service Request Received Response: ${terminate_network_service_request.status_code}
53 log to console \n${terminate_network_service_request.content}
55 Wait Until Keyword Succeeds 3 min 5 secs Get NS LCM OP OCCs
57 Invoke Delete Network Service
58 Run Keyword If "${actual_request_state}"=="COMPLETED" Log to Console NS LCM OP OCCs State: ${actual_request_state}
59 ... ELSE Fail \nDelete Network Service Failed to Start. Invalid Previous Request State Received: ${actual_request_state}
60 Create Session etsi_nfvo_ns_lcm_session http://${REPO_IP}:9095
61 &{headers}= Create Dictionary Authorization=${BASIC_AUTH} Content-Type=application/json Accept=application/json
62 ${delete_network_service_request}= DELETE On Session etsi_nfvo_ns_lcm_session ${NFVO_NS_LCM_BASE_URL}/ns_instances/${request_Id} headers=${headers}
63 log to console \n${delete_network_service_request.content}
65 Should Be Equal As Strings '${delete_network_service_request.status_code}' '204'
70 ${ns_lcm_status_request}= GET On Session etsi_nfvo_ns_lcm_session ${NFVO_NS_LCM_BASE_URL}/ns_lcm_op_occs/${request_Id}
71 log to console \n${ns_lcm_status_request.content}
72 ${ns_lcm_request_json_response}= Evaluate json.loads(r"""${ns_lcm_status_request.content}""", strict=False) json
73 ${actual_request_state}= SET VARIABLE ${ns_lcm_request_json_response}[operationState]
74 SET GLOBAL VARIABLE ${actual_request_state}
75 Should Be Equal As Strings ${ns_lcm_status_request.status_code} 200
76 Should Be Equal As Strings ${actual_request_state} COMPLETED