Commit 5d7b0b75 authored by Michele Carignani's avatar Michele Carignani
Browse files

Merge branch '2.1.1-fix-plu'

parents 31208d0c dd0169d7
Loading
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -23,12 +23,21 @@ Check HTTP Response Body Json Schema Is

Should Be Present In Json List
    [Arguments]     ${expr}   ${json_field}   ${json_value}
    Log    Check if ${json_field} is present in ${expr} with the value ${jsonvalue}
    Log    Check if ${json_field} is present in ${expr} with the value ${json_value}
    :FOR  ${item}  IN  @{expr}
    \  Exit For Loop If    "${item['${json_field}']}" == "${json_value}"
    \  Exit For Loop If    ${item[${json_field}]} == ${json_value}
    Log    Item found ${item}
    [return]    ${item}
    
Should Be Present In Json
    [Arguments]     ${expr}   ${json_field}   ${json_value}
    Log    Check if ${json_field} is present in ${expr} with the value ${json_value}
    Should Be Equal As Strings    ${expr}[${json_field}]    ${json_value}

Check Response Contains
    [Arguments]    ${source}    ${parameter}    ${value}
    Should Be Present In Json    ${source}    ${parameter}    ${value}
    
Check Result Contains
    [Arguments]    ${source}    ${parameter}    ${value}
    Should Be Present In Json List    ${source}    ${parameter}    ${value}
+74 −6
Original line number Diff line number Diff line
# MEC Testing Framework in Robot Framework
# MEC Testing Framework in Robot Framework - GS 032-2

## Introduction
This repositories contains the test specifications and test adapter code for MEC Testing project in Robot Framework
This repositories contains the test specifications and test adapter code for MEC Testing project in Robot Framework.

Latest publicly available drafts are available at https://docbox.etsi.org/isg/mec/open.


For more information on ETSI ISG Multi-access Edge Computing (MEC), visit https://www.etsi.org/technologies/multi-access-edge-computing.

## Contact information
Email at cti_support at etsi dot org

Email at `cti_support` at `etsi` dot `org`.

