Fix multicloud-k8s csit
[integration/csit.git] / tests / multicloud-k8s / multicloud-k8s-test.robot
1 *** Settings ***
2 Suite Setup       Run keywords      Check k8splugin API Docker Container      Created header    Created session
3 Library       OperatingSystem
4 Library       RequestsLibrary
5
6 *** Variables ***
7
8 *** Test Cases ***
9 Create Definition
10     [Template]      Post template
11     /v1/rb/definition      create_rbdefinition.json
12
13 Get Definition
14     [Template]  Get template
15     /v1/rb/definition/test-rbdef
16     /v1/rb/definition/test-rbdef/v1
17
18 Delete Definition
19     [Template]  Delete template
20     /v1/rb/definition/test-rbdef/v1
21
22 *** Keywords ***
23 Created session
24     Create Session      multicloud_k8s_session     http://${SERVICE_IP}:${SERVICE_PORT}
25     Set Suite Variable    ${suite_multicloud_k8s_session}    multicloud_k8s_session
26
27 Created header
28     ${headers}=  Create Dictionary   Content-Type=application/json    Accept=application/json
29     Set Suite Variable    ${suite_headers}    ${headers}
30
31 Delete template
32     [Documentation]    Deletes from Definition
33     [Arguments]    ${topic}
34     ${resp}=         Delete Request        ${suite_multicloud_k8s_session}   ${topic}   headers=${suite_headers}
35     Log To Console              *********************
36     Log To Console              response = ${resp}
37     Log To Console              body = ${resp.text}
38     Should Be Equal As Integers    ${resp.status_code}    204
39
40 Post template
41     [Documentation]    Create A Definition
42     [Arguments]    ${topic}     ${file}
43     ${data}          Get Binary File    ${CURDIR}${/}data${/}${file}
44     ${resp}=         Post Request       ${suite_multicloud_k8s_session}   ${topic}   data=${data}  headers=${suite_headers}
45     Log To Console              *********************
46     Log To Console              response = ${resp}
47     Log To Console              body = ${resp.text}
48     Should Be Equal As Integers    ${resp.status_code}    201
49
50 Get template
51     [Documentation]    Gets from Definition
52     [Arguments]    ${topic}
53     ${resp}=         Get Request        ${suite_multicloud_k8s_session}   ${topic}   headers=${suite_headers}
54     Log To Console              *********************
55     Log To Console              response = ${resp}
56     Log To Console              body = ${resp.text}
57     Should Be Equal As Integers    ${resp.status_code}    200
58
59 Check k8splugin API Docker Container
60     [Documentation]    Checks if k8splugin docker container is running
61     ${rc}    ${output}=    Run and Return RC and Output    docker ps
62     Log To Console              *********************
63     Log To Console              retrurn_code = ${rc}
64     Log To Console              output = ${output}
65     Should Be Equal As Integers    ${rc}    0
66     Should Contain    ${output}    nexus3.onap.org:10001/onap/multicloud/k8s