KarafKeywords-logging in karaf console extended to cluster
[integration/test.git] / csit / suites / openstack / tempest / tempest.robot
1 *** Settings ***
2 Documentation     Test suite for running tempest tests. It is assumed that the test environment
3 ...               is already deployed and ready.
4 Suite Setup       Log In To Tempest Executor And Setup Test Environment
5 Suite Teardown    Clean Up After Running Tempest
6 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
7 Library           SSHLibrary
8 Resource          ../../../libraries/Utils.robot
9 Resource          ../../../libraries/DevstackUtils.robot
10 Resource          ../../../libraries/SetupUtils.robot
11 Variables         ../../../variables/Variables.py
12
13 *** Variables ***
14 ${exclusion_regex}    'metering|test_l3_agent_scheduler.L3AgentSchedulerTestJSON|test_extensions.ExtensionsTestJSON.test_list_show_extensions'
15 ${tempest_config_file}    ./tempest.conf
16
17 *** Test Cases ***
18 tempest.api.network
19     Run Tempest Tests    ${TEST_NAME}    ${exclusion_regex}    ${tempest_config_file}
20
21 tempest.scenario.test_minimum_basic
22     [Tags]    exclude
23     Run Tempest Tests    ${TEST_NAME}
24
25 *** Keywords ***
26 Log In To Tempest Executor And Setup Test Environment
27     [Documentation]    Initialize SetupUtils, open SSH connection to a devstack system and source the openstack
28     ...    credentials needed to run the tempest tests
29     SetupUtils.Setup_Utils_For_Setup_And_Teardown
30     # source_pwd is expected to exist in the below Create Network, Create Subnet keywords.    Might be a bug.
31     ${source_pwd}    Set Variable    yes
32     Set Suite Variable    ${source_pwd}
33     # Tempest network.api tests need an existing external network in order to create
34     # routers against.    Creating that here.
35     Create Network    external --router:external=True
36     Create Subnet    external    external-subnet    10.0.0.0/24
37     List Networks
38     ${control_node_conn_id}=    SSHLibrary.Open Connection    ${OS_CONTROL_NODE_IP}    prompt=${DEFAULT_LINUX_PROMPT_STRICT}
39     Utils.Flexible SSH Login    ${OS_USER}
40     Write Commands Until Prompt    source ${DEVSTACK_DEPLOY_PATH}/openrc admin admin
41     ${net_id}=    Get Net Id    external    ${control_node_conn_id}
42     Generate Tempest Conf File    ${net_id}
43
44 Generate Tempest Conf File
45     [Arguments]    ${external_network_id}
46     [Documentation]    Tempest will be run with a config file ./tempest.conf. That file needs to be auto
47     ...    generated first, then updated with the current openstack info, including the specific external
48     ...    network id. There was trouble with permissions in upstream CI, so everything is done with sudo
49     ...    and even the tempest.conf is changed to 777 permissions.
50     Write Commands Until Prompt    source ${DEVSTACK_DEPLOY_PATH}/openrc admin admin
51     Write Commands Until Prompt    cd /opt/stack/tempest
52     Write Commands Until Prompt    sudo -E oslo-config-generator --config-file $(find . -name config-generator.tempest.conf) --output-file ${tempest_config_file}
53     # TODO: the below set of configs may not all be neccessary, so we could try to trim out what's not needed.
54     Add Config To File On Existing SSH Connection    ${tempest_config_file}    service_available    neutron    true
55     Add Config To File On Existing SSH Connection    ${tempest_config_file}    identity    catalog_type    identity
56     Add Config To File On Existing SSH Connection    ${tempest_config_file}    identity    uri    http://localhost:5000/v2.0
57     Add Config To File On Existing SSH Connection    ${tempest_config_file}    identity    uri_v3    http://localhost:8774/v3
58     Add Config To File On Existing SSH Connection    ${tempest_config_file}    identity    auth_version    v2
59     Add Config To File On Existing SSH Connection    ${tempest_config_file}    identity    v2_admin_endpoint_type    adminURL
60     Add Config To File On Existing SSH Connection    ${tempest_config_file}    identity    username    $OS_USERNAME
61     Add Config To File On Existing SSH Connection    ${tempest_config_file}    identity    admin_role    admin
62     Add Config To File On Existing SSH Connection    ${tempest_config_file}    identity    password    $OS_PASSWORD
63     Add Config To File On Existing SSH Connection    ${tempest_config_file}    auth    admin_username    $OS_USERNAME
64     Add Config To File On Existing SSH Connection    ${tempest_config_file}    auth    admin_project_name    $OS_TENANT_NAME
65     Add Config To File On Existing SSH Connection    ${tempest_config_file}    auth    admin_password    $OS_PASSWORD
66     Add Config To File On Existing SSH Connection    ${tempest_config_file}    network    public_network_id    ${external_network_id}
67     Add Config To File On Existing SSH Connection    ${tempest_config_file}    DEFAULT    verbose    true
68     Write Commands Until Prompt    sudo cat ./tempest.conf
69     Write Commands Until Prompt    sudo chmod 777 ./tempest.conf
70
71 Add Config To File On Existing SSH Connection
72     [Arguments]    ${config_file}    ${config_section}    ${config_key}    ${config_value}
73     [Documentation]    uses crudini to populate oslo cofg file.
74     # this keyword is only one line so seems like extra overhead, but this may be a good candidate to move
75     # to a library at some point, when/if other suites need to use it, so wanted to make it generic.
76     Write Commands Until Prompt    sudo -E crudini --set ${config_file} ${config_section} ${config_key} ${config_value}
77
78 Clean Up After Running Tempest
79     [Documentation]    Clean up any extra leftovers that were created to allow tempest tests to run.
80     Delete SubNet    external-subnet
81     Delete Network    external
82     List Networks
83     Close All Connections