2 Documentation General Utils library. This library has broad scope, it can be used by any robot system tests.
8 Library RequestsLibrary
9 Library ./UtilLibrary.py
10 Resource KarafKeywords.robot
11 Variables ../variables/Variables.py
14 ${ODL_VERSION} lithium-SR3
15 ${OPENSTACK_BRANCH} stable/liberty
16 ${NETWORKING-ODL_BRANCH} ${OPENSTACK_BRANCH}
17 ${TEMPEST_REGEX} tempest.api.network
18 ${ODL_BOOT_WAIT_URL} restconf/operational/network-topology:network-topology/topology/netvirt:1
19 ${default_devstack_prompt_timeout} 10s
20 ${devstack_workspace} ~/ds_workspace
21 ${DEVSTACK_SYSTEM_PASSWORD} \ # set to empty, but provide for others to override if desired
22 ${CLEAN_DEVSTACK_HOST} False
26 [Arguments] ${tempest_regex} ${timeout}=600s
27 Write Commands Until Prompt cd /opt/stack/new/tempest
28 Write Commands Until Prompt sudo rm -rf /opt/stack/new/tempest/.testrepository
29 Write Commands Until Prompt sudo testr init
30 ${results}= Write Commands Until Prompt sudo -E testr run ${tempest_regex} --subunit | subunit-trace --no-failure-debug -f timeout=${timeout}
31 Should Contain ${results} Failed: 0
32 # TODO: also need to verify some non-zero pass count as well as other results are ok (e.g. skipped, etc)
35 SSHLibrary.Open Connection ${DEVSTACK_SYSTEM_IP} prompt=${DEFAULT_LINUX_PROMPT}
36 Utils.Flexible SSH Login ${DEVSTACK_SYSTEM_USER} ${DEVSTACK_SYSTEM_PASSWORD}
37 SSHLibrary.Set Client Configuration timeout=${default_devstack_prompt_timeout}
38 Run Keyword If ${CLEAN_DEVSTACK_HOST} Clean DevStack Host In Case It Is Not Sterile
39 Write Commands Until Prompt export PATH=$PATH:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin
40 Write Commands Until Prompt export ODL_VERSION=${ODL_VERSION}
41 Write Commands Until Prompt export OPENSTACK_BRANCH=${OPENSTACK_BRANCH}
42 Write Commands Until Prompt export TEMPEST_REGEX=${TEMPEST_REGEX}
43 Write Commands Until Prompt export ODL_BOOT_WAIT_URL=${ODL_BOOT_WAIT_URL}
44 ${odl_version_to_install}= Get Networking ODL Version Of Release ${ODL_VERSION}
45 Write Commands Until Prompt export DEVSTACK_LOCAL_CONFIG="enable_plugin networking-odl https://git.openstack.org/openstack/networking-odl ${NETWORKING-ODL_BRANCH};"
46 Write Commands Until Prompt export DEVSTACK_LOCAL_CONFIG+="ODL_NETVIRT_DEBUG_LOGS=True;ODL_RELEASE=${odl_version_to_install};"
47 Write Commands Until Prompt echo $DEVSTACK_LOCAL_CONFIG
48 Write Commands Until Prompt export OVERRIDE_ZUUL_BRANCH=${OPENSTACK_BRANCH}
49 Write Commands Until Prompt export PYTHONUNBUFFERED=true
50 Write Commands Until Prompt export DEVSTACK_GATE_TIMEOUT=120
51 Write Commands Until Prompt export DEVSTACK_GATE_TEMPEST=1
52 Write Commands Until Prompt export DEVSTACK_GATE_NEUTRON=1
53 Write Commands Until Prompt export KEEP_LOCALRC=1
54 Write Commands Until Prompt export PROJECTS="openstack/networking-odl $PROJECTS"
55 Write Commands Until Prompt export DEVSTACK_GATE_TEMPEST_REGEX=tempest.api.network.test_ports.PortsTestJSON.test_show_port
56 Write Commands Until Prompt sudo yum -y install redhat-lsb-core indent python-testrepository timeout=120s
57 Write Commands Until Prompt sudo /usr/sbin/groupadd ${DEVSTACK_SYSTEM_USER}
58 Write Commands Until Prompt sudo mkdir -p /opt/stack/new
59 Write Commands Until Prompt sudo chown -R ${DEVSTACK_SYSTEM_USER}:${DEVSTACK_SYSTEM_USER} /opt/stack/new
60 Write Commands Until Prompt sudo bash -c 'echo "stack ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers'
61 Write Commands Until Prompt sudo mkdir -p /usr/local/${DEVSTACK_SYSTEM_USER}/slave_scripts
62 Write Commands Until Prompt git clone https://github.com/openstack/os-testr.git timeout=30s
63 Write Commands Until Prompt cd os-testr/os_testr
64 Write Commands Until Prompt sudo cp subunit2html.py /usr/local/${DEVSTACK_SYSTEM_USER}/slave_scripts
65 Write Commands Until Prompt mkdir -p ${devstack_workspace}
66 Write Commands Until Prompt cd ${devstack_workspace}
67 Write Commands Until Prompt export WORKSPACE=${devstack_workspace}
68 Write Commands Until Prompt rm -rf devstack-gate
69 Write Commands Until Prompt git clone https://git.openstack.org/openstack-infra/devstack-gate timeout=30s
71 Clean DevStack Host In Case It Is Not Sterile
72 [Documentation] In upstream CI, the expectation is that the devstack VM is fresh, sterile and ready
73 ... for any version of devstack, networking-odl, and OpenDaylight. During local test development,
74 ... it can be faster to just clean the needed packages, configurations, repos, files, etc. instead of
75 ... spinning up a new system. This keyword serves as a living list of those items needed to prep a
76 ... potentially non-sterile devstack system.
77 Write Commands Until Prompt pgrep python | awk '{print "sudo kill",$1}' | sh
78 Write Commands Until Prompt pgrep java | awk '{print "sudo kill",$1}' | sh
79 Write Commands Until Prompt rpm -qa | grep rdo
80 Write Commands Until Prompt sudo rpm -e $(sudo rpm -qa | grep rdo)
81 Write Commands Until Prompt sudo yum remove -y pyOpenSSL
82 Write Commands Until Prompt sudo -H pip uninstall -y virtualenv
83 Write Commands Until Prompt sudo rm -rf /tmp/ansible /opt/stack
84 Write Commands Until Prompt rm -rf ${devstack_workspace} ~/os-testr
85 Write Commands Until Prompt sudo ovs-vsctl del-br br-ex
86 Write Commands Until Prompt sudo ovs-vsctl del-br br-int
87 Write Commands Until Prompt sudo ovs-vsctl del-manager
89 Write Commands Until Prompt
90 [Arguments] ${cmd} ${timeout}=${default_devstack_prompt_timeout}
91 [Documentation] quick wrapper for Write and Read Until Prompt Keywords to make test cases more readable
92 SSHLibrary.Set Client Configuration timeout=${timeout}
93 SSHLibrary.Write ${cmd}
94 ${output}= SSHLibrary.Read Until Prompt
97 Get Networking ODL Version Of Release
98 [Arguments] ${version}
99 # once Beryllium SR1 goes out, we can change beryllium-latest to use 0.4.2
100 Return From Keyword If "${version}" == "beryllium-latest" beryllium-snapshot-0.4.1
101 Return From Keyword If "${version}" == "beryllium-SR1" beryllium-snapshot-0.4.1
102 Return From Keyword If "${version}" == "beryllium" beryllium-snapshot-0.4.0
103 Return From Keyword If "${version}" == "lithium-latest" lithium-snapshot-0.3.5
104 Return From Keyword If "${version}" == "lithium-SR4" lithium-snapshot-0.3.4
105 Return From Keyword If "${version}" == "lithium-SR3" lithium-snapshot-0.3.3
106 Return From Keyword If "${version}" == "lithium-SR2" lithium-snapshot-0.3.2
107 Return From Keyword If "${version}" == "lithium-SR1" lithium-snapshot-0.3.1
108 # FYI networking-odl no longer has this for some reason.
109 Return From Keyword If "${version}" == "lithium" lithium-snapshot-0.3.0
110 Return From Keyword If "${version}" == "helium" helium
113 Write Commands Until Prompt gunzip /opt/stack/logs/devstacklog.txt.gz
114 Write Commands Until Prompt tail -n2000 /opt/stack/logs/devstacklog.txt timeout=600s
115 Write Commands Until Prompt grep 'distribution-karaf.*zip' /opt/stack/logs/devstacklog.txt