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