1 ******************************
2 OPNFV FUNCTEST developer guide
3 ******************************
14 This document describes how feature projects aiming to run functional tests can be integrated into FuncTest framework.
17 ================================
18 Functest High level architecture
19 ================================
21 Functest is project delivering a test container dedicated to OPNFV.
22 It includes the tools, the scripts and the test scenarios.
24 Functest can be described as follow::
26 +----------------------+
28 | +--------------+ | +-------------------+
30 | | Tools | +------------------+ OPNFV |
31 | | Scripts | | | System Under Test |
32 | | Scenarios | +------------------+ |
33 | | | | Management | |
34 | +--------------+ | +-------------------+
38 +----------------------+
40 Functest deals with internal and external test cases.
41 The Internal test cases in Brahmaputra are:
49 see `[2]`_ for details.
51 Functest can also be considered as a framework that may include external OPNFV projects.
52 This framework will ease the integration of the feature test suite to the CI.
58 The installation and the launch of the Functest docker image is described in `[1]`_.
60 The Functest docker directories are::
83 +--------------+-------------------+---------------------------------------------------------+
84 | Directory | Subdirectory | Comments |
85 +--------------+-------------------+---------------------------------------------------------+
86 | | <project>/conf | All the useful configuration file(s) for <project> |
87 | | | the openstack creds are put there for CI |
88 | | | It is recommended to push it there when passing the |
89 | | | credentials to container through the -v option |
90 | +-------------------+---------------------------------------------------------+
91 | opnfv | <project>/data | Usefull data, images for <projects> |
92 | | | By default we put an image cirros-0.3.4-x86_64-disk.img |
93 | | | This image can be used by any projects |
94 | +-------------------+---------------------------------------------------------+
95 | | <project>/results | Local result directory of project <project> |
96 +--------------+-------------------+---------------------------------------------------------+
98 | +-------------------+ +
100 | +-------------------+ +
102 | +-------------------+ +
103 | | odl_integration | |
104 | +-------------------+ Clone of the useful repositories +
105 | | onos | These repositories may include: |
106 | +-------------------+ - tooling +
107 | | promise | - scenario |
108 | +-------------------+ - scripts +
110 | +-------------------+ +
112 | +-------------------+ +
114 | +-------------------+ +
115 | | <your project> | |
116 +--------------+-------------------+---------------------------------------------------------+
118 Before running the test suite, you must prepare the environement by running::
120 $ /home/opnfv/repos/functest/docker/prepare_env.sh
122 By running prepare_env.sh, you build the test environement required by the tests including the retrieval and sourcing of OpenStack credentials.
123 This is an example of the env variables we have in the docker container:
125 * HOSTNAME=373f77816eb0
126 * INSTALLER_TYPE=fuel
127 * repos_dir=/home/opnfv/repos
128 * INSTALLER_IP=10.20.0.2
129 * PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
133 * NODE_NAME=opnfv-jump-2
134 * creds=/home/opnfv/functest/conf/openstack.creds
137 The prepare_env.sh will source the credentials, so once run you should have access to the following env variables::
139 root@373f77816eb0:~# env|grep OS_
140 OS_REGION_NAME=RegionOne
141 OS_PROJECT_NAME=admin
143 OS_AUTH_STRATEGY=keystone
144 OS_AUTH_URL=http://172.30.10.70:5000/v2.0
147 OS_ENDPOINT_TYPE=internalURL
151 Then you may run the test suite by running::
153 $ /home/opnfv/repos/functest/docker/run_tests.sh -t <your project>
155 see `[2]`_ for details.
159 =========================
160 How to integrate Functest
161 =========================
163 The files of the Functest repository you must modify to integrate Functest are:
165 * functest/docker/Dockerfile
166 * functest/docker/common.sh
167 * functest/docker/requirements.pip
168 * functest/docker/run_tests.sh
169 * functest/docker/prepare_env.sh
170 * functest/config_funtest.yaml
176 This file lists the repositories to be cloned in the Functest container. The repositories can be internal or external::
178 RUN git clone https://gerrit.opnfv.org/gerrit/<your porject> ${repos_dir}/<your project>
184 This file can be used to declare the branch and commit variables of your projects::
186 <YOUR_PROJECT>_BRANCH=$(cat $config_file | grep -w <your project>_branch | awk 'END {print $NF}')
187 <YOUR_PROJECT>_COMMIT=$(cat $config_file | grep -w <your project>_commit | awk 'END {print $NF}')
189 echo "<YOUR_PROJECT>_BRANCH=${<YOUR_PROJECT>_BRANCH}"
190 echo "<YOUR_PROJECT>_COMMIT=${<YOUR_PROJECT>_COMMIT}"
196 This file can be used to preloaded all the needed Python libraries (and avoid that each project does it)
197 The current libraries used in Functest container are::
199 # cat requirements.pip
202 python-neutronclient==2.6.0
203 python-novaclient==2.28.1
204 python-glanceclient==1.1.0
205 python-cinderclient==1.4.0
206 python-ceilometerclient==1.5.1
207 python-keystoneclient==1.6.0
211 robotframework==2.9.1
212 robotframework-requests==0.3.8
213 robotframework-sshlibrary==2.1.1
221 This script can be adapted if you need to set up a specific environment before running the tests.
226 This script is used to run the tests. You must thus complete the cases with you own project::
230 info "Running PROMISE test case..."
234 info "Running Doctor test..."
235 python ${FUNCTEST_REPO_DIR}/testcases/features/doctor.py
238 info "Running <your project> test..."
239 # your script that launchs your tests...
242 And do not forget to update also the help line::
244 -t|--test run specific set of tests
245 <test_name> one or more of the following: vping,odl,rally,tempest,vims,onos, promise. Separated by comma.
251 This file is the main configuration file of Functest. You must add the references to your project::
255 dir_repo_<your project>: /home/opnfv/repos/<your project>
257 # branch and commit ID to which the repos will be reset (HEAD)
258 <your project>_branch: master
259 <your project>_commit: latest
266 .. _`[1]`: Functest configuration guide URL
267 .. _`[2]`: functest user guide URL
270 OPNFV main site: opnfvmain_.
272 OPNFV functional test page: opnfvfunctest_.
274 IRC support chan: #opnfv-testperf
276 .. _opnfvmain: http://www.opnfv.org
277 .. _opnfvfunctest: https://wiki.opnfv.org/opnfv_functional_testing
278 .. _`OpenRC`: http://docs.openstack.org/user-guide/common/cli_set_environment_variables_using_openstack_rc.html
279 .. _`Rally installation procedure`: https://rally.readthedocs.org/en/latest/tutorial/step_0_installation.html
280 .. _`config_test.py` : https://git.opnfv.org/cgit/functest/tree/testcases/config_functest.py
281 .. _`config_functest.yaml` : https://git.opnfv.org/cgit/functest/tree/testcases/config_functest.yaml