Commit d63f49e9 authored by Yann Garcia's avatar Yann Garcia
Browse files

Add BandWidthManagerAPI support

parent 606d36f6
Loading
Loading
Loading
Loading
+171 −0
Original line number Diff line number Diff line
''[Documentation]   robot --outputdir ../../outputs ./PlatBandwidthManager.robot
...    Test Suite to validate Bandwidth Management API (BWA) operations.

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



*** Test Cases ***
Request the list of configured bandwidth allocations
    [Documentation]   TC_MEC_SRV_BWA_001_OK
    ...  Check that the IUT responds with the list of configured bandwidth allocations when queried by a MEC Application
    ...  Reference ETSI GS MEC 015 V1.1.1, clause 8.4.3.1
    ...  Reference https://forge.etsi.org/rep/mec/gs015-bandwith-mgmt-api/blob/master/BwManagementApi.json
    Get the list of configured bandwidth allocations    ${APP_INSTANCE_ID}
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   bwInfo
    Check AppInstanceId    ${APP_INSTANCE_ID}


Request the list of configured bandwidth allocations with wrong app instance id
    [Documentation]   TC_MEC_SRV_BWA_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 015 V1.1.1, clause 8.4.3.1
    ...  Reference https://forge.etsi.org/rep/mec/gs015-bandwith-mgmt-api/blob/master/BwManagementApi.json
    Get the list of configured bandwidth allocations    ${NON_EXISTENT_APP_INSTANCE_ID}
    Check HTTP Response Status Code Is    400
    Check ProblemDetails    400


Request for the requested bandwidth requirements
    [Documentation]   TC_MEC_SRV_BWA_002_OK
    ...  Check that the IUT responds with a registration and initialisation approval for the requested bandwidth requirements sent by a MEC Application
    ...  Reference ETSI GS MEC 015 V1.1.1, clause 8.4.3.4
    ...  Reference https://forge.etsi.org/rep/mec/gs015-bandwith-mgmt-api/blob/master/BwManagementApi.json
    Registration for bandwidth requirements    ${APP_INSTANCE_ID}    ${REQUEST_FOR_BW_REQUIREMENTS}
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   bwInfo
    Check AppInstanceId    ${APP_INSTANCE_ID}


Request for the requested bandwidth requirements using wrong parameters
    [Documentation]   TC_MEC_SRV_BWA_002_BR
    ...  Check that the IUT responds with a registration and initialisation approval for the requested bandwidth requirements sent by a MEC Application
    ...  Reference ETSI GS MEC 015 V1.1.1, clause 8.4.3.4
    ...  Reference https://forge.etsi.org/rep/mec/gs015-bandwith-mgmt-api/blob/master/BwManagementApi.json
    Registration for bandwidth requirements    ${APP_INSTANCE_ID}    ${REQUEST_FOR_BW_REQUIREMENTS_BR}
    Check HTTP Response Status Code Is    400
    Check ProblemDetails    400


Request for a bandwidth allocation
    [Documentation]   TC_MEC_SRV_BWA_003_OK
    ...  Check that the IUT responds with the configured bandwidth allocation when queried by a MEC Application
    ...  Reference ETSI GS MEC 015 V1.1.1, clause 8.3.3.1
    ...  Reference https://forge.etsi.org/rep/mec/gs015-bandwith-mgmt-api/blob/master/BwManagementApi.json
    Get a bandwidth allocation    ${ALLOCATION_ID}
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   bwInfo
    Check AppInstanceId    ${APP_INSTANCE_ID}


Request for a bandwidth allocation using wrong parameters
    [Documentation]   TC_MEC_SRV_BWA_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 015 V1.1.1, clause 8.3.3.1
    ...  Reference https://forge.etsi.org/rep/mec/gs015-bandwith-mgmt-api/blob/master/BwManagementApi.json
    Get a bandwidth allocation    ${NON_EXISTENT_ALLOCATION_ID}
    Check HTTP Response Status Code Is    404
    Check ProblemDetails    404


