3ef03849e4c1a308f33339e99f4d0a05279426f4
[integration/test.git] / csit / suites / ovsdb / Devstack_Tempest_Tests / 01__single_node_devstack_tempest_tests.robot
1 *** Settings ***
2 Documentation     Test suite to deploy devstack with networking-odl
3 Suite Setup       Devstack Suite Setup
4 Library           SSHLibrary
5 Library           OperatingSystem
6 Library           RequestsLibrary
7 Resource          ../../../libraries/Utils.robot
8
9 *** Variables ***
10 ${ODL_VERSION}    lithium-SR3
11 ${OPENSTACK_BRANCH}    stable/liberty
12 ${NETWORKING-ODL_BRANCH}    ${OPENSTACK_BRANCH}
13 ${TEMPEST_REGEX}    tempest.api.network
14 ${ODL_BOOT_WAIT_URL}    restconf/operational/network-topology:network-topology/topology/netvirt:1
15 ${default_devstack_prompt_timeout}    10s
16 ${devstack_workspace}    ~/ds_workspace
17 ${DEVSTACK_SYSTEM_PASSWORD}    \    # set to empty, but provide for others to override if desired
18 ${CLEAN_DEVSTACK_HOST}    False
19
20 *** Test Cases ***
21 Run Devstack Gate Wrapper
22     Write Commands Until Prompt    unset GIT_BASE
23     Write Commands Until Prompt    env
24     ${output}=    Write Commands Until Prompt    ./devstack-gate/devstack-vm-gate-wrap.sh    timeout=3600s    #60min
25     Log    ${output}
26     Should Not Contain    ${output}    ERROR: the main setup script run by this job failed
27     # workaround for https://bugs.launchpad.net/networking-odl/+bug/1512418
28     Write Commands Until Prompt    cd /opt/stack/new/tempest-lib
29     Write Commands Until Prompt    sudo python setup.py install
30     [Teardown]    Show Devstack Debugs
31
32 Validate Neutron and Networking-ODL Versions
33     ${output}=    Write Commands Until Prompt    cd /opt/stack/new/neutron; git branch;
34     Should Contain    ${output}    * ${OPENSTACK_BRANCH}
35     ${output}=    Write Commands Until Prompt    cd /opt/stack/new/networking-odl; git branch;
36     Should Contain    ${output}    * ${NETWORKING-ODL_BRANCH}
37
38 tempest.api.network
39     Run Tempest Tests    ${TEST_NAME}
40
41 tempest
42     [Tags]    exclude
43     Run Tempest Tests    ${TEST_NAME}    900s
44
45 *** Keywords ***
46 Run Tempest Tests
47     [Arguments]    ${tempest_regex}    ${timeout}=600s
48     Write Commands Until Prompt    cd /opt/stack/new/tempest
49     Write Commands Until Prompt    sudo rm -rf /opt/stack/new/tempest/.testrepository
50     Write Commands Until Prompt    sudo testr init
51     ${results}=    Write Commands Until Prompt    sudo -E testr run ${tempest_regex} --subunit | subunit-trace --no-failure-debug -f    timeout=${timeout}
52     Should Contain    ${results}    Failed: 0
53     # TODO: also need to verify some non-zero pass count as well as other results are ok (e.g. skipped, etc)
54
55 Devstack Suite Setup
56     SSHLibrary.Open Connection    ${DEVSTACK_SYSTEM_IP}    prompt=${DEFAULT_LINUX_PROMPT}
57     Utils.Flexible SSH Login    ${DEVSTACK_SYSTEM_USER}    ${DEVSTACK_SYSTEM_PASSWORD}
58     SSHLibrary.Set Client Configuration    timeout=${default_devstack_prompt_timeout}
59     Run Keyword If    ${CLEAN_DEVSTACK_HOST}    Clean DevStack Host In Case It Is Not Sterile
60     Write Commands Until Prompt    export PATH=$PATH:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin
61     Write Commands Until Prompt    export ODL_VERSION=${ODL_VERSION}
62     Write Commands Until Prompt    export OPENSTACK_BRANCH=${OPENSTACK_BRANCH}
63     Write Commands Until Prompt    export TEMPEST_REGEX=${TEMPEST_REGEX}
64     Write Commands Until Prompt    export ODL_BOOT_WAIT_URL=${ODL_BOOT_WAIT_URL}
65     ${odl_version_to_install}=    Get Networking ODL Version Of Release    ${ODL_VERSION}
66     Write Commands Until Prompt    export DEVSTACK_LOCAL_CONFIG="enable_plugin networking-odl https://git.openstack.org/openstack/networking-odl ${NETWORKING-ODL_BRANCH};"
67     Write Commands Until Prompt    export DEVSTACK_LOCAL_CONFIG+="ODL_NETVIRT_DEBUG_LOGS=True;ODL_RELEASE=${odl_version_to_install};"
68     Write Commands Until Prompt    echo $DEVSTACK_LOCAL_CONFIG
69     Write Commands Until Prompt    export OVERRIDE_ZUUL_BRANCH=${OPENSTACK_BRANCH}
70     Write Commands Until Prompt    export PYTHONUNBUFFERED=true
71     Write Commands Until Prompt    export DEVSTACK_GATE_TIMEOUT=120
72     Write Commands Until Prompt    export DEVSTACK_GATE_TEMPEST=1
73     Write Commands Until Prompt    export DEVSTACK_GATE_NEUTRON=1
74     Write Commands Until Prompt    export KEEP_LOCALRC=1
75     Write Commands Until Prompt    export PROJECTS="openstack/networking-odl $PROJECTS"
76     Write Commands Until Prompt    export DEVSTACK_GATE_TEMPEST_REGEX=tempest.api.network.test_ports.PortsTestJSON.test_show_port
77     Write Commands Until Prompt    sudo yum -y install redhat-lsb-core indent python-testrepository    timeout=120s
78     Write Commands Until Prompt    sudo /usr/sbin/groupadd ${DEVSTACK_SYSTEM_USER}
79     Write Commands Until Prompt    sudo mkdir -p /opt/stack/new
80     Write Commands Until Prompt    sudo chown -R ${DEVSTACK_SYSTEM_USER}:${DEVSTACK_SYSTEM_USER} /opt/stack/new
81     Write Commands Until Prompt    sudo bash -c 'echo "stack ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers'
82     Write Commands Until Prompt    sudo mkdir -p /usr/local/${DEVSTACK_SYSTEM_USER}/slave_scripts
83     Write Commands Until Prompt    git clone https://github.com/openstack/os-testr.git    timeout=30s
84     Write Commands Until Prompt    cd os-testr/os_testr
85     Write Commands Until Prompt    sudo cp subunit2html.py /usr/local/${DEVSTACK_SYSTEM_USER}/slave_scripts
86     Write Commands Until Prompt    mkdir -p ${devstack_workspace}
87     Write Commands Until Prompt    cd ${devstack_workspace}
88     Write Commands Until Prompt    export WORKSPACE=${devstack_workspace}
89     Write Commands Until Prompt    rm -rf devstack-gate
90     Write Commands Until Prompt    git clone https://git.openstack.org/openstack-infra/devstack-gate    timeout=30s
91
92 Clean DevStack Host In Case It Is Not Sterile
93     [Documentation]    In upstream CI, the expectation is that the devstack VM is fresh, sterile and ready
94     ...    for any version of devstack, networking-odl, and OpenDaylight. During local test development,
95     ...    it can be faster to just clean the needed packages, configurations, repos, files, etc. instead of
96     ...    spinning up a new system. This keyword serves as a living list of those items needed to prep a
97     ...    potentially non-sterile devstack system.
98     Write Commands Until Prompt    pgrep python | awk '{print "sudo kill",$1}' | sh
99     Write Commands Until Prompt    pgrep java | awk '{print "sudo kill",$1}' | sh
100     Write Commands Until Prompt    rpm -qa | grep rdo
101     Write Commands Until Prompt    sudo rpm -e $(sudo rpm -qa | grep rdo)
102     Write Commands Until Prompt    sudo yum remove -y pyOpenSSL
103     Write Commands Until Prompt    sudo -H pip uninstall -y virtualenv
104     Write Commands Until Prompt    sudo rm -rf /tmp/ansible /opt/stack
105     Write Commands Until Prompt    rm -rf ${devstack_workspace} ~/os-testr
106     Write Commands Until Prompt    sudo ovs-vsctl del-br br-ex
107     Write Commands Until Prompt    sudo ovs-vsctl del-br br-int
108     Write Commands Until Prompt    sudo ovs-vsctl del-manager
109
110 Write Commands Until Prompt
111     [Arguments]    ${cmd}    ${timeout}=${default_devstack_prompt_timeout}
112     [Documentation]    quick wrapper for Write and Read Until Prompt Keywords to make test cases more readable
113     SSHLibrary.Set Client Configuration    timeout=${timeout}
114     SSHLibrary.Write    ${cmd}
115     ${output}=    SSHLibrary.Read Until Prompt
116     [Return]    ${output}
117
118 Get Networking ODL Version Of Release
119     [Arguments]    ${version}
120     Return From Keyword If    "${version}" == "beryllium"    beryllium-snapshot-0.4.0
121     Return From Keyword If    "${version}" == "lithium-latest"    lithium-snapshot-0.3.4
122     Return From Keyword If    "${version}" == "lithium-SR3"    lithium-snapshot-0.3.3
123     Return From Keyword If    "${version}" == "lithium-SR2"    lithium-snapshot-0.3.2
124     Return From Keyword If    "${version}" == "lithium-SR1"    lithium-snapshot-0.3.1
125     Return From Keyword If    "${version}" == "lithium"    lithium-snapshot-0.3.0
126     Return From Keyword If    "${version}" == "helium"    helium
127
128 Show Devstack Debugs
129     Write Commands Until Prompt    gunzip /opt/stack/logs/devstacklog.txt.gz
130     Write Commands Until Prompt    tail -n1000 /opt/stack/logs/devstacklog.txt    timeout=600s