Merge "Use separate timeouts for connection and reading."
[functest.git] / docs / testing / developer / devguide / index.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. SPDX-License-Identifier: CC-BY-4.0
3
4 ******************************
5 OPNFV FUNCTEST developer guide
6 ******************************
7
8 .. toctree::
9    :numbered:
10    :maxdepth: 2
11
12
13 ============
14 Introduction
15 ============
16
17 Functest is a project dealing with functional testing.
18 Functest produces its own internal test cases but can also be considered
19 as a framework to support feature and VNF onboarding project testing.
20 Functest developed a TestAPI and defined a test collection framework
21 that can be used by any OPNFV project.
22
23 Therefore there are many ways to contribute to Functest. You can:
24
25  * Develop new internal test cases
26  * Integrate the tests from your feature project
27  * Develop the framework to ease the integration of external test cases
28  * Develop the API / Test collection framework
29  * Develop dashboards or automatic reporting portals
30
31 This document describes how, as a developer, you may interact with the
32 Functest project. The first section details the main working areas of
33 the project. The Second part is a list of "How to" to help you to join
34 the Functest family whatever your field of interest is.
35
36
37 ========================
38 Functest developer areas
39 ========================
40
41
42 Functest High level architecture
43 ================================
44
45 Functest is project delivering a test container dedicated to OPNFV.
46 It includes the tools, the scripts and the test scenarios.
47
48 Functest can be described as follow::
49
50  +----------------------+
51  |                      |
52  |   +--------------+   |                  +-------------------+
53  |   |              |   |    Public        |                   |
54  |   | Tools        |   +------------------+      OPNFV        |
55  |   | Scripts      |   |                  | System Under Test |
56  |   | Scenarios    |   +------------------+                   |
57  |   |              |   |    Management    |                   |
58  |   +--------------+   |                  +-------------------+
59  |                      |
60  |    Functest Docker   |
61  |                      |
62  +----------------------+
63
64 Functest internal test cases
65 ============================
66 The internal test cases in Danube are:
67
68
69  * api_check
70  * cloudify_ims
71  * connection_check
72  * vping_ssh
73  * vping_userdata
74  * odl
75  * rally_full
76  * rally_sanity
77  * snaps_health_check
78  * tempest_full_parallel
79  * tempest_smoke_serial
80
81 By internal, we mean that this particular test cases have been
82 developped and/or integrated by functest contributors and the associated
83 code is hosted in the Functest repository.
84 An internal case can be fully developed or a simple integration of
85 upstream suites (e.g. Tempest/Rally developped in OpenStack are just
86 integrated in Functest).
87 The structure of this repository is detailed in `[1]`_.
88 The main internal test cases are in the opnfv_tests subfolder of the
89 repository, the internal test cases are:
90
91  * sdn: odl, onos
92  * openstack: api_check, connection_check, snaps_health_check, vping_ssh, vping_userdata, tempest_*, rally_*, snaps_smoke
93  * vnf: cloudify_ims
94
95 If you want to create a new test case you will have to create a new
96 folder under the testcases directory.
97
98 Functest external test cases
99 ============================
100 The external test cases are inherited from other OPNFV projects,
101 especially the feature projects.
102
103 The external test cases are:
104
105  * barometer
106  * bgpvpn
107  * doctor
108  * domino
109  * odl-netvirt
110  * onos
111  * fds
112  * multisite
113  * orchestra_ims
114  * parser
115  * promise
116  * refstack_defcore
117  * security_scan
118  * snaps_smoke
119  * sfc-odl
120  * vyos_vrouter
121
122
123 The code to run these test cases may be directly in the repository of
124 the project. We have also a **features** sub directory under opnfv_tests
125 directory that may be used (it can be useful if you want to reuse
126 Functest library).
127
128 Functest framework
129 ==================
130
131 Functest can be considered as a framework.
132 Functest is release as a docker file, including tools, scripts and a CLI
133 to prepare the environment and run tests.
134 It simplifies the integration of external test suites in CI pipeline
135 and provide commodity tools to collect and display results.
136
137 Since Colorado, test categories also known as tiers have been created to
138 group similar tests, provide consistent sub-lists and at the end optimize
139 test duration for CI (see How To section).
140
141 The definition of the tiers has been agreed by the testing working group.
142
143 The tiers are:
144   * healthcheck
145   * smoke
146   * features
147   * components
148   * performance
149   * vnf
150   * stress
151
152 Functest abstraction classes
153 ============================
154
155 In order to harmonize test integration, 3 abstraction classes have been
156 introduced in Danube:
157
158  * testcase: base for any test case
159  * feature: abstraction for feature project
160  * vnf_base: abstraction for vnf onboarding
161
162 The goal is to unify the way to run test from Functest.
163
164 feature and vnf_base inherit from testcase::
165
166               +-----------------------------------------+
167               |                                         |
168               |         TestCase                        |
169               |                                         |
170               |         - init()                        |
171               |         - run()                         |
172               |         - publish_report()              |
173               |         - check_criteria()              |
174               |                                         |
175               +-----------------------------------------+
176                      |                       |
177                      V                       V
178          +--------------------+   +--------------------------+
179          |                    |   |                          |
180          |    feature         |   |      vnf_base            |
181          |                    |   |                          |
182          |  - prepare()       |   |  - prepare()             |
183          |  - execute()       |   |  - deploy_orchestrator() |
184          |  - post()          |   |  - deploy_vnf()          |
185          |  - parse_results() |   |  - test_vnf()            |
186          |                    |   |  - clean()               |
187          |                    |   |  - execute()             |
188          |                    |   |                          |
189          +--------------------+   +--------------------------+
190
191
192 Functest util classes
193 =====================
194
195 In order to simplify the creation of test cases, Functest develops some
196 functions that can be used by any feature or internal test cases.
197 Several features are supported such as logger, configuration management and
198 Openstack capabilities (snapshot, clean, tacker,..).
199 These functions can be found under <repo>/functest/utils and can be described as
200 follows:
201
202 functest/utils/
203 |-- config.py
204 |-- constants.py
205 |-- env.py
206 |-- functest_logger.py
207 |-- functest_utils.py
208 |-- openstack_clean.py
209 |-- openstack_snapshot.py
210 |-- openstack_tacker.py
211 `-- openstack_utils.py
212
213 Note that for Openstack, keystone v3 is now deployed by default by compass,
214 fuel and joid in Danube. All installers still support keystone v2 (deprecated in
215 next version).
216
217 Test collection framework
218 =========================
219
220 The OPNFV testing group created a test collection database to collect
221 the test results from CI:
222
223
224  http://testresults.opnfv.org/test/swagger/spec.html
225
226  Authentication: opnfv/api@opnfv
227
228 Any test project running on any lab integrated in CI can push the
229 results to this database.
230 This database can be used to see the evolution of the tests and compare
231 the results versus the installers, the scenarios or the labs.
232
233
234 Overall Architecture
235 --------------------
236 The Test result management can be summarized as follows::
237
238   +-------------+    +-------------+    +-------------+
239   |             |    |             |    |             |
240   |   Test      |    |   Test      |    |   Test      |
241   | Project #1  |    | Project #2  |    | Project #N  |
242   |             |    |             |    |             |
243   +-------------+    +-------------+    +-------------+
244            |               |               |
245            V               V               V
246        +-----------------------------------------+
247        |                                         |
248        |         Test Rest API front end         |
249        |  http://testresults.opnfv.org/test      |
250        |                                         |
251        +-----------------------------------------+
252            A                |
253            |                V
254            |     +-------------------------+
255            |     |                         |
256            |     |    Test Results DB      |
257            |     |         Mongo DB        |
258            |     |                         |
259            |     +-------------------------+
260            |
261            |
262      +----------------------+
263      |                      |
264      |    test Dashboard    |
265      |                      |
266      +----------------------+
267
268 TestAPI description
269 -------------------
270 The TestAPI is used to declare pods, projects, test cases and test
271 results. Pods are the pods used to run the tests.
272 The results pushed in the database are related to pods, projects and
273 cases. If you try to push results of test done on non referenced pod,
274 the API will return an error message.
275
276 An additional method dashboard has been added to post-process
277 the raw results in release Brahmaputra (deprecated in Colorado).
278
279 The data model is very basic, 5 objects are created:
280
281   * Pods
282   * Projects
283   * Testcases
284   * Results
285   * Scenarios
286
287 The code of the API is hosted in the releng repository `[6]`_.
288 The static documentation of the API can be found at `[17]`_.
289 The TestAPI has been dockerized and may be installed locally in your
290 lab. See `[15]`_ for details.
291
292 The deployment of the TestAPI has been automated.
293 A jenkins job manages:
294   * the unit tests of the TestAPI
295   * the creation of a new docker file
296   * the deployment of the new TestAPI
297   * the archive of the old TestAPI
298   * the backup of the Mongo DB
299
300 TestAPI Authorization
301 ~~~~~~~~~~~~~~~~~~~~~
302
303 PUT/DELETE/POST operations of the TestAPI now require token based authorization. The token needs
304 to be added in the request using a header 'X-Auth-Token' for access to the database.
305
306 e.g::
307     headers['X-Auth-Token']
308
309 The value of the header i.e the token can be accessed in the jenkins environment variable
310 *TestApiToken*. The token value is added as a masked password.
311
312 .. code-block:: python
313
314     headers['X-Auth-Token'] = os.environ.get('TestApiToken')
315
316 The above example is in Python. Token based authentication has been added so that only ci pods
317 jenkins job can have access to the database.
318
319 Please note that currently token authorization is implemented but is not yet enabled.
320
321   Automatic reporting
322   ===================
323
324   An automatic reporting page has been created in order to provide a
325   consistent view of the scenarios.
326   In this page, each scenario is evaluated according to test criteria.
327   The code for the automatic reporting is available at `[8]`_.
328
329   The results are collected from the centralized database every day and,
330   per scenario. A score is calculated based on the results from the last
331   10 days. This score is the addition of single test scores. Each test
332   case has a success criteria reflected in the criteria field from the
333   results.
334
335   Considering an instance of a scenario os-odl_l2-nofeature-ha, the
336   scoring is the addition of the scores of all the runnable tests from the
337   categories (tiers healthcheck, smoke and features)
338   corresponding to this scenario.
339
340
341    +---------------------+---------+---------+---------+---------+
342    | Test                | Apex    | Compass | Fuel    |  Joid   |
343    +=====================+=========+=========+=========+=========+
344    | vPing_ssh           |    X    |    X    |    X    |    X    |
345    +---------------------+---------+---------+---------+---------+
346    | vPing_userdata      |    X    |    X    |    X    |    X    |
347    +---------------------+---------+---------+---------+---------+
348    | tempest_smoke_serial|    X    |    X    |    X    |    X    |
349    +---------------------+---------+---------+---------+---------+
350    | rally_sanity        |    X    |    X    |    X    |    X    |
351    +---------------------+---------+---------+---------+---------+
352    | odl                 |    X    |    X    |    X    |    X    |
353    +---------------------+---------+---------+---------+---------+
354    | promise             |         |         |    X    |    X    |
355    +---------------------+---------+---------+---------+---------+
356    | doctor              |    X    |         |    X    |         |
357    +---------------------+---------+---------+---------+---------+
358    | security_scan       |    X    |         |         |         |
359    +---------------------+---------+---------+---------+---------+
360    | parser              |         |         |    X    |         |
361    +---------------------+---------+---------+---------+---------+
362    src: colorado (see release note for the last matrix version)
363
364   All the testcases listed in the table are runnable on
365   os-odl_l2-nofeature scenarios.
366   If no result is available or if all the results are failed, the test
367   case get 0 point.
368   If it was successful at least once but not anymore during the 4 runs,
369   the case get 1 point (it worked once).
370   If at least 3 of the last 4 runs were successful, the case get 2 points.
371   If the last 4 runs of the test are successful, the test get 3 points.
372
373   In the example above, the target score for fuel/os-odl_l2-nofeature-ha
374   is 3x6 = 18 points.
375
376   The scenario is validated per installer when we got 3 points for all
377   individual test cases (e.g 18/18).
378   Please note that complex or long duration tests are not considered for
379   the scoring. The success criteria are not always easy to define and may
380   require specific hardware configuration. These results however provide
381   a good level of trust on the scenario.
382
383   A web page is automatically generated every day to display the status.
384   This page can be found at `[9]`_. For the status, click on Status menu,
385   you may also get feedback for vims and tempest_smoke_serial test cases.
386
387   Any validated scenario is stored in a local file on the web server. In
388   fact as we are using a sliding windows to get results, it may happen
389   that a successful scenarios is no more run (because considered as
390   stable) and then the number of iterations (4 needed) would not be
391   sufficient to get the green status.
392
393   Please note that other test cases (e.g. sfc_odl, bgpvpn) need also
394   ODL configuration addons and as a consequence specific scenario.
395   There are not considered as runnable on the generic odl_l2 scenario.
396
397 Dashboard
398 =========
399
400 Dashboard is used to provide a consistent view of the results collected
401 in CI.
402 The results showed on the dashboard are post processed from the Database,
403 which only contains raw results.
404
405 In Brahmaputra, we created a basic dashboard.
406 Since Colorado, it was decided to adopt ELK framework. Mongo DB results
407 are extracted to feed Elasticsearch database (`[7]`_).
408
409 A script was developed to build elasticsearch data set. This
410 script can be found in `[16]`_.
411
412 For next versions, it was decided to integrated bitergia dashboard.
413 Bitergia already provides a dashboard for code and infrastructure.
414 A new Test tab will be added. The dataset will be built by consuming
415 the TestAPI.
416
417
418 =======
419 How TOs
420 =======
421
422 How Functest works?
423 ===================
424
425 The installation and configuration of the Functest docker image is
426 described in `[1]`_.
427
428 The procedure to start tests is described  in `[2]`_
429
430
431 How can I contribute to Functest?
432 =================================
433
434 If you are already a contributor of any OPNFV project, you can
435 contribute to functest. If you are totally new to OPNFV, you must first
436 create your Linux Foundation account, then contact us in order to
437 declare you in the repository database.
438
439 We distinguish 2 levels of contributors:
440
441  * the standard contributor can push patch and vote +1/0/-1 on any Functest patch
442  * The commitor can vote -2/-1/0/+1/+2 and merge
443
444 Functest commitors are promoted by the Functest contributors.
445
446
447 Where can I find some help to start?
448 ====================================
449
450 This guide is made for you. You can also have a look at the project wiki
451 page `[10]`_.
452 There are references on documentation, video tutorials, tips...
453
454 You can also directly contact us by mail with [Functest] prefix in the
455 title at opnfv-tech-discuss@lists.opnfv.org or on the IRC chan
456 #opnfv-functest.
457
458
459 What kind of testing do you do in Functest?
460 ===========================================
461
462 Functest is focusing on Functional testing. The results must be PASS or
463 FAIL. We do not deal with performance and/or qualification tests.
464 We consider OPNFV as a black box and execute our tests from the jumphost
465 according to Pharos reference technical architecture.
466
467 Upstream test suites are integrated (Rally/Tempest/ODL/ONOS,...).
468 If needed Functest may bootstrap temporarily testing activities if they
469 are identified but not covered yet by an existing testing project (e.g
470 security_scan before the creation of the security repository)
471
472
473 How are test constraints defined?
474 =================================
475
476 Test constraints are defined according to 2 parameters:
477
478  * The scenario (DEPLOY_SCENARIO env variable)
479  * The installer (INSTALLER_TYPE env variable)
480
481 A scenario is a formal description of the system under test.
482 The rules to define a scenario are described in `[4]`_
483
484 These 2 constraints are considered to determinate if the test is runnable
485 or not (e.g. no need to run onos suite on odl scenario).
486
487 In the test declaration for CI, the test owner shall indicate these 2
488 constraints. The file testcases.yaml `[5]`_ must be patched in git to
489 include new test cases. A more elaborated system based on template is
490 planned for next releases
491
492 For each dependency, it is possible to define a regex::
493
494     name: promise
495     criteria: 'success_rate == 100%'
496     description: >-
497         Test suite from Promise project.
498     dependencies:
499         installer: '(fuel)|(joid)'
500         scenario: ''
501
502 In the example above, it means that promise test will be runnable only
503 with joid or fuel installers on any scenario.
504
505 The vims criteria means any installer and exclude onos and odl with
506 bgpvpn scenarios::
507
508     name: vims
509     criteria: 'status == "PASS"'
510     description: >-
511         This test case deploys an OpenSource vIMS solution from Clearwater
512         using the Cloudify orchestrator. It also runs some signaling traffic.
513     dependencies:
514         installer: ''
515         scenario: '(ocl)|(nosdn)|^(os-odl)((?!bgpvpn).)*$'
516
517
518 How to write and check constraint regex?
519 =======================================
520
521 Regex are standard regex. You can have a look at  `[11]`_
522
523 You can also easily test your regex via an online regex checker such as `[12]`_.
524 Put your scenario in the TEST STRING window (e.g. os-odl_l3-ovs-ha), put
525 your regex in the REGULAR EXPRESSION window, then you can test your rule.
526
527
528 How to know which test I can run?
529 =================================
530
531 You can use the API `[13]`_. The static declaration is in git `[5]`_
532
533 If you are in a Functest docker container (assuming that the
534 environment has been prepared): just use the CLI.
535
536 You can get the list per Test cases or by Tier::
537
538     # functest testcase list
539     healthcheck
540     vping_ssh
541     vping_userdata
542     tempest_smoke_serial
543     rally_sanity
544     odl
545     doctor
546     security_scan
547     tempest_full_parallel
548     rally_full
549     vims
550     # functest tier list
551     - 0. healthcheck:
552     ['healthcheck']
553     - 1. smoke:
554     ['vping_ssh', 'vping_userdata', 'tempest_smoke_serial', 'rally_sanity']
555     - 2. sdn_suites:
556     ['odl']
557     - 3. features:
558     ['doctor', 'security_scan']
559     - 4. openstack:
560     ['tempest_full_parallel', 'rally_full']
561     - 5. vnf:
562     ['vims']
563
564
565 How to manually start Functest tests?
566 =====================================
567
568 Assuming that you are connected on the jumphost and that the system is
569 "Pharos compliant", i.e the technical architecture is compatible with
570 the one defined in the Pharos project::
571
572     # docker pull opnfv/functest:latest
573     # envs="-e INSTALLER_TYPE=fuel -e INSTALLER_IP=10.20.0.2 -e DEPLOY_SCENARIO=os-odl_l2-nofeature-ha -e CI_DEBUG=true"
574     # sudo docker run --privileged=true -id ${envs} opnfv/functest:latest /bin/bash
575
576
577 Then you must connect to the docker container and source the
578 credentials::
579
580     # docker ps (copy the id)
581     # docker exec -ti <container_id> bash
582     # source $creds
583
584
585 You must first check if the environment is ready::
586
587     # functest env status
588     Functest environment ready to run tests.
589
590
591 If not ready, prepare the env by launching::
592
593     # functest env prepare
594     Functest environment ready to run tests.
595
596 Once the Functest env is ready, you can use the CLI to start tests.
597
598 You can run test cases per test case or per tier:
599  # functest testcase run <case name> or # functest tier run  <tier name>
600
601
602 e.g::
603
604     # functest testcase run tempest_smoke_serial
605     # functest tier run features
606
607
608 If you want to run all the tests you can type::
609
610     # functest testcase run all
611
612
613 If you want to run all the tiers (same at the end that running all the
614 test cases) you can type::
615
616     # functest tier run all
617
618
619 How to declare my tests in Functest?
620 ====================================
621
622 If you want to add new internal test cases, you can submit patch under
623 the testcases directory of Functest repository.
624
625 For feature test integration, the code can be kept into your own
626 repository. The Functest files to be modified are:
627
628  * functest/docker/Dockerfile: get your code in Functest container
629  * functest/ci/testcases.yaml: reference your test and its associated constraints
630
631
632 Dockerfile
633 ----------
634
635 This file lists the repositories (internal or external) to be cloned in
636 the Functest container. You can also add external packages::
637
638  RUN git clone https://gerrit.opnfv.org/gerrit/<your project> ${REPOS_DIR}/<your project>
639
640 testcases.yaml
641 --------------
642
643 All the test cases that must be run from CI / CLI must be declared in
644 ci/testcases.yaml.
645
646 This file is used to get the constraints related to the test::
647
648     name: <my_super_test_case>
649     criteria: <not used yet in Colorado, could be > 'PASS', 'rate > 90%'
650     description: >-
651         <the description of your super test suite>
652     dependencies:
653         installer: regex related to installer e.g. 'fuel', '(apex)||(joid)'
654         scenario: regex related to the scenario e.g. 'ovs*no-ha'
655
656
657 You must declare your test case in one of the category (tier).
658
659 If you are integrating test suites from a feature project, the default
660 category is **features**.
661
662
663 How to select my list of tests for CI?
664 ======================================
665
666 Functest can be run automatically from CI, a jenkins job is usually
667 called after an OPNFV fresh installation.
668 By default we try to run all the possible tests (see `[14]` called from
669 Functest jenkins job)::
670
671     cmd="python ${FUNCTEST_REPO_DIR}/ci/run_tests.py -t all ${flags}"
672
673
674 Each case can be configured as daily and/or weekly task.
675 Weekly tasks are used for long duration or experimental tests.
676 Daily tasks correspond to the minimum set of test suites to validate a scenario.
677
678 When executing run_tests.py, a check based on the jenkins build tag will
679 be considered to detect whether it is a daily and/or a weekly test.
680
681 in your CI you can customize the list of test you want to run by case or
682 by tier, just change the line::
683
684     cmd="python ${FUNCTEST_REPO_DIR}/ci/run_tests.py -t <whatever you want> ${flags}"
685
686 e.g.::
687
688     cmd="python ${FUNCTEST_REPO_DIR}/ci/run_tests.py -t healthcheck,smoke ${flags}"
689
690 This command will run all the test cases of the first 2 tiers, i.e.
691 healthcheck, connection_check, api_check, vping_ssh, vping_userdata,
692 snaps_smoke, tempest_smoke_serial and rally_sanity.
693
694
695 How to push your results into the Test Database
696 ===============================================
697
698 The test database is used to collect test results. By default it is
699 enabled only for CI tests from Production CI pods.
700
701 The architecture and associated API is described in previous chapter.
702 If you want to push your results from CI, you just have to call the API
703 at the end of your script.
704
705 You can also reuse a python function defined in functest_utils.py::
706
707     def push_results_to_db(db_url, case_name, logger, pod_name,version, payload):
708       """
709       POST results to the Result target DB
710       """
711       url = db_url + "/results"
712       installer = get_installer_type(logger)
713       params = {"project_name": "functest", "case_name": case_name,
714                 "pod_name": pod_name, "installer": installer,
715                 "version": version, "details": payload}
716
717       headers = {'Content-Type': 'application/json'}
718       try:
719           r = requests.post(url, data=json.dumps(params), headers=headers)
720           if logger:
721               logger.debug(r)
722           return True
723       except Exception, e:
724           print "Error [push_results_to_db('%s', '%s', '%s', '%s', '%s')]:" \
725               % (db_url, case_name, pod_name, version, payload), e
726           return False
727
728
729 Where can I find the documentation on the test API?
730 ===================================================
731
732 http://artifacts.opnfv.org/releng/docs/testapi.html
733
734
735 How to exclude Tempest case from default Tempest smoke suite?
736 =============================================================
737
738 Tempest default smoke suite deals with 165 test cases.
739 Since Colorado the success criteria is 100%, i.e. if 1 test is failed the
740 success criteria is not matched for the scenario.
741
742 It is necessary to exclude some test cases that are expected to fail due to
743 known upstream bugs (see release notes).
744
745 A file has been created for such operation: https://git.opnfv.org/cgit/functest/tree/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt.
746
747 It can be described as follows::
748
749     -
750         scenarios:
751             - os-odl_l2-bgpvpn-ha
752             - os-odl_l2-bgpvpn-noha
753         installers:
754             - fuel
755             - apex
756         tests:
757             - tempest.api.compute.servers.test_create_server.ServersTestJSON.test_list_servers
758             - tempest.api.compute.servers.test_create_server.ServersTestJSON.test_verify_server_details
759             - tempest.api.compute.servers.test_create_server.ServersTestManualDisk.test_list_servers
760             - tempest.api.compute.servers.test_create_server.ServersTestManualDisk.test_verify_server_details
761             - tempest.api.compute.servers.test_server_actions.ServerActionsTestJSON.test_reboot_server_hard
762             - tempest.scenario.test_network_basic_ops.TestNetworkBasicOps.test_network_basic_ops
763             - tempest.scenario.test_server_basic_ops.TestServerBasicOps.test_server_basic_ops
764             - tempest.scenario.test_volume_boot_pattern.TestVolumeBootPattern.test_volume_boot_pattern
765             - tempest.scenario.test_volume_boot_pattern.TestVolumeBootPatternV2.test_volume_boot_pattern
766
767 Please note that each exclusion must be justified. the goal is not to exclude
768 test cases because they do not pass. Several scenarios reached the 100% criteria.
769 So it is expected in the patch submitted to exclude the cases to indicate the
770 reasons of the exclusion.
771
772
773 How do I know the Functest status of a scenario?
774 ================================================
775
776 A Functest automatic reporting page is generated daily.
777 This page is dynamically created through a cron job and is based on the results
778 stored in the Test DB.
779 You can access this reporting page: http://testresults.opnfv.org/reporting
780
781 See https://wiki.opnfv.org/pages/viewpage.action?pageId=6828617 for details.
782
783
784 I have tests, to which category should I declare them?
785 ======================================================
786
787 CATEGORIES/TIERS description:
788
789 +----------------+-------------------------------------------------------------+
790 | healthcheck    | Simple OpenStack healthcheck tests case that validates the  |
791 |                | basic operations in OpenStack                               |
792 +----------------+-------------------------------------------------------------+
793 |   Smoke        | Set of smoke test cases/suites to validate the most common  |
794 |                | OpenStack and SDN Controller operations                     |
795 +----------------+-------------------------------------------------------------+
796 |   Features     | Test cases that validate a specific feature on top of OPNFV.|
797 |                | Those come from Feature projects and need a bit of support  |
798 |                | for integration                                             |
799 +----------------+-------------------------------------------------------------+
800 | Components     | Advanced OpenStack tests: Full Tempest, Full Rally          |
801 +----------------+-------------------------------------------------------------+
802 | Performance    | Out of Functest Scope                                       |
803 +----------------+-------------------------------------------------------------+
804 | VNF            | Test cases related to deploy an open source VNF including   |
805 |                | an orchestrator                                             |
806 +----------------+-------------------------------------------------------------+
807
808 The main ambiguity could be between features and VNF.
809 In fact sometimes you have to spawn VMs to demonstrate the capabilities of the
810 feature you introduced.
811 We recommend to declare your test in the feature category.
812
813 VNF category is really dedicated to test including:
814
815  * creation of resources
816  * deployment of an orchestrator/VNFM
817  * deployment of the VNF
818  * test of the VNFM
819  * free resources
820
821 The goal is not to study a particular feature on the infrastructure but to have
822 a whole end to end test of a VNF automatically deployed in CI.
823 Moreover VNF are run in weekly jobs (one a week), feature tests are in daily
824 jobs and use to get a scenario score.
825
826 Where are the logs?
827 ===================
828
829 Functest deals with internal and external testcases. Each testcase can generate
830 logs.
831
832 Since Colorado we introduce the possibility to push the logs to the artifact.
833 A new script (https://git.opnfv.org/releng/tree/utils/push-test-logs.sh) has
834 been created for CI.
835
836 When called, and assuming that the POD is authorized to push the logs to
837 artifacts, the script will push all the results or logs locally stored under
838 /home/opnfv/functest/results/.
839
840 If the POD is not connected to CI, logs are not pushed.
841 But in both cases, logs are stored in /home/opnfv/functest/results in the
842 container.
843 Projects are encouraged to push their logs here.
844
845 Since Colorado it is also easy for feature project to integrate this feature by
846 adding the log file as output_file parameter when calling execute_command from
847 functest_utils library
848
849   ret_val = functest_utils.execute_command(cmd, output_file=log_file)
850
851
852 How does Functest deal with VNF onboarding?
853 ===========================================
854
855 VNF onboarding has been introduced in Brahmaputra through the automation of a
856 clearwater vIMS deployed thanks to cloudify orchestrator.
857
858 This automation has been described at OpenStack summit Barcelona:
859 https://youtu.be/Jr4nG74glmY
860
861 The goal of Functest consists in testing OPNFV from a functional perspective:
862 the NFVI and/or the features developed in OPNFV. Feature test suites are
863 provided by the feature project. Functest just simplifies the integration of
864 the suite into the CI and gives a consolidated view of the tests per scenario.
865
866 Functest does not develop VNFs.
867
868 Functest does not test any MANO stack.
869
870 OPNFV projects dealing with VNF onboarding
871 ------------------------------------------
872
873 Testing VNF is not the main goal however it gives interesting and realistic
874 feedback on OPNFV as a Telco cloud.
875
876 Onboarding VNF also allows to test a full stack: orchestrator + VNF.
877
878 Functest is VNF and MANO stack agnostic.
879
880 An internship has been initiated to reference the Open Source VNF: Intern
881 Project Open Source VNF catalog
882
883 New projects dealing with orchestrators or VNFs are candidate for Danube.
884
885 The 2 projects dealing with orchestration are:
886
887  * orchestra (Openbaton)
888  * opera (Open-O)
889
890 The Models project address various goals for promoting availability and
891 convergence of information and/or data models related to NFV service/VNF
892 management, as being defined in standards (SDOs) and as developed in open
893 source projects.
894
895 Functest VNF onboarding
896 -----------------------
897
898 In order to simplify VNF onboarding a new abstraction class has been developed
899 in Functest.
900
901 This class is based on vnf_base and can be described as follow:
902
903  +------------+             +--------------+
904  | test_base  |------------>|   vnf_base   |
905  +------------+             +--------------+
906                               |_ prepare
907                                   |_ deploy_orchestrator (optional)
908                                       |_ deploy_vnf
909                                         |_ test_vnf
910                                           |_ clean
911
912
913 Several methods are declared in vnf_base:
914
915  * prepare
916  * deploy_orchestrator
917  * deploy_vnf
918  * test_vnf
919  * clean
920
921 deploy_vnf and test_vnf are mandatory.
922
923 prepare will create a user and a project.
924
925 How to declare your orchestrator/VNF?
926 -------------------------------------
927 1) test declaration
928
929 You must declare your testcase in the file <Functest repo>/functest/ci/testcases.yaml
930
931 2) configuration
932
933 You can precise some configuration parameters in config_functest.yaml
934
935 3) implement your test
936
937 Create your own VnfOnboarding file
938
939 you must create your entry point through a python class as referenced in the
940 configuration file
941
942 e.g. aaa => creation of the file <Functest repo>/functest/opnfv_tests/vnf/aaa/aaa.py
943
944 the class shall inherit vnf_base.
945 You must implement the methods deploy_vnf() and test_vnf() and may implement
946 deploy_orchestrator()
947
948 you can call the code from your repo (but need to add the repo in Functest if
949 it is not the case)
950
951 4) success criteria
952
953 So far we considered the test as PASS if vnf_deploy and test_vnf is PASS
954 (see example in aaa).
955
956 ==========
957 References
958 ==========
959
960 _`[1]`: http://artifacts.opnfv.org/functest/docs/configguide/index.html Functest configuration guide
961
962 _`[2]`: http://artifacts.opnfv.org/functest/docs/userguide/index.html functest user guide
963
964 _`[3]`: https://wiki.opnfv.org/opnfv_test_dashboard Brahmaputra dashboard
965
966 _`[4]`: https://wiki.opnfv.org/display/INF/CI+Scenario+Naming
967
968 _`[5]`: https://git.opnfv.org/cgit/functest/tree/ci/testcases.yaml
969
970 _`[6]`: https://git.opnfv.org/cgit/releng/tree/utils/test/result_collection_api
971
972 _`[7]`: https://git.opnfv.org/cgit/releng/tree/utils/test/scripts
973
974 _`[8]`: https://git.opnfv.org/cgit/releng/tree/utils/test/reporting/functest
975
976 _`[9]`: http://testresults.opnfv.org/reporting/
977
978 _`[10]`: https://wiki.opnfv.org/opnfv_functional_testing
979
980 _`[11]`: https://docs.python.org/2/howto/regex.html
981
982 _`[12]`: https://regex101.com/
983
984 _`[13]`: http://testresults.opnfv.org/test/api/v1/projects/functest/cases
985
986 _`[14]`: https://git.opnfv.org/cgit/releng/tree/jjb/functest/functest-daily.sh
987
988 _`[15]`: https://git.opnfv.org/cgit/releng/tree/utils/test/result_collection_api/README.rst
989
990 _`[16]`: https://git.opnfv.org/cgit/releng/tree/utils/test/scripts/mongo_to_elasticsearch.py
991
992 _`[17]`: http://artifacts.opnfv.org/releng/docs/testapi.html
993
994 OPNFV main site: http://www.opnfv.org
995
996 OPNFV functional test page: https://wiki.opnfv.org/opnfv_functional_testing
997
998 IRC support chan: #opnfv-functest
999
1000 _`OpenRC`: http://docs.openstack.org/user-guide/common/cli_set_environment_variables_using_openstack_rc.html
1001
1002 _`Rally installation procedure`: https://rally.readthedocs.org/en/latest/tutorial/step_0_installation.html
1003
1004 _`config_functest.yaml` : https://git.opnfv.org/cgit/functest/tree/functest/ci/config_functest.yaml