Updates the requested bandwidth requirements
    [Documentation]   TC_MEC_SRV_BWA_004_OK
    ...  Check that the IUT updates the requested bandwidth requirements when commanded by a MEC Application
    ...  Reference ETSI GS MEC 015 V1.1.1, clause 8.3.3.2
    ...  Reference https://forge.etsi.org/rep/mec/gs015-bandwith-mgmt-api/blob/master/BwManagementApi.json
    Update a bandwidth allocation    ${ALLOCATION_ID}    ${REQUEST_FOR_BW_REQUIREMENTS}
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   bwInfo
    Check AppInstanceId    ${APP_INSTANCE_ID}
    Check Allocation    ${ALLOCATION_ID}


    [Documentation]   TC_MEC_SRV_BWA_004_BR
    Updates the requested bandwidth requirements using wrong allocationDirection
    ...  Check that the IUT responds with an error when a request with incorrect parameters is sent by a MEC Application
    ...  Reference ETSI GS MEC 015 V1.1.1, clause 8.3.3.2
    ...  Reference https://forge.etsi.org/rep/mec/gs015-bandwith-mgmt-api/blob/master/BwManagementApi.json
    Update a bandwidth allocation    ${ALLOCATION_ID}    ${REQUEST_FOR_BW_REQUIREMENTS_ID}
    Check HTTP Response Status Code Is    400
    Check ProblemDetails    400


Updates the requested bandwidth requirements using wrong allocationId
    [Documentation]   TC_MEC_SRV_BWA_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 015 V1.1.1, clause 8.3.3.2
    ...  Reference https://forge.etsi.org/rep/mec/gs015-bandwith-mgmt-api/blob/master/BwManagementApi.json
    Update a bandwidth allocation    ${NOT_EXISTENT_ALLOCATION_ID}    ${REQUEST_FOR_BW_REQUIREMENTS}
    Check HTTP Response Status Code Is    404
    Check ProblemDetails    404


Updates the requested bandwidth requirements using wrong parameters
    [Documentation]   TC_MEC_SRV_BWA_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 015 V1.1.1, clause 8.3.3.2
    ...  Reference https://forge.etsi.org/rep/mec/gs015-bandwith-mgmt-api/blob/master/BwManagementApi.json
    # TODO Application doesn't comply with a required condition???
    Update a bandwidth allocation    ${ALLOCATION_ID}    ${REQUEST_FOR_BW_REQUIREMENTS}
    Check HTTP Response Status Code Is    412
    Check ProblemDetails    412


*** Keywords ***
    Get the list of configured bandwidth allocations
        [Arguments]    ${app_instance_id}
        Should Be True    ${PIC_MEC_PLAT} == 1
        Should Be True    ${PIC_SERVICES} == 1
        Set Headers    {"Accept":"application/json"}
        Set Headers    {"Content-Type":"application/json"}
        Set Headers    {"Authorization":"${TOKEN}"}
        Set Headers    {"Content-Length":"0"}
        Get    /exampleAPI/bwm/v1/bw_allocations?app_instance_id=${app_instance_id}
        ${output}=    Output    response
        Set Suite Variable    ${response}    ${output}


    Registration for bandwidth requirements
        [Arguments]    ${app_instance_id}    ${content}
        Should Be True    ${PIC_MEC_PLAT} == 1
        Should Be True    ${PIC_SERVICES} == 1
        Set Headers    {"Accept":"application/json"}
        Set Headers    {"Content-Type":"application/json"}
        Set Headers    {"Authorization":"${TOKEN}"}
        Set Headers    {"Content-Length":"0"}
        log    ${content}
        Put    /exampleAPI/bwm/v1/bw_allocations?app_instance_id=${APP_INSTANCE_ID}    ${content}
        ${output}=    Output    response
        Set Suite Variable    ${response}    ${output}


    Get a bandwidth allocation
        [Arguments]    ${allocation_id}
        Should Be True    ${PIC_MEC_PLAT} == 1
        Should Be True    ${PIC_SERVICES} == 1
        Set Headers    {"Accept":"application/json"}
        Set Headers    {"Content-Type":"application/json"}
        Set Headers    {"Authorization":"${TOKEN}"}
        Set Headers    {"Content-Length":"0"}
        Get    /exampleAPI/bwm/v1/bw_allocations?allocation_id=${allocation_id}
        ${output}=    Output    response
        Set Suite Variable    ${response}    ${output}


    Update a bandwidth allocation
        [Arguments]    ${allocation_id}    ${content}
        Should Be True    ${PIC_MEC_PLAT} == 1
        Should Be True    ${PIC_SERVICES} == 1
        Set Headers    {"Accept":"application/json"}
        Set Headers    {"Content-Type":"application/json"}
        Set Headers    {"Authorization":"${TOKEN}"}
        Set Headers    {"Content-Length":"0"}
        Put    /exampleAPI/bwm/v1/bw_allocations?allocation_id=${allocation_id}    ${content}
        ${output}=    Output    response
        Set Suite Variable    ${response}    ${output}
