Merge "Put vnf_test pass if more than 80% of vnf test result are OK"
[functest.git] / docs / testing / user / configguide / configguide.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 Installation and configuration (Ubuntu)
5 =======================================
6
7 The historical docker file is based on Ubuntu. It has been maintained for
8 Euphrates.
9
10 Pulling the Docker image
11 ------------------------
12 Pull the Functest Docker image ('opnfv/functest') from the public
13 dockerhub registry under the OPNFV account: [̀`dockerhub`_], with the
14 following docker command::
15
16   docker pull opnfv/functest:<TagIdentifier>
17
18 where <TagIdentifier> identifies a release of the Functest docker
19 container image in the public Dockerhub registry. There are many tags
20 created automatically by the CI mechanisms, and you must ensure you
21 pull an image with the **correct tag** to match the OPNFV software
22 release installed in your environment. All available tagged images can
23 be seen from location [FunctestDockerTags_]. For example, when running
24 on the first official release of the OPNFV Danube system platform,
25 tag "danube.1.0" is needed. For the second and third releases, the tag
26 "danube.2.0" and "danube.3.0" can be used respectively.
27 Pulling other tags might cause some problems while running the tests.
28 Docker images pulled without a tag specifier bear the implicitly
29 assigned label "latest". If you need to specifically pull the latest
30 Functest docker image, then omit the tag argument::
31
32   docker pull opnfv/functest
33
34 After pulling the Docker image, check that it is available with the
35 following docker command::
36
37   [functester@jumphost ~]$ docker images
38   REPOSITORY     TAG             IMAGE ID      CREATED       SIZE
39   opnfv/functest latest          8cd6683c32ae  2 weeks ago   1.321 GB
40   opnfv/functest danube.2.0      d2c174a91911  7 minutes ago 1.471 GB
41   opnfv/functest danube.1.0      13fa54a1b238  4 weeks ago   1.29 GB
42
43 The Functest docker container environment can -in principle- be also
44 used with non-OPNFV official installers (e.g. 'devstack'), with the
45 **disclaimer** that support for such environments is outside of the
46 scope and responsibility of the OPNFV project.
47
48 Please note that alpine dockers have been introduced in Euphrates. See alpine
49 section for details.
50
51 Accessing the Openstack credentials
52 -----------------------------------
53 OpenStack credentials are mandatory and must be provided to Functest.
54 When running the command "functest env prepare", the framework  will
55 automatically look for the Openstack credentials file
56 "/home/opnfv/functest/conf/openstack.creds" and will exit with
57 error if it is not present or it is empty.
58
59 There are 2 ways to provide that file:
60
61   * by using a Docker volume with -v option when creating the Docker container.
62     This is referred to in docker documentation as "Bind Mounting".
63     See the usage of this parameter in the following chapter.
64   * or creating manually the file '/home/opnfv/functest/conf/openstack.creds'
65     inside the running container and pasting the credentials in it. Consult
66     your installer guide for further details. This is however not
67     instructed in this document.
68
69 There is a default environment variable in the Functest container **$creds**
70 that points to the credentials absolute path to help the user with this task.
71
72 In proxified environment you may need to change the credentials file.
73 There are some tips in chapter: `Proxy support`_
74
75 Functest Docker parameters
76 --------------------------
77 This chapter explains how to run a container for executing functest
78 test suites. Numbered list below explains some details of the
79 recommended parameters for invoking docker container
80
81   #. It is a good practice to assign a precise container name through
82      the **--name** option.
83
84   #. Assign parameter for installer type::
85
86        -e "INSTALLER_TYPE=<type>"
87        # Use one of following apex, compass, fuel or joid
88
89   #. Functest needs to know the IP of some installers::
90
91        -e "INSTALLER_IP=<Specific IP Address>"
92
93        These two env variables are useful extract some information
94        from the deployment. However, for some test cases like
95        SFC or Barometer they are mandatory since the tests
96        need to access the installer node and the deployment.
97
98   #. Credentials for accessing the Openstack.
99      Most convenient way of passing them to container is by having a
100      local copy of the credentials file in Jumphost and then using the
101      **-v** option. In the example we have local file by the name of
102      "overcloudrc" and we are using that as an argument::
103
104        -v ~/overcloudrc:/home/opnfv/functest/conf/openstack.creds
105
106        The credentials file needs to exist in the Docker container
107        under the path: '/home/opnfv/functest/conf/openstack.creds'.
108
109      **WARNING:** If you are using the Joid installer, you must pass the
110      credentials using the **-v** option:
111      -v /var/lib/jenkins/admin-openrc:/home/opnfv/functest/conf/openstack.creds.
112      See the section `Accessing the Openstack credentials`_ above.
113
114   #. Passing deployment scenario
115      When running Functest against any of the supported OPNFV scenarios,
116      it is recommended to include also the environment variable
117      **DEPLOY_SCENARIO**. The **DEPLOY_SCENARIO** environment variable
118      is passed with the format::
119
120        -e "DEPLOY_SCENARIO=os-<controller>-<nfv_feature>-<ha_mode>"
121        where:
122        os = OpenStack (No other VIM choices currently available)
123        controller is one of ( nosdn | odl_l2 | odl_l3 )
124        nfv_feature is one or more of ( ovs | kvm | sfc | bgpvpn | nofeature )
125                 If several features are pertinent then use the underscore
126                 character '_' to separate each feature (e.g. ovs_kvm)
127                 'nofeature' indicates no NFV feature is deployed
128        ha_mode (high availability) is one of ( ha | noha )
129
130      **NOTE:** Not all possible combinations of "DEPLOY_SCENARIO" are
131      supported. The name passed in to the Functest Docker container
132      must match the scenario used when the actual OPNFV platform was
133      deployed. See release note to see the list of supported scenarios.
134
135      **NOTE:** The scenario name is mainly used to automatically detect
136      if a test suite is runnable or not (e.g. it will prevent ONOS test suite
137      to be run on ODL scenarios). If not set, Functest will try to run the
138      default test cases that might not include SDN controller or a specific
139      feature
140
141      **NOTE:** A HA scenario means that 3 OpenStack controller nodes are
142      deployed. It does not necessarily mean that the whole system is HA. See
143      installer release notes for details.
144
145
146 Putting all above together, when using installer 'fuel' and an invented
147 INSTALLER_IP of '10.20.0.2', the recommended command to create the
148 Functest Docker container is as follows::
149
150   docker run --name "FunctestContainer" -it \
151   -e "INSTALLER_IP=10.20.0.2" \
152   -e "INSTALLER_TYPE=fuel" \
153   -e "DEPLOY_SCENARIO=os-odl_l2-ovs_kvm-ha" \
154   -v ~/overcloudrc:/home/opnfv/functest/conf/openstack.creds \
155   opnfv/functest /bin/bash
156
157 After the *run* command, a new prompt appears which means that we are inside
158 the container and ready to move to the next step.
159
160 For tips on how to set up container with installer Apex, see chapter
161 `Apex Installer Tips`_.
162
163 Finally, three additional environment variables can also be passed in
164 to the Functest Docker Container, using the -e
165 "<EnvironmentVariable>=<Value>" mechanism. The first two of these are
166 only relevant to Jenkins CI invoked testing and **should not be used**
167 when performing manual test scenarios::
168
169   -e "NODE_NAME=<Test POD Name>" \
170   -e "BUILD_TAG=<Jenkins Build Tag>" \
171   -e "CI_DEBUG=<DebugTraceValue>"
172   where:
173   <Test POD Name> = Symbolic name of the POD where the tests are run.
174                     Visible in test results files, which are stored
175                     to the database. This option is only used when
176                     tests are activated under Jenkins CI control.
177                     It indicates the POD/hardware where the test has
178                     been run. If not specified, then the POD name is
179                     defined as "Unknown" by default.
180                     DO NOT USE THIS OPTION IN MANUAL TEST SCENARIOS.
181   <Jenkins Build tag> = Symbolic name of the Jenkins Build Job.
182                         Visible in test results files, which are stored
183                         to the database. This option is only set when
184                         tests are activated under Jenkins CI control.
185                         It enables the correlation of test results,
186                         which
187                         are independently pushed to the results database
188                         from different Jenkins jobs.
189                         DO NOT USE THIS OPTION IN MANUAL TEST SCENARIOS.
190   <DebugTraceValue> = "true" or "false"
191                       Default = "false", if not specified
192                       If "true" is specified, then additional debug trace
193                       text can be sent to the test results file / log files
194                       and also to the standard console output.
195
196 Installer Tips
197 --------------
198
199 Apex Installer Tips
200 ^^^^^^^^^^^^^^^^^^^
201 Some specific tips are useful for the Apex Installer case. If not using
202 Apex Installer; ignore this section.
203
204 In case of Triple-O based installer (like Apex) the docker container
205 needs to connect to the installer VM, so it is then required that some
206 known SSH keys are present in docker container. Since the Jumphost root
207 SSH keys are already known, easiest way is to use those using the
208 'Bind mount' method. See below for sample parameter::
209
210   -v /root/.ssh/id_rsa:/root/.ssh/id_rsa
211
212   NOTE: You need the "sudo" when creating the container to access root
213   users ssh credentials even the docker command itself might not
214   require that.
215
216 HINT! In case of Triple-O installers you can find value for the
217 INSTALLER_IP parameter by executing command and note the returned IP
218 address::
219
220   inst=$(sudo virsh list | grep -iEo "undercloud|instack")
221   sudo virsh domifaddr ${inst}
222
223   NOTE: In releases prior to Colorado, the name 'instack' was
224   used. Currently the name 'undercloud' is used.
225
226 You can copy the credentials file from the "stack" users home directory
227 in installer VM to Jumphost. Please check the correct IP from the
228 command above. In the example below we are using invented IP address
229 "192.168.122.89"::
230
231     scp stack@192.168.122.89:overcloudrc .
232
233 Here is an example of the full docker command invocation for an Apex
234 installed system, using latest Functest docker container, for
235 illustration purposes::
236
237   sudo docker run -it --name "ApexFuncTestODL" \
238   -e "INSTALLER_IP=192.168.122.89" \
239   -e "INSTALLER_TYPE=apex" \
240   -e "DEPLOY_SCENARIO=os-odl_l2-nofeature-ha" \
241   -v /root/.ssh/id_rsa:/root/.ssh/id_rsa \
242   -v ~/overcloudrc:/home/opnfv/functest/conf/openstack.creds \
243   opnfv/functest /bin/bash
244
245 Compass installer local development env usage Tips
246 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
247 In the compass-functest local test case check and development environment,
248 in order to get openstack service inside the functest container, some
249 parameters should be configured during container creation, which are
250 hard to guess for freshman. This section will provide the guideline, the
251 parameters values are defaults here, which should be adjusted according
252 to the settings, the complete steps are given here so as not to appear
253 too abruptly.
254
255 1, Pull Functest docker image from public dockerhub::
256
257     docker pull opnfv/functest:<Tag>
258
259 <Tag> here can be "brahmaputra.1.0", "colorado.1.0", etc.
260 Tag omitted means the latest docker image::
261
262     docker pull opnfv/functest
263
264 2, Functest Docker container creation
265
266 To make a file used for the environment, such as 'functest-docker-env'::
267
268     CINDER_ENDPOINT_TYPE=publicURL
269     NOVA_ENDPOINT_TYPE=publicURL
270     OS_ENDPOINT_TYPE=publicURL
271     OS_INTERFACE=publicURL
272     OS_USERNAME=admin
273     OS_PASSWORD='990232e0885da343ac805523322d'
274     OS_PROJECT_NAME=admin
275     OS_TENANT_NAME=admin
276     OS_AUTH_URL=https://192.16.1.222:5000/v3
277     OS_NO_CACHE=1
278     OS_USER_DOMAIN_NAME=Default
279     OS_PROJECT_DOMAIN_NAME=Default
280     OS_REGION_NAME=RegionOne
281     OS_IDENTITY_API_VERSION=3
282     OS_AUTH_VERSION=3
283
284
285 Note: please adjust the content according to the environment, such as
286 'TENANT_ID' maybe used for some special cases.
287
288 Then to create the Functest docker::
289
290     docker run --privileged=true --rm -t \
291     --env-file functest-docker-env \
292     --name <Functest_Container_Name> \
293     opnfv/functest:<Tag> /bin/bash
294
295 3, To attach Functest container
296
297 Before trying to attach the Functest container, the status can be checked by::
298
299    docker ps -a
300
301 to attach the 'Up' status Functest container and start bash mode::
302
303    docker exec -it <Functest_Container_Name> bash
304
305 4, Functest environment preparation and check
306
307 To see the Section below `Preparing the Functest environment`_.
308
309 Functest docker container directory structure
310 ---------------------------------------------
311 Inside the Functest docker container, the following directory structure
312 should now be in place::
313
314   `-- home
315     |  `-- opnfv
316     |   |-- functest
317     |   |   |-- conf
318     |   |   |-- data
319     |   |   |-- images
320     |   |   `-- results
321     |   `-- repos
322     |       |-- doctor
323     |       `-- vnfs
324    -- src
325        |-- tempest
326        |-- vims-test
327        |-- odl_test
328        `-- fds
329
330 Underneath the '/home/opnfv/' directory, the Functest docker container
331 includes two main directories:
332
333   * The **functest** directory stores configuration files (e.g. the
334     OpenStack creds are stored in path '/home/opnfv/functest/conf/openstack.creds'),
335     the **data** directory stores a 'cirros' test image used in some
336     functional tests and the **results** directory stores some temporary
337     result log files
338   * The **repos** directory holds various repositories. The directories
339     are used for the installation of the needed tooling (e.g. rally) or
340     for the retrieval of feature projects scenarios (e.g. promise)
341
342 The structure under the **functest** repository can be described as
343 follows::
344
345   |-- INFO
346   |-- LICENSE
347   |-- api
348   |  `-- apidoc
349   |-- build.sh
350   |-- commons
351   |  |-- docker
352   |  |-- Dockerfile
353   |  |-- Dockerfile.aarch64.patch
354   |  |-- components
355   |  |-- config_install_env.sh
356   |  |-- core
357   |  |-- docker_remote_api
358   |  |-- features
359   |  |-- healthcheck
360   |  |-- smoke
361   |  |-- vnf
362   |  `-- thirdparty-requirements.txt
363   |-- docs
364   |  |-- com
365   |  |-- images
366   |  |-- release
367   |  |  `-- release-notes
368   |  |-- results
369   |  | testing
370   |  |  |-- developer
371   |  |    `-- user
372   |  |      |-- configguide
373   |  |      `-- userguide
374   `-- functest
375     |-- api
376     |  |-- base.py
377     |  |-- server.py
378     |  |-- urls.py
379     |  |-- common
380     |  |  |-- api_utils.py
381     |  |  `-- error.py
382     |  `-- resources
383     |     `-- v1
384     |        |-- creds.py
385     |        |-- envs.py
386     |        |-- testcases.py
387     |        `-- tiers.py
388     |-- ci
389     │   |-- check_deployment.py
390     │   |-- config_aarch64_patch.yaml
391     │   |-- config_functest.yaml
392     │   |-- config_patch.yaml
393     │   |-- download_images.sh
394     │   |-- installer_params.yaml
395     │   |-- logging.ini
396     │   |-- prepare_env.py
397     │   |-- rally_aarch64_patch.conf
398     │   |-- run_tests.py
399     │   |-- testcases.yaml
400     │   |-- tier_builder.py
401     │   `-- tier_handler.py
402     |-- cli
403     │   |-- cli_base.py
404     │   |-- commands
405     │   │   |-- cli_env.py
406     │   │   |-- cli_os.py
407     │   │   |-- cli_testcase.py
408     │   │   `-- cli_tier.py
409     │   |-- functest-complete.sh
410     |-- core
411     │   |-- feature.py
412     │   |-- testcase.py
413     │   |-- unit.py
414     │   `-- vnf.py
415     |-- energy
416     │   |-- energy.py
417     │   `-- energy.pyc
418     |-- opnfv_tests
419     │   |-- mano
420     │   │   |-- orchestra.py
421     │   |-- openstack
422     │   │   |-- rally
423     │   │   |-- refstack_client
424     │   │   |-- snaps
425     │   │   |-- tempest
426     │   │   `-- vping
427     │   |-- sdn
428     │   │    `-- odl
429     │   `-- vnf
430     │       |-- aaa
431     │       |-- ims
432     │       `-- router
433     |-- tests
434     │   `-- unit
435     │       |-- ci
436     │       |-- cli
437     │       |-- core
438     │       |-- energy
439     │       |-- features
440     │       |-- odl
441     │       |-- openstack
442     │       |-- opnfv_tests
443     │       |-- test_utils.py
444     │       |-- utils
445     │       `-- vnf
446     |-- utils
447     |    |-- config.py
448     |    |-- constants.py
449     |    |-- decorators.py
450     |    |-- env.py
451     |    |-- functest_utils.py
452     |    |-- functest_vacation.py
453     |    |-- openstack_clean.py
454     |    |-- openstack_snapshot.py
455     |    |-- openstack_tacker.py
456     |    `-- openstack_utils.py
457   |-- requirements.txt
458   |-- setup.cfg
459   |-- setup.py
460   |-- test-requirements.txt
461   |-- tox.ini
462   |-- upper-constraints.txt
463
464   (Note: All *.pyc files removed from above list for brevity...)
465
466 We may distinguish several directories, the first level has 5 directories:
467
468 * **api**: This directory is dedicated for the internal Functest API and the API
469   (framework) documentations.
470 * **commons**: This directory is dedicated for storage of traffic
471   profile or any other test inputs that could be reused by any test
472   project.
473 * **docker**: This directory includes the needed files and tools to
474   build the Functest Docker image.
475 * **docs**: This directory includes documentation: Release Notes,
476   User Guide, Configuration Guide and Developer Guide.
477 * **functest**: This directory contains all the code needed to run
478   functest internal cases and OPNFV onboarded feature or VNF test cases.
479
480 Functest directory has 6 directories:
481   * **ci**: This directory contains test structure definition files
482     (e.g <filename>.yaml) and bash shell/python scripts used to
483     configure and execute Functional tests. The test execution script
484     can be executed under the control of Jenkins CI jobs.
485   * **cli**: This directory holds the python based Functest CLI utility
486     source code, which is based on the Python 'click' framework.
487   * **core**: This directory holds the python based Functest core
488       source code. Three abstraction classes have been created to ease
489       the integration of internal, feature or vnf cases.
490   * **opnfv_tests**: This directory includes the scripts required by
491     Functest internal test cases and other feature projects test cases.
492   * **tests**: This directory includes the functest unit tests
493   * **utils**: this directory holds Python source code for some general
494     purpose helper utilities, which testers can also re-use in their
495     own test code. See for an example the Openstack helper utility:
496     'openstack_utils.py'.
497
498 Useful Docker commands
499 ----------------------
500 When typing **exit** in the container prompt, this will cause exiting
501 the container and probably stopping it. When stopping a running Docker
502 container all the changes will be lost, there is a keyboard shortcut
503 to quit the container without stopping it: <CTRL>-P + <CTRL>-Q. To
504 reconnect to the running container **DO NOT** use the *run* command
505 again (since it will create a new container), use the *exec* or *attach*
506 command instead::
507
508   docker ps  # <check the container ID from the output>
509   docker exec -ti <CONTAINER_ID> /bin/bash
510
511 There are other useful Docker commands that might be needed to manage possible
512 issues with the containers.
513
514 List the running containers::
515
516   docker ps
517
518 List all the containers including the stopped ones::
519
520   docker ps -a
521
522 Start a stopped container named "FunTest"::
523
524   docker start FunTest
525
526 Attach to a running container named "StrikeTwo"::
527
528   docker attach StrikeTwo
529
530 It is useful sometimes to remove a container if there are some problems::
531
532   docker rm <CONTAINER_ID>
533
534 Use the *-f* option if the container is still running, it will force to
535 destroy it::
536
537   docker rm -f <CONTAINER_ID>
538
539 Check the Docker documentation [`dockerdocs`_] for more information.
540
541 Preparing the Functest environment
542 ----------------------------------
543 Once the Functest docker container is up and running, the required
544 Functest environment needs to be prepared. A custom built **functest**
545 CLI utility is available to perform the needed environment preparation
546 action. Once the environment is prepared, the **functest** CLI utility
547 can be used to run different functional tests. The usage of the
548 **functest** CLI utility to run tests is described further in the
549 `Functest User Guide`_
550
551 Prior to commencing the Functest environment preparation, we can check
552 the initial status of the environment. Issue the **functest env status**
553 command at the prompt::
554
555   functest env status
556   Functest environment is not installed.
557
558   Note: When the Functest environment is prepared, the command will
559   return the status: "Functest environment ready to run tests."
560
561 To prepare the Functest docker container for test case execution, issue
562 the **functest env prepare** command at the prompt::
563
564   functest env prepare
565
566 This script will make sure that the requirements to run the tests are
567 met and will install the needed libraries and tools by all Functest
568 test cases. It should be run only once every time the Functest docker
569 container is started from scratch. If you try to run this command, on
570 an already prepared environment, you will be prompted whether you really
571 want to continue or not::
572
573   functest env prepare
574   It seems that the environment has been already prepared.
575   Do you want to do it again? [y|n]
576
577   (Type 'n' to abort the request, or 'y' to repeat the
578    environment preparation)
579
580
581 To list some basic information about an already prepared Functest
582 docker container environment, issue the **functest env show** at the
583 prompt::
584
585   functest env show
586   +======================================================+
587   | Functest Environment info                            |
588   +======================================================+
589   |  INSTALLER: apex, 192.168.122.89                     |
590   |   SCENARIO: os-odl_l2-nofeature-ha                   |
591   |        POD: localhost                                |
592   | GIT BRANCH: master                                   |
593   |   GIT HASH: 5bf1647dec6860464eeb082b2875798f0759aa91 |
594   | DEBUG FLAG: false                                    |
595   +------------------------------------------------------+
596   |     STATUS: ready                                    |
597   +------------------------------------------------------+
598
599   Where:
600
601   INSTALLER:  Displays the INSTALLER_TYPE value
602               - here = "apex"
603               and the INSTALLER_IP value
604               - here = "192.168.122.89"
605   SCENARIO:   Displays the DEPLOY_SCENARIO value
606               - here = "os-odl_l2-nofeature-ha"
607   POD:        Displays the value passed in NODE_NAME
608               - here = "localhost"
609   GIT BRANCH: Displays the git branch of the OPNFV Functest
610               project repository included in the Functest
611               Docker Container.
612               - here = "master"
613                        (In first official colorado release
614                         would be "colorado.1.0")
615   GIT HASH:   Displays the git hash of the OPNFV Functest
616               project repository included in the Functest
617               Docker Container.
618               - here = "5bf1647dec6860464eeb082b2875798f0759aa91"
619   DEBUG FLAG: Displays the CI_DEBUG value
620               - here = "false"
621
622   NOTE: In Jenkins CI runs, an additional item "BUILD TAG"
623         would also be listed. The value is set by Jenkins CI.
624
625 Finally, the **functest** CLI has a **--help** options:
626
627 Some examples::
628
629   functest --help Usage: functest [OPTIONS] COMMAND [ARGS]...
630
631   Options:
632     --version  Show the version and exit.
633     -h, --help Show this message and exit.
634
635   Commands:
636     env
637     openstack
638     testcase
639     tier
640
641   functest env --help
642   Usage: functest env [OPTIONS] COMMAND [ARGS]...
643
644   Options:
645     -h, --help Show this message and exit.
646
647   Commands:
648     prepare  Prepares the Functest environment.
649     show     Shows information about the current...
650     status   Checks if the Functest environment is ready...
651
652 Checking Openstack and credentials
653 ----------------------------------
654 It is recommended and fairly straightforward to check that Openstack
655 and credentials are working as expected.
656
657 Once the credentials are there inside the container, they should be
658 sourced before running any Openstack commands::
659
660   source /home/opnfv/functest/conf/openstack.creds
661
662 After this, try to run any OpenStack command to see if you get any
663 output, for instance::
664
665   openstack user list
666
667 This will return a list of the actual users in the OpenStack
668 deployment. In any other case, check that the credentials are sourced::
669
670   env|grep OS_
671
672 This command must show a set of environment variables starting with
673 *OS_*, for example::
674
675   OS_REGION_NAME=RegionOne
676   OS_DEFAULT_DOMAIN=default
677   OS_PROJECT_NAME=admin
678   OS_PASSWORD=admin
679   OS_AUTH_STRATEGY=keystone
680   OS_AUTH_URL=http://172.30.10.3:5000/v2.0
681   OS_USERNAME=admin
682   OS_TENANT_NAME=admin
683   OS_ENDPOINT_TYPE=internalURL
684   OS_NO_CACHE=true
685
686 If the OpenStack command still does not show anything or complains
687 about connectivity issues, it could be due to an incorrect url given to
688 the OS_AUTH_URL environment variable. Check the deployment settings.
689
690 SSL Support
691 -----------
692 If you need to connect to a server that is TLS-enabled (the auth URL
693 begins with "https") and it uses a certificate from a private CA or a
694 self-signed certificate, then you will need to specify the path to an
695 appropriate CA certificate to use, to validate the server certificate
696 with the environment variable OS_CACERT::
697
698   echo $OS_CACERT
699   /etc/ssl/certs/ca.crt
700
701 However, this certificate does not exist in the container by default.
702 It has to be copied manually from the OpenStack deployment. This can be
703 done in 2 ways:
704
705   #. Create manually that file and copy the contents from the OpenStack
706      controller.
707   #. (Recommended) Add the file using a Docker volume when starting the
708      container::
709
710        -v <path_to_your_cert_file>:/etc/ssl/certs/ca.cert
711
712 You might need to export OS_CACERT environment variable inside the
713 container::
714
715   export OS_CACERT=/etc/ssl/certs/ca.crt
716
717 Certificate verification can be turned off using OS_INSECURE=true. For
718 example, Fuel uses self-signed cacerts by default, so an pre step would
719 be::
720
721   export OS_INSECURE=true
722
723 Proxy support
724 -------------
725 If your Jumphost node is operating behind a http proxy, then there are
726 2 places where some special actions may be needed to make operations
727 succeed:
728
729   #. Initial installation of docker engine First, try following the
730      official Docker documentation for Proxy settings. Some issues were
731      experienced on CentOS 7 based Jumphost. Some tips are documented
732      in section: `Docker Installation on CentOS behind http proxy`_
733      below.
734
735   #. Execution of the Functest environment preparation inside the
736      created docker container Functest needs internet access to
737      download some resources for some test cases. This might not
738      work properly if the Jumphost is connecting to internet
739      through a http Proxy.
740
741 If that is the case, make sure the resolv.conf and the needed
742 http_proxy and https_proxy environment variables, as well as the
743 'no_proxy' environment variable are set correctly::
744
745   # Make double sure that the 'no_proxy=...' line in the
746   # 'openstack.creds' file is commented out first. Otherwise, the
747   # values set into the 'no_proxy' environment variable below will
748   # be ovewrwritten, each time the command
749   # 'source ~/functest/conf/openstack.creds' is issued.
750
751   cd ~/functest/conf/
752   sed -i 's/export no_proxy/#export no_proxy/' openstack.creds
753   source ./openstack.creds
754
755   # Next calculate some IP addresses for which http_proxy
756   # usage should be excluded:
757
758   publicURL_IP=$(echo $OS_AUTH_URL | grep -Eo "([0-9]+\.){3}[0-9]+")
759
760   adminURL_IP=$(openstack catalog show identity | \
761   grep adminURL | grep -Eo "([0-9]+\.){3}[0-9]+")
762
763   export http_proxy="<your http proxy settings>"
764   export https_proxy="<your https proxy settings>"
765   export no_proxy="127.0.0.1,localhost,$publicURL_IP,$adminURL_IP"
766
767   # Ensure that "git" uses the http_proxy
768   # This may be needed if your firewall forbids SSL based git fetch
769   git config --global http.sslVerify True
770   git config --global http.proxy <Your http proxy settings>
771
772 Validation check: Before running **'functest env prepare'** CLI command,
773 make sure you can reach http and https sites from inside the Functest
774 docker container.
775
776 For example, try to use the **nc** command from inside the functest
777 docker container::
778
779   nc -v opnfv.org 80
780   Connection to opnfv.org 80 port [tcp/http] succeeded!
781
782   nc -v opnfv.org 443
783   Connection to opnfv.org 443 port [tcp/https] succeeded!
784
785 Note: In a Jumphost node based on the CentOS family OS, the **nc**
786 commands might not work. You can use the **curl** command instead.
787
788   curl http://www.opnfv.org:80
789   <HTML><HEAD><meta http-equiv="content-type"
790   .
791   .
792   </BODY></HTML>
793
794   curl https://www.opnfv.org:443
795   <HTML><HEAD><meta http-equiv="content-type"
796   .
797   .
798   </BODY></HTML>
799
800   (Ignore the content. If command returns a valid HTML page, it proves
801   the connection.)
802
803 Docker Installation on CentOS behind http proxy
804 -----------------------------------------------
805 This section is applicable for CentOS family OS on Jumphost which
806 itself is behind a proxy server. In that case, the instructions below
807 should be followed **before** installing the docker engine::
808
809   1) # Make a directory '/etc/systemd/system/docker.service.d'
810      # if it does not exist
811      sudo mkdir /etc/systemd/system/docker.service.d
812
813   2) # Create a file called 'env.conf' in that directory with
814      # the following contents:
815      [Service]
816      EnvironmentFile=-/etc/sysconfig/docker
817
818   3) # Set up a file called 'docker' in directory '/etc/sysconfig'
819      # with the following contents:
820      HTTP_PROXY="<Your http proxy settings>"
821      HTTPS_PROXY="<Your https proxy settings>"
822      http_proxy="${HTTP_PROXY}"
823      https_proxy="${HTTPS_PROXY}"
824
825   4) # Reload the daemon
826      systemctl daemon-reload
827
828   5) # Sanity check - check the following docker settings:
829      systemctl show docker | grep -i env
830
831      Expected result:
832      ----------------
833      EnvironmentFile=/etc/sysconfig/docker (ignore_errors=yes)
834      DropInPaths=/etc/systemd/system/docker.service.d/env.conf
835
836 Now follow the instructions in [`InstallDockerCentOS`_] to download
837 and install the **docker-engine**. The instructions conclude with a
838 "test pull" of a sample "Hello World" docker container. This should now
839 work with the above pre-requisite actions.
840
841
842 Installation and Configuration (Alpine)
843 =======================================
844
845 Introduction to Alpine
846 ----------------------
847 Alpine container have been introduced in Euphrates and released as experimental.
848 Alpine allows Functest testing in several very light container and thanks to
849 the refactoring on dependency management shoudl allow the creation of light and
850 fully customized docker files
851
852 Functest Alpine
853 ---------------
854 Docker files are available on the the dockerhub:
855
856   * opnfv/functest-core
857   * opnfv/functest-healthcheck
858   * opnfv/functest-smoke
859   * opnfv/functest-features
860   * opnfv/functest-components
861   * opnfv/functest-vnf
862
863
864 Preparing your environment
865 --------------------------
866
867 cat env::
868
869   INSTALLER_TYPE=XXX
870   INSTALLER_IP=XXX
871   EXTERNAL_NETWORK=XXX
872
873 cat openstack.creds::
874
875   export OS_AUTH_URL=XXX
876   export OS_USER_DOMAIN_NAME=XXX
877   export OS_PROJECT_DOMAIN_NAME=XXX
878   export OS_USERNAME=XXX
879   export OS_TENANT_NAME=XXX
880   export OS_PROJECT_NAME=XXX
881   export OS_PASSWORD=XXX
882   export OS_VOLUME_API_VERSION=XXX
883   export OS_IDENTITY_API_VERSION=XXX
884   export OS_IMAGE_API_VERSION=XXX
885
886 md5sum images/*md5sum images/*::
887
888   c03e55c22b6fb2127e7de391b488d8d6  `images/CentOS-7-x86_64-GenericCloud.qcow2`_
889   f8ab98ff5e73ebab884d80c9dc9c7290  `images/cirros-0.3.5-x86_64-disk.img`_
890   845c9b0221469f9e0f4d7ea0039ab5f2  `images/ubuntu-14.04-server-cloudimg-amd64-disk1.img`_
891
892 .. _`dockerdocs`: https://docs.docker.com/
893 .. _`dockerhub`: https://hub.docker.com/r/opnfv/functest/
894 .. _`Proxy`: https://docs.docker.com/engine/admin/systemd/#http-proxy
895 .. _`FunctestDockerTags`: https://hub.docker.com/r/opnfv/functest/tags/
896 .. _`InstallDockerCentOS`: https://docs.docker.com/engine/installation/linux/centos/
897 .. _`Functest User Guide`: http://docs.opnfv.org/en/stable-danube/submodules/functest/docs/testing/user/userguide/index.html
898 :: _`images/CentOS-7-x86_64-GenericCloud.qcow2` http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img
899 :: _`images/cirros-0.3.5-x86_64-disk.img` https://cloud-images.ubuntu.com/releases/14.04/release/ubuntu-14.04-server-cloudimg-amd64-disk1.img
900 :: _`images/ubuntu-14.04-server-cloudimg-amd64-disk1.img` https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2