1 ******************************
2 OPNFV FUNCTEST developer guide
3 ******************************
14 Functest is a project dealing with functional testing.
15 Functest produces its own internal test cases but can also be considered
16 as a framework to support feature and VNF onboarding project testing.
17 Functest developed a test API and defined a test collection framework
18 that can be used by any OPNFV project.
20 Therefore there are many ways to contribute to Functest. You can:
22 * Develop new internal test cases
23 * Integrate the tests from your feature project
24 * Develop the framework to ease the integration of external test cases
25 * Develop the API / Test collection framework
26 * Develop dashboards or automatic reporting portals
28 This document describes how, as a developer, you may interact with the
29 Functest project. The first section details the main working areas of
30 the project. The Second part is a list of "How to" to help you to join
31 the Functest family whatever your field of interest is.
34 ========================
35 Functest developer areas
36 ========================
39 Functest High level architecture
40 ================================
42 Functest is project delivering a test container dedicated to OPNFV.
43 It includes the tools, the scripts and the test scenarios.
45 Functest can be described as follow::
47 +----------------------+
49 | +--------------+ | +-------------------+
51 | | Tools | +------------------+ OPNFV |
52 | | Scripts | | | System Under Test |
53 | | Scenarios | +------------------+ |
54 | | | | Management | |
55 | +--------------+ | +-------------------+
59 +----------------------+
61 Functest internal test cases
62 ============================
63 The internal test cases in Danube are:
72 * tempest_smoke_serial
74 * tempest_full_parallel
78 By internal, we mean that this particular test cases have been
79 developped and/or integrated by functest contributors and the associated
80 code is hosted in the Functest repository.
81 An internal case can be fully developped or a simple integration of
82 upstream suites (e.g. Tempest/Rally developped in OpenStack are just
83 integrated in Functest).
84 The structure of this repository is detailed in `[1]`_.
85 The main internal test cases are in the opnfv_tests subfolder of the
86 repository, the internal test cases are:
89 * openstack: healthcheck, vping_ssh, vping_userdata, tempest_*, rally_*, connection_check, api_check, snaps_smoke
92 If you want to create a new test case you will have to create a new
93 folder under the testcases directory.
95 Functest external test cases
96 ============================
97 The external test cases are inherited from other OPNFV projects,
98 especially the feature projects.
100 The external test cases are:
117 The code to run these test cases may be directly in the repository of
118 the project. We have also a **features** sub directory under opnfv_tests
119 directory that may be used (it can be usefull if you want to reuse
125 Functest can be considered as a framework.
126 Functest is release as a docker file, including tools, scripts and a CLI
127 to prepare the environement and run tests.
128 It simplifies the integration of external test suites in CI pipeline
129 and provide commodity tools to collect and display results.
131 Since Colorado, test categories also known as tiers have been created to
132 group similar tests, provide consistant sub-lists and at the end optimize
133 test duration for CI (see How To section).
135 The definition of the tiers has been agreed by the testing working group.
146 Functest abstraction classes
147 ============================
149 In order to harmonize test integration, 3 abstraction classes have been
150 introduced in Danube:
152 * testcase_base: base for any test case
153 * feature_base: abstraction for feature project
154 * vnf_base: abstraction for vnf onboarding
156 The goal is to unify the way to run test from Functest.
158 feature_base and vnf_base inherit from testcase_base.
160 +-----------------------------------------+
166 | - publish_report() |
167 | - check_criteria() |
169 +-----------------------------------------+
172 +--------------------+ +--------------------------+
174 | feature_base | | vnf_base |
176 | - prepare() | | - prepare() |
177 | - post() | | - deploy_orchestrator() |
178 | - parse_results() | | - deploy_vnf() |
183 +--------------------+ +--------------------------+
186 Functest util classes
187 =====================
189 In order to simplify the creation of test cases, Functest develops some
190 functions that can be used by any feature or internal test cases.
191 Several features are supported such as logger, configuration management and
192 Openstack capabilities (snapshot, clean, tacker,..).
193 These functions can be found under <repo>/functest/utils and can be described as
200 |-- functest_constants.py
201 |-- functest_logger.py
202 |-- functest_utils.py
203 |-- openstack_clean.py
204 |-- openstack_snapshot.py
205 |-- openstack_tacker.py
206 `-- openstack_utils.py
208 Note that for Openstack, keystone v3 is now deployed by default by compass,
209 fuel and joid in Danube. All installers still support keysone v2 (deprecated in
212 Test collection framework
213 =========================
215 The OPNFV testing group created a test collection database to collect
216 the test results from CI:
219 http://testresults.opnfv.org/test/swagger/spec.html
221 Authentication: opnfv/api@opnfv
223 Any test project running on any lab integrated in CI can push the
224 results to this database.
225 This database can be used to see the evolution of the tests and compare
226 the results versus the installers, the scenarios or the labs.
231 The Test result management can be summarized as follows::
233 +-------------+ +-------------+ +-------------+
235 | Test | | Test | | Test |
236 | Project #1 | | Project #2 | | Project #N |
238 +-------------+ +-------------+ +-------------+
241 +-----------------------------------------+
243 | Test Rest API front end |
244 | http://testresults.opnfv.org/test |
246 +-----------------------------------------+
249 | +-------------------------+
251 | | Test Results DB |
254 | +-------------------------+
257 +----------------------+
261 +----------------------+
265 The Test API is used to declare pods, projects, test cases and test
266 results. Pods are the pods used to run the tests.
267 The results pushed in the database are related to pods, projects and
268 cases. If you try to push results of test done on non referenced pod,
269 the API will return an error message.
271 An additional method dashboard has been added to post-process
272 the raw results in release Brahmaputra (deprecated in Colorado).
274 The data model is very basic, 4 objects are created:
285 "details": <URL description of the POD>,
286 "creation_date": "YYYY-MM-DD HH:MM:SS",
287 "name": <The POD Name>,
288 "mode": <metal or virtual>,
289 "role": <ci-pod or community-pod or single-node>
296 "name": <Name of the Project>,
297 "creation_date": "YYYY-MM-DD HH:MM:SS",
298 "description": <Short description>
305 "name":<Name of the test case>,
306 "project_name":<Name of belonged project>,
307 "creation_date": "YYYY-MM-DD HH:MM:SS",
308 "description": <short description>,
309 "url":<URL for longer description>
316 "case_name": <Reference to the test case>,
317 "project_name": <Reference to project>,
318 "pod_name": <Reference to POD where the test was executed>,
319 "installer": <Installer Apex or Compass or Fuel or Joid>,
320 "version": <master or Colorado or Brahmaputra>,
321 "start_date": "YYYY-MM-DD HH:MM:SS",
322 "stop_date": "YYYY-MM-DD HH:MM:SS",
323 "build_tag": <such as "jenkins-functest-fuel-baremetal-daily-master-108">,
324 "scenario": <Scenario on which the test was executed>,
325 "criteria": <PASS or FAILED>,
332 The API can described as follows. For detailed information, please go to
334 http://testresults.opnfv.org/test/swagger/spec.html
336 Authentication: opnfv/api@opnfv
340 +--------+--------------------------+-----------------------------------------+
341 | Method | Path | Description |
342 +========+==========================+=========================================+
343 | GET | /versions | Get all supported API versions |
344 +--------+--------------------------+-----------------------------------------+
349 +--------+----------------------------+-----------------------------------------+
350 | Method | Path | Description |
351 +========+============================+=========================================+
352 | GET | /api/v1/pods | Get the list of declared Labs (PODs) |
353 +--------+----------------------------+-----------------------------------------+
354 | POST | /api/v1/pods | Declare a new POD |
355 | | | Content-Type: application/json |
357 | | | "name": "pod_foo", |
358 | | | "mode": "metal", |
359 | | | "role": "ci-pod", |
360 | | | "details": "it is a ci pod" |
362 +--------+----------------------------+-----------------------------------------+
363 | GET | /api/v1/pods/{pod_name} | Get a declared POD |
364 +--------+----------------------------+-----------------------------------------+
368 +--------+----------------------------+-----------------------------------------+
369 | Method | Path | Description |
370 +========+============================+=========================================+
371 | GET | /api/v1/projects | Get the list of declared projects |
372 +--------+----------------------------+-----------------------------------------+
373 | POST | /api/v1/projects | Declare a new test project |
374 | | | Content-Type: application/json |
376 | | | "name": "project_foo", |
377 | | | "description": "whatever you want" |
379 +--------+----------------------------+-----------------------------------------+
380 | DELETE | /api/v1/projects/{project} | Delete a test project |
381 +--------+----------------------------+-----------------------------------------+
382 | GET | /api/v1/projects/{project} | Get details on a {project} |
384 +--------+----------------------------+-----------------------------------------+
385 | PUT | /api/v1/projects/{project} | Update a test project |
387 | | | Content-Type: application/json |
389 | | | <the field(s) you want to modify> |
391 +--------+----------------------------+-----------------------------------------+
396 +--------+----------------------------+-----------------------------------------+
397 | Method | Path | Description |
398 +========+============================+=========================================+
399 | GET | /api/v1/projects/{project}/| Get the list of testcases of {project} |
401 +--------+----------------------------+-----------------------------------------+
402 | POST | /api/v1/projects/{project}/| Add a new test case to {project} |
403 | | cases | Content-Type: application/json |
405 | | | "name": "case_foo", |
406 | | | "description": "whatever you want" |
407 | | | "url": "whatever you want" |
409 +--------+----------------------------+-----------------------------------------+
410 | DELETE | /api/v1/projects/{project}/| Delete a test case |
412 +--------+----------------------------+-----------------------------------------+
413 | GET | /api/v1/projects/{project}/| Get a declared test case |
415 +--------+----------------------------+-----------------------------------------+
416 | PUT | /api/v1/projects/{project}?| Modify a test case of {project} |
418 | | | Content-Type: application/json |
420 | | | <the field(s) you want to modify> |
422 +--------+----------------------------+-----------------------------------------+
426 +--------+----------------------------+------------------------------------------+
427 | Method | Path | Description |
428 +========+============================+==========================================+
429 | GET | /api/v1/results | Get all the test results |
430 +--------+----------------------------+------------------------------------------+
431 | POST | /api/v1/results | Add a new test results |
432 | | | Content-Type: application/json |
434 | | | "project_name": "project_foo", |
435 | | | "scenario": "odl-l2", |
436 | | | "stop_date": "2016-05-28T14:42:58.384Z", |
437 | | | "trust_indicator": 0.5, |
438 | | | "case_name": "vPing", |
439 | | | "build_tag": "", |
440 | | | "version": "Colorado", |
441 | | | "pod_name": "pod_foo", |
442 | | | "criteria": "PASS", |
443 | | | "installer": "fuel", |
444 | | | "start_date": "2016-05-28T14:41:58.384Z",|
445 | | | "details": <your results> |
447 +--------+----------------------------+------------------------------------------+
448 | GET | /api/v1/results? | Get the test results of {case} |
450 +--------+----------------------------+------------------------------------------+
451 | GET | /api/v1/results? | Get the test results of build_tag |
452 | | build_tag={tag} | {tag}. |
453 +--------+----------------------------+------------------------------------------+
454 | GET | /api/v1/results? | Get last {N} records of test results |
456 +--------+----------------------------+------------------------------------------+
457 | GET | /api/v1/results? | Get the test results of scenario |
458 | | scenario={scenario} | {scenario}. |
459 +--------+----------------------------+------------------------------------------+
460 | GET | /api/v1/results? | Get the test results of trust_indicator |
461 | | trust_indicator={ind} | {ind}. |
462 +--------+----------------------------+------------------------------------------+
463 | GET | /api/v1/results? | Get the test results of last days |
464 | | period={period} | {period}. |
465 +--------+----------------------------+------------------------------------------+
466 | GET | /api/v1/results? | Get the test results of {project} |
467 | | project={project} | |
468 +--------+----------------------------+------------------------------------------+
469 | GET | /api/v1/results? | Get the test results of version |
470 | | version={version} | {version}. |
471 +--------+----------------------------+------------------------------------------+
472 | GET | /api/v1/results? | Get the test results of criteria |
473 | | criteria={criteria} | {criteria}. |
474 +--------+----------------------------+------------------------------------------+
475 | GET | /api/v1/results? | get the results on pod {pod} |
477 +--------+----------------------------+------------------------------------------+
478 | GET | /api/v1/results? | Get the test results of installer {inst} |
479 | | installer={inst} | |
480 +--------+----------------------------+------------------------------------------+
481 | GET | /api/v1/results? | Get the results according to combined |
482 | | <query conditions> | query conditions supported above |
483 +--------+----------------------------+------------------------------------------+
484 | GET | /api/v1/results/{result_id}| Get the test result by result_id |
485 +--------+----------------------------+------------------------------------------+
489 +--------+----------------------------+-----------------------------------------+
490 | Method | Path | Description |
491 +========+============================+=========================================+
492 | GET | /api/v1/scenarios | Get the list of declared scenarios |
493 +--------+----------------------------+-----------------------------------------+
494 | POST | /api/v1/scenario | Declare a new scenario |
495 +--------+----------------------------+-----------------------------------------+
496 | GET | /api/v1/scenario? | Get a declared scenario |
497 | | <query conditions> | |
498 +--------+----------------------------+-----------------------------------------+
501 The code of the API is hosted in the releng repository `[6]`_.
502 The static documentation of the API can be found at `[17]`_.
503 The test API has been dockerized and may be installed locally in your
504 lab. See `[15]`_ for details.
506 The deployment of the test API has been automated.
507 A jenkins job manages:
508 * the unit tests of the test api
509 * the creation of a new docker file
510 * the deployment of the new test api
511 * the archive of the old test api
512 * the backup of the Mongo DB
514 Test API Authorization
515 ~~~~~~~~~~~~~~~~~~~~~~
517 PUT/DELETE/POST operations of the testapi now require token based authorization. The token needs
518 to be added in the request using a header 'X-Auth-Token' for access to the database.
521 headers['X-Auth-Token']
523 The value of the header i.e the token can be accessed in the jenkins environment variable
524 *TestApiToken*. The token value is added as a masked password.
526 .. code-block:: python
528 headers['X-Auth-Token'] = os.environ.get('TestApiToken')
530 The above example is in Python. Token based authentication has been added so that only ci pods
531 jenkins job can have access to the database.
533 Please note that currently token authorization is implemented but is not yet enabled.
538 An automatic reporting page has been created in order to provide a
539 consistant view of the scenarios.
540 In this page, each scenario is evaluated according to test criteria.
541 The code for the automatic reporting is available at `[8]`_.
543 The results are collected from the centralized database every day and,
544 per scenario. A score is calculated based on the results from the last
545 10 days. This score is the addition of single test scores. Each test
546 case has a success criteria reflected in the criteria field from the
549 Considering an instance of a scenario os-odl_l2-nofeature-ha, the
550 scoring is the addition of the scores of all the runnable tests from the
551 categories (tiers healthcheck, smoke and features)
552 corresponding to this scenario.
555 +---------------------+---------+---------+---------+---------+
556 | Test | Apex | Compass | Fuel | Joid |
557 +=====================+=========+=========+=========+=========+
558 | vPing_ssh | X | X | X | X |
559 +---------------------+---------+---------+---------+---------+
560 | vPing_userdata | X | X | X | X |
561 +---------------------+---------+---------+---------+---------+
562 | tempest_smoke_serial| X | X | X | X |
563 +---------------------+---------+---------+---------+---------+
564 | rally_sanity | X | X | X | X |
565 +---------------------+---------+---------+---------+---------+
566 | odl | X | X | X | X |
567 +---------------------+---------+---------+---------+---------+
568 | promise | | | X | X |
569 +---------------------+---------+---------+---------+---------+
570 | doctor | X | | X | |
571 +---------------------+---------+---------+---------+---------+
572 | security_scan | X | | | |
573 +---------------------+---------+---------+---------+---------+
575 +---------------------+---------+---------+---------+---------+
576 | copper | X | | | X |
577 +---------------------+---------+---------+---------+---------+
579 All the testcases listed in the table are runnable on
580 os-odl_l2-nofeature scenarios.
581 If no result is available or if all the results are failed, the test
583 If it was succesfull at least once but not anymore during the 4 runs,
584 the case get 1 point (it worked once).
585 If at least 3 of the last 4 runs were successful, the case get 2 points.
586 If the last 4 runs of the test are successful, the test get 3 points.
588 In the example above, the target score for fuel/os-odl_l2-nofeature-ha
591 The scenario is validated per installer when we got 3 points for all
592 individual test cases (e.g 18/18).
593 Please note that complex or long duration tests are not considered for
594 the scoring. The success criteria are not always easy to define and may
595 require specific hardware configuration. These results however provide
596 a good level of trust on the scenario.
598 A web page is automatically generated every day to display the status.
599 This page can be found at `[9]`_. For the status, click on Status menu,
600 you may also get feedback for vims and tempest_smoke_serial test cases.
602 Any validated scenario is stored in a local file on the web server. In
603 fact as we are using a sliding windows to get results, it may happen
604 that a successful scenarios is no more run (because considered as
605 stable) and then the number of iterations (4 needed) would not be
606 sufficient to get the green status.
608 Please note that other test cases (e.g. sfc_odl, bgpvpn) need also
609 ODL configuration addons and as a consequence specific scenario.
610 There are not considered as runnable on the generic odl_l2 scenario.
615 Dashboard is used to provide a consistant view of the results collected
617 The results showed on the dashboard are post processed from the Database,
618 which only contains raw results.
620 In Brahmaputra, we created a basic dashboard.
621 Since Colorado, it was decided to adopt ELK framework. Mongo DB results
622 are extracted to feed Elasticsearch database (`[7]`_).
624 A script was developed to build elasticsearch data set. This
625 script can be found in `[16]`_.
627 For next versions, it was decided to integrated bitergia dashboard.
628 Bitergia already provides a dashboard for code and infrastructure.
629 A new Test tab will be added. The dataset will be built by consuming
640 The installation and configuration of the Functest docker image is
643 The procedure to start tests is described in `[2]`_
646 How can I contribute to Functest?
647 =================================
649 If you are already a contributor of any OPNFV project, you can
650 contribute to functest. If you are totally new to OPNFV, you must first
651 create your Linux Foundation account, then contact us in order to
652 declare you in the repository database.
654 We distinguish 2 levels of contributors:
656 * the standard contributor can push patch and vote +1/0/-1 on any Functest patch
657 * The commitor can vote -2/-1/0/+1/+2 and merge
659 Functest commitors are promoted by the Functest contributors.
662 Where can I find some help to start?
663 ====================================
665 This guide is made for you. You can also have a look at the project wiki
667 There are references on documentation, video tutorials, tips...
669 You can also directly contact us by mail with [Functest] prefix in the
670 title at opnfv-tech-discuss@lists.opnfv.org or on the IRC chan
674 What kind of testing do you do in Functest?
675 ===========================================
677 Functest is focusing on Functional testing. The results must be PASS or
678 FAIL. We do not deal with performance and/or qualification tests.
679 We consider OPNFV as a black box and execute our tests from the jumphost
680 according to Pharos reference technical architecture.
682 Upstream test suites are integrated (Rally/Tempest/ODL/ONOS,...).
683 If needed Functest may bootstrap temporarily testing activities if they
684 are identified but not covered yet by an existing testing project (e.g
685 security_scan before the creation of the security repository)
688 How test constraints are defined?
689 =================================
691 Test constraints are defined according to 2 paramaters:
693 * The scenario (DEPLOY_SCENARIO env variable)
694 * The installer (INSTALLER_TYPE env variable)
696 A scenario is a formal description of the system under test.
697 The rules to define a scenario are described in `[4]`_
699 These 2 constraints are considered to determinate if the test is runnable
700 or not (e.g. no need to run onos suite on odl scenario).
702 In the test declaration for CI, the test owner shall indicate these 2
703 constraints. The file testcases.yaml `[5]`_ must be patched in git to
704 include new test cases. A more elaborated system based on template is
705 planned for next releases
707 For each dependency, it is possible to define a regex::
710 criteria: 'success_rate == 100%'
712 Test suite from Promise project.
714 installer: '(fuel)|(joid)'
717 In the example above, it means that promise test will be runnable only
718 with joid or fuel installers on any scenario.
720 The vims criteria means any installer and exclude onos and odl with
724 criteria: 'status == "PASS"'
726 This test case deploys an OpenSource vIMS solution from Clearwater
727 using the Cloudify orchestrator. It also runs some signaling traffic.
730 scenario: '(ocl)|(nosdn)|^(os-odl)((?!bgpvpn).)*$'
733 How to write and check constaint regex?
734 =======================================
736 Regex are standard regex. You can have a look at `[11]`_
738 You can also easily test your regex via an online regex checker such as `[12]`_.
739 Put your scenario in the TEST STRING window (e.g. os-odl_l3-ovs-ha), put
740 your regex in the REGULAR EXPRESSION window, then you can test your rule
744 How to know which test I can run?
745 =================================
747 You can use the API `[13]`_. The static declaration is in git `[5]`_
749 If you are in a Functest docker container (assuming that the
750 environement has been prepared): just use the CLI.
752 You can get the list per Test cases or by Tier::
754 # functest testcase list
763 tempest_full_parallel
770 ['vping_ssh', 'vping_userdata', 'tempest_smoke_serial', 'rally_sanity']
774 ['doctor', 'security_scan']
776 ['tempest_full_parallel', 'rally_full']
781 How to manually start Functest tests?
782 =====================================
784 Assuming that you are connected on the jumphost and that the system is
785 "Pharos compliant", i.e the technical architecture is compatible with
786 the one defined in the Pharos project::
788 # docker pull opnfv/functest:latest
789 # envs="-e INSTALLER_TYPE=fuel -e INSTALLER_IP=10.20.0.2 -e DEPLOY_SCENARIO=os-odl_l2-nofeature-ha -e CI_DEBUG=true"
790 # sudo docker run --privileged=true -id ${envs} opnfv/functest:latest /bin/bash
793 Then you must connect to the docker container and source the
796 # docker ps (copy the id)
797 # docker exec -ti <container_id> bash
801 You must first check if the environment is ready::
803 # functest env status
804 Functest environment ready to run tests.
807 If not ready, prepare the env by launching::
809 # functest env prepare
810 Functest environment ready to run tests.
812 Once the Functest env is ready, you can use the CLI to start tests.
814 You can run test cases per test case or per tier:
815 # functest testcase run <case name> or # functest tier run <tier name>
820 # functest testcase run tempest_smoke_serial
821 # functest tier run features
824 If you want to run all the tests you can type::
826 # functest testcase run all
829 If you want to run all the tiers (same at the end that running all the
830 test cases) you can type::
832 # functest tier run all
835 How to declare my tests in Functest?
836 ====================================
838 If you want to add new internal test cases, you can submit patch under
839 the testcases directory of Functest repository.
841 For feature test integration, the code can be kept into your own
842 repository. The Functest files to be modified are:
844 * functest/docker/Dockerfile: get your code in Functest container
845 * functest/ci/testcases.yaml: reference your test and its associated constraints
851 This file lists the repositories (internal or external) to be cloned in
852 the Functest container. You can also add external packages::
854 RUN git clone https://gerrit.opnfv.org/gerrit/<your project> ${REPOS_DIR}/<your project>
859 All the test cases that must be run from CI / CLI must be declared in
862 This file is used to get the constraints related to the test::
864 name: <my_super_test_case>
865 criteria: <not used yet in Colorado, could be > 'PASS', 'rate > 90%'
867 <the description of your super test suite>
869 installer: regex related to installer e.g. 'fuel', '(apex)||(joid)'
870 scenario: regex related to the scenario e.g. 'ovs*no-ha'
873 You must declare your test case in one of the category (tier).
875 If you are integrating test suites from a feature project, the default
876 category is **features**.
879 How to select my list of tests for CI?
880 ======================================
882 Functest can be run automatically from CI, a jenkins job is usually
883 called after an OPNFV fresh installation.
884 By default we try to run all the possible tests (see `[14]` called from
885 Functest jenkins job)::
887 cmd="python ${FUNCTEST_REPO_DIR}/ci/run_tests.py -t all ${flags}"
890 Each case can be configured as daily and/or weekly task.
891 Weekly tasks are used for long duration or experimental tests.
892 Daily tasks correspond to the minimum set of test suites to validate a scenario.
894 When executing run_tests.py, a check based on the jenkins build tag will
895 be considered to detect whether it is a daily and/or a weekly test.
897 in your CI you can customize the list of test you want to run by case or
898 by tier, just change the line::
900 cmd="python ${FUNCTEST_REPO_DIR}/ci/run_tests.py -t <whatever you want> ${flags}"
904 cmd="python ${FUNCTEST_REPO_DIR}/ci/run_tests.py -t healthcheck,smoke ${flags}"
906 This command will run all the test cases of the first 2 tiers, i.e.
907 healthcheck, connection_check, api_check, vping_ssh, vping_userdata,
908 snaps_somke, tempest_smoke_serial and rally_sanity.
911 How to push your results into the Test Database
912 ===============================================
914 The test database is used to collect test results. By default it is
915 enabled only for CI tests from Production CI pods.
917 The architecture and associated API is described in previous chapter.
918 If you want to push your results from CI, you just have to call the API
919 at the end of your script.
921 You can also reuse a python function defined in functest_utils.py::
923 def push_results_to_db(db_url, case_name, logger, pod_name,version, payload):
925 POST results to the Result target DB
927 url = db_url + "/results"
928 installer = get_installer_type(logger)
929 params = {"project_name": "functest", "case_name": case_name,
930 "pod_name": pod_name, "installer": installer,
931 "version": version, "details": payload}
933 headers = {'Content-Type': 'application/json'}
935 r = requests.post(url, data=json.dumps(params), headers=headers)
940 print "Error [push_results_to_db('%s', '%s', '%s', '%s', '%s')]:" \
941 % (db_url, case_name, pod_name, version, payload), e
949 _`[1]`: http://artifacts.opnfv.org/functest/docs/configguide/index.html Functest configuration guide
951 _`[2]`: http://artifacts.opnfv.org/functest/docs/userguide/index.html functest user guide
953 _`[3]`: https://wiki.opnfv.org/opnfv_test_dashboard Brahmaputra dashboard
955 _`[4]`: https://wiki.opnfv.org/display/INF/CI+Scenario+Naming
957 _`[5]`: https://git.opnfv.org/cgit/functest/tree/ci/testcases.yaml
959 _`[6]`: https://git.opnfv.org/cgit/releng/tree/utils/test/result_collection_api
961 _`[7]`: https://git.opnfv.org/cgit/releng/tree/utils/test/scripts
963 _`[8]`: https://git.opnfv.org/cgit/releng/tree/utils/test/reporting/functest
965 _`[9]`: http://testresults.opnfv.org/reporting/
967 _`[10]`: https://wiki.opnfv.org/opnfv_functional_testing
969 _`[11]`: https://docs.python.org/2/howto/regex.html
971 _`[12]`: https://regex101.com/
973 _`[13]`: http://testresults.opnfv.org/test/api/v1/projects/functest/cases
975 _`[14]`: https://git.opnfv.org/cgit/releng/tree/jjb/functest/functest-daily.sh
977 _`[15]`: https://git.opnfv.org/cgit/releng/tree/utils/test/result_collection_api/README.rst
979 _`[16]`: https://git.opnfv.org/cgit/releng/tree/utils/test/scripts/mongo_to_elasticsearch.py
981 _`[17]`: http://artifacts.opnfv.org/releng/docs/testapi.html
983 OPNFV main site: http://www.opnfv.org
985 OPNFV functional test page: https://wiki.opnfv.org/opnfv_functional_testing
987 IRC support chan: #opnfv-functest
989 _`OpenRC`: http://docs.openstack.org/user-guide/common/cli_set_environment_variables_using_openstack_rc.html
991 _`Rally installation procedure`: https://rally.readthedocs.org/en/latest/tutorial/step_0_installation.html
993 _`config_functest.yaml` : https://git.opnfv.org/cgit/functest/tree/testcases/config_functest.yaml