Commit a205dae2 authored by piscione's avatar piscione
Browse files

MEC013 v3.1.1 UELOCSUB Draft TCs available

parent 1ab59ce8
Loading
Loading
Loading
Loading
+212 −53
Original line number Diff line number Diff line
@@ -8,98 +8,257 @@ Resource ../../../pics.txt
Resource    environment/variables.txt
Library     REST    ${SCHEMA}://${HOST}:${PORT}    ssl_verify=false
Library     OperatingSystem 

Library     String
Library     libraries/Server.py
Default Tags    TC_MEC_SRV_UELOCSUB


*** Variables ***
${response}

*** Test Cases ***

TC_MEC_MEC013_SRV_UELOCSUB_001_OK
TC_MEC_MEC013_SRV_UELOCSUB_001_OK_01
    [Documentation]
    ...    Check that the IUT acknowledges the UE location change subscription request
    ...    when commanded by a MEC Application and notifies it when the location changes
    ...    Check that the IUT acknowledges the subscription by a MEC Application to notifications user location event
    ...
    ...    Reference  ETSI GS MEC 013 3.1.1 Clause 5.3.4
    ...    ETSI GS MEC 013 3.1.1 Clause 6.3.4
    ...    ETSI GS MEC 013 3.1.1 Clause 6.4.4
    ...    ETSI GS MEC 013 3.1.1 Clause 7.5.3.4
    ...    
    ...    Reference    ETSI GS MEC 013 V2.1.1, clause 7.3.4
    ...    OpenAPI    https://forge.etsi.org/gitlab/mec/gs013-location-api/blob/master/LocationAPI.yaml#/definitions/UserTrackingSubscription

    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
    Create new subscription    UserTrackingSubscription
    Create a subscription    UserLocationEventSubscription
    ${elements} =  Split String    ${response['headers']['Location']}       /
    Set Suite Variable    ${SUB_ID}    ${elements[3]}
    Check HTTP Response Status Code Is    201
    Check HTTP Response Body Json Schema Is    UserTrackingSubscription
    # TODO fix related TP
    # Check Result Contains    ${response['body']['userTrackingSubscription']}    clientCorrelator    ${USERTRACKSUB_CLIENT_ID}
    Should Be Equal As Strings    ${response['body']['userTrackingSubscription']['callbackReference']}    ${USERTRACK_NOTIF_CALLBACK_URI}
    Should Be Equal As Strings    ${response['body']['userTrackingSubscription']['address']}    ${USERTRACK_IP_ADDRESS}

    # TODO how to send this? The TP has the IUT doing this immediately. Do we want this or will it be discarded as part of the test?
    # // MEC 013, clause 7.3.4.3
    # the IUT entity sends a vPOST containing
    # Uri set to CALLBACK_URL 
    # body containing
    # zonalPresenceNotification containing
    # clientCorrelator set to CLIENT_ID, 
    # address set to IP_ADDRESS
    # ;
    # ;
    # ;
    # to the MEC_APP entity

TC_MEC_MEC013_SRV_UELOCSUB_001_BR
    Check HTTP Response Body Json Schema Is    UserLocationEventSubscription
    Get value entry from JSON file  UserLocationEventSubscription   subscriptionType
    ${CLIENT_CORR}       Get value entry from JSON file  UserLocationEventSubscription   clientCorrelator
    ${CALLBACK_REF}      Get value entry from JSON file  UserLocationEventSubscription   callbackReference
    ${ADDRESS}           Get value entry from JSON file  UserLocationEventSubscription   address
    Should be Equal   ${response['body']['subscriptionType']}    UserLocationEventSubscription
    Should be Equal   ${response['body']['clientCorrelator']}    ${CLIENT_CORR} 
    Should be Equal   ${response['body']['callbackReference']}   ${CALLBACK_REF}  
    Should be Equal   ${response['body']['address']}             ${ADDRESS} 
    Spawn Notification Server     UserLocationEventNotification
    Validate Json   UserLocationEventNotification.schema.json    ${payload_notification}
    [TearDown]  Remove a subscription    ${SUB_ID}



