AMSService.robot 15 KB
Newer Older
1
2
3
4
5
6
7
8
9
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
45
46
47
''[Documentation]   robot --outputdir ./outputs ./SRV/UETAG/PlatUeIdentity.robot
...    Test Suite to validate UE Identity Tag (UETAG) operations.

*** Settings ***
Resource    environment/variables.txt
Resource    ../../pics.txt
Resource    ../../GenericKeywords.robot
Library     REST    ${AMS_SCHEMA}://${AMS_HOST}:${AMS_PORT}    ssl_verify=false
Library     BuiltIn
Library     OperatingSystem
Library     MockServerLibrary




*** Test Cases ***
Request Registered AMS information
    [Documentation]   TP_MEC_SRV_AMS_001_OK
    ...  Check that the AMS service returns information about the registered application mobility services when requested
    ...  ETSI GS MEC 021 2.0.8, clause 8.3.3.1
    Get Registered AMS information
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   AppMobilityServiceInfos


Request Registered AMS information using attribute-selector    
    [Documentation]   TP_MEC_SRV_AMS_001_OK
    ...  Check that the AMS service returns information about the registered application mobility services when requested
    ...  ETSI GS MEC 021 2.0.8, clause 8.3.3.1
    Get Registered AMS information using attribute-selector    appMobilityServiceId    ${APP_MOBILITY_SERVICE_ID}
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   AppMobilityServiceInfos
    Check Result Contains    ${response['body']['AppMobilityServiceInfo']}    appMobilityServiceId    ${APP_MOBILITY_SERVICE_ID}
    

Request Registered AMS information using bad parameters
    [Documentation]   TP_MEC_SRV_AMS_001_BR
    ...  Check that the AMS service returns an error when receives a query about a registered application mobility service with wrong parameters
    ...  ETSI GS MEC 021 2.0.8, clause 8.3.3.1
    Get Registered AMS information using bad parameters
    Check HTTP Response Status Code Is    400


Register a new application mobility services
    [Documentation]   TP_MEC_SRV_AMS_002_OK
    ...  Check that the AMS service creates a new application mobility services when requested
    ...  ETSI GS MEC 021 2.0.8, clause 8.3.3.4
48
    Create a new application mobility service      RegistrationInfo
49
50
51
52
53
54
55
56
57
58
    Check HTTP Response Status Code Is    201
    Check HTTP Response Body Json Schema Is    AppMobilityServiceInfo
    Log    Checking Postcondition
    Check Result Contains    ${response['body']['AppMobilityServiceInfo']['registeredAppMobilityService']['serviceConsumerId']['']}    appInstanceId    ${APP_INS_ID}
    

Register an UE Identity Tag using invalid parameter
    [Documentation]   TP_MEC_SRV_AMS_002_BR
    ...  Check that the AMS service sends an error when it receives a malformed request to create a new application mobility service
    ...  ETSI GS MEC 021 2.0.8, clause 8.3.3.4
59
    Create a new application mobility service    RegistrationInfoMalformed
60
61
62
63
64
65
66
67
68
69
70
71
    Check HTTP Response Status Code Is    400


Request Subscriptions List for the registered AMS services
    [Documentation]   TP_MEC_SRV_AMS_003_OK
    ...  Check that the AMS service returns information about the available subscriptions when requested.
    ...     Permitted SUBSCRIPTION_TYPE are:
    ...     - MobilityProcedureSubscription
    ...     - AdjacentAppInfoSubscription"
    ...  ETSI GS MEC 021 2.0.8, clause 8.6.3.1
    Get Subscriptions for registered AMS
    Check HTTP Response Status Code Is    200
72
    Check HTTP Response Body Json Schema Is    SubscriptionLinkList
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220



Request Subscription List for registered AMS Services using wrong attribute parameters
    [Documentation]   TP_MEC_SRV_AMS_003_BR
    ...  Check that the AMS service sends an error when it receives a malformed query about the available subscriptions
    Get Subscriptions for registered AMS with wrong attbirube parameter
    Check HTTP Response Status Code Is    400



Create a notification subscription
    [Documentation]   TP_MEC_SRV_AMS_004_OK
    ...  Check that the AMS service creates a notification subscriptions when requested.
    ...     Permitted SUBSCRIPTION_TYPE are:
    ...     - MobilityProcedureSubscription
    ...     - AdjacentAppInfoSubscription"
    ...  ETSI GS MEC 021 2.0.8, clause 8.6.3.4
    Post a new notification subscription    NotificationSubscription
    Check HTTP Response Status Code Is    201
    Check HTTP Response Body Json Schema Is    NotificationSubscription
    

Create a notification subscription with wrong attribute parameter
    [Documentation]   TP_MEC_SRV_AMS_004_BR
    ...  Check that the AMS service creates a notification subscriptions when requested.
    ...     Permitted SUBSCRIPTION_TYPE are:
    ...     - MobilityProcedureSubscription
    ...     - AdjacentAppInfoSubscription"
    ...  ETSI GS MEC 021 2.0.8, clause 8.6.3.4
    Post a new notification subscription    NotificationSubscriptionError
    Check HTTP Response Status Code Is    400



