Commit e681c0a7 authored by Elian Kraja's avatar Elian Kraja
Browse files

Minor fixies on variables

parent ebc7ed76
Loading
Loading
Loading
Loading
Loading
+0 −110
Original line number Diff line number Diff line
*** Settings ***
Library    JSONSchemaLibrary    schemas/
Library    BuiltIn
Library    REST    ${AMS_SCHEMA}://${AMS_HOST}:${AMS_PORT}    ssl_verify=false
Library    OperatingSystem

*** Variables ***
@@ -54,113 +53,4 @@ Check HTTP Response Contain Header with value
    Check HTTP Response Header Contains    ${HEADER_TOCHECK}
    Should Be Equal As Strings    ${value}    ${response['headers']['Content-Type']}    

vGET
    [Arguments]    ${uri}

    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Content-Type":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}

    GET    ${uri}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

vPOST
    [Arguments]    ${uri}    ${content}

    ${file}=    Catenate    SEPARATOR=    json/    ${content}    .json
    ${body}=    Get File    ${file}

    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Content-Type":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}

    POST    ${uri}    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

vPUT
    [Arguments]    ${uri}    ${content}

    ${file}=    Catenate    SEPARATOR=    json/    ${content}    .json
    ${body}=    Get File    ${file}

    # Retrieve the e-tag value to ensure a proper update.
    vGET    ${uri}
    Set Headers    {"If-Match":"${response['headers']['If-Match']}"}

    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Content-Type":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}

    PUT    ${uri}    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

vPUT without e-tag
    [Arguments]    ${uri}    ${content}

    ${file}=    Catenate    SEPARATOR=    json/    ${content}    .json
    ${body}=    Get File    ${file}

    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Content-Type":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}

    PUT    ${uri}    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

vPUT invalid e-tag
    [Arguments]    ${uri}    ${content}

    ${file}=    Catenate    SEPARATOR=    json/    ${content}    .json
    ${body}=    Get File    ${file}

    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Content-Type":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    Set Headers    {"If-Match":"__some_invalid_value__"}

    PUT    ${uri}    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

vDELETE
    [Arguments]    ${uri}

    # Retrieve the e-tag value to ensure a proper delete.
    vGET    ${uri}
    Set Headers    {"If-Match":"${response['headers']['If-Match']}"}

    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Content-Type":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}

    DELETE    ${uri}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

vDELETE without e-tag
    [Arguments]    ${uri}

    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Content-Type":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}

    DELETE    ${uri}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

vDELETE invalid e-tag
    [Arguments]    ${uri}

    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Content-Type":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    Set Headers    {"If-Match":"__some_invalid_value__"}

    DELETE    ${uri}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
+5 −4
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ Resource environment/variables.txt
Resource    ../../pics.txt
Resource    ../../GenericKeywords.robot
Resource    resources/UeAppsContextAPI.robot
Library     String
Library     REST    ${MEC-APP_SCHEMA}://${MEC-APP_HOST}:${MEC-APP_PORT}    ssl_verify=false


@@ -43,7 +44,7 @@ Update of the application context
    Should Be True    ${PIC_SERVICES} == 1
    Create an application context
    # Test Body
    ${CREATE_APP_CTX['callbackReference']}=    ${CALLBACK_REFERENCE_1}
    ${CREATE_APP_CTX}=    Set Variable  ${CALLBACK_REFERENCE_1}
    Update application context    ${APP_CTX_ID}    ${CREATE_APP_CTX}
    Check HTTP Response Status Code Is    204
    Check HTTP Response Body Json Schema Is   AppContext
@@ -62,7 +63,7 @@ Update of the application context with wrong parameters
    Should Be True    ${PIC_SERVICES} == 1
    Create an application context
    # Test Body
    ${CREATE_APP_CTX['callbackReference']}=    '' # Empty string
    ${CREATE_APP_CTX}=     Set Variable  '' # Empty string
    Update application context    ${APP_CTX_ID}    ${CREATE_APP_CTX}
    Check HTTP Response Status Code Is    400
    Check ProblemDetails    400
