Add O2 IMS compliance automation test scripts.
[it/test.git] / test_scripts / O2IMS_Compliance_Test / o2ims_compliance / 7.3.7_SMO_gets_400_405_while_issuing_O2ims_APIs_with_incorrect_data.robot
1 *** Settings ***
2 Documentation  Verify SMO gets 4xx response while issuing o2ims APIs with incorrect data
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, Operate resourceTypes with invalid data
21     [documentation]  This test case verifies Operate resourceTypes with invalid data
22     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS     ORAN_O2IMS_Client_Errors
23
24     Clear Expectations
25     # Expect Response Body        ${CURDIR}/schemas/client_errors_properties.json
26     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourceTypes?filter=(eq,WrongAttrName,anyvalue)
27     # Output Schema   response body   ${CURDIR}/schemas/.output/client_errors_properties.json
28     # Clear Expectations
29     log      ${res}   level=DEBUG
30     Integer  response status    400
31     Object   response body
32
33     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourceTypes?fields=(resourceTypeId,WrongAttrName)
34     # Clear Expectations
35     log      ${res}   level=DEBUG
36     Integer  response status    400
37     Object   response body
38
39 s2, Operate resourcePool with invalid data
40     [documentation]  This test case verifies Operate resourcePool with invalid data
41     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS     ORAN_O2IMS_Client_Errors
42
43     Clear Expectations
44     # Expect Response Body        ${CURDIR}/schemas/client_errors_properties.json
45     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools?fields=(resourceTypeId,WrongAttrName)
46     # Clear Expectations
47     log      ${res}   level=DEBUG
48     Integer  response status    400
49     Object   response body
50
51 s3, Operate Resource with invalid data
52     [documentation]  This test case verifies Operate Resource with invalid data
53     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS     ORAN_O2IMS_Client_Errors
54
55     Clear Expectations
56     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools
57     # ${resourcePoolId}   input   $[0].resourcePoolId
58     ${resourcePoolId}      output   $[0].resourcePoolId
59
60     # Expect Response Body        ${CURDIR}/schemas/client_errors_properties.json
61     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourcePools/${resourcePoolId}/resources?fields=(resourceTypeId,WrongAttrName)
62     # Clear Expectations
63     log      ${res}   level=DEBUG
64     Integer  response status    400
65     Object   response body
66
67 s4, Operate DeploymentManager with invalid data
68     [documentation]  This test case verifies Operate DeploymentManager with invalid data
69     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS     ORAN_O2IMS_Client_Errors
70
71     Clear Expectations
72     # Expect Response Body        ${CURDIR}/schemas/client_errors_properties.json
73     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/deploymentManagers?fields=(deploymentManagerId,WrongAttrName)
74     # Clear Expectations
75     log      ${res}   level=DEBUG
76     Integer  response status    400
77     Object   response body
78
79 s5, Operate Ocloud with invalid data
80     [documentation]  This test case verifies Operate Ocloud with invalid data
81     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS     ORAN_O2IMS_Client_Errors
82
83     Clear Expectations
84     # Expect Response Body        ${CURDIR}/schemas/client_errors_properties.json
85     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1?fields=(resourceId,WrongAttrName)
86     # Clear Expectations
87     log      ${res}   level=DEBUG
88     Integer  response status    400
89     Object   response body
90
91 s6, Operate Inventory Subscription with invalid data
92     [documentation]  This test case verifies Operate Inventory Subscription with invalid data
93     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS     ORAN_O2IMS_Client_Errors
94
95     Clear Expectations
96     # Expect Response Body        ${CURDIR}/schemas/client_errors_properties.json
97     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/subscriptions?fields=(SubscriptionId,WrongAttrName)
98     # Clear Expectations
99     log      ${res}   level=DEBUG
100     Integer  response status    400
101     Object   response body
102
103 s7, Operate Alarm with invalid data
104     [documentation]  This test case verifies Operate Alarm with invalid data
105     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS     ORAN_O2IMS_Client_Errors
106
107     Clear Expectations
108     # Expect Response Body        ${CURDIR}/schemas/client_errors_properties.json
109     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureMonitoring/v1/alarms?fields=(AlarmId,WrongAttrName)
110     # Clear Expectations
111     log      ${res}   level=DEBUG
112     Integer  response status    400
113     Object   response body
114
115 s8, Operate Alarm Subscription with invalid data
116     [documentation]  This test case verifies Operate Alarm Subscription with invalid data
117     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS     ORAN_O2IMS_Client_Errors
118
119     Clear Expectations
120     # Expect Response Body        ${CURDIR}/schemas/client_errors_properties.json
121     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureMonitoring/v1/alarmSubscriptions?fields=(AlarmSubscriptionId,WrongAttrName)
122     # Clear Expectations
123     log      ${res}   level=DEBUG
124     Integer  response status    400
125     Object   response body
126
127
128 *** Keywords ***
129 Set REST Headers
130     Set Headers     {"accept": "application/json"}
131     Set Headers     {"Content-Type": "application/json"}
132     Set Headers     {"Authorization": "Bearer ${SMO_TOKEN_DATA}"}