43f8b85e996d210b846d4486188930f620380691
[it/test.git] / test_scripts / O2IMS_Compliance_Test / o2ims_compliance / 7.3.5_Verify_general_aspects_of_O2ims_API.robot
1 *** Settings ***
2 Documentation  Verify general aspects of o2ims APIs
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
19 *** Test Cases ***
20 s1, query ApiVersionInformation of o2ims infrastructureInventory services 
21     [documentation]  This test case verifies query ApiVersionInformation of o2ims infrastructureInventory services 
22     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS     ORAN_O2IMS_GeneralAspect
23
24     # Clear Expectations
25     # Expect Response Body        ${CURDIR}/schemas/api_versions_properties.json
26     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/api_versions
27     # Output Schema   response body   ${CURDIR}/schemas/.output/api_versions_properties.json
28     Clear Expectations
29     log      ${res}   level=DEBUG
30     Integer  response status    200
31     Object   response body  
32
33     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/api_versions
34     # Output Schema   response body   ${CURDIR}/schemas/.output/api_versions_properties.json
35     Clear Expectations
36     log      ${res}   level=DEBUG
37     Integer  response status    200
38     Object   response body
39
40 s2, query ApiVersionInformation of o2ims infrastructureMonitoring services 
41     [documentation]  This test case verifies query ApiVersionInformation of o2ims infrastructureMonitoring services 
42     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS     ORAN_O2IMS_GeneralAspect
43
44     # Clear Expectations
45     # Expect Response Body        ${CURDIR}/schemas/api_versions_properties.json
46     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureMonitoring/api_versions
47     # Clear Expectations
48     log      ${res}   level=DEBUG
49     Integer  response status    200
50     Object   response body
51
52     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureMonitoring/v1/api_versions
53     # Output Schema   response body   ${CURDIR}/schemas/.output/api_versions_properties.json
54     Clear Expectations
55     log      ${res}   level=DEBUG
56     Integer  response status    200
57     Object   response body
58
59 s3, query Resources with nextpage_opaque_marker
60     [documentation]  This test case verifies query Resources with nextpage_opaque_marker
61     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS     ORAN_O2IMS_GeneralAspect
62
63     Clear Expectations
64     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools
65     ${resourcePoolId}      output   $[0].resourcePoolId
66     # Clear Expectations
67     # Expect Response Body        ${CURDIR}/schemas/resources_properties.json
68     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools/${resourcePoolId}/resources?nextpage_opaque_marker=2
69     # Clear Expectations
70     log      ${res}   level=INFO
71     Integer     response status    200
72     Array       response body
73     Array       $   minItems=1  uniqueItems=true
74
75 s4, query Resources with filters
76     [documentation]  This test case verifies query Resources with filters
77     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS     ORAN_O2IMS_GeneralAspect
78
79     Clear Expectations
80
81     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourceTypes?filter=(eq,name,pserver)
82     ${resourceTypeId}      output   $[0].resourceTypeId
83
84     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools
85     ${resourcePoolId}      output   $[0].resourcePoolId
86     # Clear Expectations
87     # Expect Response Body        ${CURDIR}/schemas/resources_properties.json
88     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools/${resourcePoolId}/resources?filter=(eq,resourceTypeId,${resourceTypeId})
89     # Clear Expectations
90     log      ${res}   level=INFO
91     Integer     response status    200
92     Array       response body
93     Array       $   minItems=1  uniqueItems=true
94     @{resources}     output  $
95     FOR     ${resource}     IN      @{resources}
96         Should Be Equal  ${resource}[resourceTypeId]  ${resourceTypeId}
97     END
98
99     # filter accelerator
100     ${substring1}   input   "Intel Corporation"
101     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools/${resourcePoolId}/resources?filter=(cont,description,${substring1})
102     # Clear Expectations
103     log      ${res}   level=INFO
104     Integer     response status    200
105     Array       response body
106     Array       $   minItems=1  uniqueItems=true
107     @{resources}     output  $
108     FOR     ${resource}     IN      @{resources}
109         should contain  ${resource}[description]  ${substring1}
110     END
111
112     # filters combination
113     
114     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourceTypes?filter=(eq,name,pserver_ethernet)
115     ${resourceTypeId}      output   $[0].resourceTypeId
116
117     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools
118     ${resourcePoolId}      output   $[0].resourcePoolId
119     # Clear Expectations
120     ${substring1}   input   "Intel Corporation"
121     # Expect Response Body        ${CURDIR}/schemas/resources_properties.json
122     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools/${resourcePoolId}/resources     {"filter": "(eq,resourceTypeId,${resourceTypeId});(cont,description,${substring1})"}
123     # Clear Expectations
124     log      ${res}   level=INFO
125     Integer     response status    200
126     Array       response body
127     Array       $   minItems=1  uniqueItems=true
128     @{resources}     output  $
129     FOR     ${resource}     IN      @{resources}
130         Should Be Equal  ${resource}[resourceTypeId]  ${resourceTypeId}
131         Should Contain  ${resource}[description]  ${substring1}
132     END
133
134 s5, query Resources with attribute selector
135     [documentation]  This test case verifies query Resources with attribute selector
136     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS     ORAN_O2IMS_GeneralAspect
137
138     # Clear Expectations
139     Expect Response Body        ${CURDIR}/schemas/resourceTypes_properties.json
140     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourceTypes?all_fields
141     Clear Expectations
142     log      ${res}   level=INFO
143     Integer     response status    200
144     Array       response body
145     Array       $   minItems=1  uniqueItems=true
146
147     Expect Response Body        ${CURDIR}/schemas/resourceTypes_field2_properties.json
148     ${res2}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourceTypes?fields=extensions
149     Clear Expectations
150     log      ${res2}   level=INFO
151     Integer     response status    200
152     Array       response body
153     Array       $   minItems=1  uniqueItems=true
154
155     Expect Response Body        ${CURDIR}/schemas/resourceTypes_field3_properties.json
156     ${res2}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourceTypes?exclude_fields=extensions
157     Clear Expectations
158     log      ${res2}   level=INFO
159     Integer     response status    200
160     Array       response body
161     Array       $   minItems=1  uniqueItems=true
162
163     Expect Response Body        ${CURDIR}/schemas/resourceTypes_field4_properties.json
164     ${res2}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourceTypes?exclude_default
165     Clear Expectations
166     log      ${res2}   level=INFO
167     Integer     response status    200
168     Array       response body
169     Array       $   minItems=1  uniqueItems=true
170
171 *** Keywords ***
172 Set REST Headers
173     Set Headers     {"accept": "application/json"}
174     Set Headers     {"Authorization": "Bearer ${SMO_TOKEN_DATA}"}