TC_MEC_MEC013_SRV_UELOCSUB_001_OK_02
    [Documentation]
    ...    Check that the IUT responds with an error when
    ...    a request with incorrect parameters is sent by a MEC Application
    ...    Check that the IUT acknowledges the subscription by a MEC Application to notifications user location periodic
    ...
    ...    Reference  ETSI GS MEC 013 3.1.1 Clause 5.3.4
    ...    ETSI GS MEC 013 3.1.1 Clause 6.3.5
    ...    ETSI GS MEC 013 3.1.1 Clause 6.4.5
    ...    ETSI GS MEC 013 3.1.1 Clause 7.5.3.4
    ...    
    ...    Reference    ETSI GS MEC 013 V2.1.1, clause 7.3.4
    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
    Create a subscription    UserLocationPeriodicSubscription
    Check HTTP Response Status Code Is    201
    ${elements} =  Split String    ${response['headers']['Location']}       /
    Set Suite Variable    ${SUB_ID}    ${elements[3]}
    Check HTTP Response Body Json Schema Is    UserLocationPeriodicSubscription
    Get value entry from JSON file  UserLocationPeriodicSubscription   subscriptionType
    ${CLIENT_CORR}       Get value entry from JSON file  UserLocationPeriodicSubscription   clientCorrelator
    ${CALLBACK_REF}      Get value entry from JSON file  UserLocationPeriodicSubscription   callbackReference
    ${ADDRESS}           Get value entry from JSON file  UserLocationPeriodicSubscription   address
    ${PER_EVENT_INFO}    Get value entry from JSON file  UserLocationPeriodicSubscription   periodicEventInfo
    Should be Equal   ${response['body']['subscriptionType']}    UserLocationPeriodicSubscription
    Should be Equal   ${response['body']['clientCorrelator']}        ${CLIENT_CORR} 
    Should be Equal   ${response['body']['callbackReference']}       ${CALLBACK_REF}  
    Should be Equal   ${response['body']['address']}                 ${ADDRESS} 
    Should be Equal   ${response['body']['periodicEventInfo']}       ${PER_EVENT_INFO} 
    Spawn Notification Server     UserLocationPeriodicNotification
    Validate Json   UserLocationPeriodicNotification.schema.json    ${payload_notification}
    [TearDown]  Remove a subscription    ${SUB_ID}


TC_MEC_MEC013_SRV_UELOCSUB_001_BR_01
    [Documentation]
    ...    Check that the IUT responds with an error 
    ...    when a request with incorrect parameters is sent by a MEC Application - Neither callbackReference nor websockNotifConfig provided
    ...    Reference  ETSI GS MEC 013 3.1.1 Clause 5.3.4
    ...    ETSI GS MEC 013 3.1.1 Clause 6.3.4
    ...    ETSI GS MEC 013 3.1.1 Clause 6.4.4
    ...    ETSI GS MEC 013 3.1.1 Clause 7.5.3.4
    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
    Create a subscription    UserLocationEventSubscriptionBR
    Check HTTP Response Status Code Is    400

TC_MEC_MEC013_SRV_UELOCSUB_001_BR_02
    [Documentation]
    ...    Check that the IUT responds with an error 
    ...    when a request with incorrect parameters is sent by a MEC Application - Neither callbackReference nor websockNotifConfig provided
    ...    Reference  ETSI GS MEC 013 3.1.1 Clause 5.3.4
    ...    ETSI GS MEC 013 3.1.1 Clause 6.3.5
    ...    ETSI GS MEC 013 3.1.1 Clause 6.4.5
    ...    ETSI GS MEC 013 3.1.1 Clause 7.5.3.4
    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
    Create new subscription    UserTrackingSubscriptionError
    Create a subscription    UserLocationPeriodicSubscriptionBR
    Check HTTP Response Status Code Is    400
    

TC_MEC_MEC013_SRV_UELOCSUB_002_OK
    [Documentation]
    ...    Check that the IUT acknowledges the cancellation of UE location change notifications
    ...    Check that the IUT acknowledges the cancellation of UE information change notifications 
    ...    when commanded by a MEC Application
    ...
    ...    Reference    ETSI GS MEC 013 V2.1.1, clause 7.3.6

    ...    Reference  ETSI GS MEC 013 3.1.1 Clause 5.3.4
    ...    ETSI GS MEC 013 3.1.1 Clause 5.3.6
    ...    ETSI GS MEC 013 3.1.1 Clause 7.6.3.5
    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
    Remove subscription    ${SUBSCRIPTION_ID}
    [Setup]   Create a subscription    UserLocationEventSubscription
    ${elements} =  Split String    ${response['headers']['Location']}       /
    Set Suite Variable    ${SUB_ID}    ${elements[3]}
    Remove a subscription  ${SUB_ID}
    Check HTTP Response Status Code Is    204


TC_MEC_MEC013_SRV_UELOCSUB_002_NF
    [Documentation]
    ...    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 013 V2.1.1, clause 7.3.6

    ...    Check that the IUT responds with an error 
    ...    when a request for an URI that cannot be mapped to a valid resource URI is sent by a MEC Application
    ...    Reference  ETSI GS MEC 013 3.1.1 Clause 5.3.4
    ...    ETSI GS MEC 013 3.1.1 Clause 5.3.6
    ...    ETSI GS MEC 013 3.1.1 Clause 7.6.3.5
    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
    Remove subscription    ${NON_EXISTENT_SUBSCRIPTION_ID}
    [Setup]   Remove a subscription  ${NON_EXISTENT_SUBSCRIPTION_ID}
    Remove a subscription  ${NON_EXISTENT_SUBSCRIPTION_ID}
    Check HTTP Response Status Code Is    404
    


