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:
48 see `[2]`_ for details.
50 Functest can also be considered as a framework that may include external OPNFV projects.
51 This framework will ease the integration of the feature test suite to the CI.
57 The installation and the launch of the Functest docker image is described in `[1]`_.
59 The Functest docker directories are::
81 +--------------+-------------------+---------------------------------------------------------+
82 | Directory | Subdirectory | Comments |
83 +--------------+-------------------+---------------------------------------------------------+
84 | | <project>/conf | All the useful configuration file(s) for <project> |
85 | | | the openstack creds are put there for CI |
86 | | | It is recommended to push it there when passing the |
87 | | | credentials to container through the -v option |
88 | +-------------------+---------------------------------------------------------+
89 | opnfv | <project>/data | Usefull data, images for <projects> |
90 | | | By default we put an image cirros-0.3.4-x86_64-disk.img |
91 | | | This image can be used by any projects |
92 | +-------------------+---------------------------------------------------------+
93 | | <project>/results | Local result directory of project <project> |
94 +--------------+-------------------+---------------------------------------------------------+
96 | +-------------------+ +
98 | +-------------------+ +
100 | +-------------------+ +
101 | | odl_integration | |
102 | +-------------------+ Clone of the useful repositories +
103 | | onos | These repositories may include: |
104 | +-------------------+ - tooling +
105 | | promise | - scenario |
106 | +-------------------+ - scripts +
108 | +-------------------+ +
110 | +-------------------+ +
112 | +-------------------+ +
113 | | <your project> | |
114 +--------------+-------------------+---------------------------------------------------------+
116 Before running the test suite, you must prepare the environement by running::
118 $ /home/opnfv/repos/functest/docker/prepare_env.sh
120 By running prepare_env.sh, you build the test environement required by the tests including the retrieval and sourcing of OpenStack credentials.
121 This is an example of the env variables we have in the docker container:
123 * HOSTNAME=373f77816eb0
124 * INSTALLER_TYPE=fuel
125 * repos_dir=/home/opnfv/repos
126 * INSTALLER_IP=10.20.0.2
127 * PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
131 * NODE_NAME=opnfv-jump-2
132 * creds=/home/opnfv/functest/conf/openstack.creds
135 The prepare_env.sh will source the credentials, so once run you should have access to the following env variables::
137 root@373f77816eb0:~# env|grep OS_
138 OS_REGION_NAME=RegionOne
139 OS_PROJECT_NAME=admin
141 OS_AUTH_STRATEGY=keystone
142 OS_AUTH_URL=http://172.30.10.70:5000/v2.0
145 OS_ENDPOINT_TYPE=internalURL
149 Then you may run the test suite by running::
151 $ /home/opnfv/repos/functest/docker/run_tests.sh -t <your project>
153 see `[2]`_ for details.
157 =========================
158 How to integrate Functest
159 =========================
161 The files of the Functest repository you must modify to integrate Functest are:
163 * functest/docker/Dockerfile
164 * functest/docker/common.sh
165 * functest/docker/requirements.pip
166 * functest/docker/run_tests.sh
167 * functest/docker/prepare_env.sh
168 * functest/config_funtest.yaml
174 This file lists the repositories to be cloned in the Functest container. The repositories can be internal or external::
176 RUN git clone https://gerrit.opnfv.org/gerrit/<your porject> ${repos_dir}/<your project>
182 This file can be used to declare the branch and commit variables of your projects::
184 <YOUR_PROJECT>_BRANCH=$(cat $config_file | grep -w <your project>_branch | awk 'END {print $NF}')
185 <YOUR_PROJECT>_COMMIT=$(cat $config_file | grep -w <your project>_commit | awk 'END {print $NF}')
187 echo "<YOUR_PROJECT>_BRANCH=${<YOUR_PROJECT>_BRANCH}"
188 echo "<YOUR_PROJECT>_COMMIT=${<YOUR_PROJECT>_COMMIT}"
194 This file can be used to preloaded all the needed Python libraries (and avoid that each project does it)
195 The current libraries used in Functest container are::
197 # cat requirements.pip
200 python-neutronclient==2.6.0
201 python-novaclient==2.28.1
202 python-glanceclient==1.1.0
203 python-cinderclient==1.4.0
204 python-ceilometerclient==1.5.1
205 python-keystoneclient==1.6.0
209 robotframework==2.9.1
210 robotframework-requests==0.3.8
211 robotframework-sshlibrary==2.1.1
219 This script can be adapted if you need to set up a specific environment before running the tests.
224 This script is used to run the tests. You must thus complete the cases with you own project::
228 info "Running PROMISE test case..."
232 info "Running Doctor test..."
233 python ${FUNCTEST_REPO_DIR}/testcases/features/doctor.py
236 info "Running <your project> test..."
237 # your script that launchs your tests...
240 And do not forget to update also the help line::
242 -t|--test run specific set of tests
243 <test_name> one or more of the following: vping,odl,rally,tempest,vims,onos, promise. Separated by comma.
249 This file is the main configuration file of Functest. You must add the references to your project::
253 dir_repo_<your project>: /home/opnfv/repos/<your project>
255 # branch and commit ID to which the repos will be reset (HEAD)
256 <your project>_branch: master
257 <your project>_commit: latest
264 .. _`[1]`: Functest configuration guide URL
265 .. _`[2]`: functest user guide URL
268 OPNFV main site: opnfvmain_.
270 OPNFV functional test page: opnfvfunctest_.
272 IRC support chan: #opnfv-testperf
274 .. _opnfvmain: http://www.opnfv.org
275 .. _opnfvfunctest: https://wiki.opnfv.org/opnfv_functional_testing
276 .. _`OpenRC`: http://docs.openstack.org/user-guide/common/cli_set_environment_variables_using_openstack_rc.html
277 .. _`Rally installation procedure`: https://rally.readthedocs.org/en/latest/tutorial/step_0_installation.html
278 .. _`config_test.py` : https://git.opnfv.org/cgit/functest/tree/testcases/config_functest.py
279 .. _`config_functest.yaml` : https://git.opnfv.org/cgit/functest/tree/testcases/config_functest.yaml