Subscriptions.robot 25.4 KB
Newer Older
1
*** Settings ***
2
Resource    environment/variables.txt 
3
4
5
6
7
8
9
Library    REST    ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT} 
Library     OperatingSystem
Library    JSONLibrary
Library    JSONSchemaLibrary    schemas/

*** Test Cases ***
Create a new subscription
10
    [Documentation]    Test ID: 6.3.4.4.1
11
    ...    Test title: Create a new subscription
12
13
    ...    Test objective: The objective is to create a new subscription.
    ...    Pre-conditions: no subscription with the same filter and callbackUri exists
Michele Carignani's avatar
Michele Carignani committed
14
    ...    Reference: Clause 7.4.5.3.1 - ETSI GS NFV-SOL 002 [2] v2.6.1
15
16
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: 
root's avatar
root committed
17
    ...    Post-Conditions: Resource created successfully
18
19
20
    Post Create subscription
    Check HTTP Response Status Code Is    201
    Check HTTP Response Body Json Schema Is    FmSubscription
root's avatar
root committed
21
    Check resource existence
22
23

Create a new Subscription - DUPLICATION
24
     [Documentation]    Test ID: 6.3.4.4.2
25
    ...    Test title: Create a new Subscription - DUPLICATION
26
    ...    Test objective: The objective is to create a duplicate subscription.
27
    ...    Pre-conditions: subscription with the same filter and callbackUri exists
Michele Carignani's avatar
Michele Carignani committed
28
    ...    Reference: Clause 7.4.5.3.1 - ETSI GS NFV-SOL 002 [2] v2.6.1
29
    ...    Config ID: Config_prod_VNFM
30
    ...    Applicability: the VNFM does not allow creation of a subscription resource if another subscription resource with the same filter and callbackUri already exists
aureliano sinatra's avatar
aureliano sinatra committed
31
    ...    Post-Conditions: duplicated subscription is created
32
33
34
35
    Post Create subscription - DUPLICATION
    Check HTTP Response Status Code Is    201
    Check HTTP Response Body Json Schema Is    FmSubscription
    
36
Create a new Subscription - NO-DUPLICATION
37
    [Documentation]    Test ID: 6.3.4.4.3
38
39
    ...    Test title: Create a new Subscription - NO-DUPLICATION
    ...    Test objective: The objective is to create a subscription in case of not allowed DUPLICATION.
40
    ...    Pre-conditions: subscription with the same filter and callbackUri exists
Michele Carignani's avatar
Michele Carignani committed
41
    ...    Reference: Clause 7.4.5.3.1 - ETSI GS NFV-SOL 002 [2] v2.6.1
42
    ...    Config ID: Config_prod_VNFM
43
    ...    Applicability: the VNFM does not allow creation of a duplicate subscription resource 
aureliano sinatra's avatar
aureliano sinatra committed
44
    ...    Post-Conditions: duplicated subscription is not created
45
46
    Post Create subscription - DUPLICATION
    Check HTTP Response Status Code Is    303
47
48

GET Subscriptions
49
    [Documentation]    Test ID: 6.3.4.4.4
50
    ...    Test title: GET Subscriptions
51
52
    ...    Test objective: The objective is to retrieve the list of active subscriptions
    ...    Pre-conditions: 
Michele Carignani's avatar
Michele Carignani committed
53
    ...    Reference: Clause 7.4.5.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
54
55
    ...    Config ID: Config_prod_VNFM
    ...    Applicability:  
aureliano sinatra's avatar
aureliano sinatra committed
56
    ...    Post-Conditions: subscription is not deleted
57
58
59
    Get subscriptions
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   FmSubscriptions 
60
61

GET Subscription - Filter
62
    [Documentation]    Test ID: 6.3.4.4.5
63
    ...    Test title: GET Subscription - Filter
64
65
    ...    Test objective: The objective is to retrieve the list of active subscriptions with filter
    ...    Pre-conditions: 
Michele Carignani's avatar
Michele Carignani committed
66
    ...    Reference: Clause 7.4.5.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
67
68
69
    ...    Config ID: Config_prod_VNFM
    ...    Applicability:  
    ...    Post-Conditions: 
70
71
72
    Get subscriptions - filter
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   FmSubscriptions 
73
74
    