TC_MEC_MEC013_SRV_UELOCSUB_003_OK_01
    [Documentation]
    ...    Check that the IUT acknowledges a request 
    ...    to modify an existing subscription by a MEC Application
    ...    Reference  ETSI GS MEC 013 3.1.1 Clause 5.3.4
    ...    ETSI GS MEC 013 3.1.1 Clause 6.3.4
    ...    ETSI GS MEC 013 3.1.1 Clause 6.4.4
    ...    ETSI GS MEC 013 3.1.1 Clause 7.6.3.2
    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
    [Setup]   Create a subscription    UserLocationEventSubscription
    ${elements} =  Split String    ${response['headers']['Location']}       /
    Set Suite Variable    ${SUB_ID}    ${elements[3]}
    Update a subscription    ${SUB_ID}  UserLocationEventSubscriptionUpdate
    ${CLIENT_CORR}       Get value entry from JSON file  UserLocationEventSubscriptionUpdate   clientCorrelator
    ${CALLBACK_REF}      Get value entry from JSON file  UserLocationEventSubscriptionUpdate   callbackReference
    ${ADDRESS}           Get value entry from JSON file  UserLocationEventSubscriptionUpdate   address
    Should be Equal   ${response['body']['subscriptionType']}    UserLocationEventSubscription
    Should be Equal   ${response['body']['clientCorrelator']}    ${CLIENT_CORR} 
    Should be Equal   ${response['body']['callbackReference']}   ${CALLBACK_REF}  
    Should be Equal   ${response['body']['address']}             ${ADDRESS} 
    Check HTTP Response Status Code Is    200
    [TearDown]  Remove a subscription  ${SUB_ID}
    

TC_MEC_MEC013_SRV_UELOCSUB_003_OK_02
    [Documentation]
    ...    Check that the IUT acknowledges a request to modify an existing subscription by a MEC Application
    ...    ETSI GS MEC 013 3.1.1 Clause 6.3.4
    ...    ETSI GS MEC 013 3.1.1 Clause 6.4.4
    ...    ETSI GS MEC 013 3.1.1 Clause 7.6.3.2
    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
    [Setup]  Create a subscription    UserLocationPeriodicSubscription

    ${elements} =  Split String    ${response['headers']['Location']}       /
    Set Suite Variable    ${SUB_ID}    ${elements[3]}
    
    Update a subscription    ${SUB_ID}  UserLocationPeriodicSubscriptionUpdate
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    UserLocationPeriodicSubscription
    ${CLIENT_CORR}       Get value entry from JSON file  UserLocationPeriodicSubscriptionUpdate   clientCorrelator
    ${CALLBACK_REF}      Get value entry from JSON file  UserLocationPeriodicSubscriptionUpdate   callbackReference
    ${ADDRESS}           Get value entry from JSON file  UserLocationPeriodicSubscriptionUpdate   address
    ${PER_EVENT_INFO}    Get value entry from JSON file  UserLocationPeriodicSubscriptionUpdate   periodicEventInfo
    Should be Equal   ${response['body']['subscriptionType']}    UserLocationPeriodicSubscription
    Should be Equal   ${response['body']['clientCorrelator']}        ${CLIENT_CORR} 
    Should be Equal   ${response['body']['callbackReference']}       ${CALLBACK_REF}  
    Should be Equal   ${response['body']['address']}                 ${ADDRESS} 
    Should be Equal   ${response['body']['periodicEventInfo']}       ${PER_EVENT_INFO} 
    [TearDown]  Remove a subscription    ${SUB_ID}



TC_MEC_MEC013_SRV_UELOCSUB_003_BR_02
    [Documentation]
    ...    Check that the IUT responds with an error when received an inconsistent request
    ...    Reference  ETSI GS MEC 013 3.1.1 Clause 5.3.4
    ...    ETSI GS MEC 013 3.1.1 Clause 6.3.4
    ...    ETSI GS MEC 013 3.1.1 Clause 6.4.4
    ...    ETSI GS MEC 013 3.1.1 Clause 7.6.3.2
    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
    [Setup]   Create a subscription    UserLocationPeriodicSubscription
    ${elements} =  Split String    ${response['headers']['Location']}       /
    Set Suite Variable    ${SUB_ID}    ${elements[3]}
    Update a subscription    ${SUB_ID}  UserLocationEventSubscriptionUpdateBR
    Check HTTP Response Status Code Is    400
    [TearDown]  Remove a subscription  ${SUB_ID}
    

