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