## License
Unless specified otherwise, the content of this repository and the files contained are released under the BSD-3-Clause license.
@@ -21,16 +27,78 @@ NOTE All draft can be found in the 'IETF XML Registry', accessible [here](https:

## Installation

TODO
The main precondition for running the tests is having [Robot Framework](http://robotframework.org/) installed.
The [Robot Framework Installation Instructions](https://github.com/robotframework/robotframework/blob/master/INSTALL.rst) provide full details of the installation procedure.
For those familiar with installing Python packages with [pip](http://pip-installer.org/) package manager, the following command can be run to install [Robot Framework](http://robotframework.org/):

[Robot Framework](http://robotframework.org/) >3.0 is recommended. It requires Python 3.

### Robot Framework Required Libraries
The [Robot Framework](http://robotframework.org/) Test Cases in this repository depend on the following libraries:

* [RESTInstance](https://github.com/asyrjasalo/RESTinstance)
* [DependencyLibrary](https://github.com/mentalisttraceur/robotframework-dependencylibrary)
* [JSONLibrary](https://github.com/nottyo/robotframework-jsonlibrary)
* [JSONSchemaLibrary](https://github.com/jstaffans/robotframework-jsonschemalibrary)
* [Requests](https://pypi.org/project/robotframework-requests/)

A [pip](http://pip-installer.org/) [requirements file](https://forge.etsi.org/rep/mec/gs032p3-robot-test-suite/blob/2.1.1-fix-plu/requirements.txt) is provided to ease the installation of the required python libraries, as follows:
```
$ pip install -r requirements.txt
```


## Usage

TODO
The usage of these Test Suites goes through different steps. First of all, you should be aware of the structure's folder. After that, some configuration steps are needed and at the end, you can run the test.  

### Folder structure
The Test folder is structured as follow:

### Test Suite files
```
<group>/<feature>/<interface>  

e.g.: SRV/APPSUB/PlatAppSubscriptions.robot
```

### Environmental files
In the same folder, you will find two subfolders 
* environment
* jsons

The **environment** folder contain a  file, called *variables.txt*, which contains all the information necessary to reach and interact with the SUT
```
*** Variables ***
${MEC-APP_SCHEMA}                   http  
${MEC-APP_HOST}                     192.168.56.1  
${MEC-APP_PORT}                     8081  
...
```
This file should be updated before running the tests.

The **json** folder contains the json payloads necessary to perform the POST/PUT/PATCH requests. 
These files should contain the exact content to be sent.


### Execution of the test cases
The [Robot Framework](http://robotframework.org/) Test Cases in this repository can be executed with the following command:
```
$ robot <name_of_the_robot_file>
```

To execute all test case files in a directory recursively, just give the directory as an argument. You can also give multiple files or directories in one go and use various command-line options supported by [Robot Framework](http://robotframework.org/). 

For more information about the command-line usage, you can run:
```
$ robot --help
```
The [Robot Framework User Guide](http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#executing-test-cases) provides full details on how to execute tests in general.

## How to Report a Bug

The ETSI MEC Testing Framework project is under constant development, so it is possible that you will
encounter a bug while using it. Please report bugs at cti_support at etsi dot org.
encounter a bug while using it. You may report in the [Issues section](https://forge.etsi.org/rep/mec/gs032p3-robot-test-suite/issues) of the project.

For any other inquiry, you may contact cti_support at etsi dot org.
+58 −24
Original line number Diff line number Diff line
@@ -18,8 +18,8 @@ TC_MEC_SRV_APPSAQ_001_OK
    ...    Check that the IUT responds with a list of available MEC services
    ...    for a given application instance when queried by a MEC Application
    ...
    ...    Reference    ETSI GS MEC 011 V2.0.9, clause 8.2.6.3.1
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/v2.0.9/MecServiceMgmtApi.yaml#/definitions/ServiceInfo
    ...    Reference    ETSI GS MEC 011 V2.1.1, clause 8.2.6.3.1
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/master/MecServiceMgmtApi.yaml#/definitions/ServiceInfo

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES

@@ -33,7 +33,7 @@ TC_MEC_SRV_APPSAQ_001_BR
    ...   Check that the IUT responds with an error when
    ...    a request with incorrect parameters is sent by a MEC Application
    ...
    ...    Reference    ETSI GS MEC 011 V2.0.9, clause 8.2.6.3.1
    ...    Reference    ETSI GS MEC 011 V2.1.1, clause 8.2.6.3.1

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES

@@ -47,15 +47,15 @@ TC_MEC_SRV_APPSAQ_002_OK
    ...    Check that the IUT notifies the authorised relevant (subscribed) application
    ...    instances when a new service for a given application instance is registered
    ...
    ...    Reference    ETSI GS MEC 011 V2.0.9, clause 8.2.6.3.4
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/v2.0.9/MecServiceMgmtApi.yaml#/definitions/ServiceInfo
    ...    Reference    ETSI GS MEC 011 V2.1.1, clause 8.2.6.3.4
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/master/MecServiceMgmtApi.yaml#/definitions/ServiceInfo

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
    Create new service    ServiceInfo    ${APP_INSTANCE_ID}
    Check HTTP Response Status Code Is    201
    Check HTTP Response Body Json Schema Is    ServiceInfo
    Check HTTP Response Header Contains    Location
#    Check Result Contains    ${response['body']['ServiceInfo']}    serName    ${SERVICE_NAME}
    Check Response Contains    ${response['body']}    serName    ${NEW_SERVICE_NAME}


TC_MEC_SRV_APPSAQ_002_BR
@@ -63,8 +63,8 @@ TC_MEC_SRV_APPSAQ_002_BR
    ...    Check that the IUT responds with an error when
    ...    a request with incorrect parameters is sent by a MEC Application
    ...
    ...    Reference    ETSI GS MEC 011 V2.0.9, clause 8.2.6.3.4
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/v2.0.9/MecServiceMgmtApi.yaml#/definitions/ServiceInfo
    ...    Reference    ETSI GS MEC 011 V2.1.1, clause 8.2.6.3.4
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/master/MecServiceMgmtApi.yaml#/definitions/ServiceInfo

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
    Create new service    ServiceInfoError    ${APP_INSTANCE_ID}
@@ -76,8 +76,8 @@ TC_MEC_SRV_APPSAQ_002_NF
    ...    Check that the IUT responds with an error when
    ...    a request for an unknown URI is sent by a MEC Application
    ...
    ...    Reference    ETSI GS MEC 011 V2.0.9, clause 8.2.6.3.4
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/v2.0.9/MecServiceMgmtApi.yaml#/definitions/ServiceInfo
    ...    Reference    ETSI GS MEC 011 V2.1.1, clause 8.2.6.3.4
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/master/MecServiceMgmtApi.yaml#/definitions/ServiceInfo

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
    Create new service    ServiceInfo    ${NON_EXISTENT_APP_INSTANCE_ID}
@@ -89,14 +89,14 @@ TC_MEC_SRV_APPSAQ_003_OK
    ...    Check that the IUT responds with the information on a specific service
    ...    for a given application instance when queried by a MEC Application
    ...
    ...    Reference    ETSI GS MEC 011 V2.0.9, clause 8.2.7.3.1
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/v2.0.9/MecServiceMgmtApi.yaml#/definitions/ServiceInfo
    ...    Reference    ETSI GS MEC 011 V2.1.1, clause 8.2.7.3.1
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/master/MecServiceMgmtApi.yaml#/definitions/ServiceInfo

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
    Get individual service    ${APP_INSTANCE_ID}    ${SERVICE_ID}
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    ServiceInfo
    Check Result Contains    ${response['body']['ServiceInfo']}    serInstanceId    ${SERVICE_ID}
    Check Response Contains    ${response['body']}    serInstanceId    ${SERVICE_ID}


TC_MEC_SRV_APPSAQ_003_NF
@@ -104,7 +104,7 @@ TC_MEC_SRV_APPSAQ_003_NF
    ...    Check that the IUT responds with an error when
    ...    a request for an unknown URI is sent by a MEC Application
    ...
    ...    Reference    ETSI GS MEC 011 V2.0.9, clause 8.2.7.3.1
    ...    Reference    ETSI GS MEC 011 V2.1.1, clause 8.2.7.3.1

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
    Get individual service    ${APP_INSTANCE_ID}    ${NON_EXISTENT_SERVICE_ID}
@@ -116,14 +116,14 @@ TC_MEC_SRV_APPSAQ_004_OK
    ...    Check that the IUT updates a service information for a given
    ...    application instance when commanded by a MEC Application
    ...
    ...    Reference    ETSI GS MEC 011 V2.0.9, clause 8.2.7.3.2
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/v2.0.9/MecServiceMgmtApi.yaml#/definitions/ServiceInfo
    ...    Reference    ETSI GS MEC 011 V2.1.1, clause 8.2.7.3.2
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/master/MecServiceMgmtApi.yaml#/definitions/ServiceInfo

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
    Update service    ${APP_INSTANCE_ID}    ${SERVICE_ID}    ServiceInfoUpdated
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    ServiceInfo
    #Check Result Contains    ${response['body']['ServiceInfo']}    version    ${SVC_NEW_VERSION}
    Check Response Contains    ${response['body']}    version    ${SVC_NEW_VERSION}


TC_MEC_SRV_APPSAQ_004_BR
@@ -131,8 +131,8 @@ TC_MEC_SRV_APPSAQ_004_BR
    ...    Check that the IUT responds with an error when
    ...    a request with incorrect parameters is sent by a MEC Application
    ...
    ...    Reference    ETSI GS MEC 011 V2.0.9, clause 8.2.7.3.2
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/v2.0.9/MecServiceMgmtApi.yaml#/definitions/ServiceInfo
    ...    Reference    ETSI GS MEC 011 V2.1.1, clause 8.2.7.3.2
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/master/MecServiceMgmtApi.yaml#/definitions/ServiceInfo

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
    Update service    ${APP_INSTANCE_ID}    ${SERVICE_ID}    ServiceInfoUpdatedError
@@ -144,8 +144,8 @@ TC_MEC_SRV_APPSAQ_004_NF
    ...    Check that the IUT responds with an error when
    ...    a request for an unknown URI is sent by a MEC Application
    ...
    ...    Reference    ETSI GS MEC 011 V2.0.9, clause 8.2.7.3.2
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/v2.0.9/MecServiceMgmtApi.yaml#/definitions/ServiceInfo
    ...    Reference    ETSI GS MEC 011 V2.1.1, clause 8.2.7.3.2
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/master/MecServiceMgmtApi.yaml#/definitions/ServiceInfo

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
    Update service    ${APP_INSTANCE_ID}    ${NON_EXISTENT_SERVICE_ID}    ServiceInfoUpdated
@@ -157,14 +157,39 @@ TC_MEC_SRV_APPSAQ_004_PF
    ...    Check that the IUT responds with an error when
    ...    a request sent by a MEC Application doesn't comply with a required condition
    ...
    ...    Reference    ETSI GS MEC 011 V2.0.9, clause 8.2.7.3.2
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/v2.0.9/MecServiceMgmtApi.yaml#/definitions/ServiceInfo
    ...    Reference    ETSI GS MEC 011 V2.1.1, clause 8.2.7.3.2
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/master/MecServiceMgmtApi.yaml#/definitions/ServiceInfo

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
    Update service with invalid etag     ${APP_INSTANCE_ID}    ${SERVICE_ID}    ServiceInfoUpdated
    Check HTTP Response Status Code Is    412


TC_MEC_SRV_APPSAQ_005_OK
    [Documentation]
    ...    Check that the IUT executes the deletion of a service 
    ...    for a given application instance when requested by a MEC Application
    ...
    ...    Reference    ETSI GS MEC 011 V2.1.1, clause 8.2.7.3.1
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/master/MecServiceMgmtApi.yaml#/definitions/ServiceInfo

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
    Remove individual service    ${APP_INSTANCE_ID}    ${SERVICE_ID}
    Check HTTP Response Status Code Is    204


TC_MEC_SRV_APPSAQ_005_NF
    [Documentation]
    ...    Check that the IUT responds with an error when
    ...    a request for deletion of a unknown service is sent by a MEC Application
    ...
    ...    Reference    ETSI GS MEC 011 V2.1.1, clause 8.2.7.3.1

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
    Remove individual service    ${APP_INSTANCE_ID}    ${NON_EXISTENT_SERVICE_ID}
    Check HTTP Response Status Code Is    404



*** Keywords ***
Get a list of mecService of an application instance with parameters
@@ -211,7 +236,7 @@ Update service
    Set Headers    {"Authorization":"${TOKEN}"}
    ${file}=    Catenate    SEPARATOR=    jsons/    ${content}    .json
    ${body}=    Get File    ${file}
    Post    ${apiRoot}/${apiName}/${apiVersion}/applications/${appInstanceId}/services/${serviceId}    ${body}
    PUT    ${apiRoot}/${apiName}/${apiVersion}/applications/${appInstanceId}/services/${serviceId}    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
@@ -223,6 +248,15 @@ Update service with invalid etag
    Update service    ${appInstanceId}    ${serviceId}    ${content}
    

Remove individual service
    [Arguments]    ${appInstanceId}    ${serviceName} 
    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    Delete    ${apiRoot}/${apiName}/${apiVersion}/applications/${appInstanceId}/services/${serviceName}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output} 
    

# Check Plaform IUT notifies the MEC Application instances
    # [Documentation]
    # ...    
+4 −13
Original line number Diff line number Diff line
@@ -18,17 +18,8 @@ ${SERVICE_ID} e0deee2b-6e50-4f33-ab09-8bf0585025d3
${NON_EXISTENT_SERVICE_ID}          NON_EXISTENT_SERVICE_ID
${INVALID_ETAG}                     INVALID_ETAG

# ${SUBSCRIPTION_TYPE}                MobilityProcedureSubscription
# ${SUBSCRIPTION_ID}                  e0deee2b-6e50-4f33-ab09-8bf0585025d3
# ${NON_EXISTENT_SUBSCRIPTION_ID}     NON_EXISTENT_SUBSCRIPTION_ID
# ${NON_EXISTENT_APP_MOBILITY_SERVICE_ID}     NON_EXISTENT_APP_MOBILITY_SERVICE_ID
## this parameter should be the same as in jsons/ServiceInfo.json on param serName
${NEW_SERVICE_NAME}                NEW_SERVICE_NAME

# # Notifications variables
# ${MOCK_SERVER_JAR}    ../../../bin/mockserver-netty-5.5.0-jar-with-dependencies.jar

# ${callback_port}    9091
# ${callback_uri}    http://172.22.1.7:${callback_port}
# ${callback_endpoint}    /amsi/subscriptions
# ${callback_endpoint_error}    /subs_404
# ${total_polling_time}   2 min
# ${polling_interval}     10 sec
 No newline at end of file
## this parameter should be the same as in jsons/ServiceInfoUpdated.json on param sversion
${SVC_NEW_VERSION}                 v2.0
 No newline at end of file
+42 −0
Original line number Diff line number Diff line
{
  "serName": "NEW_SERVICE_NAME",
  "version": "reprehenderit Ut non commodo",
  "state": "INACTIVE",
  "transportInfo": {
    "id": "labore ut Excepteur sunt ipsum",
    "name": "in minim enim",
    "type": "MB_ROUTING",
    "protocol": "veniam aliqua cillum in",
    "version": "exercitation pariatur",
    "endpoint": {
      "addresses": [
        {
          "host": "sint culpa laboris",
          "port": 10968
        }
      ]
    },
    "security": {
      "oAuth2Info": {
        "grantTypes": [
          "OAUTH2_IMPLICIT_GRANT",
          "OAUTH2_IMPLICIT_GRANT",
          "OAUTH2_CLIENT_CREDENTIALS"
        ],
        "tokenEndpoint": "https://RXjkuoqKaR.nskcJZJsyoIFJ0k86hJdxq.eTHEGqxAybM3DEZlUlYQpZ47s6RR+O9gyFrLbO92,9"
      }
    },
    "description": "dolor occaecat pariatur ex do"
  },
  "serializer": "XML",
  "serInstanceId": "cillum nostrud minim consectetur proident",
  "serCategory": {
    "href": "http://VWwswcAtAylGx.usasPjZ+bqQIHCMc7FfToVvk2M.SYAWYvSDKGSRL7Z.rxyfC0goFNZtoGJrlFc89,",
    "id": "consectetur et eiusmod",
    "name": "ea ipsum irure mollit et",
    "version": "et"
  },
  "scopeOfLocality": "ZONE",
  "consumedLocalOnly": true,
  "isLocal": false
}
 No newline at end of file
Loading