@@ -80,7 +81,7 @@ Update of the application context with unknown URI
    Should Be True    ${PIC_SERVICES} == 1
    Create an application context
    # Test Body
    ${CREATE_APP_CTX['callbackReference']}=    ${CALLBACK_REFERENCE_1}
    ${CREATE_APP_CTX}=    Set Variable    ${CALLBACK_REFERENCE_1}
    Update application context    ${NON_EXISTENT_APP_CTX_ID}    ${CREATE_APP_CTX}
    Check HTTP Response Status Code Is    404
    Check ProblemDetails    404
@@ -102,7 +103,7 @@ Delete of the application context
    Check HTTP Response Status Code Is    204


Delete of the application context
Delete of the application context with non esistent APP CTX ID
    [Documentation]   TC_MEC_MEO_UEAPPCTX_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 016 V1.1.1, clause 7.5.3.5
+1 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ Get the list of the application contexts with wrong parameter
    Delete an application context    ${APP_CTX_ID}


Get the list of the application contexts with wrong parameter
Get the list of the application contexts with non esistent parameter
    [Documentation]   TC_MEC_MEO_UEAPPS_001_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 016 V1.1.1, clause 7.3.3.1
+86 −41
Original line number Diff line number Diff line
@@ -4,16 +4,16 @@ Documentation
...    A test suite for validating Application Service Availability Query (APPSAQ) operations.

Resource    ../../GenericKeywords.robot
Resource    environment/variables.txt
Library     REST    ${SCHEMA}://${HOST}:${PORT}    ssl_verify=false

Default Tags    TP_MEC_SRV_APPSAQ
Default Tags    TC_MEC_SRV_APPSAQ


*** Variables ***


*** Test Cases ***

TP_MEC_SRV_APPSAQ_001_OK
TC_MEC_SRV_APPSAQ_001_OK
    [Documentation]
    ...    Check that the IUT responds with a list of available MEC services
    ...    for a given application instance when queried by a MEC Application
@@ -23,12 +23,12 @@ TP_MEC_SRV_APPSAQ_001_OK

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES

    vGET    /${PX_MEC_SVC_MGMT_APPS_URI}/${APP_INSTANCE_ID}/services
    Get a list of mecService of an application instance    ${APP_INSTANCE_ID} 
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    ServiceInfoList


TP_MEC_SRV_APPSAQ_001_BR
TC_MEC_SRV_APPSAQ_001_BR
    [Documentation]
    ...   Check that the IUT responds with an error when
    ...    a request with incorrect parameters is sent by a MEC Application
@@ -38,11 +38,11 @@ TP_MEC_SRV_APPSAQ_001_BR
    [Tags]    PIC_MEC_PLAT    PIC_SERVICES

    # Wrong query parameter name should trigger an error response.
    vGET    /${PX_MEC_SVC_MGMT_APPS_URI}/${APP_INSTANCE_ID}/services?id=some_instance_id
    Get a list of mecService of an application instance with parameters    ${APP_INSTANCE_ID}    ${INSTANCE_ID}    ${FAKE_INSTANCE_ID_VALUE}
    Check HTTP Response Status Code Is    400


TP_MEC_SRV_APPSAQ_002_OK
TC_MEC_SRV_APPSAQ_002_OK
    [Documentation]
    ...    Check that the IUT notifies the authorised relevant (subscribed) application
    ...    instances when a new service for a given application instance is registered
@@ -51,16 +51,14 @@ TP_MEC_SRV_APPSAQ_002_OK
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/v2.0.9/MecServiceMgmtApi.yaml#/definitions/ServiceInfo

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES

    vPOST    /${PX_MEC_SVC_MGMT_APPS_URI}/${APP_INSTANCE_ID}/services    ${MEC_APP_NEW_SVC_DATA}
    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 Plaform IUT notifies the MEC Application instances    ServiceAvailabilityNotification
#    Check Result Contains    ${response['body']['ServiceInfo']}    serName    ${SERVICE_NAME}


TP_MEC_SRV_APPSAQ_002_BR
TC_MEC_SRV_APPSAQ_002_BR
    [Documentation]
    ...    Check that the IUT responds with an error when
    ...    a request with incorrect parameters is sent by a MEC Application
