331f74da8ead57bda00839c7e4853f16ed233d1b
[it/test.git] / test_scripts / O2IMS_Compliance_Test / o2ims_compliance / 7.3.8_SMO_get_security_error_response_while_issuing_APIs_with_incorrect_token.robot
1 *** Settings ***
2 Documentation  Verify SMO get security error response while issuing APIs with incorrect 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 ${SMO_TOKEN_DATA_INVALID}       ${ocloud.oran_o2_app.smo_token_data}[10:]${ocloud.oran_o2_app.smo_token_data}[:10]
19
20
21 *** Test Cases ***
22 s1, Issue API Request without Authorization Bearer Token Header
23     [documentation]  This test case verifies Issue API Request without Authorization Bearer Token Header
24     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS     ORAN_O2IMS_Client_Errors
25
26     Clear Expectations
27     # Set Headers     {"Authorization": "Bearer ${SMO_TOKEN_DATA}"}
28     Expect Response Body        ${CURDIR}/schemas/client_errors_properties.json
29     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/
30     # Output Schema   response body   ${CURDIR}/schemas/.output/client_errors_properties.json
31     # Clear Expectations
32     log      ${res}   level=DEBUG
33     Integer  response status    401
34     # Object   response body
35
36 s2, Issue API Request with Authorization Bearer Token Header and invalid token
37     [documentation]  This test case verifies Issue API Request with Authorization Bearer Token Header and invalid token
38     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS     ORAN_O2IMS_Client_Errors
39
40     Clear Expectations
41     Set Headers     {"Authorization": "Bearer ${SMO_TOKEN_DATA_INVALID}"}
42     Expect Response Body        ${CURDIR}/schemas/client_errors_properties.json
43     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1/resourceTypes?fields=(resourceTypeId,WrongAttrName)
44     # Clear Expectations
45     log      ${res}   level=DEBUG
46     Integer  response status    401
47     # Object   response body
48
49 s3, Issue API Request with Authorization Bearer Token Header and valid token
50     [documentation]  This test case verifies Issue API Request with Authorization Bearer Token Header and valid token
51     [tags]  ORAN_Compliance     ORAN_O2     ORAN_O2IMS     ORAN_O2IMS_Client_Errors
52
53     # Clear Expectations
54     Set Headers     {"Authorization": "Bearer ${SMO_TOKEN_DATA}"}
55     Expect Response Body        ${CURDIR}/schemas/ocloud_properties.json
56     ${res}     GET   ${ORAN_O2IMS_ENDPOINT}/o2ims-infrastructureInventory/v1
57     # Output Schema   response body   ${CURDIR}/schemas/.output/ocloud_properties.json
58     Clear Expectations
59     log      ${res}   level=DEBUG
60     Integer  response status    200
61     Object   response body
62
63
64 *** Keywords ***
65 Set REST Headers
66     Set Headers     {"accept": "application/json"}
67     Set Headers     {"Content-Type": "application/json"}
68     # Set Headers     {"Authorization": "Bearer ${SMO_TOKEN_DATA}"}