1bb9c60ef2e831279fd8a275d8cb3be6cfcaed84
[it/test.git] /
1 *** Settings ***
2 Documentation  Verify SMO gets client error response while issuing requests with incorrect APIs
3 # Library  REST       ssl_verify=False    loglevel=DEBUG
4 Library  REST       ssl_verify=False
5 Variables              ${EXECDIR}${/}test_configs.yaml
6
7
8 Suite Setup            Set REST Headers
9
10 *** Variables ***
11 ${ORAN_HOST_EXTERNAL_IP}    ${ocloud.oran_o2_app.api.host}
12 ${ORAN_SERVICE_NODE_PORT}   ${ocloud.oran_o2_app.api.node_port}
13 ${GLOBAL_OCLOUD_ID1}        ${ocloud.oran_o2_app.g_ocloud_id}
14 ${SMO_TOKEN_DATA}           ${ocloud.oran_o2_app.smo_token_data}
15 ${globalLocationId}         ${ocloud.oran_o2_app.g_location_id}
16
17 ${ORAN_O2IMS_ENDPOINT}  ${ocloud.oran_o2_app.api.protocol}://${ORAN_HOST_EXTERNAL_IP}:${ORAN_SERVICE_NODE_PORT}
18 # Wrong port number set to 1
19 ${WRONG_PORT_ORAN_O2IMS_ENDPOINT}  ${ocloud.oran_o2_app.api.protocol}://${ORAN_HOST_EXTERNAL_IP}:1
20
21
22
23 *** Test Cases ***
24 s1, Verify query with wrong port does not receive API response.
25     [documentation]  Verify query with wrong port does not receive API response.
26     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS     ORAN_O2IMS_Client_Errors
27
28     Clear Expectations
29     Set Headers     {"Authorization": "Bearer ${SMO_TOKEN_DATA}"}
30     TRY
31        ${res}     GET   ${WRONG_PORT_ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1
32     EXCEPT    ConnectionError: *    type=glob
33        log    PASS:query with wrong port got error code   level=DEBUG
34     END
35
36 s2, Verify query with wrong url got error code.
37     [documentation]  Verify query with wrong url got error code.
38     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS     ORAN_O2IMS_Client_Errors
39
40     Clear Expectations
41     Set Headers     {"Authorization": "Bearer ${SMO_TOKEN_DATA}"}
42     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/deploymentManagersWrongURL
43     log      ${res}   level=DEBUG
44     Integer  response status    404
45     # Object   response body
46
47 s3, Verify query with wrong api version got error code.
48     [documentation]  Verify query with wrong api version got error code.
49     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS     ORAN_O2IMS_Client_Errors
50
51     Clear Expectations
52     Set Headers     {"Authorization": "Bearer ${SMO_TOKEN_DATA}"}
53     Expect Response Body      ${CURDIR}${/}..${/}o2ims_compliance${/}schemas${/}client_errors_properties.json
54     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v2/deploymentManagers
55     # Clear Expectations
56     log      ${res}   level=DEBUG
57     Integer  response status    404
58     # Object   response body
59
60 s4, Verify query with wrong deploymentManagerID got error code.
61     [documentation]  Verify query with wrong deploymentManagerID got error code.
62     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS     ORAN_O2IMS_Client_Errors
63
64     # Clear Expectations
65     Set Headers     {"Authorization": "Bearer ${SMO_TOKEN_DATA}"}
66     Expect Response Body        ${CURDIR}${/}..${/}o2ims_compliance${/}schemas${/}client_errors_properties.json
67     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/deploymentManagers/wrongDeploymentManagerID
68     Clear Expectations
69     log      ${res}   level=DEBUG
70     Integer  response status    404
71     Object   response body
72
73
74 *** Keywords ***
75 Set REST Headers
76     Set Headers     {"accept": "application/json"}
77     Set Headers     {"Content-Type": "application/json"}
78     # Set Headers     {"Authorization": "Bearer ${SMO_TOKEN_DATA}"}
79     Set Client Cert   ${CURDIR}/../certs/client.pem