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