Commit 049d3a21 authored by Yann Garcia's avatar Yann Garcia
Browse files

Add TC_MEC_SRV_RNIS_011_OK

parent e9d6e38e
Loading
Loading
Loading
Loading
+35 −0
Original line number Diff line number Diff line
''[Documentation]   robot --outputdir ../../outputs ./RnisSpecificSubscription_BV.robot
...    Test Suite to validate RNIS/Subscription (RNIS) operations.

*** Settings ***
Resource    environment/variables.txt
Resource    environment/pics.txt
Resource    resources/GenericKeywords.robot
Resource    resources/RadioNetworkInformationAPI.robot
Library     REST    ${MEC-APP_SCHEMA}://${MEC-APP_HOST}:${MEC-APP_PORT}    ssl_verify=false



*** Test Cases ***
Request RNIS subscription list
    [Documentation]   TC_MEC_SRV_RNIS_011_OK
    ...  Check that the RNIS service sends the list of links to the relevant RNIS subscriptions when requested
    ...  ETSI GS MEC 012 2.0.4, clause 7.6.3.1
    ...  Reference https://forge.etsi.org/gitlab/mec/gs012-rnis-api/blob/master/RniAPI.yaml#/definitions/SubscriptionLinkList
    Get RNIS subscription list
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   RadioNetworkInformationAPI
    log    ${response['body']['SubscriptionLinkList']['_links']}
    Should Be Equal    ${response['body']['SubscriptionLinkList']['_links']['self']}    ${LINKS_SELF}


*** Keywords ***
Get RNIS subscription list
    Should Be True    ${PIC_RNIS_SPECIFIC_SUBSCRIPTION} == 1
    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Content-Type":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    Set Headers    {"Content-Length":"0"}
    Get    /exampleAPI/rni/v2/subscriptions
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
+3 −0
Original line number Diff line number Diff line
*** Variables ***

${PIC_RNIS_SPECIFIC_SUBSCRIPTION}    1
+11 −0
Original line number Diff line number Diff line
*** Variables ***
${MEC-APP_SCHEMA}                   http
#${MEC-APP_HOST}                     172.28.4.87
#${MEC-APP_HOST}                     127.0.0.1
${MEC-APP_HOST}                     192.168.56.1
${MEC-APP_PORT}                     8081
${SUBSCRIPTION_ID}                  7777
${NON_EXISTENT_SUBSCRIPTION_ID}     6666
${LINKS_SELF}                       http://example.com/exampleAPI/rni/v2/subscriptions
${response}                         {}
${TOKEN}                            Basic YWxhZGRpbjpvcGVuc2VzYW1l
+38 −0
Original line number Diff line number Diff line
*** Settings ***
Resource    ../environment/variables.txt
Resource    GenericKeywords.robot
Library    REST    ${MEC-APP_SCHEMA}://${MEC-APP_HOST}:${MEC-APP_PORT}    ssl_verify=false
Library    JSONSchemaLibrary    schemas/

*** Keywords ***
Get User Equipment for location with filters
    [Arguments]    ${value}
    Set Headers  {"Accept":"application/json"}
    Get    /location/v2/users/${value}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Check HTTP Response Status Code Is
    [Arguments]    ${expected_status}
    ${status}=    Convert To Integer    ${expected_status}
    Should Be Equal    ${response['status']}    ${status}
    Log    Status code validated

Check HTTP Response Body Json Schema Is
    [Arguments]    ${input}
    Should Contain    ${response['headers']['Content-Type']}    application/json
    ${schema} =    Catenate    SEPARATOR=    ${input}    .schema.json
    Validate Json    ${schema}    ${response['body']}
    Log    Json Schema Validation OK

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}
    :FOR  ${item}  IN  @{expr}
    \  Exit For Loop If    "${item['${json_field}']}" == "${json_value}"
    Log    Item found ${item}
    [return]    ${item}

Check Result Contains
    [Arguments]    ${source}    ${parameter}    ${value}
    Should Be Present In Json List    ${source}    ${parameter}    ${value}
+12 −0
Original line number Diff line number Diff line
*** Settings ***
Resource    ../environment/variables.txt
Resource    LocationAPI.robot
#Library    REST    ${MEC-APP_SCHEMA}://${MEC-APP_HOST}:${MEC-APP_PORT}    ssl_verify=false
Library    JSONSchemaLibrary    schemas/

*** Keywords ***
Check Location
    [Arguments]    ${value}
    Log    Check Location for userInfo element
    Should be Equal    ${response['body']['userInfo']['zoneId']}    ${value}
    Log    Location OK
Loading