GET subscriptions - Bad Request Invalid attribute-based filtering parameters
75
    [Documentation]    Test ID: 6.3.4.4.6
76
    ...    Test title: GET subscriptions - Bad Request Invalid attribute-based filtering parameters
77
78
    ...    Test objective: The objective is to retrieve the list of active subscriptions with Invalid attribute-based filtering parameters
    ...    Pre-conditions: 
Michele Carignani's avatar
Michele Carignani committed
79
    ...    Reference: Clause 7.4.5.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
80
81
82
    ...    Config ID: Config_prod_VNFM
    ...    Applicability:  
    ...    Post-Conditions: 
83
84
85
    Get subscriptions - invalid filter
    Check HTTP Response Status Code Is    400
    Check HTTP Response Body Json Schema Is   ProblemDetails 
86
87

GET subscriptions with "all_fields" attribute selector
88
    [Documentation]    Test ID: 6.3.4.4.7
89
90
91
    ...    Test title: GET subscriptions with "all_fields" attribute selector
    ...    Test objective: The objective is to retrieve the list of active subscriptions with attribute selector
    ...    Pre-conditions: 
Michele Carignani's avatar
Michele Carignani committed
92
    ...    Reference: Clause 7.4.5.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
93
94
95
96
97
98
99
100
    ...    Config ID: Config_prod_VNFM
    ...    Applicability:  
    ...    Post-Conditions: 
    Get subscriptions with all_fields attribute selector
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   FmSubscriptions 

GET subscriptions with "exclude_default" attribute selector
101
    [Documentation]    Test ID: 6.3.4.4.8
102
103
104
    ...    Test title: GET subscriptions with "exclude_default" attribute selector
    ...    Test objective: The objective is to retrieve the list of active subscriptions with attribute selector
    ...    Pre-conditions: 
Michele Carignani's avatar
Michele Carignani committed
105
    ...    Reference: Clause 7.4.5.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
106
107
108
109
110
111
112
113
    ...    Config ID: Config_prod_VNFM
    ...    Applicability:  
    ...    Post-Conditions: 
    Get subscriptions with exclude_default attribute selector
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   FmSubscriptions

GET subscriptions with "fields" attribute selector
114
    [Documentation]    Test ID: 6.3.4.4.9
115
116
117
    ...    Test title: GET subscriptions with "fields" attribute selector
    ...    Test objective: The objective is to retrieve the list of active subscriptions with attribute selector
    ...    Pre-conditions: 
Michele Carignani's avatar
Michele Carignani committed
118
    ...    Reference: Clause 7.4.5.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
119
120
121
122
123
124
125
126
    ...    Config ID: Config_prod_VNFM
    ...    Applicability:  
    ...    Post-Conditions: 
    Get subscriptions with fields attribute selector
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   FmSubscriptions

GET subscriptions with "exclude_fields" attribute selector
127
    [Documentation]    Test ID: 6.3.4.4.10
128
129
130
    ...    Test title: GET subscriptions with "exclude_fields" attribute selector
    ...    Test objective: The objective is to retrieve the list of active subscriptions with attribute selector
    ...    Pre-conditions: 
Michele Carignani's avatar
Michele Carignani committed
131
    ...    Reference: Clause 7.4.5.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
132
133
134
135
136
137
138
139
    ...    Config ID: Config_prod_VNFM
    ...    Applicability:  
    ...    Post-Conditions: 
    Get subscriptions with exclude_fields attribute selector
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   FmSubscriptions    


aureliano sinatra's avatar
aureliano sinatra committed
140
        
141
PUT subscriptions - Method not implemented
142
    [Documentation]    Test ID: 6.3.4.4.11
143
144
145
    ...    Test title: PUT subscriptions - Method not implemented
    ...    Test objective: The objective is to test that the method is not implemented
    ...    Pre-conditions: 
Michele Carignani's avatar
Michele Carignani committed
146
    ...    Reference: Clause 7.4.5.3.3 - ETSI GS NFV-SOL 002 [2] v2.6.1
147
148
149
150
151
152
153
    ...    Config ID: Config_prod_VNFM
    ...    Applicability:  
    ...    Post-Conditions: 
    PUT subscriptions
    Check HTTP Response Status Code Is    405

