Add O2 IMS compliance automation test scripts.
[it/test.git] / test_scripts / O2IMS_Compliance_Test / o2ims_compliance / 7.3.2_SMO_succeeds_to_query_inventory_with_O2ims_APIs_and_correct_token.robot
1 *** Settings ***
2 Documentation  Verify SMO succeeds to query inventory with O2ims APIs and correct token
3 # Library  REST       ssl_verify=False    loglevel=DEBUG
4 Library  REST       ssl_verify=False
5 Variables              ${EXECDIR}${/}test_configs.yaml
6
7 Suite Setup            Set REST Headers
8
9 *** Variables ***
10 ${ORAN_HOST_EXTERNAL_IP}    ${ocloud.oran_o2_app.api.host}
11 ${ORAN_SERVICE_NODE_PORT}   ${ocloud.oran_o2_app.api.node_port}
12 ${GLOBAL_OCLOUD_ID1}        ${ocloud.oran_o2_app.g_ocloud_id}
13 ${SMO_TOKEN_DATA}           ${ocloud.oran_o2_app.smo_token_data}
14 ${globalLocationId}         ${ocloud.oran_o2_app.g_location_id}
15
16 ${ORAN_O2IMS_ENDPOINT}  ${ocloud.oran_o2_app.api.protocol}://${ORAN_HOST_EXTERNAL_IP}:${ORAN_SERVICE_NODE_PORT}
17
18 *** Test Cases ***
19 s1, query o-cloud detail
20     [documentation]  This test case verifies Query OCloud Detail
21     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS
22     # Builtin.Set Log Level   DEBUG
23     # Set SSL Verify      False
24     # Set Headers     {"accept": "application/json"}
25     # Set Headers     {"Authorization": "Bearer ${SMO_TOKEN_DATA}"}
26     # Clear Expectations
27     Expect Response Body        ${CURDIR}/schemas/ocloud_properties.json
28     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/
29     # Output Schema   response body   ${CURDIR}/schemas/.output/ocloud_properties.json
30     Clear Expectations
31     log      ${res}   level=DEBUG
32     Integer  response status    200
33     # Object   response body
34     String   $.globalcloudId    ${GLOBAL_OCLOUD_ID1}
35     String   $.serviceUri       ${ORAN_O2IMS_ENDPOINT}
36
37     # all_fields
38     Expect Response Body        ${CURDIR}/schemas/ocloud_allfields_properties.json
39     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1?all_fields
40     # Output Schema   response body   ${CURDIR}/schemas/.output/ocloud_allfields_properties.json
41     Clear Expectations
42     log      ${res}   level=DEBUG
43     Integer  response status    200
44
45 s2, query resource type list without filter
46     [documentation]  This test case verifies Query OCloud resourceTypes without filter
47     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS    ORAN_O2IMS_Inventory
48     # Clear Expectations
49     Expect Response Body        ${CURDIR}/schemas/resourceTypes_properties.json
50     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourceTypes
51     # Output Schema   response body   ${CURDIR}/schemas/.output/resourceTypes_properties.json
52     Clear Expectations
53     log      ${res}   level=DEBUG
54     Integer     response status    200
55     Array       response body
56     Array       $   minItems=1  uniqueItems=true
57
58     # all_fields
59     Expect Response Body        ${CURDIR}/schemas/resourceTypes_allfields_properties.json
60     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourceTypes?all_fields
61     # Output Schema   response body   ${CURDIR}/schemas/.output/resourceTypes_allfields_properties.json
62     Clear Expectations
63     log      ${res}   level=DEBUG
64     Integer     response status    200
65     Array       response body
66
67
68 s3, query resource type list with filters
69     [documentation]  This test case verifies Query OCloud resourceTypes with filter
70     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS    ORAN_O2IMS_Inventory
71     # Clear Expectations
72     Expect Response Body        ${CURDIR}/schemas/resourceTypes_properties.json
73     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourceTypes?filter=(eq,name,pserver)
74     Clear Expectations
75     log      ${res}   level=DEBUG
76     Integer     response status    200
77     Array       response body
78     Array       $   minItems=1  maxItems=1
79     # String      $[0].resourceTypeId
80     # String      $[0].name
81     # String      $[0].resourceKind
82     # String      $[0].resourceClass
83     # String      $[0].resourceTypeId
84
85 s4, query resource type list with selectors
86     [documentation]  This test case verifies query resource type list with selectors
87     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS    ORAN_O2IMS_Inventory
88     # Clear Expectations
89     Expect Response Body        ${CURDIR}/schemas/resourceTypes_properties.json
90     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourceTypes?fields=name,description
91     Clear Expectations
92     log      ${res}   level=DEBUG
93     Integer     response status    200
94     Array       response body
95     Array       $   minItems=1  uniqueItems=true
96
97 s5, query Resource Type detail
98     [documentation]  This test case verifies Query OCloud resourceTypes detail
99     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS    ORAN_O2IMS_Inventory
100     Clear Expectations
101     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourceTypes?filter=(eq,name,pserver)
102     ${resourceTypeId}      output   $[0].resourceTypeId
103     # Clear Expectations
104     Expect Response Body        ${CURDIR}/schemas/resourceType_properties.json
105     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourceTypes/${resourceTypeId}
106     # Output Schema   response body   ${CURDIR}/schemas/.output/resourceType_properties.json
107     Clear Expectations
108     log      ${res}   level=DEBUG
109     Integer     response status    200
110     Object       response body
111
112     # all_fields
113     Expect Response Body        ${CURDIR}/schemas/resourceType_allfields_properties.json
114     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourceTypes/${resourceTypeId}?all_fields
115     # Output Schema   response body   ${CURDIR}/schemas/.output/resourceType_allfields_properties.json
116     Clear Expectations
117     log      ${res}   level=DEBUG
118     Integer     response status    200
119     Object       response body
120     String   $.alarmDictionary.managementInterfaceId    "O2IMS"
121
122 s6, query Resource Pool list without filter
123     [documentation]  This test case verifies Query OCloud resourcePools without filter
124     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS    ORAN_O2IMS_Inventory
125     # Clear Expectations
126     Expect Response Body        ${CURDIR}/schemas/resourcePools_properties.json
127     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools
128     # Output Schema   response body   ${CURDIR}/schemas/.output/resourcePools_properties.json
129     Clear Expectations
130     log      ${res}   level=DEBUG
131     Integer     response status    200
132     Array       response body
133     Array       $   minItems=1  uniqueItems=true
134
135     # # all_fields
136     # # Expect Response Body        ${CURDIR}/schemas/resourcePools_allfields_properties.json
137     # ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools?all_fields
138     # Output Schema   response body   ${CURDIR}/schemas/.output/resourcePools_allfields_properties.json
139     # Clear Expectations
140     # log      ${res}   level=DEBUG
141     # Integer     response status    200
142
143 s7, query Resource Pool list with filter
144     [documentation]  This test case verifies Query OCloud resourcePools with filter
145     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS    ORAN_O2IMS_Inventory
146
147     Clear Expectations
148     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools
149     ${resourcePoolId}      output   $[0].resourcePoolId
150
151     # Clear Expectations
152     Expect Response Body        ${CURDIR}/schemas/resourcePools_properties.json
153     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools?filter=(eq,resourcePoolId,${resourcePoolId})
154     # Output Schema   response body   ${CURDIR}/schemas/.output/resourcePools_properties.json
155     Clear Expectations
156     log      ${res}   level=DEBUG
157     Integer     response status    200
158     Array       response body
159     Array       $   minItems=1  maxItems=1
160
161 s8, query Resource Pool list with selector
162     [documentation]  This test case verifies query Resource Pool list with selector
163     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS    ORAN_O2IMS_Inventory
164     # Clear Expectations
165     Expect Response Body        ${CURDIR}/schemas/resourcePools_properties.json
166     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools
167     # Output Schema   response body   ${CURDIR}/schemas/.output/resourcePools_properties.json
168     Clear Expectations
169     log      ${res}   level=DEBUG
170     Integer     response status    200
171     Array       response body
172     Array       $   minItems=1  uniqueItems=true
173
174 s9, query Resource Pool detail
175     [documentation]  This test case verifies Query OCloud resourcePools detail
176     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS    ORAN_O2IMS_Inventory
177     Clear Expectations
178     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools
179     ${resourcePoolId}      output   $[0].resourcePoolId
180     # Clear Expectations
181     Expect Response Body        ${CURDIR}/schemas/resourcePool_properties.json
182     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools/${resourcePoolId}
183     # Output Schema   response body   ${CURDIR}/schemas/.output/resourcePool_properties.json
184     Clear Expectations
185     log      ${res}   level=DEBUG
186     Integer     response status    200
187     Object       response body
188
189     # all_fields
190     Expect Response Body        ${CURDIR}/schemas/resourcePool_allfields_properties.json
191     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools/${resourcePoolId}?all_fields
192     # Output Schema   response body   ${CURDIR}/schemas/.output/resourcePool_allfields_properties.json
193     Clear Expectations
194     log      ${res}   level=DEBUG
195     Integer     response status    200
196
197
198 s10, query Resource list of a Resource Pool without filter
199     [documentation]  This test case verifies Query OCloud Resource list without filter
200     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS    ORAN_O2IMS_Inventory
201     Clear Expectations
202     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools
203     @{resourcePools}     output  $
204     FOR     ${resourcePool}     IN      @{resourcePools}
205         # ${resourcePoolId}      output   $[0].resourcePoolId
206         ${resourcePoolId}       input       ${resourcePool}[resourcePoolId]
207         # Clear Expectations
208         Expect Response Body        ${CURDIR}/schemas/resources_properties.json
209         ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools/${resourcePoolId}/resources
210         # Output Schema   response body   ${CURDIR}/schemas/.output/resources_properties.json
211         # Clear Expectations
212         log      ${res}   level=DEBUG
213         Integer     response status    200
214         Array       response body
215         Array       $   minItems=1  uniqueItems=true
216     END
217
218
219 s11, query Resource list of a Resource Pool with filter
220     [documentation]  This test case verifies Query OCloud Resource list with filter
221     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS    ORAN_O2IMS_Inventory
222     Clear Expectations
223     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourceTypes?filter=(eq,name,pserver)
224     ${resourceTypeId}      output   $[0].resourceTypeId
225     Clear Expectations
226     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools
227     @{resourcePools}     output  $
228     FOR     ${resourcePool}     IN      @{resourcePools}
229         # ${resourcePoolId}      output   $[0].resourcePoolId
230         ${resourcePoolId}       input       ${resourcePool}[resourcePoolId]
231         # Clear Expectations
232         Expect Response Body        ${CURDIR}/schemas/resources_properties.json
233         ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools/${resourcePoolId}/resources?filter=(eq,resourceTypeId,${resourceTypeId})
234         # Output Schema   response body   ${CURDIR}/schemas/.output/resources_properties.json
235         # Clear Expectations
236         log      ${res}   level=DEBUG
237         Integer     response status    200
238         Array       response body
239         Array       $   minItems=1  uniqueItems=true
240     END
241
242
243 s12, query Resource list of a Resource Pool with selector
244     [documentation]  This test case verifies query Resource list of a Resource Pool with selector
245     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS    ORAN_O2IMS_Inventory
246     Clear Expectations
247     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourceTypes?filter=(eq,name,pserver)
248     ${resourceTypeId}      output   $[0].resourceTypeId
249     Clear Expectations
250     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools
251     @{resourcePools}     output  $
252     FOR     ${resourcePool}     IN      @{resourcePools}
253         # ${resourcePoolId}      output   $[0].resourcePoolId
254         ${resourcePoolId}       input       ${resourcePool}[resourcePoolId]
255         # Clear Expectations
256         Expect Response Body        ${CURDIR}/schemas/resources_properties.json
257         ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools/${resourcePoolId}/resources?exclude_default
258         # Output Schema   response body   ${CURDIR}/schemas/.output/resources_properties.json
259         # Clear Expectations
260         log      ${res}   level=DEBUG
261         Integer     response status    200
262         Array       response body
263         Array       $   minItems=1  uniqueItems=true
264     END
265
266 s13, query Resource detail
267     [documentation]  This test case verifies Query OCloud Resource Detail of pserver
268     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS    ORAN_O2IMS_Inventory
269     Clear Expectations
270     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourceTypes?filter=(eq,name,pserver)
271     ${resourceTypeId}      output   $[0].resourceTypeId
272     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools
273     @{resourcePools}     output  $
274     FOR     ${resourcePool}     IN      @{resourcePools}
275         # ${resourcePoolId}      output   $[0].resourcePoolId
276         ${resourcePoolId}       input       ${resourcePool}[resourcePoolId]
277
278         Clear Expectations
279         GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools/${resourcePoolId}/resources?filter=(eq,resourceTypeId,${resourceTypeId})
280         @{resources}    output   $
281         ${length1}=     Get Length     ${resources}
282         IF      ${length1} == 0
283             log     "resourcePool with id: ${resourcePoolId} has no resource"
284             CONTINUE
285         END
286         ${resourceId}      output   $[0].resourceId
287
288         Expect Response Body        ${CURDIR}/schemas/resource_properties.json
289         ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools/${resourcePoolId}/resources/${resourceId}
290
291         # Output Schema   response body   ${CURDIR}/schemas/.output/resource_properties.json
292         # Clear Expectations
293         log      ${res}   level=DEBUG
294         Integer     response status    200
295         Object      response body
296
297         # all_fields
298
299         Expect Response Body        ${CURDIR}/schemas/resource_allfields_properties.json
300         ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools/${resourcePoolId}/resources/${resourceId}?all_fields
301         # Output Schema   response body   ${CURDIR}/schemas/.output/resource_allfields_properties.json
302         # Clear Expectations
303         log      ${res}   level=DEBUG
304         Integer     response status    200
305         ${description}    output    $.description
306         should contain  ${description}  hostname:
307         should contain  ${description}  id:
308         should contain  ${description}  personality:
309         should contain  ${description}  subfunctions:
310         should contain  ${description}  max_cpu_mhz_allowed:
311         should contain  ${description}  install_state:
312         should contain  ${description}  operational:
313         should contain  ${description}  availability:
314         should contain  ${description}  administrative:
315         should contain  ${description}  boot_device:
316         should contain  ${description}  mgmt_mac:
317         should contain  ${description}  clock_synchronization:
318         should contain  ${description}  rootfs_device:
319         Object      $.extensions
320         String      $.extensions['hostname']
321         Integer      $.extensions['id']
322         String      $.extensions['personality']
323         # String      $.extensions['max_cpu_mhz_allowed']
324         # String      $.extensions['install_state']
325         String      $.extensions['operational']
326         String      $.extensions['availability']
327         String      $.extensions['administrative']
328         String      $.extensions['boot_device']
329         String      $.extensions['rootfs_device']
330         String      $.extensions['subfunctions']
331         String      $.extensions['mgmt_mac']
332         String      $.extensions['clock_synchronization']
333
334         BREAK
335     END
336
337
338 s14, query Resource detail of an accelerator
339     [documentation]  This test case verifies Query OCloud Resource Detail of an accelerator
340     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS    ORAN_O2IMS_Inventory
341     Clear Expectations
342     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourceTypes?filter=(eq,name,pserver_acc)
343     ${resourceTypeId}      output   $[0].resourceTypeId
344     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools
345     @{resourcePools}     output  $
346     FOR     ${resourcePool}     IN      @{resourcePools}
347         # ${resourcePoolId}      output   $[0].resourcePoolId
348         ${resourcePoolId}       input       ${resourcePool}[resourcePoolId]
349
350         Clear Expectations
351         GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools/${resourcePoolId}/resources?filter=(eq,resourceTypeId,${resourceTypeId})
352         @{resources}    output   $
353         ${length1}=     Get Length     ${resources}
354         IF      ${length1} == 0
355             log     "resourcePool with id: ${resourcePoolId} has no resource of accelerator"
356             CONTINUE
357         END
358         ${resourceId}      output   $[0].resourceId
359
360         Expect Response Body        ${CURDIR}/schemas/resource_allfields_properties.json
361         ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools/${resourcePoolId}/resources/${resourceId}?all_fields
362
363         # Output Schema   response body   ${CURDIR}/schemas/.output/resource_properties.json
364         # Clear Expectations
365         log      ${res}   level=DEBUG
366         Integer     response status    200
367         Object      response body
368         ${description}    output    $.description
369         should contain  ${description}  name:
370         should contain  ${description}  pdevice:
371         should contain  ${description}  pciaddr:
372         should contain  ${description}  pvendor_id:
373         should contain  ${description}  pvendor:
374         should contain  ${description}  pclass_id:
375         should contain  ${description}  pclass:
376         should contain  ${description}  psvendor:
377         should contain  ${description}  psdevice:
378         should contain  ${description}  sriov_totalvfs:
379         should contain  ${description}  sriov_numvfs:
380         should contain  ${description}  numa_node:
381         # should contain  ${description}  name:
382         # should contain  ${description}  class:
383         # should contain  ${description}  vendor:
384         Object      $.extensions
385         String      $.extensions['name']
386         String      $.extensions['pdevice']
387         String      $.extensions['pciaddr']
388         String      $.extensions['pvendor_id']
389         String      $.extensions['pvendor']
390         String      $.extensions['pclass_id']
391         String      $.extensions['pclass']
392         String      $.extensions['psvendor']
393         String      $.extensions['psdevice']
394         # Integer      $.extensions['sriov_totalvfs']
395         Integer     $.extensions['sriov_numvfs']
396         Integer     $.extensions['numa_node']
397
398         BREAK
399     END
400
401 s15, query Resource detail of an cpu
402     [documentation]  This test case verifies Query OCloud Resource Detail of an cpu
403     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS    ORAN_O2IMS_Inventory
404     Clear Expectations
405     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourceTypes?filter=(eq,name,pserver_cpu)
406     ${resourceTypeId}      output   $[0].resourceTypeId
407     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools
408     @{resourcePools}     output  $
409     FOR     ${resourcePool}     IN      @{resourcePools}
410         # ${resourcePoolId}      output   $[0].resourcePoolId
411         ${resourcePoolId}       input       ${resourcePool}[resourcePoolId]
412
413         Clear Expectations
414         GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools/${resourcePoolId}/resources?filter=(eq,resourceTypeId,${resourceTypeId})
415         @{resources}    output   $
416         ${length1}=     Get Length     ${resources}
417         IF      ${length1} == 0
418             log     "resourcePool with id: ${resourcePoolId} has no resource of accelerator"
419             CONTINUE
420         END
421         ${resourceId}      output   $[0].resourceId
422
423         Expect Response Body        ${CURDIR}/schemas/resource_allfields_properties.json
424         ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools/${resourcePoolId}/resources/${resourceId}?all_fields
425
426         # Output Schema   response body   ${CURDIR}/schemas/.output/resource_properties.json
427         # Clear Expectations
428         log      ${res}   level=DEBUG
429         Integer     response status    200
430         Object      response body
431         ${description}    output    $.description
432         should contain  ${description}  core:
433         should contain  ${description}  thread:
434         should contain  ${description}  allocated_function:
435         should contain  ${description}  numa_node:
436         should contain  ${description}  cpu_model:
437         should contain  ${description}  cpu_family:
438         should contain  ${description}  cpu:
439         Object      $.extensions
440         Integer      $.extensions['cpu']
441         Integer      $.extensions['core']
442         Integer      $.extensions['thread']
443         String      $.extensions['allocated_function']
444         Integer      $.extensions['numa_node']
445         String      $.extensions['cpu_model']
446         String      $.extensions['cpu_family']
447
448         BREAK
449     END
450
451
452 s16, query Resource detail of an interface
453     [documentation]  This test case verifies Query OCloud Resource Detail of an interface
454     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS    ORAN_O2IMS_Inventory
455     Clear Expectations
456     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourceTypes?filter=(eq,name,pserver_if)
457     ${resourceTypeId}      output   $[0].resourceTypeId
458     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools
459     @{resourcePools}     output  $
460     FOR     ${resourcePool}     IN      @{resourcePools}
461         # ${resourcePoolId}      output   $[0].resourcePoolId
462         ${resourcePoolId}       input       ${resourcePool}[resourcePoolId]
463
464         Clear Expectations
465         GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools/${resourcePoolId}/resources?filter=(eq,resourceTypeId,${resourceTypeId})
466         @{resources}    output   $
467         ${length1}=     Get Length     ${resources}
468         IF      ${length1} == 0
469             log     "resourcePool with id: ${resourcePoolId} has no resource of accelerator"
470             CONTINUE
471         END
472         ${resourceId}      output   $[0].resourceId
473
474         Expect Response Body        ${CURDIR}/schemas/resource_allfields_properties.json
475         ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools/${resourcePoolId}/resources/${resourceId}?all_fields
476
477         # Output Schema   response body   ${CURDIR}/schemas/.output/resource_properties.json
478         # Clear Expectations
479         log      ${res}   level=DEBUG
480         Integer     response status    200
481         Object      response body
482         ${description}    output    $.description
483         should contain  ${description}  ifname:
484         should contain  ${description}  iftype:
485         should contain  ${description}  imac:
486         should contain  ${description}  vlan_id:
487         should contain  ${description}  imtu:
488         should contain  ${description}  ifclass:
489         should contain  ${description}  uses:
490         should contain  ${description}  max_tx_rate:
491         should contain  ${description}  sriov_vf_driver:
492         should contain  ${description}  sriov_numvfs:
493         should contain  ${description}  ptp_role:
494         Object      $.extensions
495         String      $.extensions['ifname']
496         String      $.extensions['iftype']
497         String      $.extensions['imac']
498         # Integer      $.extensions['vlan_id']
499         Integer      $.extensions['imtu']
500         # String      $.extensions['ifclass']
501         # String      $.extensions['uses']
502         # Integer      $.extensions['max_tx_rate']
503         # String      $.extensions['sriov_vf_driver']
504         # Integer     $.extensions['sriov_numvfs']
505         # String     $.extensions['ptp_role']
506
507         BREAK
508     END
509
510
511 s17, query Resource detail of a memory
512     [documentation]  This test case verifies Query OCloud Resource Detail of a memory
513     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS    ORAN_O2IMS_Inventory
514     Clear Expectations
515     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourceTypes?filter=(eq,name,pserver_mem)
516     ${resourceTypeId}      output   $[0].resourceTypeId
517     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools
518     @{resourcePools}     output  $
519     FOR     ${resourcePool}     IN      @{resourcePools}
520         # ${resourcePoolId}      output   $[0].resourcePoolId
521         ${resourcePoolId}       input       ${resourcePool}[resourcePoolId]
522
523         Clear Expectations
524         GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools/${resourcePoolId}/resources?filter=(eq,resourceTypeId,${resourceTypeId})
525         @{resources}    output   $
526         ${length1}=     Get Length     ${resources}
527         IF      ${length1} == 0
528             log     "resourcePool with id: ${resourcePoolId} has no resource of accelerator"
529             CONTINUE
530         END
531         ${resourceId}      output   $[0].resourceId
532
533         Expect Response Body        ${CURDIR}/schemas/resource_allfields_properties.json
534         ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools/${resourcePoolId}/resources/${resourceId}?all_fields
535
536         # Output Schema   response body   ${CURDIR}/schemas/.output/resource_properties.json
537         # Clear Expectations
538         log      ${res}   level=DEBUG
539         Integer     response status    200
540         Object      response body
541         ${description}    output    $.description
542         should contain  ${description}  memtotal_mib:
543         should contain  ${description}  memavail_mib:
544         should contain  ${description}  vm_hugepages_use_1G:
545         should contain  ${description}  vm_hugepages_possible_1G:
546         should contain  ${description}  hugepages_configured:
547         should contain  ${description}  vm_hugepages_avail_1G:
548         should contain  ${description}  vm_hugepages_nr_1G:
549         should contain  ${description}  vm_hugepages_nr_4K:
550         should contain  ${description}  vm_hugepages_nr_2M:
551         should contain  ${description}  numa_node:
552         should contain  ${description}  vm_hugepages_possible_2M:
553         should contain  ${description}  vm_hugepages_avail_2M:
554         should contain  ${description}  platform_reserved_mib:
555         Object      $.extensions
556         Integer      $.extensions['memtotal_mib']
557         Integer      $.extensions['memavail_mib']
558         # String       $.extensions['vm_hugepages_use_1G']
559         Integer      $.extensions['vm_hugepages_possible_1G']
560         # String       $.extensions['hugepages_configured']
561         Integer      $.extensions['vm_hugepages_avail_1G']
562         Integer      $.extensions['vm_hugepages_nr_1G']
563         Integer      $.extensions['vm_hugepages_nr_4K']
564         Integer      $.extensions['vm_hugepages_nr_2M']
565         Integer      $.extensions['vm_hugepages_possible_2M']
566         Integer      $.extensions['vm_hugepages_avail_2M']
567         Integer      $.extensions['platform_reserved_mib']
568         Integer      $.extensions['numa_node']
569
570         BREAK
571     END
572
573 s18, query Resource detail of an ethernet port
574     [documentation]  This test case verifies Query OCloud Resource Detail of an ethernet port
575     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS    ORAN_O2IMS_Inventory
576     Clear Expectations
577     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourceTypes?filter=(eq,name,pserver_ethernet)
578     ${resourceTypeId}      output   $[0].resourceTypeId
579     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools
580     @{resourcePools}     output  $
581     FOR     ${resourcePool}     IN      @{resourcePools}
582         # ${resourcePoolId}      output   $[0].resourcePoolId
583         ${resourcePoolId}       input       ${resourcePool}[resourcePoolId]
584
585         Clear Expectations
586         GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools/${resourcePoolId}/resources?filter=(eq,resourceTypeId,${resourceTypeId})
587         @{resources}    output   $
588         ${length1}=     Get Length     ${resources}
589         IF      ${length1} == 0
590             log     "resourcePool with id: ${resourcePoolId} has no resource of accelerator"
591             CONTINUE
592         END
593         ${resourceId}      output   $[0].resourceId
594
595         Expect Response Body        ${CURDIR}/schemas/resource_allfields_properties.json
596         ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools/${resourcePoolId}/resources/${resourceId}?all_fields
597
598         # Output Schema   response body   ${CURDIR}/schemas/.output/resource_properties.json
599         # Clear Expectations
600         log      ${res}   level=DEBUG
601         Integer     response status    200
602         Object      response body
603         ${description}    output    $.description
604         should contain  ${description}  name:
605         should contain  ${description}  pdevice:
606         should contain  ${description}  pciaddr:
607         should contain  ${description}  mac:
608         should contain  ${description}  dev_id:
609         should contain  ${description}  pclass:
610         should contain  ${description}  psvendor:
611         should contain  ${description}  psdevice:
612         should contain  ${description}  sriov_totalvfs:
613         should contain  ${description}  sriov_numvfs:
614         should contain  ${description}  numa_node:
615         should contain  ${description}  capabilities:
616         should contain  ${description}  type:
617         should contain  ${description}  driver:
618         Object      $.extensions
619         String      $.extensions['name']
620         String      $.extensions['pdevice']
621         String      $.extensions['pciaddr']
622         String      $.extensions['mac']
623         Integer      $.extensions['dev_id']
624         String      $.extensions['pclass']
625         String      $.extensions['psvendor']
626         String      $.extensions['psdevice']
627         # Integer      $.extensions['sriov_totalvfs']
628         Integer     $.extensions['sriov_numvfs']
629         Integer     $.extensions['numa_node']
630         # Integer     $.extensions['capabilities']
631         String     $.extensions['type']
632         String     $.extensions['driver']
633
634         BREAK
635     END
636
637 *** Keywords ***
638 Set REST Headers
639     Set Headers     {"accept": "application/json"}
640     Set Headers     {"Authorization": "Bearer ${SMO_TOKEN_DATA}"}