Adding a structure for the reporting of test cases for functest
[functest.git] / docs / userguide / index.rst
1 =========================
2 OPNFV FUNCTEST user guide
3 =========================
4
5 .. toctree::
6    :numbered:
7    :maxdepth: 2
8
9
10 Introduction
11 ============
12
13 The goal of this documents is to describe the Functest test cases as well as
14 provide a procedure about how to execute them.
15
16 A presentation has been created for the first OPNFV Summit `[4]`_.
17
18 It is assumed that Functest container has been properly installed `[1]`_.
19
20 .. include:: ./description.rst
21
22 The different scenarios are described in the section hereafter.
23
24 VIM (Virtualized Infrastructure Manager)
25 ---
26
27 vPing_SSH
28 ^^^^^^^^^
29
30 Given the script 'ping.sh'::
31
32     #!/bin/sh
33     while true; do
34         ping -c 1 $1 2>&1 >/dev/null
35         RES=$?
36         if [ "Z$RES" = "Z0" ] ; then
37             echo 'vPing OK'
38             break
39         else
40             echo 'vPing KO'
41         fi
42     sleep 1
43     done
44
45 The goal of this test is described as follows::
46
47  vPing test case
48  +-------------+                    +-------------+
49  |             |                    |             |
50  |             | Boot VM1 with IP1  |             |
51  |             +------------------->|             |
52  |   Tester    |                    |   System    |
53  |             | Boot VM2           |    Under    |
54  |             +------------------->|     Test    |
55  |             |                    |             |
56  |             | Create floating IP |             |
57  |             +------------------->|             |
58  |             |                    |             |
59  |             | Assign floating IP |             |
60  |             | to VM2             |             |
61  |             +------------------->|             |
62  |             |                    |             |
63  |             | Stablish SSH       |             |
64  |             | connection to VM2  |             |
65  |             | through floating IP|             |
66  |             +------------------->|             |
67  |             |                    |             |
68  |             | SCP ping.sh to VM2 |             |
69  |             +------------------->|             |
70  |             |                    |             |
71  |             | VM2 executes       |             |
72  |             | ping.sh to VM1     |             |
73  |             +------------------->|             |
74  |             |                    |             |
75  |             |    If ping:        |             |
76  |             |      exit OK       |             |
77  |             |    else (timeout)  |             |
78  |             |      exit Failed   |             |
79  |             |                    |             |
80  +-------------+                    +-------------+
81
82 This test can be considered as an "Hello World" example.
83 It is the first basic use case which shall work on any deployment.
84
85 vPing_userdata
86 ^^^^^^^^^^^^^^
87
88 The goal of this test can be described as follows::
89
90  vPing_userdata test case
91  +-------------+                    +-------------+
92  |             |                    |             |
93  |             | Boot VM1 with IP1  |             |
94  |             +------------------->|             |
95  |             |                    |             |
96  |             | Boot VM2 with      |             |
97  |             | ping.sh as userdata|             |
98  |             | with IP1 as $1.    |             |
99  |             +------------------->|             |
100  |   Tester    |                    |   System    |
101  |             | VM2 exeutes ping.sh|    Under    |
102  |             | (ping IP1)         |     Test    |
103  |             +------------------->|             |
104  |             |                    |             |
105  |             | Monitor nova       |             |
106  |             |  console-log VM 2  |             |
107  |             |    If ping:        |             |
108  |             |      exit OK       |             |
109  |             |    else (timeout)  |             |
110  |             |      exit Failed   |             |
111  |             |                    |             |
112  +-------------+                    +-------------+
113
114 This scenario is similar to the previous one but it uses cloud-init (nova
115 metadata service) instead of floating IPs and SSH connection. When the second VM
116 boots it will execute the script automatically and the ping will be detected
117 capturing periodically the output in the console-log of the second VM.
118
119
120 Tempest
121 ^^^^^^^
122
123 Tempest `[2]`_ is the reference OpenStack Integration test suite.
124 It is a set of integration tests to be run against a live OpenStack cluster.
125 Tempest has batteries of tests for:
126
127   * OpenStack API validation
128   * Scenarios
129   * Other specific tests useful in validating an OpenStack deployment
130
131 Functest uses Rally `[3]`_ to run the Tempest suite.
132 Rally generates automatically the Tempest configuration file (tempest.conf).
133 Before running the actual test cases, Functest creates the needed resources and
134 updates the appropriate parameters to the configuration file.
135 When the Tempest suite is executed, each test duration is measured and the full
136 console output is stored in the tempest.log file for further analysis.
137
138 As an addition of Arno, Brahmaputra runs a customized set of Tempest test cases.
139 The list is specificed through *--tests-file* when running Rally.
140 This option has been introduced in Rally in version 0.1.2.
141
142 The customized test list is available in the Functest repo `[4]`_.
143 This list contains more than 200 Tempest test cases and can be divided
144 into two main sections:
145
146   1) Set of tempest smoke test cases
147   2) Set of test cases from DefCore list `[8]`_
148
149 The goal of the Tempest test suite is to check the basic functionalities of
150 different OpenStack components on an OPNFV fresh installation using
151 the corresponding REST API interfaces.
152
153
154 Rally bench test suites
155 ^^^^^^^^^^^^^^^^^^^^^^^
156
157 Rally `[3]`_ is a benchmarking tool that answers the question::
158
159  “How does OpenStack work at scale?”.
160
161 The goal of this test suite is to benchmark the different OpenStack modules and
162 get significant figures that could help to define Telco Cloud KPIs.
163
164 The OPNFV scenarios are based on the collection of the existing Rally scenarios:
165
166  * authenticate
167  * cinder
168  * glance
169  * heat
170  * keystone
171  * neutron
172  * nova
173  * quotas
174  * requests
175
176 A basic SLA (stop test on errors) have been implemented.
177
178
179 SDN Controllers
180 ---------------
181
182 Brahmaputra introduces new SDN controllers.
183 There are currently 3 possible controllers:
184
185  * OpenDaylight (ODL)
186  * ONOS
187  * OpenContrail (OCL)
188
189 OpenDaylight
190 ^^^^^^^^^^^^
191
192 The OpenDaylight (ODL) test suite consists of a set of basic tests inherited
193 from the ODL project using the Robot `[11]`_ framework.
194 The suite verifies creation and deletion of networks, subnets and ports with
195 OpenDaylight and Neutron.
196
197 The list of tests can be described as follows:
198
199  * Restconf.basic: Get the controller modules via Restconf
200  * Neutron.Networks
201
202    * Check OpenStack Networks :: Checking OpenStack Neutron for known networks
203    * Check OpenDaylight Networks :: Checking OpenDaylight Neutron API
204    * Create Network :: Create new network in OpenStack
205    * Check Network :: Check Network created in OpenDaylight
206    * Neutron.Networks :: Checking Network created in OpenStack are pushed
207
208  * Neutron.Subnets
209
210    * Check OpenStack Subnets :: Checking OpenStack Neutron for known Subnets
211    * Check OpenDaylight subnets :: Checking OpenDaylight Neutron API
212    * Create New subnet :: Create new subnet in OpenStack
213    * Check New subnet :: Check new subnet created in OpenDaylight
214    * Neutron.Subnets :: Checking Subnets created in OpenStack are pushed
215
216  * Neutron.Ports
217
218    * Check OpenStack ports :: Checking OpenStack Neutron for known ports
219    * Check OpenDaylight ports :: Checking OpenDaylight Neutron API
220    * Create New Port :: Create new port in OpenStack
221    * Check New Port :: Check new subnet created in OpenDaylight
222    * Neutron.Ports :: Checking Port created in OpenStack are pushed
223
224  * Delete Ports
225
226    * Delete previously created subnet in OpenStack
227    * Check subnet deleted in OpenDaylight
228    * Check subnet deleted in OpenStack
229
230  * Delete network
231
232    * Delete previously created network in OpenStack
233    * Check network deleted in OpenDaylight
234    * Check network deleted in OpenStack
235
236
237 ONOS
238 ^^^^
239
240 TestON Framework is used to test the ONOS SDN controller functions.
241 The test cases deal with L2 and L3 functions.
242 The ONOS test suite can be run on any ONOS compliant scenario.
243
244 The test cases may be described as follows:
245
246  * onosfunctest: The main executable file contains the initialization of
247    the docker environment and functions called by FUNCvirNetNB and
248    FUNCvirNetNBL3
249
250  * FUNCvirNetNB
251
252    * Create Network: Post Network data and check it in ONOS
253    * Update Network: Update the Network and compare it in ONOS
254    * Delete Network: Delete the Network and check if it's NULL in ONOS or
255      not
256    * Create Subnet: Post Subnet data and check it in ONOS
257    * Update Subnet: Update the Subnet and compare it in ONOS
258    * Delete Subnet: Delete the Subnet and check if it's NULL in ONOS or not
259    * Create Port: Post Port data and check it in ONOS
260    * Update Port: Update the Port and compare it in ONOS
261    * Delete Port: Delete the Port and check if it's NULL in ONOS or not
262
263  * FUNCvirNetNBL3
264
265    * Create Router: Post dataes for create Router and check it in ONOS
266    * Update Router: Update the Router and compare it in ONOS
267    * Delete Router: Delete the Router dataes and check it in ONOS
268    * Create RouterInterface: Post RouterInterface data to an exist Router
269      and check it in ONOS
270    * Delete RouterInterface: Delete the RouterInterface and check the Router
271    * Create FloatingIp: Post dataes for create FloatingIp and check it in
272      ONOS
273    * Update FloatingIp: Update the FloatingIp and compare it in ONOS
274    * Delete FloatingIp: Delete the FloatingIp and check if it's NULL in
275      ONOS  or not
276    * Create External Gateway: Post dataes for create External Gateway to an
277      exit Router and check it
278    * Update External Gateway: Update the External Gateway and compare it
279    * Delete External Gateway: Delete the External Gateway and check if it's
280      NULL in ONOS or not
281
282
283 OpenContrail
284 ^^^^^^^^^^^^
285 TODO OVNO
286
287
288
289 Features
290 --------
291
292 vIMS
293 ^^^^
294 The goal of this test suite consists of:
295
296  * deploy a VNF orchestrator (Cloudify)
297  * deploy a Clearwater vIMS (IP Multimedia Subsystem) VNF from this
298    orchestrator based on a TOSCA blueprint defined in `[5]`_
299  * run suite of signaling tests on top of this VNF
300
301 The Clearwater architecture is described as follows:
302
303 .. figure:: ../images/clearwater-architecture.png
304    :align: center
305    :alt: vIMS architecture
306
307 Two types of information are stored in the Test Database:
308
309  * the duration of each step (orchestion deployment, VNF deployment and test)
310  * the test results
311
312 The deployment of a complete functional VNF allows the test of most of the
313 essential functions needed for a NFV platform.
314
315 Promise
316 ^^^^^^^
317
318 Promise provides a basic set of test cases as part of Brahmaputra.
319
320 The available 33 test cases can be grouped into 7 test suites:
321
322     #. Add a new OpenStack provider into resource pool: Registers
323        OpenStack into a new resource pool and adds more capacity associated
324        with this pool.
325
326     #. Allocation without reservation: Creates a new server in OpenStack
327        and adds a new allocation record in Promise shim-layer.
328
329     #. Allocation using reservation for immediate use: Creates a resource
330        reservation record with no start/end time and immediately creates a new
331        server in OpenStack and add a new allocation record in Promise
332        shim-layer.
333
334     #. Reservation for future use: Creates a resource reservation record
335        for a future start time, queries, modifies and cancels the newly created
336        reservation.
337
338     #. Capacity planning: Decreases and increases the available capacity
339        from a provider in the future and queries the available collections and
340        utilizations.
341
342     #. Reservation with conflict: Tries to create reservations for
343        immediate and future use with conflict.
344
345     #. Cleanup test allocations: Destroys all allocations in OpenStack.
346
347
348 The specific parameters for Promise can be found in config_functest.yaml and
349 include::
350
351    promise:
352      general:
353          tenant_name: Name of the OpenStack tenant/project (e.g. promise)
354          tenant_description: Description of the OpenStack tenant (e.g. promise Functionality Testing)
355          user_name: Name of the user tenant (e.g. promiser)
356          user_pwd: Password of the user tenant (e.g. test)
357          image_name: Name of the software image (e.g. promise-img)
358          flavor_name: Name of the flavor (e.g. promise-flavor with 1 vCPU and 512 MB RAM)
359          flavor_vcpus: 1
360          flavor_ram: 512
361          flavor_disk: 0
362
363 However, these parameters must not be changed, as they are the values expected
364 by the Promise test suite.
365
366 .. include:: ./runfunctest.rst
367
368 Test results
369 ============
370
371 For Brahmaputra test results, see the functest results document at:
372 http://artifacts.opnfv.org/functest/brahmaputra/docs/results/index.html
373
374
375 Test Dashboard
376 ==============
377
378 Based on results collected in CI, a test dashboard is dynamically generated.
379 The URL of this dashboard is TODO LF
380
381
382 Troubleshooting
383 ===============
384
385 VIM
386 ---
387
388 vPing_SSH
389 ^^^^^^^^^
390
391 vPing should work on all the scenarios. In case of timeout, check your network
392 connectivity. The test case creates its own security group to allow SSH access,
393 check your network settings and your security rules.
394
395
396 vPing_userdata
397 ^^^^^^^^^^^^^^
398
399 Cloud-init in not supported on scenario dealing with ONOS.
400
401 Tempest
402 ^^^^^^^
403
404 In the upstream OpenStack CI all the Tempest test cases are supposed to pass.
405 If some test cases fail in an OPNFV deployment, the reason is very probably one
406 of the following::
407
408  +-----------------------------+------------------------------------------------+
409  | Error                       | Details                                        |
410  +=============================+================================================+
411  | Resources required for test | Such resources could be e.g. an external       |
412  | case execution are missing  | network and access to the management subnet    |
413  |                             | (adminURL) from the Functest docker container. |
414  +-----------------------------+------------------------------------------------+
415  | OpenStack components or     | Check running services in the controller and   |
416  | services are missing or not | compute nodes (e.g. with "systemctl" or        |
417  | configured properly         | "service" commands). Configuration parameters  |
418  |                             | can be verified from related .conf files       |
419  |                             | located under /etc/<component> directories.    |
420  +-----------------------------+------------------------------------------------+
421  | Some resources required for | The tempest.conf file, automatically generated |
422  | execution test cases are    | by Rally in Functest, does not contain all the |
423  | missing                     | needed parameters or some parameters are not   |
424  |                             | set properly.                                  |
425  |                             | The tempest.conf file is located in /home/opnfv|
426  |                             | /.rally/tempest/for-deployment-<UUID> in       |
427  |                             | Functest container                             |
428  |                             | Use "rally deployment list" command in order to|
429  |                             | check UUID of current deployment.              |
430  +-----------------------------+------------------------------------------------+
431
432
433 When some Tempest test case fails, captured traceback and possibly also related
434 REST API requests/responses are output to the console.
435 More detailed debug information can be found from tempest.log file stored into
436 related Rally deployment folder.
437
438
439 Rally
440 ^^^^^
441
442 Same error causes than for Tempest mentioned above may lead to error in Rally.
443
444 Controllers
445 -----------
446
447 ODL
448 ^^^
449 2 versions are supported in Brahmaputra depending on the scenario:
450  * Lithium
451  * Berylium
452
453 The upstream test suites have not been adapted, so you may get 18 or 15 tests
454 passed on 18 depending on your configuration. The 3 testcases are partly failed
455 due to wrong return code.
456
457 ONOS
458 ^^^^
459
460 TODO
461
462 OpenContrail
463 ^^^^^^^^^^^^
464
465
466 Feature
467 -------
468
469 vIMS
470 ^^^^
471 vIMS deployment may fail for several reasons, the most frequent ones are
472 described in the following table:
473
474 +===================================+====================================+
475 | Error                             |  Comments                          |
476 +-----------------------------------+------------------------------------+
477 | Keystone admin API  not reachable | Impossible to create vIMS user and |
478 |                                   | tenant                             |
479 +-----------------------------------+------------------------------------+
480 | Impossible to retrieve admin role | Impossible to create vIMS user and |
481 | id                                | tenant                             |
482 +-----------------------------------+------------------------------------+
483 | Error when uploading image from   | impossible to deploy VNF           |
484 | OpenStack to glance               |                                    |
485 +-----------------------------------+------------------------------------+
486 | Cinder quota cannot be updated    | Default quotas not sufficient, they|
487 |                                   | are adapted in the script          |
488 +-----------------------------------+------------------------------------+
489 | Impossible to create a volume     | VNF cannot be deployed             |
490 +-----------------------------------+------------------------------------+
491 | SSH connection issue between the  | if vPing test fails, vIMS test will|
492 | Test container and the VM         | fail...                            |
493 +-----------------------------------+------------------------------------+
494 | No Internet access from a VM      | the VMs of the VNF must have an    |
495 |                                   | external access to Internet        |
496 +-----------------------------------+------------------------------------+
497
498
499 Promise
500 ^^^^^^^
501
502 TODO
503
504 References
505 ==========
506
507 .. _`[1]`: Functest configuration guide URL
508 .. _`[2]`: http://docs.openstack.org/developer/tempest/overview.html
509 .. _`[3]`: https://rally.readthedocs.org/en/latest/index.html
510 .. _`[4]`: http://events.linuxfoundation.org/sites/events/files/slides/Functest%20in%20Depth_0.pdf
511 .. _`[5]`: https://github.com/Orange-OpenSource/opnfv-cloudify-clearwater/blob/master/openstack-blueprint.yaml
512 .. _`[6]`: https://wiki.opnfv.org/opnfv_test_dashboard
513 .. _`[7]`: http://testresults.opnfv.org/testapi/test_projects/functest/cases
514 .. _`[8]`: https://wiki.openstack.org/wiki/Governance/DefCoreCommittee
515 .. _`[9]`: https://git.opnfv.org/cgit/functest/tree/testcases/VIM/OpenStack/CI/libraries/os_defaults.yaml
516 .. _`[10]`: https://git.opnfv.org/cgit/functest/tree/testcases/VIM/OpenStack/CI/rally_cert/task.yaml
517 .. _`[11]`: http://robotframework.org/
518
519 OPNFV main site: opnfvmain_.
520
521 OPNFV functional test page: opnfvfunctest_.
522
523 IRC support chan: #opnfv-testperf
524
525 .. _opnfvmain: http://www.opnfv.org
526 .. _opnfvfunctest: https://wiki.opnfv.org/opnfv_functional_testing
527 .. _`OpenRC`: http://docs.openstack.org/user-guide/common/cli_set_environment_variables_using_openstack_rc.html
528 .. _`Rally installation procedure`: https://rally.readthedocs.org/en/latest/tutorial/step_0_installation.html
529 .. _`config_test.py` : https://git.opnfv.org/cgit/functest/tree/testcases/config_functest.py
530 .. _`config_functest.yaml` : https://git.opnfv.org/cgit/functest/tree/testcases/config_functest.yaml