PATCH subscriptions - Method not implemented
154
    [Documentation]    Test ID: 6.3.4.4.12
155
156
157
    ...    Test title: PUT subscriptions - Method not implemented
    ...    Test objective: The objective is to test that the method is not implemented
    ...    Pre-conditions: 
Michele Carignani's avatar
Michele Carignani committed
158
    ...    Reference: Clause 7.4.5.3.4 - ETSI GS NFV-SOL 002 [2] v2.6.1
159
160
161
162
163
164
165
    ...    Config ID: Config_prod_VNFM
    ...    Applicability:  
    ...    Post-Conditions: 
    PATCH subscriptions
    Check HTTP Response Status Code Is    405

DELETE subscriptions - Method not implemented
166
    [Documentation]    Test ID: 6.3.4.4.13
167
168
169
    ...    Test title: DELETE subscriptions - Method not implemented
    ...    Test objective: The objective is to test that the method is not implemented
    ...    Pre-conditions: 
Michele Carignani's avatar
Michele Carignani committed
170
    ...    Reference: Clause 7.4.5.3.5 - ETSI GS NFV-SOL 002 [2] v2.6.1
171
172
    ...    Config ID: Config_prod_VNFM
    ...    Applicability:  
173
    ...    Post-Conditions: subscription not deleted
174
175
    DELETE subscriptions
    Check HTTP Response Status Code Is    405
176
177
    
GET Subscriptions to get Paged Response
178
    [Documentation]    Test ID: 6.3.4.4.14
179
180
181
    ...    Test title: GET Subscriptions to get Paged Response
    ...    Test objective: The objective is to retrieve the list of active subscriptions to get paged response
    ...    Pre-conditions: 
Michele Carignani's avatar
Michele Carignani committed
182
    ...    Reference: Clause 7.4.5.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
183
184
185
186
187
188
189
190
    ...    Config ID: Config_prod_VNFM
    ...    Applicability:  
    ...    Post-Conditions: subscription is not deleted
    Get subscriptions
    Check HTTP Response Status Code Is    200
    Check LINK in Header
    
GET subscriptions - Bad Request Response too Big
191
    [Documentation]    Test ID: 6.3.4.4.15
192
193
194
    ...    Test title: GET subscriptions - Bad Request Response too Big
    ...    Test objective: The objective is to test that GET method fail retrieving list of active subscription because Response is too big, and perform the JSON schema validation of the failed operation HTTP response
    ...    Pre-conditions: 
Michele Carignani's avatar
Michele Carignani committed
195
    ...    Reference: Clause 7.4.5.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
196
197
198
199
200
201
    ...    Config ID: Config_prod_VNFM
    ...    Applicability:  
    ...    Post-Conditions: 
    Get subscriptions - invalid filter
    Check HTTP Response Status Code Is    400
    Check HTTP Response Body Json Schema Is   ProblemDetails
202

203
GET Subscription with attribute-based filter "id"
204
    [Documentation]    Test ID: 6.3.4.4.16
205
206
207
    ...    Test title: GET Subscription with attribute-based filter "id"
    ...    Test objective: The objective is to retrieve the list of active subscriptions with filter "id"
    ...    Pre-conditions: 
Michele Carignani's avatar
Michele Carignani committed
208
    ...    Reference: Clause 7.4.5.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
209
210
211
212
213
214
215
216
217
218
    ...    Config ID: Config_prod_VNFM
    ...    Applicability:  
    ...    Post-Conditions: 
    Get subscriptions with filter "id"
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   FmSubscription
    Check PostCondition HTTP Response Body Subscription Matches the requested attribute-based filter "id"
    
    
Get subscriptions with filter "filter.notificationTypes"
219
    [Documentation]    Test ID: 6.3.4.4.17
220
221
222
    ...    Test title: GET Subscription with attribute-based filter "filter.notificationTypes"
    ...    Test objective: The objective is to retrieve the list of active subscriptions with filter "filter.notificationTypes"
    ...    Pre-conditions: 
Michele Carignani's avatar
Michele Carignani committed
223
    ...    Reference: Clause 7.4.5.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