+17 −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
${ZONE_ID}                          zone01
${APP_INSTANCE_ID}                  appInst01
${NON_EXISTENT_APP_INSTANCE_ID}     appInst99
${ALLOCATION_ID}                    allInst01
${NON_EXISTENT_ALLOCATION_ID}       allInst99
${FIXED_ALLOCATION}                 string
${REQUEST_FOR_BW_REQUIREMENTS}      "{ "appInsId": "${APP_INSTANCE_ID}", "requestType": "APPLICATION_SPECIFIC_BW_ALLOCATION", "fixedBWPriority": "not defined in the present document", "fixedAllocation": "${FIXED_ALLOCATION}", "allocationDirection": "00 = Downlink (towards the UE)"}"
${REQUEST_FOR_BW_REQUIREMENTS_BR}   "{ "appInsId": "${APP_INSTANCE_ID}", "requestType": "UNKMOWN", "fixedBWPriority": "not defined in the present document", "fixedAllocation": "${FIXED_ALLOCATION}", "allocationDirection": "00 = Downlink (towards the UE)"}"
${REQUEST_FOR_BW_REQUIREMENTS_ID}   "{ "appInsId": "${APP_INSTANCE_ID}", "requestType": "APPLICATION_SPECIFIC_BW_ALLOCATION", "fixedBWPriority": "not defined in the present document", "fixedAllocation": "${FIXED_ALLOCATION}", "allocationDirection": "99 = DownAndDownlink (towards the UE)"}"
${response}                         {}
${TOKEN}                            Basic YWxhZGRpbjpvcGVuc2VzYW1l
+21 −0
Original line number Diff line number Diff line
*** Settings ***
Resource    ../environment/variables.txt
Resource    ../../../pics.txt
Resource    ../../../GenericKeywords.robot
Library    REST    ${MEC-APP_SCHEMA}://${MEC-APP_HOST}:${MEC-APP_PORT}    ssl_verify=false
Library    JSONSchemaLibrary    schemas/


*** Keywords ***
Check AppInstanceId
    [Arguments]    ${value}
    Log    Check AppInstanceId for bwInfo element
    Should be Equal    ${response['body']['bwInfo']['appInsId']}    ${value}
    Log    AppInstanceId OK


Check AllocationId
    [Arguments]    ${value}
    Log    Check AllocationId for bwInfo element
    Should be Equal    ${response['body']['bwInfo']['fixedAllocation']}    ${value}
    Log    AllocationId OK
+674 −0

File added.

Preview size limit exceeded, changes collapsed.

+19 −1
Original line number Diff line number Diff line
@@ -22,7 +22,25 @@ ETSI GS MEC 016 V2.1.1

https://forge.etsi.org/rep/mec/gs032p2-test-purposes/blob/master/Test%20Purposes/MEO/UEAPPS/SysUeApplications.tplan2

TODO
- TC_MEC_SRV_BWA_001_OK       <font color="color:green">To be tested</font>

- TC_MEC_SRV_BWA_001_BR       <font color="color:green">To be tested</font>

- TC_MEC_SRV_BWA_002_OK       <font color="color:green">To be tested</font>

- TC_MEC_SRV_BWA_002_BR       <font color="color:green">To be tested</font>

- TC_MEC_SRV_BWA_003_OK       <font color="color:green">To be tested</font>

- TC_MEC_SRV_BWA_003_NF       <font color="color:green">To be tested</font>

- TC_MEC_SRV_BWA_004_OK       <font color="color:green">To be tested</font>

- TC_MEC_SRV_BWA_004_BR       <font color="color:green">To be tested</font>

- TC_MEC_SRV_BWA_004_NF       <font color="color:green">To be tested</font>

- TC_MEC_SRV_BWA_004_PF       <font color="color:green">To be tested</font>


## SRV