Request a specific subscription
    [Documentation]   TP_MEC_SRV_AMS_005_OK
    ...  Check that the AMS service returns information about a given subscription when requested.
    ...     Permitted SUBSCRIPTION_TYPE are:
    ...     - MobilityProcedureSubscription
    ...     - AdjacentAppInfoSubscription"
    ...  ETSI GS MEC 021 2.0.8, clause 8.7.3.1
    Get individual subscription for AMS services    ${SUBSCRIPTION_ID}
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    NotificationSubscription




Request a specific subscription using wrong identifier
    [Documentation]   TP_MEC_SRV_AMS_005_NF
    ...  Check that the AMS service returns an error when receives a query about a not existing subscription
    ...     ETSI GS MEC 021 2.0.8, clause 8.7.3.1
    Get individual subscription for AMS services    ${NON_EXISTENT_SUBSCRIPTION_ID}
    Check HTTP Response Status Code Is    404



Modify a specific subscription
    [Documentation]   TP_MEC_SRV_AMS_007_OK
    ...  Check that the AMS service modifies a given subscription when requested.
    ...  Permitted SUBSCRIPTION_TYPE are:
    ...    - MobilityProcedureSubscription
    ...    - AdjacentAppInfoSubscription
    ...  ETSI GS MEC 021 2.0.8, clause 8.7.3.2
    Update individual subscription for AMS services    ${SUBSCRIPTION_ID}    NotificationSubscription
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    NotificationSubscription



Modify a specific subscription using malformed request
    [Documentation]   TP_MEC_SRV_AMS_007_BR
    ...  Check that the AMS service sends an error when it receives a malformed modify request for a given subscription.
    ...  Permitted SUBSCRIPTION_TYPE are:
    ...    - MobilityProcedureSubscription
    ...    - AdjacentAppInfoSubscription
    ...  ETSI GS MEC 021 2.0.8, clause 8.7.3.2
    Update individual subscription for AMS services    ${SUBSCRIPTION_ID}    NotificationSubscriptionError
    Check HTTP Response Status Code Is    400


Modify a specific subscription using wrong identifier
    [Documentation]   TP_MEC_SRV_AMS_007_NF
    ...  Check that the AMS service sends an error when it receives a modify request for a not existing subscription.
    ...  ETSI GS MEC 021 2.0.8, clause 8.7.3.2
    Update individual subscription for AMS services    ${NON_EXISTENT_SUBSCRIPTION_ID}    NotificationSubscription
    Check HTTP Response Status Code Is    404


Remove a specific subscription
    [Documentation]   TP_MEC_SRV_AMS_006_OK
    ...  Check that the AMS service deletes a given subscription when requested
    ...  ETSI GS MEC 021 2.0.8, clause 8.7.3.5
    Delete individual subscription for AMS services    ${SUBSCRIPTION_ID}
    Check HTTP Response Status Code Is    204


Remove a specific subscription using wrong identifier
    [Documentation]   TP_MEC_SRV_AMS_006_NF
    ...  Check that the AMS service sends an error when it receives a delete request for a not existing subscription
    ...  ETSI GS MEC 021 2.0.8, clause 8.7.3.5
    Delete individual subscription for AMS services    ${NON_EXISTENT_SUBSCRIPTION_ID}
    Check HTTP Response Status Code Is    404



Post Mobility Procedure Notification
    [Documentation]   TP_MEC_SRV_AMS_008_OK
    ...  Check that the AMS service sends an AMS notification  about a mobility procedure 
    ...    if the AMS service has an associated subscription and the event is generated
    ...  ETSI GS MEC 021 2.0.8, clause 7.4.2
    ${json}=	Get File	schemas/MobilityProcedureNotification.schema.json
    Log  Creating mock request and response to handle  Mobility Procedure Notification
    &{req}=  Create Mock Request Matcher	POST  ${callback_endpoint}  body_type="JSON_SCHEMA"    body=${json}
    &{rsp}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    Create Mock Expectation  ${req}  ${rsp}
    Wait Until Keyword Succeeds    ${total_polling_time}   ${polling_interval}   Verify Mock Expectation    ${req}
    Log  Verifying results
    Verify Mock Expectation  ${req}
    Log  Cleaning the endpoint
    Clear Requests  ${callback_endpoint} 
    


Post Adjacent Application Info Notification
    [Documentation]   TP_MEC_SRV_AMS_009_OK
    ...  Check that the AMS service sends an AMS notification about adjacent application instances 
    ...    if the AMS service has an associated subscription and the event is generated
    ...  ETSI GS MEC 021 2.0.8, clause 7.4.3
    ${json}=	Get File	schemas/AdjacentAppInfoNotification.schema.json
    Log  Creating mock request and response to handle Adjacent Application Info Notification
    &{req}=  Create Mock Request Matcher	POST  ${callback_endpoint}  body_type="JSON_SCHEMA"    body=${json}
    &{rsp}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    Create Mock Expectation  ${req}  ${rsp}
    Wait Until Keyword Succeeds    ${total_polling_time}   ${polling_interval}   Verify Mock Expectation    ${req}
    Log  Verifying results
    Verify Mock Expectation  ${req}
    Log  Cleaning the endpoint
    Clear Requests  ${callback_endpoint} 



