reformat CI part, add vPing description, remove images, replace them with ASCII descr...
[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 code::
74
75  CIMC/Lights+out management                  Admin     Private   Public   Storage
76                                               PXE
77                                                                    +
78  +                                             +     IP_PRIV/24    |        |
79  |                                             |         +         +        |
80  |                                             |         |    IP_PUB/24     |
81  |     +-----------------+                     |         |         +        |
82  |     |                 |                     |         |         |        |
83  +-----+  Jumpserver     |                     |         |         |        |
84  |     |                 +---------------------+         |         |        |
85  |     |                 |                     |         |         |        |
86  |     |  +----------+   |                     |         |         |        |
87  |     |  |  Rally   |   +---- --------------------------+         |        |
88  |     |  |          |   |                     |         |         |        |
89  |     |  |  Robot   |   |                     |         |         |        |
90  |     |  |          |   |                     |         |         |        |
91  |     |  |  vPing   |   |                     |         |         |        |
92  |     |  |          |   |                     |         |         |        |
93  |     |  |  vIMS    |   |                     |         |         |        |
94  |     |  +----------+   |                     |         |         |        |
95  |     |   FuncTests     +-----------------------------------------+        |
96  |     |                 |                     |         |         |        |
97  |     |                 +--------------------------------------------------+
98  |     |                 |                     |         |         |        |
99  |     +-----------------+                     |         |         |        |
100  |                                             |         |         |        |
101  |    +----------------+                       |         |         |        |
102  |    |             1  |                       |         |         |        |
103  +----+ +--------------+-+                     |         |         |        |
104  |    | |             2  |                     |         |         |        |
105  |    | | +--------------+-+                   |         |         |        |
106  |    | | |             3  |                   |         |         |        |
107  |    | | | +--------------+-+                 |         |         |        |
108  |    | | | |             4  |                 |         |         |        |
109  |    +-+ | | +--------------+-+               |         |         |        |
110  |      | | | |             5  +---------------+         |         |        |
111  |      +-+ | |  nodes for     |               |         |         |        |
112  |        | | |  deploying     +-------------------------+         |        |
113  |        +-+ |  opnfv         |               |         |         |        |
114  |          | |     SUT        +-----------------------------------+        |
115  |          +-+                |               |         |         |        |
116  |            |                +--------------------------------------------+
117  |            +----------------+               |         |         |        |
118  |                                             |         |         |        |
119  |                                             +         +         +        +
120
121 .. _description:
122
123 -----------------------------
124 Description of the test cases
125 -----------------------------
126
127 Rally bench test suite
128 ======================
129
130 .. _Rally: https://wiki.openstack.org/wiki/Rally
131
132 The OPNFV scenarios are based on the collection of Rally_ default scenarios:
133  * authenticate
134  * cinder
135  * nova
136  * vm
137  * glance
138  * keystone
139  * neutron
140  * quotas
141
142 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.
143
144 This test suite provides performance information on VIM (OpenStack) part.
145
146 No SLA were defined for release 1, we just consider whether the tests are passed or failed.
147
148 In the future SLA shall be considered (e.g. accepting booting time for a given image with a given flavour).
149
150 Through its integration in Continuous Integration, the evolution of the performance of these tests shall also be considered.
151
152 Tempest
153 =======
154
155 .. _Tempest: http://docs.openstack.org/developer/tempest/overview.html
156
157 Tempest_ is the OpenStack Integration Test Suite. We use Rally to run Tempest suite.
158
159 The goal of this test is to check the OpenStack installation (sanity checks).
160
161
162 OpenDaylight
163 ============
164
165 vPing
166 =====
167
168 The goal of this test can be described as follow:
169
170 code::
171
172  vPing testcase
173  +-------------+                   +-------------+
174  |             |                   |             |
175  |             |     Boot VM1      |             |
176  |             +------------------>|             |
177  |             |                   |             |
178  |             |     Get IP VM1    |             |
179  |             +------------------>|             |
180  |   Tester    |                   |   System    |
181  |             |     Boot VM2      |    Under    |
182  |             +------------------>|     Test    |
183  |             |  Including Ping   |             |
184  |             |at the end of boot |             |
185  |             |                   |             |
186  |             |                   |             |
187  |             |   Check console   |             |
188  |             |     Grep Ping     |             |
189  |             +------------------>|             |
190  |             |                   |             |
191  +-------------+                   +-------------+
192
193
194 The vPing test case is already present in Tempest suite.
195
196 This example, using OpenStack python clients can be considered as an "hellow World" example and may be modified for future use.
197
198
199 vIMS
200 ====
201
202 vIMS is one of the testcases defined by ETSI.
203
204 .. figure:: images/Ims_overview.png
205    :scale: 50
206    :alt: IMS (src wikipedia)
207
208 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. 
209
210 This functional test will verify that
211  * The OpenStack Nova API can be called to instantiate a set of VMs that together comprise a vIMS network function
212  * The OpenStack Glance service is capable of serving up the required images
213  * The virtual networking component of the platform can provide working IP connectivity between and among the VMs
214  * 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
215
216 Functional testing of vIMS in OPNFV Release 1 will be limited to a basic, non-scalable and non-fault-tolerant deployment of IMS.
217 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.
218
219 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. 
220
221 .. _clearwater: http://www.projectclearwater.org/
222
223 The vIMS core function is based on the clearwater_ open source solution.
224
225
226 .. _tooling_installation:
227
228 ----------------------
229 Tooling installation
230 ----------------------
231
232 2 external tools are needed for the R1 functional tests:
233  * Rally
234  * Robot
235
236
237 Rally
238 =====
239
240 .. _`Rally installation procedure`: https://rally.readthedocs.org/en/latest/tutorial/step_0_installation.html
241
242 .. _`OpenRC`: http://docs.openstack.org/user-guide/common/cli_set_environment_variables_using_openstack_rc.html
243
244 The Rally creation can be describe as follow (ref: `Rally installation procedure`_):
245  * Create or enter a folder where you want to check out the tool repos.
246  * $ git clone https://git.openstack.org/openstack/rally
247  * $ ./rally/install_rally.sh
248  * 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)
249  * $ source Your_OpenRC_file
250  * $ rally deployment create --fromenv --name=my-opnfv-test
251  * $ rally-manage tempest install
252
253 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::
254
255     # rally deployment check
256     keystone endpoints are valid and following service are available:
257     +-------------+-----------+------------+
258     | Services  | Type        | Status     |
259     +-----------+-------------+------------+
260     | cinder    | volume      | Available  |
261     | cinderv2  | volumev2    | Available  |
262     | glance    | image       | Available  |
263     | keystone  | identity    | Available  |
264     | neutron   | network     | Available  |
265     | nova      | compute     | Available  |
266     | nova_ec2  | compute_ec2 | Available  |
267     | novav3    | computev3   | Available  |
268     +-----------+-------------+------------+
269
270     # rally show images
271     +--------------------------------------+----------------------------------------------+------------+
272     | UUID                                 | Name                                         | Size (B)   |
273     +--------------------------------------+----------------------------------------------+------------+
274     | 0a15951f-6388-4d5d-8531-79e7205eb140 | cirros_2015_04_10_13_13_18                   | 13167616   |
275     | 67734efd-75f6-4919-991e-bba9855f3ae1 | Ubuntu 12.04 64b                             | 260637184  |
276     | b1504066-045a-4f8f-8919-8c665ef3f400 | Ubuntu 14.04 64b                             | 253297152  |
277     +--------------------------------------+----------------------------------------------+------------+
278
279     # rally show flavors
280     +--------------------------------------+---------------------+-------+----------+-----------+-----------+
281     | ID                                   | Name                | vCPUs | RAM (MB) | Swap (MB) | Disk (GB) |
282     +--------------------------------------+---------------------+-------+----------+-----------+-----------+
283     | 110e6375-a058-4af6-b21e-b765187904d2 | m1.medium           | 2     | 1024     |           | 20        |
284     | 7084d7e7-415a-455d-a55a-2ad286ddf7c9 | m1.large            | 4     | 4096     |           | 80        |
285     | a0345ba7-c667-4fd2-964f-7e98f8cda279 | m1.xlarge           | 4     | 8192     |           | 200       |
286     | accdc28c-5e20-4859-a5cc-61cf9009e56d | m1.small            | 1     | 512      |           | 10        |
287     +--------------------------------------+---------------------+-------+----------+-----------+-----------+
288
289 Robot
290 =====
291 Summary: Set up python2.7 virtual environment::
292
293     mkvirtualenv robot
294
295     pip install requests
296     pip install robotframework
297     pip install robotframework-sshlibrary
298     pip install robotframework-requests
299
300
301 vPing
302 =====
303
304 Make sure that nova services are up::
305
306     #nova service list
307     +----+----------------+--------+----------+---------+-------+
308     | Id | Binary         | Host   | Zone     | Status  | State |
309     +----+----------------+--------+----------+---------+-------+
310     | 1  | nova-conductor | xxxxxx | internal | enabled | up    |
311     | 3  | nova-network   | xxxxxx | internal | enabled | up    |
312     | 4  | nova-scheduler | xxxxxx | internal | enabled | up    |
313     | 5  | nova-compute   | xxxxxx | nova     | enabled | up    |
314     +----+----------------+--------+----------+---------+-------+
315
316
317 .. _vPing.py: https://git.opnfv.org/cgit/functest/tree/testcases/vPing/CI/libraries/vPing.py
318
319 Retrieve vPing.py_ script from OPNFV git repo
320
321 Make sure you have sourced your OpenRC file::
322
323     # source Your_OpenRC_file
324
325 ------------------------------
326 Functional test configuration
327 ------------------------------
328
329 Rally bench suite
330 =================
331
332 Rally bench scenarios have been aggregated in json files.
333 A script has been developed to simplify the management of the tests and the integration in CI, get it from git::
334
335     # wget https://git.opnfv.org/cgit/functest/tree/testcases/VIM/OpenStack/CI/libraries/run_rally.py
336
337 Several scenarios are available (all based on native Rally scenarios):
338  * glance
339  * nova
340  * authenticate
341  * keystone
342  * neutron
343  * vm
344  * quotas
345  * request
346  * tempest
347  * all (every module except tempest)
348
349 You can run the script as follow::
350
351     # python run_rally.py keystone
352
353 The script will:
354  * get the json scenario (if not already available) and put it into the scenario folder
355  * run rally
356  * generate the html result page into the result folder as opnfv-[module name]-[timestamp].html
357  * generate the json result page into the result folder as opnfv-[module name]-[timestamp].json
358  * generate OK or KO
359
360 Tempest suite
361 =============
362
363 It is possible to use Rally to perform Tempest tests (ref: `tempest installation guide using Rally`_)
364 You just need to run::
365
366      # rally verify start
367
368 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.
369
370 .. _`tempest installation guide using Rally`: https://www.mirantis.com/blog/rally-openstack-tempest-testing-made-simpler/
371
372 OpenDaylight
373 ============
374 ODL wiki page describes system preparation and running tests. See `Integration Group CSIT`_.
375
376 .. _`Integration Group CSIT`: https://wiki.opendaylight.org/view/CrossProject:Integration_Group:CSIT
377
378
379 vPing
380 =====
381
382 By default, the script’s is configured as follow::
383
384  * OS_USERNAME:         admin
385  * OS_PASSWORD:         test
386  * OS_AUTH_URL:          http://192.168.20.71:5000/v2.0
387  * OS_TENANT_NAME: invisible_to_admin
388  * Name of VM: opnfv-vping-1 , opnfv-vping-2
389  * Flavor: m1.small
390  * Image: Ubuntu 14.04 (amd64)
391  * Network: private
392
393 The script needs to be tuned to  your specific system configuration
394
395 vIMS
396 ====
397
398
399
400 .. _manualtest:
401
402 --------------
403 Test results
404 --------------
405
406 Rally bench suite
407 =================
408
409 Results are available in the result folder through a html page and a json file.
410
411 Tempest suite
412 =============
413
414 You can get the results of tempest by typing::
415
416     # rally verify list
417
418
419
420
421 OpenDaylight
422 ============
423
424 Tests can be executed with script *start_test.sh* from directory *functest/testcases/Controllers/ODL/CI*. For usage example see::
425
426     # bash start_test.sh -h
427
428 vPing
429 =====
430 The test can be executed with command::
431
432     #python vPing.py
433
434 vIMS
435 ====
436
437
438 .. _automatictest:
439
440 ------------------
441 Testing Automation
442 ------------------
443
444 Connection of your platform
445 ===========================
446
447 .. _`Octopus procedure`: https://wiki.opnfv.org/octopus/jenkins_slave_connection/
448
449 If you want to add your platform to the community automation, please follow the `Octopus procedure`_.
450
451 Integrating into CI Pipeline
452 ============================
453
454 .. _`pipeline document`: https://wiki.opnfv.org/octopus/pipelines
455
456 Contact Octopus Team (#opnfv-octopus) and see `pipeline document`_ for more details.
457
458 .. _references:
459
460 ----------
461 References
462 ----------
463
464 OPNFV main site: opnfvmain_.
465
466 OPNFV functional test page: opnfvfunctest_.
467
468 IRC support chan: #opnfv-testperf
469
470 .. _opnfvmain: http://www.opnfv.org
471 .. _opnfvfunctest: https://wiki.opnfv.org/opnfv_functional_testing