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