Post Expire Notification
    [Documentation]   TP_MEC_SRV_AMS_010_OK
    ...  Check that the AMS service sends an AMS notification on subscription expiration
    ...    if the AMS service has an associated subscription and the event is generated
    ...  ETSI GS MEC 021 2.0.8, clause 7.4.4
221
    ${json}=	Get File	schemas/ExpiryNotification.schema.json
222
223
224
225
226
227
228
229
230
231
232
233
234
235
    Log  Creating mock request and response to handle Expire Notification
    &{req}=  Create Mock Request Matcher	POST  ${callback_endpoint}  body_type="JSON_SCHEMA"    body=${json}
    &{rsp}=  Create Mock Response	headers="Content-Type: application/json"  status_code=204
    Create Mock Expectation  ${req}  ${rsp}
    Wait Until Keyword Succeeds    ${total_polling_time}   ${polling_interval}   Verify Mock Expectation    ${req}
    Log  Verifying results
    Verify Mock Expectation  ${req}
    Log  Cleaning the endpoint
    Clear Requests  ${callback_endpoint} 

        

*** Keywords ***
Get Registered AMS information
Elian Kraja's avatar
Elian Kraja committed
236
    Should Be True    ${PIC_AMS} == 1
237
238
239
240
241
242
243
244
245
    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Content-Type":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/appMobilityServices
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
Get Registered AMS information using attribute-selector
    [Arguments]    ${key}    ${value}
Elian Kraja's avatar
Elian Kraja committed
246
    Should Be True    ${PIC_AMS} == 1
247
248
249
250
251
252
253
254
255
    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Content-Type":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/appMobilityServices?${key}=${value}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
    
Get Registered AMS information using bad parameters
Elian Kraja's avatar
Elian Kraja committed
256
    Should Be True    ${PIC_AMS} == 1
257
258
259
260
261
262
263
264
265
266
    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Content-Type":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/appMobilityServices?appMobilityService=${APP_MOBILITY_SERVICE_ID}     //param should be appMobilityServiceId
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}


Create a new application mobility service
    [Arguments]    ${content}
Elian Kraja's avatar
Elian Kraja committed
267
    Should Be True    ${PIC_AMS} == 1
268
269
270
271
272
273
274
275
276
277
278
    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Content-Type":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    ${file}=    Catenate    SEPARATOR=    json/    ${content}    .json
    ${body}=    Get File    ${file}
    Post    ${apiRoot}/${apiName}/${apiVersion}/appMobilityServices    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    

Get Subscriptions for registered AMS    
Elian Kraja's avatar
Elian Kraja committed
279
    Should Be True    ${PIC_AMS} == 1
280
281
282
283
284
285
286
287
288
    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/subscriptions
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
    
    
Get Subscriptions for registered AMS with wrong attbirube parameter
Elian Kraja's avatar
Elian Kraja committed
289
    Should Be True    ${PIC_AMS} == 1
290
291
292
293
294
295
296
297
298
299
    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/subscriptions?subscriptionTyp=${SUBSCRIPTION_TYPE}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}



Post a new notification subscription
    [Arguments]    ${content}
Elian Kraja's avatar
Elian Kraja committed
300
    Should Be True    ${PIC_AMS} == 1
301
302
303
304
305
306
307
308
309
310
311
312
313
    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Content-Type":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    ${file}=    Catenate    SEPARATOR=    json/    ${content}    .json
    ${body}=    Get File    ${file}
    Post    ${apiRoot}/${apiName}/${apiVersion}/subscriptions    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
    
    
Get individual subscription for AMS services
    [Arguments]    ${content}
Elian Kraja's avatar
Elian Kraja committed
314
    Should Be True    ${PIC_AMS} == 1
315
316
317
318
319
320
321
322
323
    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${content}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}   
    

Delete individual subscription for AMS services 
    [Arguments]    ${content}
Elian Kraja's avatar
Elian Kraja committed
324
    Should Be True    ${PIC_AMS} == 1
325
326
327
328
329
330
331
332
    Set Headers    {"Authorization":"${TOKEN}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${content}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}      


Update individual subscription for AMS services
    [Arguments]    ${identifier}    ${content}
Elian Kraja's avatar
Elian Kraja committed
333
    Should Be True    ${PIC_AMS} == 1
334
335
336
337
338
339
340
341
342
    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Content-Type":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    ${file}=    Catenate    SEPARATOR=    json/    ${content}    .json
    ${body}=    Get File    ${file}
    Put    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${identifier}    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}