update python script to manage Rally bench tests, add help section, exclude Tempest...
[functest.git] / docs / functest.rst
1 ===========================
2 OPNFV functional test guide
3 ===========================
4
5 Testing is a key challenge of OPNFV.
6 It shall be possible to run functional tests on any OPNFV solution.
7
8 The goal of this document consists in
9 * a description of functional tests for OPNFV
10 * a description of the tools needed to perform these tests
11 * the procedure to configure the tools and the scenarios associated with these tests
12
13 Functional tests shall be automated and collected results shall be used to improve the robustness and the reliability of the overall system. 
14
15 Function tests may cover any domain that could lead to improve the OPNFV solution and define "Telco Cloud" KPI.
16
17 The last section also describes how to automate these tests within the OPNFV continuous integration project.
18
19 .. _ETSI: http://docbox.etsi.org/ISG/NFV/Open/Published/gs_NFV001v010101p%20-%20Use%20Cases.pdf
20
21 ETSI NFV defined 9 use cases (ref ETSI_):
22  * VNF as a Service
23  * NFV as a service
24  * VNF Forwarding graphs
25  * Virtual Network Platform as a Service
26  * Virtualisation of Mobile Core and IMS
27  * Virtualisation of Mobile station
28  * Fixed Access NFV
29  * Virtualization of CDNs (vCDN)
30  * Virtualization of the Home environment
31
32 .. _`Openstack Telco Working Group`: https://wiki.openstack.org/wiki/TelcoWorkingGroup
33
34 Most of the use cases are also discussed in upstream projects (e.g. `Openstack Telco Working Group`_ )
35
36 For release 1 (Arno), 5 test suites have been selected:
37  * Rally Bench test suite for Openstack
38  * Openstack Tempest test suite
39  * OpenDaylight test suite
40  * vPing
41  * vIMS
42
43 The 3 first suites are directly inherited from upstream projects.
44 vPing, that is already present in Tempest suite, has been developped to provided a basic "hellow world" functional test example.
45
46 .. _`Continuous Integration`: https://build.opnfv.org/ci/view/functest/
47
48 vEPC, vPE, vHGW, vCDN use cases are not considered for first release.
49 It does not mean that such use cases cannot be tested on OPNFV Arno.
50 It means that these use cases have not been integrated in the `Continuous Integration`_ and no specific work (integration or developpment) have been done for R1.
51
52 .. _prereqs:
53
54 -------------
55 Prerequisites
56 -------------
57 We assume that an OPNFV solution has been installed.
58
59 .. _here: TBC
60
61 The installation of the OPNFV solution is out of scope of this document but can be found [here_].
62 In the rest of the document the OPNFV solution would be considered as the System Under Test (SUT).
63
64 The installation and configuration of the tools needed to perform the tests will be described in the following sections.
65
66 For release 1, the tools are not automatically installed.
67
68 .. _pharos: https://wiki.opnfv.org/pharos
69
70 It is recommended to install the different tools on the jump host server as defined in the pharos_ project.
71 The high level architecture can be described as follow:
72
73 .. figure:: images/overall_description.png
74    :scale: 50
75    :alt: overall description
76
77 .. _description:
78
79 -----------------------------
80 Description of the test cases
81 -----------------------------
82
83 Rally bench test suite
84 ======================
85
86 .. _Rally: https://wiki.openstack.org/wiki/Rally
87
88 The OPNFV scenarios are based on the collection of Rally_ default scenarios:
89  * authenticate
90  * cinder
91  * nova
92  * vm
93  * glance
94  * keystone
95  * neutron
96  * quotas
97
98 The goal of this test suite is to test the different modules of OpenStack and get significant figures that could help us to define telco Cloud KPI.
99
100 This test suite provides performance information on VIM (OpenStack) part.
101
102 No SLA were defined for release 1, we just consider whether the tests are passed or failed.
103
104 In the future SLA shall be considered (e.g. accepting booting time for a given image with a given flavour).
105
106 Through its integration in Continuous Integration, the evolution of the performance of these tests shall also be considered.
107
108 Tempest
109 =======
110
111 .. _Tempest: http://docs.openstack.org/developer/tempest/overview.html
112
113 Tempest_ is the OpenStack Integration Test Suite. We use Rally to run Tempest suite.
114
115 The goal of this test is to check the OpenStack installation (sanity checks).
116
117
118 OpenDaylight
119 ============
120
121 vPing
122 =====
123
124 The goal of this test can be described as follow:
125
126 .. figure:: images/vPing.png
127    :scale: 50
128    :alt: vPing description
129
130 The vPing test case is already present in Tempest suite.
131
132 This example, using OpenStack python clients can be considered as an "hellow World" example and may be modified for future use.
133
134
135 vIMS
136 ====
137
138 vIMS is one of the testcases defined by ETSI.
139
140 .. figure:: images/Ims_overview.png
141    :scale: 50
142    :alt: IMS (src wikipedia)
143
144 the goal of this test consists in deploying a virtualized IP Multimedia Subsystem (vIMS) on OPNFV, configuring it to deliver services to a set of emulated SIP endpoints, deploying a virtualized test system that implements those emulated SIP endpoints, and performing a series of simple functional tests on the vIMS, including the ability to establish SIP sessions between emulated endpoints. 
145
146 This functional test will verify that
147  * The OpenStack Nova API can be called to instantiate a set of VMs that together comprise a vIMS network function
148  * The OpenStack Glance service is capable of serving up the required images
149  * The virtual networking component of the platform can provide working IP connectivity between and among the VMs
150  * The platform as a whole is capable of supporting the running of a real virtualized network function that delivers a typical service offered by a network operator, i.e. voice telephony
151
152 Functional testing of vIMS in OPNFV Release 1 will be limited to a basic, non-scalable and non-fault-tolerant deployment of IMS.
153 Furthermore, in this release the vIMS will perform only control plane functions (i.e. processing of SIP signaling messages) and will not be passing RTP media streams.
154
155 In future releases, the same software elements can be deployed with multiple instances of each VNF component to provide a fault tolerant and dynamically scalable deployment of IMS. With the addition of virtualized Session Border Controller software elements, the scope of vIMS functional testing can be further expanded to include the handling of RTP media. 
156
157 .. _clearwater: http://www.projectclearwater.org/
158
159 The vIMS core function is based on the clearwater_ open source solution.
160
161
162 .. _tooling_installation:
163
164 ----------------------
165 Tooling installation
166 ----------------------
167
168 2 tools are needed for the R1 functional tests:
169  * Rally
170  * Robot
171
172
173 Rally
174 =====
175
176 .. _`Rally installation procedure`: https://rally.readthedocs.org/en/latest/tutorial/step_0_installation.html
177
178 .. _`OpenRC`: http://docs.openstack.org/user-guide/common/cli_set_environment_variables_using_openstack_rc.html
179
180 The Rally creation can be describe as follow (ref: `Rally installation procedure`_):
181  * Create or enter a folder where you want to check out the tool repos.
182  * $ git clone https://git.openstack.org/openstack/rally
183  * $ ./rally/install_rally.sh
184  * configure your `OpenRC`_ file to let Rally access to your OpenStack, you can either export it from Horizon or build it manually (OpenStack credentials are required)
185  * $ source Your_OpenRC_file
186  * $ rally deployment create --fromenv --name=my-opnfv-test
187  * $ rally-manage tempest install
188
189 You can check if the configuration of rally is fine by typing 'rally deployment check', you shall see the list of available services as follow::
190
191     # rally deployment check
192     keystone endpoints are valid and following service are available:
193     +-------------+-----------+------------+
194     | Services  | Type        | Status     |
195     +-----------+-------------+------------+
196     | cinder    | volume      | Available  |
197     | cinderv2  | volumev2    | Available  |
198     | glance    | image       | Available  |
199     | keystone  | identity    | Available  |
200     | neutron   | network     | Available  |
201     | nova      | compute     | Available  |
202     | nova_ec2  | compute_ec2 | Available  |
203     | novav3    | computev3   | Available  |
204     +-----------+-------------+------------+
205
206     # rally show images
207     +--------------------------------------+----------------------------------------------+------------+
208     | UUID                                 | Name                                         | Size (B)   |
209     +--------------------------------------+----------------------------------------------+------------+
210     | 0a15951f-6388-4d5d-8531-79e7205eb140 | cirros_2015_04_10_13_13_18                   | 13167616   |
211     | 67734efd-75f6-4919-991e-bba9855f3ae1 | Ubuntu 12.04 64b                             | 260637184  |
212     | b1504066-045a-4f8f-8919-8c665ef3f400 | Ubuntu 14.04 64b                             | 253297152  |
213     +--------------------------------------+----------------------------------------------+------------+
214
215     # rally show flavors
216     +--------------------------------------+---------------------+-------+----------+-----------+-----------+
217     | ID                                   | Name                | vCPUs | RAM (MB) | Swap (MB) | Disk (GB) |
218     +--------------------------------------+---------------------+-------+----------+-----------+-----------+
219     | 110e6375-a058-4af6-b21e-b765187904d2 | m1.medium           | 2     | 1024     |           | 20        |
220     | 7084d7e7-415a-455d-a55a-2ad286ddf7c9 | m1.large            | 4     | 4096     |           | 80        |
221     | a0345ba7-c667-4fd2-964f-7e98f8cda279 | m1.xlarge           | 4     | 8192     |           | 200       |
222     | accdc28c-5e20-4859-a5cc-61cf9009e56d | m1.small            | 1     | 512      |           | 10        |
223     +--------------------------------------+---------------------+-------+----------+-----------+-----------+
224
225 Robot
226 =====
227 Summary: Set up python2.7 virtual environment::
228
229     mkvirtualenv robot
230
231     pip install requests
232     pip install robotframework
233     pip install robotframework-sshlibrary
234     pip install robotframework-requests
235
236
237 ------------------------------
238 Functional test configuration
239 ------------------------------
240
241 Rally bench suite
242 =================
243
244 Rally bench scenarios have been aggregated in json files.
245 A script has been developed to simplify the management of the tests and the integration in CI, get it from git::
246
247     # wget https://git.opnfv.org/cgit/functest/tree/testcases/VIM/OpenStack/CI/libraries/run_rally.py
248
249 Several scenarios are available (all based on native Rally scenarios):
250  * glance
251  * nova
252  * authenticate
253  * keystone
254  * neutron
255  * vm
256  * quotas
257  * request
258  * tempest
259  * all (every module except tempest)
260
261 You can run the script as follow::
262     #python run_rally.py keystone
263
264 The script will:
265  * get the json scenario (if not already available) and put it into the scenario folder
266  * run rally
267  * generate the html result page into the result folder as opnfv-[module name]-[timestamp].html
268  * generate the json result page into the result folder as opnfv-[module name]-[timestamp].json
269  * generate OK or KO
270
271 Tempest suite
272 =============
273
274 It is possible to use Rally to perform Tempest tests (ref: `tempest installation guide using Rally`_)
275 You just need to run::
276
277      # rally verify start
278
279 The different modes available are smoke, baremetal, compute, data_processing, identity, image, network, object_storage, orchestration, telemetry, and volume. By default if you do not precise anything then smoke tests be selected by default.
280
281 .. _`tempest installation guide using Rally`: https://www.mirantis.com/blog/rally-openstack-tempest-testing-made-simpler/
282
283 OpenDaylight
284 ============
285 ODL wiki page describes system preparation and running tests. See `Integration Group CSIT`_.
286
287 .. _`Integration Group CSIT`: https://wiki.opendaylight.org/view/CrossProject:Integration_Group:CSIT
288
289
290 vPing
291 =====
292
293 vIMS
294 ====
295
296
297 .. _manualtest:
298
299 --------------
300 Test results
301 --------------
302
303 Rally bench suite
304 =================
305
306 Results are available in the result folder through a html page and a json file.
307
308 Tempest suite
309 =============
310
311 You can get the results of tempest by typing::
312
313     # rally verify list
314
315
316
317
318 OpenDaylight
319 ============
320
321 Tests can be executed with script *start_test.sh* from directory *functest/testcases/Controllers/ODL/CI*. For usage example see::
322
323     # bash start_test.sh -h
324
325 vPing
326 =====
327
328 vIMS
329 ====
330
331
332 .. _automatictest:
333
334 ------------------
335 Testing Automation
336 ------------------
337
338 Connection of your platform
339 ===========================
340 If you want to add your platform to the community automation, you need to declare your machine as a Jenkins slave.
341  * Send a mail to OPNFV LF Helpdesk (opnfv-helpdesk@rt.linuxfoundation.org)
342  * Create a local user jenkins on your machine
343  * wget http://mirrors.jenkins-ci.org/war/1.599/jenkins.war
344  * Extract contents, find the file named slave.jar and copy it to somewhere which jenkins user created in first step can access.
345  * Create a directory /home/jenkins/opnfv_slave_root
346  * check the java version (>1.7.0_75)
347  * Contact Linux Foundation to manage authentication of your server
348  * A key/token will be produced. Establish connection towards OPNFV Jenkins by using below command: java -jar slave.jar -jnlpUrl https://build.opnfv.org/ci/computer/<slave_name>/slave-agent.jnlp -secret <token>
349
350 Continuous integration scripts
351 ==============================
352
353 .. _references:
354
355 ----------
356 References
357 ----------
358
359 OPNFV main site: opnfvmain_.
360
361 OPNFV functional test page: opnfvfunctest_.
362
363 IRC support chan: #opnfv-testperf
364
365 .. _opnfvmain: http://www.opnfv.org
366 .. _opnfvfunctest: https://wiki.opnfv.org/opnfv_functional_testing