BandwidthManagerAPI.robot 2.19 KB
Newer Older
Yann Garcia's avatar
Yann Garcia committed
1
2
3
4
5
6
7
8
9
*** 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 ***
Yann Garcia's avatar
Yann Garcia committed
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
    Register Bandwidth Management Service
    ...  Register a Bandwidth Management Service
        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"}
        Post    /exampleAPI/bwm/v1/bw_allocations    ${REQUEST_FOR_BW_REQUIREMENTS}
        ${output}=    Output    response
        Set Suite Variable    ${response}    ${output}
        Check HTTP Response Status Code Is    201
        Check HTTP Response Body Json Schema Is   bwInfo
        # Extract ETAG_VALUE
        ${etag_value}=     ${response['status']['${etag_label}']}
        # TODO Extract allocationId
        ${allocation_id}=    'todo'
        [return]    ${allocation_id}     ${etag_value}


    Unregister Bandwidth Management Service
        ...  Unregister a Bandwidth Management Service
        [Arguments]    ${value}
        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"}
        Delete    /exampleAPI/bwm/v1/bw_allocations/${value}
        ${output}=    Output    response
        Set Suite Variable    ${response}    ${output}
        Check HTTP Response Status Code Is    204


Yann Garcia's avatar
Yann Garcia committed
45
46
47
48
49
50
51
52
53
54
55
56
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