PMJobs.robot 22.1 KB
Newer Older
1
2
*** Settings ***
Library           JSONSchemaLibrary    schemas/
Elian Kraja's avatar
Elian Kraja committed
3
Resource          environment/variables.txt    # Generic Parameters
4
5
Library           JSONLibrary
Library           OperatingSystem
6
Library           String
7
Resource          environment/pmJobs.txt
Elian Kraja's avatar
Elian Kraja committed
8
Library           REST    ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT}    ssl_verify=false
9
10

*** Test Cases ***
11
12
13
14
15
GET all VNF Performance Monitoring Jobs
    [Documentation]    Test ID: 6.3.3.1.1
    ...    Test title: GET all VNF Performance Monitoring Jobs
    ...    Test objective: The objective is to test the retrieval of all the available VNF performance monitoring jobs and perform a JSON schema and content validation of the collected jobs data structure
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance jobs are set in the VNF.
Michele Carignani's avatar
Michele Carignani committed
16
    ...    Reference: Clause 6.4.2.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
17
18
19
20
21
22
23
24
25
26
27
28
29
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none
    GET all VNF Performance Monitoring Jobs
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   PmJobs
    Check HTTP Response Body Does Not Contain reports

GET VNF Performance Monitoring Jobs with attribute-based filter
    [Documentation]    Test ID: 6.3.3.1.2
    ...    Test title: GET all VNF Performance Monitoring Jobs with attribute-based filter
    ...    Test objective: The objective is to test the retrieval of VNF performance monitoring jobs using attribute-based filter, perform a JSON schema validation of the collected jobs data structure, and verify that the retrieved information matches the issued attribute-based filter
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance jobs are set in the VNF.
Michele Carignani's avatar
Michele Carignani committed
30
    ...    Reference: Clause 6.4.2.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
31
32
33
34
35
36
37
38
39
40
41
42
43
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none
    GET VNF Performance Monitoring Jobs with attribute-based filter
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   PmJobs
    Check HTTP Response Body Matches filter

GET all VNF Performance Monitoring Jobs with all_fields attribute selector
    [Documentation]    Test ID: 6.3.3.1.3
    ...    Test title: GET all VNF Performance Monitoring Jobs with all_fields attribute selector
    ...    Test objective: The objective is to test the retrieval of all VNF performance monitoring jobs all_fields attribute selector, perform a JSON schema validation of the collected jobs data structure, and verify that the retrieved information matches the issued all_fileds selector
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance jobs are set in the VNF.
Michele Carignani's avatar
Michele Carignani committed
44
    ...    Reference: Clause 4.3.3.2.1, 6.4.2.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
45
46
47
48
49
50
51
52
53
54
55
56
57
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none
    GET VNF Performance Monitoring Jobs with all_fields attribute selector
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   PmJobs
    Check HTTP Response Body Matches all_fields selector

GET all VNF Performance Monitoring Jobs with exclude_default attribute selector
    [Documentation]    Test ID: 6.3.3.1.4
    ...    Test title: GET all VNF Performance Monitoring Jobs with exclude_default attribute selector
    ...    Test objective: The objective is to test the retrieval of all VNF performance monitoring jobs exclude_default attribute selector, perform a JSON schema validation of the collected jobs data structure, and verify that the retrieved information matches the issued exclude_default selector
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance jobs are set in the VNF.
Michele Carignani's avatar
Michele Carignani committed
58
    ...    Reference: Clause 4.3.3.2.1, 6.4.2.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
59
60
61
62
63
64
65
66
67
68
69
70
71
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none
    GET VNF Performance Monitoring Jobs with exclude_default attribute selector
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   PmJobs
    Check HTTP Response Body Matches exclude_default selector

GET all VNF Performance Monitoring Jobs with fields attribute selector
    [Documentation]    Test ID: 6.3.3.1.5
    ...    Test title: GET all VNF Performance Monitoring Jobs with fields attribute selector
    ...    Test objective: The objective is to test the retrieval of all VNF performance monitoring jobs fields attribute selector, perform a JSON schema validation of the collected jobs data structure, and verify that the retrieved information matches the issued fields selector
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance jobs are set in the VNF.
Michele Carignani's avatar
Michele Carignani committed
72
    ...    Reference: Clause 4.3.3.2.1, 6.4.2.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
