Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

Commit

Permalink
Merge pull request #62 from 5GEVE/add-sapdata-rf-test
Browse files Browse the repository at this point in the history
Add sapdata Robot Framework test
  • Loading branch information
TheWall89 authored Dec 16, 2020
2 parents 0ddd32b + 892c1d3 commit 31853ef
Show file tree
Hide file tree
Showing 6 changed files with 195 additions and 8 deletions.
139 changes: 139 additions & 0 deletions adaptation_layer/robotframework/MSO-LO-LCM-RANO-Workflow.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
*** Settings ***
Resource environment/variables.robot
Variables ${SCHEMAS_PATH}
Resource NSLCMOperationKeywords.robot
Resource NFVOOperationKeywords.robot
Library REST ${MSO-LO_BASE_API}
Library OperatingSystem
Library JSONLibrary
Library JSONSchemaLibrary schemas/


*** Test Cases ***
POST NS Instance Creation
[Tags] instantiate-terminate-workflow
[Documentation] Test ID: mso-lo-test-3.2
... Test title: POST NS Instance Creation
... Test objective: The objective is to test the workflow for Creating a NS instance
... Pre-conditions: none
... Post-Conditions: The NS lifecycle management operation occurrence is in NOT_ISTANTIATED state
POST New nsInstance
Check HTTP Response Status Code Is 201
Check HTTP Response Header Contains Location
Check HTTP Response Body Json Schema Is ${ns_schema}
Check NS Id
Run Keyword If "${apiRoot}" == "nfvo"
... Check VNF Ids
... ELSE IF "${apiRoot}" == "rano"
... Log No vnfInstance with rano
... ELSE
... Fatal Error Unknown value for variable apiRoot
Check resource not_instantiated

GET NS Instance List
[Tags] instantiate-terminate-workflow
[Documentation] Test ID: mso-lo-test-3.1
... Test title: GET NS Instance List
... Test objective: The objective is to test the workflow for retriving the NS instance list
... Pre-conditions: none
... Post-Conditions: none
GET NsInstances
Check HTTP Response Status Code Is 200
Check HTTP Response Body Json Schema Is ${ns_list_schema}

GET Information about an individual NS Instance
[Tags] instantiate-terminate-workflow
[Documentation] Test ID: mso-lo-test-3.3
... Test title: GET Information about an individual NS Instance
... Test objective: The objective is to test that GET method returns an individual NS instance
... Pre-conditions: none
... Post-Conditions: none
GET IndividualNSInstance
Check HTTP Response Status Code Is 200
Check HTTP Response Body Json Schema Is ${ns_schema}

POST NS Instance Instantiate
[Tags] instantiate-terminate-workflow
[Documentation] Test ID: mso-lo-test-3.4
... Test title: POST NS Instance Instantiate
... Test objective: The objective is to test the workflow for Instantiate a NS instance
... Pre-conditions: the resource is in NOT_INSTANTIATED state
... Post-Conditions: status code 202
Check resource existence
Check resource not_instantiated
Run Keyword If "${apiRoot}" == "nfvo"
... POST Instantiate nsInstance with vnf/vld in additionalParamsForNs
... ELSE IF "${apiRoot}" == "rano"
... POST Instantiate nsInstance with SapData
... ELSE
... Fatal Error Unknown value for variable apiRoot
Check HTTP Response Status Code Is 202
Check HTTP Response Header Contains Location
Check Operation Occurrence Id

GET NS LCM OP Occurrence Instantiate COMPLETED
[Tags] instantiate-terminate-workflow
[Documentation] Test ID: mso-lo-test-3.6
... Test title: GET NS LCM OP Occurrence Instantiate COMPLETED
... Test objective: The objective is to test the workflow for retrive NS LCM OP Occurrence
... Pre-conditions: none
... Post-Conditions: status code 200
Wait Until Keyword Succeeds ${MAX_WAIT} ${INTERVAL_WAIT} Run Keywords
... GET Individual NS LCM OP Occurrence
... AND Check resource operationState is COMPLETED

GET NS LCM OP Occurrences
[Tags] instantiate-terminate-workflow
[Documentation] Test ID: mso-lo-test-3.5
... Test title: GET LCM OP Occurrences
... Test objective: The objective is to test the workflow for retrive NS LCM OP Occurrences
... Pre-conditions: none
... Post-Conditions: status code 200
GET NS LCM OP Occurrences
Check HTTP Response Status Code Is 200
Check HTTP Response Body Json Schema Is ${ns_lcm_op_occ_list_schema}

POST NS Instance Terminate
[Tags] instantiate-terminate-workflow
[Documentation] Test ID: mso-lo-test-3.
... Test title: POST Terminate NS Instance
... Test objective: The objective is to test the workflow for Terminate a NS instance
... Pre-conditions: the resource is in INSTANTIATED state
... Post-Conditions: the resource is in NOT_INSTANTIATED state
Check resource existence
Check resource instantiated
POST Terminate NSInstance
Check HTTP Response Status Code Is 202
Check Operation Occurrence Id

POST NS Instance Delete
[Tags] instantiate-terminate-workflow
[Documentation] Test ID: mso-lo-test-3.6
... Test title: POST NS Instance Delete
... Test objective: The objective is to test the workflow for Deleting a NS instance
... Pre-conditions: the resource is in NOT_INSTANTIATED state
... Post-Conditions: status code 204
Sleep 5s
Check resource not_instantiated
DELETE IndividualNSInstance
Check HTTP Response Status Code Is 204

POST NS Instance Creation Bad Request
[Tags] standalone
[Documentation] Test ID: mso-lo-test-3.2.1
... Test title: POST Instance Creation Bad Request
... Test objective: The objective is to test the workflow for Creating a NS instance with a bad request
... Pre-conditions: none
... Post-Conditions: Status code 400
POST New nsInstance with invalid request body
Check HTTP Response Status Code Is 400