@@ -69,12 +67,11 @@ TP_MEC_SRV_APPSAQ_002_BR
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/v2.0.9/MecServiceMgmtApi.yaml#/definitions/ServiceInfo

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES

    vPOST    /${PX_MEC_SVC_MGMT_APPS_URI}/${APP_INSTANCE_ID}/services    ${MEC_APP_NEW_SVC_DATA_BR}
    Create new service    ServiceInfoError    ${APP_INSTANCE_ID}
    Check HTTP Response Status Code Is    400


TP_MEC_SRV_APPSAQ_002_NF
TC_MEC_SRV_APPSAQ_002_NF
    [Documentation]
    ...    Check that the IUT responds with an error when
    ...    a request for an unknown URI is sent by a MEC Application
@@ -83,12 +80,11 @@ TP_MEC_SRV_APPSAQ_002_NF
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/v2.0.9/MecServiceMgmtApi.yaml#/definitions/ServiceInfo

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES

    vPOST    /${PX_MEC_SVC_MGMT_APPS_URI}/${NON_EXISTENT_APP_INSTANCE_ID}/services    ${MEC_APP_NEW_SVC_DATA}
    Create new service    ServiceInfo    ${NON_EXISTENT_APP_INSTANCE_ID}
    Check HTTP Response Status Code Is    404


TP_MEC_SRV_APPSAQ_003_OK
TC_MEC_SRV_APPSAQ_003_OK
    [Documentation]
    ...    Check that the IUT responds with the information on a specific service
    ...    for a given application instance when queried by a MEC Application
@@ -97,14 +93,13 @@ TP_MEC_SRV_APPSAQ_003_OK
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/v2.0.9/MecServiceMgmtApi.yaml#/definitions/ServiceInfo

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES

    vGET    /${PX_MEC_SVC_MGMT_APPS_URI}/${APP_INSTANCE_ID}/services/${SERVICE_ID}
    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}


TP_MEC_SRV_APPSAQ_003_NF
TC_MEC_SRV_APPSAQ_003_NF
    [Documentation]
    ...    Check that the IUT responds with an error when
    ...    a request for an unknown URI is sent by a MEC Application
@@ -112,12 +107,11 @@ TP_MEC_SRV_APPSAQ_003_NF
    ...    Reference    ETSI GS MEC 011 V2.0.9, clause 8.2.7.3.1

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES

    vGET    /${PX_MEC_SVC_MGMT_APPS_URI}/${APP_INSTANCE_ID}/services/${NON_EXISTENT_SERVICE_ID}
    Get individual service    ${APP_INSTANCE_ID}    ${NON_EXISTENT_SERVICE_ID}
    Check HTTP Response Status Code Is    404


TP_MEC_SRV_APPSAQ_004_OK
TC_MEC_SRV_APPSAQ_004_OK
    [Documentation]
    ...    Check that the IUT updates a service information for a given
    ...    application instance when commanded by a MEC Application
@@ -126,14 +120,13 @@ TP_MEC_SRV_APPSAQ_004_OK
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/v2.0.9/MecServiceMgmtApi.yaml#/definitions/ServiceInfo

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES

    vPUT    /${PX_MEC_SVC_MGMT_APPS_URI}/${APP_INSTANCE_ID}/services/${SERVICE_ID}    ${MEC_APP_SVC_UPDT_DATA}
    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 Result Contains    ${response['body']['ServiceInfo']}    version    ${SVC_NEW_VERSION}


TP_MEC_SRV_APPSAQ_004_BR
TC_MEC_SRV_APPSAQ_004_BR
    [Documentation]
    ...    Check that the IUT responds with an error when
    ...    a request with incorrect parameters is sent by a MEC Application
@@ -142,12 +135,11 @@ TP_MEC_SRV_APPSAQ_004_BR
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/v2.0.9/MecServiceMgmtApi.yaml#/definitions/ServiceInfo

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES

    vPUT    /${PX_MEC_SVC_MGMT_APPS_URI}/${APP_INSTANCE_ID}/services/${SERVICE_ID}    ${MEC_APP_SVC_UPDT_DATA_BR}
    Update service    ${APP_INSTANCE_ID}    ${SERVICE_ID}    ServiceInfoUpdatedError
    Check HTTP Response Status Code Is    400


TP_MEC_SRV_APPSAQ_004_NF
TC_MEC_SRV_APPSAQ_004_NF
    [Documentation]
    ...    Check that the IUT responds with an error when
    ...    a request for an unknown URI is sent by a MEC Application
