PlatBandwidthManager.robot 15 KB
Newer Older
Yann Garcia's avatar
Yann Garcia committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
''[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
Yann Garcia's avatar
Yann Garcia committed
18
    Retrieve the list of configured bandwidth allocations    ${APP_INSTANCE_ID}
Yann Garcia's avatar
Yann Garcia committed
19
20
21
22
23
24
25
26
27
28
    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
Yann Garcia's avatar
Yann Garcia committed
29
    Retrieve the list of configured bandwidth allocations    ${NON_EXISTENT_APP_INSTANCE_ID}
Yann Garcia's avatar
Yann Garcia committed
30
31
32
33
    Check HTTP Response Status Code Is    400
    Check ProblemDetails    400


Yann Garcia's avatar
Yann Garcia committed
34
Request to register Bandwidth Management Services
Yann Garcia's avatar
Yann Garcia committed
35
36
37
38
    [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
Yann Garcia's avatar
Yann Garcia committed
39
    Registration for bandwidth services    ${APP_INSTANCE_ID}    ${REQUEST_FOR_BW_REQUIREMENTS}
Yann Garcia's avatar
Yann Garcia committed
40
41
42
43
44
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   bwInfo
    Check AppInstanceId    ${APP_INSTANCE_ID}


Yann Garcia's avatar
Yann Garcia committed
45
Request to register Bandwidth Management Services using wrong parameters
Yann Garcia's avatar
Yann Garcia committed
46
47
48
49
    [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
Yann Garcia's avatar
Yann Garcia committed
50
    Registration for bandwidth services    ${APP_INSTANCE_ID}    ${REQUEST_FOR_BW_REQUIREMENTS_BR}
Yann Garcia's avatar
Yann Garcia committed
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
    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
Yann Garcia's avatar
Yann Garcia committed
81
    # Preamble
82
    Register Bandwidth Management Service
Yann Garcia's avatar
Yann Garcia committed
83
    # Test body
84
    Update a bandwidth allocation    ${ALLOCATION_ID}    ${REQUEST_FOR_BW_REQUIREMENTS}
Yann Garcia's avatar
Yann Garcia committed
85
86
87
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   bwInfo
    Check AppInstanceId    ${APP_INSTANCE_ID}
88
    Check Allocation    ${ALLOCATION_ID}
Yann Garcia's avatar
Yann Garcia committed
89
    # Postamble
90
    Unregister Bandwidth Management Service
Yann Garcia's avatar
Yann Garcia committed
91
92


Yann Garcia's avatar
Yann Garcia committed
93
Updates the requested bandwidth requirements using wrong allocationDirection
Yann Garcia's avatar
Yann Garcia committed
94
95
96
97
    [Documentation]   TC_MEC_SRV_BWA_004_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.3.3.2
    ...  Reference https://forge.etsi.org/rep/mec/gs015-bandwith-mgmt-api/blob/master/BwManagementApi.json
Yann Garcia's avatar
Yann Garcia committed
98
    # Preamble
99
    Register Bandwidth Management Service
Yann Garcia's avatar
Yann Garcia committed
100
    # Test body
101
    Update a bandwidth allocation    ${ALLOCATION_ID}    ${REQUEST_FOR_BW_REQUIREMENTS_BR}
Yann Garcia's avatar
Yann Garcia committed
102
103
    Check HTTP Response Status Code Is    400
    Check ProblemDetails    400
Yann Garcia's avatar
Yann Garcia committed
104
    # Postamble
105
    Unregister Bandwidth Management Service
Yann Garcia's avatar
Yann Garcia committed
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123


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???
Yann Garcia's avatar
Yann Garcia committed
124
    # Preamble
125
    Register Bandwidth Management Service
Yann Garcia's avatar
Yann Garcia committed
126
    # Test body
127
    Update a bandwidth allocation with invalid ETAG    ${ALLOCATION_ID}    ${REQUEST_FOR_BW_REQUIREMENTS}
Yann Garcia's avatar
Yann Garcia committed
128
129
    Check HTTP Response Status Code Is    412
    Check ProblemDetails    412
Yann Garcia's avatar
Yann Garcia committed
130
    # Postamble
131
    Unregister Bandwidth Management Service
Yann Garcia's avatar
Yann Garcia committed
132
133
134
135
136
137
138
139


Request for deltas changes
    [Documentation]   TC_MEC_SRV_BWA_005_OK
    ...  Check that the IUT when provided with just the changes (deltas) updates the requested bandwidth requirements when commanded by a MEC Application
    ...  Reference ETSI GS MEC 015 V1.1.1, clause 8.3.3.3
    ...  Reference https://forge.etsi.org/rep/mec/gs015-bandwith-mgmt-api/blob/master/BwManagementApi.json
    # Preamble
140
    Register Bandwidth Management Service
Yann Garcia's avatar
Yann Garcia committed
141
    # Test body
142
    Request a deltas changes    ${ALLOCATION_ID}    ${REQUEST_FOR_DELTAS_CHANGES}
Yann Garcia's avatar
Yann Garcia committed
143
144
145
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   bwInfo
    Check AppInstanceId    ${APP_INSTANCE_ID}
146
    Check Allocation   ${ALLOCATION_ID}
Yann Garcia's avatar
Yann Garcia committed
147
    # Postamble
148
    Unregister Bandwidth Management Service
Yann Garcia's avatar
Yann Garcia committed
149
150
151
152
153
154
155
156


Request for deltas changes using invalid requestType
    [Documentation]   TC_MEC_SRV_BWA_005_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.3.3.3
    ...  Reference https://forge.etsi.org/rep/mec/gs015-bandwith-mgmt-api/blob/master/BwManagementApi.json
    # Preamble
157
    Register Bandwidth Management Service
Yann Garcia's avatar
Yann Garcia committed
158
    # Test body
159
    Request a deltas changes    ${ALLOCATION_ID}    ${REQUEST_FOR_DELTAS_CHANGES_BR}
Yann Garcia's avatar
Yann Garcia committed
160
161
162
    Check HTTP Response Status Code Is    400
    Check ProblemDetails    400
    # Postamble
163
    Unregister Bandwidth Management Service
Yann Garcia's avatar
Yann Garcia committed
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181


Request for deltas changes using an unknown URI
    [Documentation]   TC_MEC_SRV_BWA_005_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.3
    ...  Reference https://forge.etsi.org/rep/mec/gs015-bandwith-mgmt-api/blob/master/BwManagementApi.json
    Request a deltas changes    ${NOT_EXISTENT_ALLOCATION_ID}    ${REQUEST_FOR_DELTAS_CHANGES}
    Check HTTP Response Status Code Is    404
    Check ProblemDetails    404


Request for deltas changes using wrong parameters
    [Documentation]   TC_MEC_SRV_BWA_005_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.3
    ...  Reference https://forge.etsi.org/rep/mec/gs015-bandwith-mgmt-api/blob/master/BwManagementApi.json
    # Preamble
182
    Register Bandwidth Management Service
Yann Garcia's avatar
Yann Garcia committed
183
    # Test body
184
    Request a deltas changes with invalid ETAG    ${ALLOCATION_ID}    ${REQUEST_FOR_DELTAS_CHANGES}
Yann Garcia's avatar
Yann Garcia committed
185
186
187
    Check HTTP Response Status Code Is    412
    Check ProblemDetails    412
    # Postamble
188
    Unregister Bandwidth Management Service
Yann Garcia's avatar
Yann Garcia committed
189
190
191
192
193
194
195
196
197
198


Request to unregister bandwidth Management Service
    [Documentation]   TC_MEC_SRV_BWA_006_OK
    ...  Check that the IUT unregisters from the Bandwidth Management Service when commanded by a MEC Application
    ...  Reference ETSI GS MEC 015 V1.1.1, clause 8.3.3.5
    ...  Reference https://forge.etsi.org/rep/mec/gs015-bandwith-mgmt-api/blob/master/BwManagementApi.json
    # Preamble
    Should Be True    ${PIC_MEC_PLAT} == 1
    Should Be True    ${PIC_SERVICES} == 1
199
    Register Bandwidth Management Service
Yann Garcia's avatar
Yann Garcia committed
200
201
202
203
204
    # Test body
    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Content-Type":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    Set Headers    {"Content-Length":"0"}
205
    Delete    /exampleAPI/bwm/v1/bw_allocations/${ALLOCATION_ID}
Yann Garcia's avatar
Yann Garcia committed
206
207
208
209
210
211
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    Check HTTP Response Status Code Is    204


Request to unregister bandwidth Management Service with wrong parameters
212
213
    [Documentation]   TC_MEC_SRV_BWA_006_NF
    ...  Check that the IUT responds with an error when a request for an unknown URI is sent by a MEC Application
Yann Garcia's avatar
Yann Garcia committed
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
    ...  Reference ETSI GS MEC 015 V1.1.1, clause 8.3.3.5
    ...  Reference https://forge.etsi.org/rep/mec/gs015-bandwith-mgmt-api/blob/master/BwManagementApi.json
    # Preamble
    Should Be True    ${PIC_MEC_PLAT} == 1
    Should Be True    ${PIC_SERVICES} == 1
    # Test body
    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/${NON_EXISTENT_ALLOCATION_ID}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    Check HTTP Response Status Code Is    404
    Check ProblemDetails    404
Yann Garcia's avatar
Yann Garcia committed
229
230
231


*** Keywords ***
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
Retrieve 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}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}


Registration for bandwidth services
    [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}
    Post    /exampleAPI/bwm/v1/bw_allocations/${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}
    ${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    {"ETag":"${ETAG_VALUE}"}
    Set Headers    {"Content-Length":"0"}
    Put    /exampleAPI/bwm/v1/bw_allocations/${allocation_id}    ${content}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}


Update a bandwidth allocation with invalid ETAG
    [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    {"${ETAG_LABEL}":"${INVALID_ETAG}"}
    Set Headers    {"Content-Length":"0"}
    Put    /exampleAPI/bwm/v1/bw_allocations/${allocation_id}    ${content}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}


Request a deltas changes
    [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    {"${ETAG_LABEL}":"${ETAG}"}
    Set Headers    {"Content-Length":"0"}
    Patch    /exampleAPI/bwm/v1/bw_allocations/${allocation_id}    ${content}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}


Request a deltas changes with invalid ETAG
    [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    {"${ETAG_LABEL}":"${INVALID_ETAG}"}
    Set Headers    {"Content-Length":"0"}
    Patch    /exampleAPI/bwm/v1/bw_allocations/${allocation_id}    ${content}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}