73
74
75
76
77
78
79
80
81
82
83
84
85
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: The VNFM supports the use of exclude_fields attribute selector
    ...    Post-Conditions: none
    GET VNF Performance Monitoring Jobs with fields attribute selector
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   PmJobs
    Check HTTP Response Body Matches fields selector

GET all VNF Performance Monitoring Jobs with exclude_fields attribute selector
    [Documentation]    Test ID: 6.3.3.1.6
    ...    Test title: GET all VNF Performance Monitoring Jobs with exclude_fields attribute selector
    ...    Test objective: The objective is to test the retrieval of all VNF performance monitoring jobs exclude_fields attribute selector, perform a JSON schema validation of the collected jobs data structure, and verify that the retrieved information matches the issued exclude_fields selector
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance jobs are set in the VNF.
Michele Carignani's avatar
Michele Carignani committed
86
    ...    Reference: Clause 4.3.3.2.1, 6.4.2.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
87
88
89
90
91
92
93
94
95
96
97
98
99
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: The VNFM supports the use of exclude_fields attribute selector
    ...    Post-Conditions: none
    GET VNF Performance Monitoring Jobs with exclude_fields attribute selector
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is   PmJobs
    Check HTTP Response Body Matches exclude_fields selector

GET VNF Performance Monitoring Jobs with invalid attribute-based filter
    [Documentation]    Test ID: 6.3.3.1.7
    ...    Test title: GET VNF Performance Monitoring Jobs with invalid attribute-based filter
    ...    Test objective: The objective is to test that the retrieval of VNF performance monitoring jobs fails when using invalid attribute-based filter, and perform the JSON schema validation of the failed operation HTTP response
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance jobs are set in the VNF.
Michele Carignani's avatar
Michele Carignani committed
100
    ...    Reference: Clause 6.4.2.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
101
102
103
104
105
106
107
108
109
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none
    GET VNF Performance Monitoring Jobs with invalid attribute-based filter
    Check HTTP Response Status Code Is    400
    Check HTTP Response Body Json Schema Is   ProblemDetails

GET VNF Performance Monitoring Jobs with invalid resource endpoint
    [Documentation]    Test ID: 6.3.3.1.8
110
    ...    Test title: GET VNF Performance Monitoring Jobs with invalid resource endpoint
111
112
    ...    Test objective: The objective is to test that the retrieval of VNF performance monitoring jobs fails when using invalid resource endpoint, and perform the JSON schema validation of the failed operation HTTP response
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance jobs are set in the VNF.
Michele Carignani's avatar
Michele Carignani committed
113
    ...    Reference: Clause 6.4.2.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
114
115
116
117
118
119
120
121
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none
    GET VNF Performance Monitoring Jobs with invalid resource endpoint
    Check HTTP Response Status Code Is    400
    Check HTTP Response Body Json Schema Is   ProblemDetails

Create new VNF Performance Monitoring Job
Giacomo Bernini's avatar
fix    
Giacomo Bernini committed
122
    [Documentation]    Test ID: 6.3.3.1.9
123
124
    ...    Test title:  Create a new VNF Performance Monitoring Job
    ...    Test objective: The objective is to test the creation of a new VNF performance monitoring job and perform the JSON schema validation of the returned job data structure
125
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance jobs are set in the VNF.
Michele Carignani's avatar
Michele Carignani committed
126
    ...    Reference: Clause 6.4.2.3.1 - ETSI GS NFV-SOL 002 [2] v2.6.1
127
128
129
130
131
132
133
134
135
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: The VNF Performance Job is successfully created on the VNFM
    Send Post Request Create new VNF Performance Monitoring Job
    Check HTTP Response Status Code Is    201
    Check HTTP Response Body Json Schema Is   PmJob
    Check Postcondition PmJob Exists

PUT all VNF Performance Monitoring Jobs - Method not implemented
Giacomo Bernini's avatar
fix    
Giacomo Bernini committed
136
    [Documentation]    Test ID: 6.3.3.1.10
137
138
139
    ...    Test title: PUT all VNF Performance Monitoring Jobs - Method not implemented
    ...    Test objective: The objective is to test that PUT method is not allowed to modify VNF Performance Monitoring Jobs
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance jobs are set in the VNF.
Michele Carignani's avatar
Michele Carignani committed
140
    ...    Reference: Clause 6.4.2.3.3 - ETSI GS NFV-SOL 002 [2] v2.6.1