@@ -156,12 +148,11 @@ TP_MEC_SRV_APPSAQ_004_NF
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/v2.0.9/MecServiceMgmtApi.yaml#/definitions/ServiceInfo

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES

    vPUT    /${PX_MEC_SVC_MGMT_APPS_URI}/${APP_INSTANCE_ID}/services/${NON_EXISTENT_SERVICE_ID}    ${MEC_APP_SVC_UPDT_DATA}
    Update service    ${APP_INSTANCE_ID}    ${NON_EXISTENT_SERVICE_ID}    ServiceInfoUpdated
    Check HTTP Response Status Code Is    404


TP_MEC_SRV_APPSAQ_004_PF
TC_MEC_SRV_APPSAQ_004_PF
    [Documentation]
    ...    Check that the IUT responds with an error when
    ...    a request sent by a MEC Application doesn't comply with a required condition
@@ -170,19 +161,73 @@ TP_MEC_SRV_APPSAQ_004_PF
    ...    OpenAPI    https://forge.etsi.org/rep/mec/gs011-app-enablement-api/blob/v2.0.9/MecServiceMgmtApi.yaml#/definitions/ServiceInfo

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES

    vPUT invalid e-tag    /${PX_MEC_SVC_MGMT_APPS_URI}/${APP_INSTANCE_ID}/services/${SERVICE_ID}    ${MEC_APP_SVC_UPDT_DATA}
    Update service with invalid etag     ${APP_INSTANCE_ID}    ${SERVICE_ID}    ServiceInfoUpdated
    Check HTTP Response Status Code Is    412



*** Keywords ***

Check Plaform IUT notifies the MEC Application instances
    [Documentation]
    ...    

    [Arguments]    ${instance_id}    ${content}
Get a list of mecService of an application instance with parameters
    [Arguments]    ${appInstanceId}    ${key}=None    ${value}=None
    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/applications/${appInstanceId}/services?${key}=${value}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Get a list of mecService of an application instance
    [Arguments]    ${appInstanceId}
    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/applications/${appInstanceId}/services
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    

Create new service
    [Arguments]    ${content}    ${appInstanceId}
    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Content-Type":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    ${file}=    Catenate    SEPARATOR=    jsons/    ${content}    .json
    ${body}=    Get File    ${file}
    Post    ${apiRoot}/${apiName}/${apiVersion}/applications/${appInstanceId}/services    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}


Get individual service
    [Arguments]    ${appInstanceId}    ${serviceName} 
    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/applications/${appInstanceId}/services/${serviceName}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}  
    
Update service    
    [Arguments]    ${appInstanceId}    ${serviceId}    ${content}
    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Content-Type":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    ${file}=    Catenate    SEPARATOR=    jsons/    ${content}    .json
    ${body}=    Get File    ${file}
    Post    ${apiRoot}/${apiName}/${apiVersion}/applications/${appInstanceId}/services/${serviceId}    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    


Update service with invalid etag
    [Arguments]    ${appInstanceId}    ${serviceId}    ${content}
    Set Headers    {"If-Match": ${INVALID_ETAG}}
    Update service    ${appInstanceId}    ${serviceId}    ${content}
    

# Check Plaform IUT notifies the MEC Application instances
    # [Documentation]
    # ...    

    # [Arguments]    ${instance_id}    ${content}

    # TODO check how to send the message (isn't defined). Does it need to be tested as it's not defined?
    
+34 −0
Original line number Diff line number Diff line
*** Variables ***
# Generic variables
${SCHEMA}                   http
${HOST}                     10.192.2.172
${PORT}                     8081
${response}                         {}
${TOKEN}                            Basic YWxhZGRpbjpvcGVuc2VzYW1l
${apiRoot}        
${apiName}        mec_service_mgmt
${apiVersion}     v1

# Specific variables
${APP_INSTANCE_ID}                       5abe4782-2c70-4e47-9a4e-0ee3a1a0fd1f
${INSTANCE_ID}                      instance_id
${FAKE_INSTANCE_ID_VALUE}           5
${NON_EXISTENT_APP_INSTANCE_ID}     NON_ESISTENT_APP_INSTANCE_ID
${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

# # 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
Loading