TC_MEC_MEC013_SRV_UELOCSUB_003_NF
    [Documentation]
    ...    Check that the IUT acknowledges a request to modify a not existing subscription by a MEC Application
    ...    Reference  ETSI GS MEC 013 3.1.1 Clause 6.3.4
    ...    ETSI GS MEC 013 3.1.1 Clause 6.4.4
    ...    ETSI GS MEC 013 3.1.1 Clause 7.6.3.2
    [Tags]    PIC_MEC_PLAT    PIC_SERVICES
    [Setup]   Remove a subscription  ${NON_EXISTENT_SUBSCRIPTION_ID}  
    Update a subscription    ${NON_EXISTENT_SUBSCRIPTION_ID}   UserLocationEventSubscriptionUpdate
    Check HTTP Response Status Code Is    404
    
*** Keywords ***
Create new subscription
Create a subscription
    [Arguments]    ${content}
    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Content-Type":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    Set Headers    {"Authorization":"${TOKEN}"}
    ${file}=    Catenate    SEPARATOR=    jsons/    ${content}    .json
    ${body}=    Get File    ${file}
    Post    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/userTracking    ${body}
    Post    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/users   ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
Remove subscription  
    [Arguments]    ${subscriptionId}

Update a subscription
    [Arguments]    ${subscription_id}   ${content}
    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    Delete    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/userTracking/${subscriptionId}
    Set Headers    {"Authorization":"${TOKEN}"}
    ${file}=    Catenate    SEPARATOR=    jsons/    ${content}    .json
    ${body}=    Get File    ${file}    
    Put    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/users/${subscription_id}   ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    

    
Retrieve a subscription
    [Arguments]    ${subscription_id}
    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    Set Headers    {"Authorization":"${TOKEN}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/users/${subscription_id}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
    
Remove a subscription
    [Arguments]    ${subscription_id}
    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    Set Headers    {"Authorization":"${TOKEN}"}
    Delete    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/users/${subscription_id}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    



Spawn Notification Server
    [Arguments]  ${payload_notification}
    ${output}   Spawn Web Server  ${NOTIFICATION_SERVER_IP}  ${NOTIFICATION_SERVER_PORT}  ${NOTIFICATION_SERVER_TIMEOUT}  ${NOTIFICATION_SERVER_HTTP_METHOD}  ${NOTIFICATION_SERVER_URI}   ${payload_notification} 
    ${length} =  Get Length  ${output}
    Set Suite Variable    ${payload_notification}    ${output}
    Run Keyword If  ${length} == 0  Skip
    
    
 No newline at end of file
+11 −3
Original line number Diff line number Diff line
*** Variables ***
# Generic variables
${SCHEMA}                   http
${HOST}                     10.192.2.172
${HOST}                     127.0.0.1
${PORT}                     8081
${response}                         {}
${TOKEN}                            Basic YWxhZGRpbjpvcGVuc2VzYW1l
${apiRoot}        
${apiName}        location
${apiVersion}     v2
${apiVersion}     v3

# Specific variables
${USERTRACKSUB_CLIENT_ID}            0123
@@ -16,3 +16,11 @@ ${USERTRACK_IP_ADDRESS} acr:10.0.0.1

${SUBSCRIPTION_ID}                    e0deee2b-6e50-4f33-ab09-8bf0585025d3
${NON_EXISTENT_SUBSCRIPTION_ID}       NON_EXISTENT_SUBSCRIPTION_ID


##Notification Server variables
${NOTIFICATION_SERVER_IP}      127.0.0.1
${NOTIFICATION_SERVER_PORT}      8888
${NOTIFICATION_SERVER_HTTP_METHOD}      POST
${NOTIFICATION_SERVER_URI}      /callback_url
${NOTIFICATION_SERVER_TIMEOUT}      5
+16 −0
Original line number Diff line number Diff line
{
                              "notificationType": "UserLocationEventNotification",
                              "timestamp": {
                                "seconds": 1673507343,
                                "nanoseconds": 0
                              },
                              "address": "acr:10.0.0.1",
                              "userLocationEvent": "ENTERING_AREA_EVENT",
                              "zoneId": "zone01",
                              "accessPointId": "001010000000000000000000000000001",
                              "_links": {
                                "subscription": {
                                  "href": "http://meAppServer.example.com/location/v3/subscriptions/user/subscription123"
                                }
                              }
                            }
 No newline at end of file
+6 −0
Original line number Diff line number Diff line
{
    "subscriptionType": "UserLocationEventSubscription",
    "clientCorrelator":"someCorrelator",
    "address": "acr:10.0.0.1",
    "callbackReference": "http://10.3.0.0.8:8888"
}
 No newline at end of file
+5 −0
Original line number Diff line number Diff line
{
    "subscriptionType": "UserLocationEventSubscription",
    "clientCorrelator":"someCorrelator",
    "address": "acr:10.0.0.1"
}
 No newline at end of file
Loading