141
142
143
144
145
146
147
    ...    Config ID: Config_prod_VE
    ...    Applicability: none
    ...    Post-Conditions: none
    Send PUT Request for all VNF Performance Monitoring Jobs
    Check HTTP Response Status Code Is    405
    
PATCH all VNF Performance Monitoring Jobs - (Method not implemented)
Giacomo Bernini's avatar
fix    
Giacomo Bernini committed
148
    [Documentation]    Test ID: 6.3.3.1.11
149
150
151
    ...    Test title: PATCH all VNF Performance Monitoring Jobs - Method not implemented
    ...    Test objective: The objective is to test that PATCH method is not allowed to update VNF Performance Monitoring Jobs
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance jobs are set in the VNF.
Michele Carignani's avatar
Michele Carignani committed
152
    ...    Reference: Clause 6.4.2.3.3 - ETSI GS NFV-SOL 002 [2] v2.6.1
153
154
155
156
157
158
159
    ...    Config ID: Config_prod_VE
    ...    Applicability: none
    ...    Post-Conditions: none
    Send PATCH Request for all VNF Performance Monitoring Jobs
    Check HTTP Response Status Code Is    405
    
DELETE all VNF Performance Monitoring Jobs - Method not implemented
Giacomo Bernini's avatar
fix    
Giacomo Bernini committed
160
    [Documentation]    Test ID: 6.3.3.1.12
161
162
163
    ...    Test title: DELETE all VNF Performance Monitoring Jobs - Method not implemented
    ...    Test objective: The objective is to test that DELETE method is not allowed to update VNF Performance Monitoring Jobs
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance jobs are set in the VNF.
Michele Carignani's avatar
Michele Carignani committed
164
    ...    Reference: Clause 6.4.2.3.3 - ETSI GS NFV-SOL 002 [2] v2.6.1
165
166
167
168
169
170
171
    ...    Config ID: Config_prod_VE
    ...    Applicability: none
    ...    Post-Conditions: none
    Send PATCH Request for all VNF Performance Monitoring Jobs
    Check HTTP Response Status Code Is    405
    Check Postcondition VNF Performance Monitoring Jobs Exist
    
172
173
174
175
176
GET VNF Performance Monitoring Jobs to get Paged Response   
    [Documentation]    Test ID: 6.3.3.1.13
    ...    Test title: GET VNF Performance Monitoring Jobs to get Paged Response
    ...    Test objective: The objective is to test the retrieval of VNF performance monitoring jobs to get Paged response.
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance jobs are set in the VNF.
Michele Carignani's avatar
Michele Carignani committed
177
    ...    Reference: Clause 6.4.2.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
178
179
180
181
182
183
184
185
186
187
188
189
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none   
    GET all VNF Performance Monitoring Jobs
    Check HTTP Response Status Code Is    200
    Check LINK in Header 
    
GET VNF Performance Monitoring Jobs for Bad Request Response too big
    [Documentation]    Test ID: 6.3.3.1.14
    ...    Test title: GET VNF Performance Monitoring Jobs for Bad Request Response too big
    ...    Test objective: The objective is to test that GET method fail retrieving status information about VNF Performance Monitoring when Response is too big, and perform the JSON schema validation of the failed operation HTTP response
    ...    Pre-conditions: A VNF instance is instantiated. One or more VNF performance jobs are set in the VNF.
Michele Carignani's avatar
Michele Carignani committed
190
    ...    Reference: Clause 6.4.2.3.2 - ETSI GS NFV-SOL 002 [2] v2.6.1
191
192
193
194
195
196
197
198
    ...    Config ID: Config_prod_VNFM
    ...    Applicability: none
    ...    Post-Conditions: none
    GET all VNF Performance Monitoring Jobs
    Check HTTP Response Status Code Is    400
    Check HTTP Response Body Json Schema Is    ProblemDetails

    
199
200
*** Keywords ***
GET all VNF Performance Monitoring Jobs
201
202
    Log    Trying to get all PM Jobs present in the VNFM
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
203
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
204
    GET    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs
205
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
206
    Set Suite Variable    ${response}    ${output}
207

208
GET VNF Performance Monitoring Jobs with attribute-based filter
209
210
    Log    Trying to get all PM Jobs present in the VNFM, using filter params
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
211
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
212
    GET    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs?${POS_FILTER}
