[ROBOT] Adopt HVVES test case in order to work with strimzi kafka
[testsuite.git] / robot / resources / openstack / openstack_common.robot
1 *** Settings ***
2 Documentation     The private interface for interacting with Openstack. It handles low level stuff like managing the authtoken and Openstack required fields
3
4 Library           Collections
5 Library           ONAPLibrary.Openstack
6 Library               RequestsLibrary
7 Library           ONAPLibrary.Utilities
8 Resource    ../global_properties.robot
9
10 *** Keywords ***
11 Internal Get Openstack
12     [Documentation]    Runs an Openstack Get Request and returns the response
13     [Arguments]    ${alias}    ${service_type}    ${url_ext}   ${data_path}=
14     ${region}=   Get Openstack Region
15     ${resp}=   Internal Get Openstack With Region   ${alias}    ${service_type}    ${region}   ${url_ext}   ${data_path}
16     [Return]    ${resp}
17
18 Internal Get Openstack With Region
19     [Documentation]    Runs an Openstack Get Request and returns the response
20     [Arguments]    ${alias}    ${service_type}    ${region}   ${url_ext}   ${data_path}=
21     Log    Internal Get Openstack values alias=${alias} service_type=${service_type} region=${region} url_ext=${url_ext} data_path=${data_path}
22     ${url}=    Get Openstack Service Url    ${alias}     ${service_type}    ${region}
23     ${uuid}=    Generate UUID4
24     ${session_alias}=    Catenate    openstack-${uuid}
25     ${session}=    Create Session       ${session_alias}        ${url}${url_ext}        verify=True
26     ${token}=    Get Openstack Token    ${alias}
27     ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json    X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid}    X-FromAppId=${GLOBAL_APPLICATION_ID}     X-Auth-Token=${token}
28     ${resp}=    Get Request     ${session_alias}        ${data_path}     headers=${headers}
29     Log    Received response from openstack ${resp.text}
30     [Return]    ${resp}
31
32 Internal Post Openstack
33     [Documentation]    Runs an Openstack Post Response and returns the response
34     [Arguments]    ${alias}    ${service_type}    ${url_ext}   ${data_path}=    ${data}=
35     ${region}=   Get Openstack Region
36     Log    Internal Post Openstack values alias=${alias} service_type=${service_type} region=${region} url_ext=${url_ext} data_path=${data_path}
37     ${url}=    Get Openstack Service Url    ${alias}     ${service_type}    ${region}
38     ${uuid}=    Generate UUID4
39     ${session_alias}=    Catenate    openstack-${uuid}
40     ${session}=    Create Session       ${session_alias}        ${url}${url_ext}        verify=True
41     ${token}=    Get Openstack Token    ${alias}
42     ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json    X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid}    X-FromAppId=${GLOBAL_APPLICATION_ID}     X-Auth-Token=${token}
43     ${resp}=    Post Request    ${session_alias}        ${data_path}     data=${data}    headers=${headers}
44     Log    Received response from openstack ${resp.text}
45     [Return]    ${resp}
46
47 Internal Delete Openstack
48     [Documentation]    Runs an Openstack Delete Request and returns the response
49     [Arguments]    ${alias}    ${service_type}    ${url_ext}   ${data_path}=
50     ${region}=   Get Openstack Region
51     Log    Internal Post Openstack values alias=${alias} service_type=${service_type} region=${region} url_ext=${url_ext} data_path=${data_path}
52     ${url}=    Get Openstack Service Url    ${alias}     ${service_type}    ${region}
53     ${uuid}=    Generate UUID4
54     ${session_alias}=    Catenate    openstack-${uuid}
55     ${session}=    Create Session       ${session_alias}        ${url}${url_ext}        verify=True
56     ${token}=    Get Openstack Token    ${alias}
57     ${headers}=  Create Dictionary     Accept=application/json    Content-Type=application/json    X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid}    X-FromAppId=${GLOBAL_APPLICATION_ID}     X-Auth-Token=${token}
58     ${resp}=    Delete Request  ${session_alias}        ${data_path}    headers=${headers}
59     Log    Received response from openstack ${resp.text}
60     [Return]    ${resp}
61
62 Get Openstack Region
63     [Documentation]   Returns the current openstack region test variable
64     ...               Defaults to the openstack region of the Robot VM
65     [Return]   ${GLOBAL_INJECTED_REGION}