GET Information about an inexistent individual NS Instance
[Tags] standalone
[Documentation] Test ID: mso-lo-test-3.3.1
... Test title: GET Information about an inexistent individual NS Instance
... Test objective: The objective is to test that GET method returns an inexistent individual NS instance
... Pre-conditions: none
... Post-Conditions: Status code 404
GET IndividualNSInstance inexistent
Check HTTP Response Status Code Is 404
14 changes: 12 additions & 2 deletions adaptation_layer/robotframework/MSO-LO-LCM-Workflow.robot
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ POST NS Instance Creation
Check HTTP Response Header Contains Location
Check HTTP Response Body Json Schema Is ${ns_schema}
Check NS Id
Check VNF Ids
Run Keyword If "${apiRoot}" == "nfvo"
... Check VNF Ids
... ELSE IF "${apiRoot}" == "rano"
... Log No vnfInstance with rano
... ELSE
... Fatal Error Unknown value for variable apiRoot
Check resource not_instantiated
POST New Subscription Good
Check Sub Id
Expand Down Expand Up @@ -58,7 +63,12 @@ POST NS Instance Instantiate
... Post-Conditions: status code 202
Check resource existence
Check resource not_instantiated
POST Instantiate nsInstance with vnf/vld in additionalParamsForNs
Run Keyword If "${apiRoot}" == "nfvo"
... POST Instantiate nsInstance with vnf/vld in additionalParamsForNs
... ELSE IF "${apiRoot}" == "rano"
... POST Instantiate nsInstance with SapData
... ELSE
... Fatal Error Unknown value for variable apiRoot
Check HTTP Response Status Code Is 202
Check HTTP Response Header Contains Location
Check Operation Occurrence Id
Expand Down
12 changes: 11 additions & 1 deletion adaptation_layer/robotframework/NSLCMOperationKeywords.robot
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Check VNF Ids
Check Operation Occurrence Id
${nsLcmOpOcc}= set variable ${response[0]['headers']['Location']}
# using a basic regex, it can be improved
${nsLcmOpOcc}= evaluate re.search(r'(/nfvo/.*/ns_lcm_op_occs/(.*))', '''${nsLcmOpOcc}''').group(2) re
${nsLcmOpOcc}= evaluate re.search(r'(/${apiRoot}/.*/ns_lcm_op_occs/(.*))', '''${nsLcmOpOcc}''').group(2) re
Set Global Variable ${nsLcmOpOccId} ${nsLcmOpOcc}
Should Not Be Empty ${nsLcmOpOccId}
Log ${nsLcmOpOccId}
Expand Down Expand Up @@ -219,6 +219,16 @@ POST Instantiate nsInstance with vnf/vld in additionalParamsForNs
${outputResponse}= Output response
Set Global Variable @{response} ${outputResponse}

POST Instantiate nsInstance with SapData
Log Trying to Instantiate a ns Instance with SapData
Set Headers {"Accept":"${ACCEPT}"}
Set Headers {"Content-Type": "${CONTENT_TYPE}"}
Run Keyword If ${AUTH_USAGE} == 1 Set Headers {"Authorization":"${AUTHORIZATION}"}
${body}= Load JSON From File jsons/InstantiateNsRequestSapData.json
Post ${apiRoot}/${nfvoId}/ns_instances/${nsInstanceId}/instantiate ${body} timeout=300
${outputResponse}= Output response
Set Global Variable @{response} ${outputResponse}

POST Instantiate nsInstance
Log Trying to Instantiate a ns Instance
Set Headers {"Accept":"${ACCEPT}"}
Expand Down
17 changes: 13 additions & 4 deletions adaptation_layer/robotframework/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,21 @@
The `.robot` scripts in this folder perform integration tests of the `mso-lo` application
against a real instance of a NFVO or RANO.

The test suites included are:

- [MSO-LO-NFVO-Workflow](MSO-LO-NFVO-Workflow.robot): tests the retrieval of information about NFVOs
- [MSO-LO-LCM-Workflow](MSO-LO-LCM-Workflow.robot): tests the complete LCM of a Network Service in a NFVO (includes subscriptions to notifications)
- [MSO-LO-LCM-RANO-Workflow](MSO-LO-LCM-RANO-Workflow.robot): tests the complete LCM of slice in a RANO
- [MSO-LO-SUBS](MSO-LO-SUBS.robot): tests the retrieval of information about subscriptions.

## Prerequisites

To execute the tests you need:

- An instance of `mso-lo` up and running
- An instance of a real NFVO or RANO
- An instante of the [IWF Repository](https://github.com/5GEVE/iwf-repository)
- Correct communication between the components above
- An instance of `mso-lo` up and running
- An instance of a real NFVO or RANO
- An instante of the [IWF Repository](https://github.com/5GEVE/iwf-repository)
- Correct communication between the components above

## Configuration

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"SapData": [
{
"sapdId": "sap_test_mobile",
"sapName": "External Test Mobile Sap",
"description": "Sap Test description",
"radioSliceProfile": {
"site": "ITALY_TURIN",
"coverageArea": "ITALY.TIM_LAB",
"radioAccessTechnology": "5GNSA",
"sST": "URLLC",
"latency": 10,
"uLThptPerSlice": 50,
"dLThptPerSlice": 50
}
}
]
}
3 changes: 2 additions & 1 deletion nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ server {
location / {
include uwsgi_params;
uwsgi_pass uwsgicluster;
uwsgi_read_timeout 300s;
}
}
}

0 comments on commit 31853ef

Please sign in to comment.