213
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
214
    Set Suite Variable    ${response}    ${output}
215
216

GET VNF Performance Monitoring Jobs with all_fields attribute selector
217
218
    Log    Trying to get all PM Jobs present in the VNFM, using 'all_fields' filter
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
219
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
220
    GET    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs?all_fields
221
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
222
    Set Suite Variable    ${response}    ${output}
223

224
GET VNF Performance Monitoring Jobs with exclude_default attribute selector
225
226
    Log    Trying to get all VNF Packages present in the VNFM, using filter params
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
227
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
228
    GET    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs?exclude_default
229
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
230
    Set Suite Variable    ${response}    ${output}
231

232
GET VNF Performance Monitoring Jobs with fields attribute selector
233
    Log    Trying to get all VNF Packages present in the VNFM, using filter params
Giacomo Bernini's avatar
fixes    
Giacomo Bernini committed
234
    Pass Execution If    ${FIELD_USAGE} == 0    Skipping test as VNFM is not supporting 'fields'
235
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
236
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
237
    GET    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs?fields=${fields}
238
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
239
    Set Suite Variable    ${response}    ${output}
240

241
GET VNF Performance Monitoring Jobs with exclude_fields attribute selector
242
    Log    Trying to get all VNF Packages present in the VNFM, using filter params
Giacomo Bernini's avatar
fixes    
Giacomo Bernini committed
243
    Pass Execution If    ${FIELD_USAGE} == 0    Skipping test as VNFM is not supporting 'fields'
244
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
245
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
246
    GET    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs?fields=${fields}
247
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
248
    Set Suite Variable    ${response}    ${output}
249

250
GET VNF Performance Monitoring Jobs with invalid attribute-based filter
251
252
    Log    Trying to get all PM Jobs present in the VNFM, using an erroneous filter param
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
253
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
254
    GET    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs?${NEG_FILTER}
255
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
256
    Set Suite Variable    ${response}    ${output}
257
258

GET VNF Performance Monitoring Jobs with invalid resource endpoint    
259
260
    Log    Trying to perform a GET on a erroneous URI
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
261
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
262
    GET    ${apiRoot}/${apiName}/${apiVersion}/pm_job    # wrong URI /pm_job instead of /pm_jobs
263
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
264
    Set Suite Variable    ${response}    ${output}
265
266

Send Post Request Create new VNF Performance Monitoring Job
267
268
269
    Log    Creating a new PM Job
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
270
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
271
272
    ${body}=    Get File    jsons/CreatePmJobRequest.json
    POST    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs    ${body}
273
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
274
    Set Suite Variable    ${response}    ${output}
275
276

Send PUT Request for all VNF Performance Monitoring Jobs 
277
278
    Log    Trying to perform a PUT. This method should not be implemented
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
279
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
280
    PUT    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs
281
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
282
    Set Suite Variable    ${response}    ${output}
283

284
285
Send PATCH Request for all VNF Performance Monitoring Jobs 
    Log    Trying to perform a PUT. This method should not be implemented
286
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
287
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
288
    PATCH    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs
289
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
290
    Set Suite Variable    ${response}    ${output}
291
292
293
294
295
296
297
    
Send DELETE Request for all VNF Performance Monitoring Jobs 
    Log    Trying to perform a PUT. This method should not be implemented
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
    PATCH    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
298
    Set Suite Variable    ${response}    ${output}
299

300
301
302
303
304
305
Check Postcondition VNF Performance Monitoring Jobs Exist
    Log    Checking that Pm Job still exists
    GET all VNF Performance Monitoring Jobs
    
Check Postcondition PmJob Exists
    Log    Checking that Pm Job exists
306
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
307
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
Giacomo Bernini's avatar
Giacomo Bernini committed
308
    GET    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${response['body']['id']}
309
    ${output}=    Output    response
Giacomo Bernini's avatar
Giacomo Bernini committed
310
    Set Suite Variable    ${response}    ${output}
311
312
313
314
315
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    PmJob
    
Check HTTP Response Body Matches exclude_fields selector
    Log    Checking that reports element is missing
Giacomo Bernini's avatar
Giacomo Bernini committed
316
    ${reports}=    Get Value From Json    ${response['body']}    $..reports
317
318
    Should Be Empty    ${reports}
    Log    Checking that reports element is missing
