Update AAI query to DSL query - Slice termination
[optf/osdf.git] / csit / tests / osdf / optf_osdf_test.robot
1 *** Settings ***
2 Library       json
3 Library       OperatingSystem
4 Resource          ./resources/common-keywords.robot
5
6 Suite Teardown  Delete All Sessions
7
8 *** Variables ***
9 &{placement_auth} =    username=test   password=testpwd
10 &{wrong_authorization} =    username=test   password=test
11 &{pci_auth}=    username=pci_test   password=pci_testpwd
12
13 *** Test Cases ***
14 Healthcheck
15     [Documentation]    It sends a REST GET request to healthcheck url
16     ${resp}=         Http Get         ${osdf_host}   /api/oof/v1/healthcheck
17     Should Be Equal As Integers    ${resp.status_code}    200
18
19 SendPlacementWithInvalidAuth
20     [Documentation]    It sends a POST request to osdf fail authentication
21     ${data}=         Get Binary File     ${CURDIR}${/}data${/}placement_request.json
22     ${resp}=         Http Post        host=${osdf_host}   restUrl=/api/oof/v1/placement     data=${data}    auth=${wrong_authorization}
23     ${response_json}    json.loads    ${resp.content}
24     Should Be Equal     Unauthorized, check username and password    ${response_json['serviceException']['text']}
25     Should Be Equal As Integers    ${resp.status_code}    401
26
27 SendPlacementWithValidAuth
28     [Documentation]    It sends a POST request to osdf with correct authentication
29     ${data}=         Get Binary File     ${CURDIR}${/}data${/}placement_request.json
30     ${resp}=         Http Post        host=${osdf_host}   restUrl=/api/oof/v1/placement     data=${data}    auth=${placement_auth}
31     ${response_json}    json.loads    ${resp.content}
32     Should Be Equal As Integers    ${resp.status_code}    202
33     Should Be Equal     accepted    ${response_json['requestStatus']}
34
35 SendPCIOptimizationWithAuth
36     [Documentation]    It sends a POST request PCI Optimization service
37
38     ${data}=         Get Binary File     ${CURDIR}${/}data${/}pci-opt-request.json
39     ${resp}=         Http Post        host=${osdf_host}   restUrl=/api/oof/v1/pci     data=${data}    auth=${pci_auth}
40     ${response_json}    json.loads    ${resp.content}
41     Should Be Equal As Integers    ${resp.status_code}    202
42     Should Be Equal     accepted    ${response_json['requestStatus']}