224
225
226
227
228
229
230
231
232
    ...    Config ID: Config_prod_VNFM
    ...    Applicability:  
    ...    Post-Conditions: 
    Get subscriptions with filter "filter_notificationTypes"
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   FmSubscriptions 
    Check PostCondition HTTP Response Body Subscriptions Matches the requested attribute-based filter "filter_notificationTypes"
    
Get subscriptions with filter "filter.faultyResourceTypes"
233
    [Documentation]    Test ID: 6.3.4.4.18
234
235
236
    ...    Test title: GET Subscription with attribute-based filter "filter.faultyResourceTypes"
    ...    Test objective: The objective is to retrieve the list of active subscriptions with filter "filter.faultyResourceTypes"
    ...    Pre-conditions: 
Michele Carignani's avatar
Michele Carignani committed
237
    ...    Reference: Clause 7.4.5.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
238
239
240
241
242
243
244
245
246
    ...    Config ID: Config_prod_VNFM
    ...    Applicability:  
    ...    Post-Conditions: 
    Get subscriptions with filter "filter_faultyResourceTypes"
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   FmSubscriptions
    Check PostCondition HTTP Response Body Subscriptions Matches the requested attribute-based filter "filter_faultyResourceTypes"
    
Get subscriptions with filter "filter.perceivedSeverities"
247
    [Documentation]    Test ID: 6.3.4.4.19
248
249
250
    ...    Test title: GET Subscription with attribute-based filter "filter.perceivedSeverities"
    ...    Test objective: The objective is to retrieve the list of active subscriptions with filter "filter.perceivedSeverities"
    ...    Pre-conditions: 
Michele Carignani's avatar
Michele Carignani committed
251
    ...    Reference: Clause 7.4.5.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
252
253
254
255
256
257
258
259
260
    ...    Config ID: Config_prod_VNFM
    ...    Applicability:  
    ...    Post-Conditions: 
    Get subscriptions with filter "filter_perceivedSeverities"
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   FmSubscriptions
    Check PostCondition HTTP Response Body Subscriptions Matches the requested attribute-based filter "filter_perceivedSeverities"
    
Get subscriptions with filter "filter.eventTypes"
261
    [Documentation]    Test ID: 6.3.4.4.20
262
263
264
    ...    Test title: GET Subscription with attribute-based filter "filter.eventTypes"
    ...    Test objective: The objective is to retrieve the list of active subscriptions with filter "filter.eventTypes"
    ...    Pre-conditions: 
Michele Carignani's avatar
Michele Carignani committed
265
    ...    Reference: Clause 7.4.5.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
266
267
268
269
270
271
272
273
274
    ...    Config ID: Config_prod_VNFM
    ...    Applicability:  
    ...    Post-Conditions: 
    Get subscriptions with filter "filter_eventTypes"
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   FmSubscriptions
    Check PostCondition HTTP Response Body Subscriptions Matches the requested attribute-based filter "filter_eventTypes"
    
Get subscriptions with filter "filter.probableCauses"
275
    [Documentation]    Test ID: 6.3.4.4.21
276
277
278
    ...    Test title: GET Subscription with attribute-based filter "filter.probableCauses"
    ...    Test objective: The objective is to retrieve the list of active subscriptions with filter "filter.probableCauses"
    ...    Pre-conditions: 
Michele Carignani's avatar
Michele Carignani committed
279
    ...    Reference: Clause 7.4.5.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
280
281
282
283
284
285
286
287
    ...    Config ID: Config_prod_VNFM
    ...    Applicability:  
    ...    Post-Conditions: 
    Get subscriptions with filter "filter_probableCauses"
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   FmSubscriptions
    Check PostCondition HTTP Response Body Subscriptions Matches the requested attribute-based filter "filter_probableCauses"
    
288
289
290
291
292
293
294
295
296
*** Keywords ***
Post Create subscription
    Log    Create subscription instance by POST to ${apiRoot}/${apiName}/${apiVersion}/subscriptions
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    ${body}=    Get File    jsons/fmSubscriptionRequest.json
    Post    ${apiRoot}/${apiName}/${apiVersion}/subscriptions    ${body}
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
297
	Set Global Variable    ${response}    ${outputResponse}				