Giacomo Bernini's avatar
Giacomo Bernini committed
319
    ${criteria}=    Get Value From Json    ${response['body']}    $..criteria
320
321
322
323
324
    Should Be Empty    ${criteria}
    Log    Reports element is empty as expected

Check HTTP Response Body Matches fields selector
    Log    Trying to validate criteria schema
Giacomo Bernini's avatar
Giacomo Bernini committed
325
    ${criteria}=    Get Value From Json    ${response['body']}    $..criteria
326
    Validate Json    criteria.schema.json    ${criteria}
327
328
    Log    Validation for criteria schema OK
    Log    Trying to validate criteria schema
Giacomo Bernini's avatar
Giacomo Bernini committed
329
    ${reports}=    Get Value From Json    ${response['body']}    $..reports
330
331
332
333
334
    Validate Json    reports.schema.json    ${reports[0]}
    Log    Validation for reports schema OK
    
Check HTTP Response Body Matches exclude_default selector
    Log    Checking that reports element is missing
Giacomo Bernini's avatar
Giacomo Bernini committed
335
    ${reports}=    Get Value From Json    ${response['body']}    $..reports
336
337
338
339
340
    Should Be Empty    ${reports}
    Log    Reports element is empty as expected

Check HTTP Response Body Matches all_fields selector
    Log    Trying to validate criteria schema
Giacomo Bernini's avatar
Giacomo Bernini committed
341
    ${criteria}=    Get Value From Json    ${response['body']}    $..criteria
342
    Validate Json    criteria.schema.json    ${criteria}
343
344
    Log    Validation for criteria schema OK
    Log    Trying to validate criteria schema
Giacomo Bernini's avatar
Giacomo Bernini committed
345
    ${reports}=    Get Value From Json    ${response['body']}    $..reports
346
347
348
    Validate Json    reports.schema.json    ${reports[0]}
    Log    Validation for reports schema OK
    Log    Validating _links schema
Giacomo Bernini's avatar
Giacomo Bernini committed
349
    ${links}=    Get Value From Json    ${response['body']}    $.._links
350
351
352
353
354
    Validate Json    links.schema.json    ${links[0]}
    Log    Validation for _links schema OK
    
Check HTTP Response Body Matches filter
    Log    Checking that attribute-based filter is matched
Najam UI Hassan's avatar
Najam UI Hassan committed
355
356
    @{words} =  Split String    ${POS_FILTER}       ,${SEPERATOR} 
    Should Be Equal As Strings    ${response['body'][0]['objectInstanceIds']}    @{words}[1]
357
358
359

Check HTTP Response Body Does Not Contain reports
    Log    Checking that field element is missing
Giacomo Bernini's avatar
Giacomo Bernini committed
360
    ${reports}=    Get Value From Json    ${response['body']}    $..reports
361
362
363
364
365
    Should Be Empty    ${reports}
    Log    Reports element is empty as expected
    
Check HTTP Response Status Code Is
    [Arguments]    ${expected_status}
Elian Kraja's avatar
Elian Kraja committed
366
    Should Be Equal As Strings   ${response['status']}    ${expected_status} 
367
368
369
    Log    Status code validated
    
Check HTTP Response Status Code Is 40x  
Giacomo Bernini's avatar
Giacomo Bernini committed
370
    Should Contain Any    ${response['status']}    401    403
371
372
373
374
    Log    Status code validated

Check HTTP Response Header Contains
    [Arguments]    ${CONTENT_TYPE}
Giacomo Bernini's avatar
Giacomo Bernini committed
375
    Should Contain    ${response['headers']}    ${CONTENT_TYPE}
376
377
378
379
    Log    Header is present
    
Check HTTP Response Body Json Schema Is
    [Arguments]    ${input}
Giacomo Bernini's avatar
Giacomo Bernini committed
380
    Should Contain    ${response['headers']['Content-Type']}    application/json
381
    ${schema} =    Catenate    SEPARATOR=    ${input}	.schema.json
Giacomo Bernini's avatar
Giacomo Bernini committed
382
    Validate Json    ${schema}    ${response['body']}
383
    Log    Json Schema Validation OK
384
385
    
Check LINK in Header
Elian Kraja's avatar
Elian Kraja committed
386
    ${linkURL}=    Get Value From Json    ${response['headers']}    $..Link
387
388
    Should Not Be Empty    ${linkURL}

389