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