298
299
300
301
302
303
304
305
306
Post Create subscription - DUPLICATION
    Log    Trying to create a subscription with an already created content
    Pass Execution If    ${VNFM_ALLOWS_DUPLICATE_SUBS} == 0    NVFO is not permitting duplication. Skipping the test
    Set Headers    {"Accept": "${ACCEPT}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    ${body}=    Get File    jsons/fmSubscriptionRequest.json
    Post    ${apiRoot}/${apiName}/${apiVersion}/subscriptions    ${body}		
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
307
	Set Global Variable    ${response}    ${outputResponse}			
308
309
310
311
312
313
314
315
316
Post Create subscription - NO-DUPLICATION	
    Log    Trying to create a subscription with an already created content
    Pass Execution If    ${VNFM_ALLOWS_DUPLICATE_SUBS} == 1    VNFM permits duplication. Skipping the test
    Set Headers    {"Accept": "${ACCEPT}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    ${body}=    Get File    jsons/fmSubscriptionRequest.json
    Post    ${apiRoot}/${apiName}/${apiVersion}/subscriptions    ${body}
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
317
	Set Global Variable    ${response}    ${outputResponse}		
318
319
320
321
322
323
324
325
Get subscriptions
    Log    Get the list of active subscriptions
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Log    Execute Query and validate response
    Get    ${apiRoot}/${apiName}/${apiVersion}/subscriptions	
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
326
	Set Global Variable    ${response}    ${outputResponse}	
327
328
329
330
331
332
Get subscriptions - filter
    Log    Get the list of active subscriptions using a filter
    Set Headers    {"Accept": "${ACCEPT}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/subscriptions?${sub_filter}
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
333
	Set Global Variable    ${response}    ${outputResponse}		
334
Get subscriptions - invalid filter  
335
336
337
338
    Log    Get the list of active subscriptions using an invalid filter
    Set Headers    {"Accept": "${ACCEPT}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/subscriptions?${sub_filter_invalid}
339
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
340
	Set Global Variable    ${response}    ${outputResponse}		
aureliano sinatra's avatar
aureliano sinatra committed
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
Get subscriptions with all_fields attribute selector
    Log    Get the list of active subscriptions, using fields
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/subscriptions?exclude_default
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
Get subscriptions with exclude_default attribute selector
    Log    Get the list of active subscriptions, using fields
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/subscriptions?exclude_default
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
Get subscriptions with fields attribute selector
    Log    Get the list of active subscriptions, using fields
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/subscriptions?fields=${fields}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}	
Get subscriptions with exclude_fields attribute selector
    Log    Get the list of active subscriptions, using fields
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/subscriptions?exclude_fields=${fields}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output} 	
369
PUT subscriptions
370
371
372
    log    Trying to perform a PUT. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
373
374
    Put    ${apiRoot}/${apiName}/${apiVersion}/subscriptions       
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
375
	Set Global Variable    ${response}    ${outputResponse}	
376
PATCH subscriptions
377
378
379
    log    Trying to perform a PATCH. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
380
381
    Patch    ${apiRoot}/${apiName}/${apiVersion}/subscriptions     
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
382
	Set Global Variable    ${response}    ${outputResponse}		
383
DELETE subscriptions
384
385
386
    log    Trying to perform a DELETE. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
387
388
    Delete    ${apiRoot}/${apiName}/${apiVersion}/subscriptions 	   
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
389
	Set Global Variable    ${response}    ${outputResponse}	  
Giacomo Bernini's avatar
Giacomo Bernini committed
390
391
392

Check HTTP Response Status Code Is
    [Arguments]    ${expected_status}    
Elian Kraja's avatar
Elian Kraja committed
393
    Should Be Equal As Strings   ${response['status']}    ${expected_status}
Giacomo Bernini's avatar
Giacomo Bernini committed
394
395
396
397
398
399
400
    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']}
root's avatar
root committed
401
402
    Log    Json Schema Validation OK  
    
403
Check LINK in Header
Elian Kraja's avatar
Elian Kraja committed
404
    ${linkURL}=    Get Value From Json    ${response['headers']}    $..Link
405
406
407
408
409
410
411
412
    Should Not Be Empty    ${linkURL}
    
Get subscriptions with filter "id"
    Log    Get the list of active subscriptions using a filter "id"
    Set Headers    {"Accept": "${ACCEPT}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/subscriptions?id=${subscription_id}
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
413
	Set Global Variable    ${response}    ${outputResponse}
414
415
416
417
418
419
420
421
422
423
	
Check PostCondition HTTP Response Body Subscription Matches the requested attribute-based filter "id"
    Should Be Equal As Strings    ${response['body']['id']}    ${subscription_id}
	
Get subscriptions with filter "filter_notificationTypes"
    Log    Get the list of active subscriptions using a filter "filter.notificationTypes"
    Set Headers    {"Accept": "${ACCEPT}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/subscriptions?filter.notificationTypes=${notification_type}
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
424
	Set Global Variable    ${response}    ${outputResponse}
425
426
427
428
429
430
431
432
433
434
435
436
	
Check PostCondition HTTP Response Body Subscriptions Matches the requested attribute-based filter "filter_notificationTypes"
    :FOR   ${item}   IN  @{response['body']}
    Should Be Equal As Strings    ${item['filter']['notificationTypes']}   ${notification_type}
    END
	
Get subscriptions with filter "filter_faultyResourceTypes"
    Log    Get the list of active subscriptions using a filter "filter.faultyResourceTypes"
    Set Headers    {"Accept": "${ACCEPT}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/subscriptions?filter.faultyResourceTypes=${faultyResourceType}
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
437
	Set Global Variable    ${response}    ${outputResponse}
438
439
440
441
442
443
444
445
446
447
448
449
	
Check PostCondition HTTP Response Body Subscriptions Matches the requested attribute-based filter "filter_faultyResourceTypes"
    :FOR   ${item}   IN  @{response['body']}
    Should Be Equal As Strings    ${item['filter']['faultyResourceTypes']}   ${faultyResourceType}
    END
	
Get subscriptions with filter "filter_perceivedSeverities"
    Log    Get the list of active subscriptions using a filter "filter.perceivedSeverities"
    Set Headers    {"Accept": "${ACCEPT}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/subscriptions?filter.perceivedSeverities=${perceivedSeverity}
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
450
	Set Global Variable    ${response}    ${outputResponse}
451
452
453
454
455
456
457
458
459
460
461
462
	
Check PostCondition HTTP Response Body Subscriptions Matches the requested attribute-based filter "filter_perceivedSeverities"
    :FOR   ${item}   IN  @{response['body']}
    Should Be Equal As Strings    ${item['filter']['perceivedSeverities']}   ${perceivedSeverity}
    END
	
Get subscriptions with filter "filter_eventTypes"
    Log    Get the list of active subscriptions using a filter "filter.eventTypes"
    Set Headers    {"Accept": "${ACCEPT}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/subscriptions?filter.eventTypes=${eventType}
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
463
	Set Global Variable    ${response}    ${outputResponse}
464
465
466
467
468
469
470
471
472
473
474
475
	
Check PostCondition HTTP Response Body Subscriptions Matches the requested attribute-based filter "filter_eventTypes"
    :FOR   ${item}   IN  @{response['body']}
    Should Be Equal As Strings    ${item['filter']['eventTypes']}   ${eventType}
    END
	
Get subscriptions with filter "filter_probableCauses"
    Log    Get the list of active subscriptions using a filter "filter.probableCauses"
    Set Headers    {"Accept": "${ACCEPT}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    GET    ${apiRoot}/${apiName}/${apiVersion}/subscriptions?filter.probableCauses=${probableCause}
    ${outputResponse}=    Output    response
Elian Kraja's avatar
Elian Kraja committed
476
	Set Global Variable    ${response}    ${outputResponse}
477
478
479
480
	
Check PostCondition HTTP Response Body Subscriptions Matches the requested attribute-based filter "filter_probableCauses"
    :FOR   ${item}   IN  @{response['body']}
    Should Be Equal As Strings    ${item['filter']['probableCauses']}   ${probableCause}
481
482
483
484
485
486
487
488
    END
    
Check resource existence
    Set Headers    {"Accept":"${ACCEPT}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization":"${AUTHORIZATION}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/subscriptions/${subscriptionId} 
    Integer    response status    200