fix KeyError: 'clean_flag'
[functest.git] / docs / testing / user / 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             |-- odl_test
335             |-- onos
336             |-- ovno
337             |-- parser
338             |-- promise
339             |-- rally
340             |-- releng
341             |-- sdnvpn
342             |-- securityscanning
343             |-- sfc
344             |-- tempest
345             |-- vims_test
346             `-- vnfs
347
348 Underneath the '/home/opnfv/' directory, the Functest docker container
349 includes two main directories:
350
351   * The **functest** directory stores configuration files (e.g. the
352     OpenStack creds are stored in path '/home/opnfv/functest/conf/openstack.creds'),
353     the **data** directory stores a 'cirros' test image used in some
354     functional tests and the **results** directory stores some temporary
355     result log files
356   * The **repos** directory holds various repositories. The directory
357     '/home/opnfv/repos/functest' is used to prepare the needed Functest
358     environment and to run the tests. The other repository directories
359     are used for the installation of the needed tooling (e.g. rally) or
360     for the retrieval of feature projects scenarios (e.g. promise)
361
362 The structure under the **functest** repository can be described as
363 follows::
364
365   . |-- INFO
366     |-- LICENSE
367     |-- requirements.txt
368     |-- run_unit_tests.sh
369     |-- setup.py
370     |-- test-requirements.txt
371     |-- commons
372     |   |-- ims
373     |   |-- mobile
374     |   `--traffic-profile-guidelines.rst
375     |-- docker
376     |   |-- Dockerfile
377     |   |-- config_install_env.sh
378     |   `-- docker_remote_api
379     |-- docs
380     |   |-- com
381     |   |-- configguide
382     |   |-- devguide
383     |   |-- images
384     |   |-- internship
385     |   |-- release-notes
386     |   |-- results
387     |   `--userguide
388     |-- functest
389         |-- __init__.py
390         |-- ci
391         |   |-- __init__.py
392         |   |-- check_os.sh
393         |   |-- config_functest.yaml
394         |   |-- config_patch.yaml
395         |   |-- exec_test.sh
396         |   |-- generate_report.py
397         |   |-- prepare_env.py
398         |   |-- run_tests.py
399         |   |-- testcases.yaml
400         |   |-- tier_builder.py
401         |   `-- tier_handler.py
402         |-- cli
403         |   |-- __init__.py
404         |   |-- cli_base.py
405         |   |-- commands
406         |   |-- functest-complete.sh
407         |   `-- setup.py
408         |-- core
409         |   |-- __init__.py
410         |   |-- feature_base.py
411         |   |-- pytest_suite_runner.py
412         |   |-- testcase_base.py
413         |   |-- vnf_base.py
414         |-- opnfv_tests
415         |   |-- __init__.py
416         |   |-- features
417         |   |-- mano
418         |   |-- openstack
419         |   |-- sdn
420         |   |-- security_scan
421         |   `-- vnf
422         |-- tests
423         |   |-- __init__.py
424         |   `-- unit
425         `-- utils
426             |-- __init__.py
427             |-- config.py
428             |-- constants.py
429             |-- env.py
430             |-- functest_constants.py
431             |-- functest_logger.py
432             |-- functest_utils.py
433             |-- openstack
434             |-- openstack_clean.py
435             |-- openstack_snapshot.py
436             |-- openstack_tacker.py
437             `-- openstack_utils.py
438
439
440     (Note: All *.pyc files removed from above list for brevity...)
441
442 We may distinguish several directories, the first level has 4 directories:
443
444 * **commons**: This directory is dedicated for storage of traffic
445   profile or any other test inputs that could be reused by any test
446   project.
447 * **docker**: This directory includes the needed files and tools to
448   build the Funtest Docker image.
449 * **docs**: This directory includes documentation: Release Notes,
450   User Guide, Configuration Guide and Developer Guide. Test results
451   are also located in a sub--directory called 'results'.
452 * **functest**: This directory contains all the code needed to run
453   functest internal cases and OPNFV onboarded feature or VNF test cases.
454
455 Functest directory has 6 directories:
456   * **ci**: This directory contains test structure definition files
457     (e.g <filename>.yaml) and bash shell/python scripts used to
458     configure and execute Functional tests. The test execution script
459     can be executed under the control of Jenkins CI jobs.
460   * **cli**: This directory holds the python based Functest CLI utility
461     source code, which is based on the Python 'click' framework.
462   * **core**: This directory holds the python based Functest core
463       source code. Three abstraction classes have been created to ease
464       the integration of internal, feature or vnf cases.
465   * **opnfv_tests**: This directory includes the scripts required by
466     Functest internal test cases and other feature projects test cases.
467   * **tests**: This directory includes the functest unit tests
468   * **utils**: this directory holds Python source code for some general
469     purpose helper utilities, which testers can also re-use in their
470     own test code. See for an example the Openstack helper utility:
471     'openstack_utils.py'.
472
473 Useful Docker commands
474 ----------------------
475 When typing **exit** in the container prompt, this will cause exiting
476 the container and probably stopping it. When stopping a running Docker
477 container all the changes will be lost, there is a keyboard shortcut
478 to quit the container without stopping it: <CTRL>-P + <CTRL>-Q. To
479 reconnect to the running container **DO NOT** use the *run* command
480 again (since it will create a new container), use the *exec* or *attach*
481 command instead::
482
483   docker ps  # <check the container ID from the output>
484   docker exec -ti <CONTAINER_ID> /bin/bash
485
486 There are other useful Docker commands that might be needed to manage possible
487 issues with the containers.
488
489 List the running containers::
490
491   docker ps
492
493 List all the containers including the stopped ones::
494
495   docker ps -a
496
497 Start a stopped container named "FunTest"::
498
499   docker start FunTest
500
501 Attach to a running container named "StrikeTwo"::
502
503   docker attach StrikeTwo
504
505 It is useful sometimes to remove a container if there are some problems::
506
507   docker rm <CONTAINER_ID>
508
509 Use the *-f* option if the container is still running, it will force to
510 destroy it::
511
512   docker rm -f <CONTAINER_ID>
513
514 Check the Docker documentation dockerdocs_ for more information.
515
516 Preparing the Functest environment
517 ----------------------------------
518 Once the Functest docker container is up and running, the required
519 Functest environment needs to be prepared. A custom built **functest**
520 CLI utility is available to perform the needed environment preparation
521 action. Once the environment is prepared, the **functest** CLI utility
522 can be used to run different functional tests. The usage of the
523 **functest** CLI utility to run tests is described further in the
524 Functest User Guide `OPNFV_FuncTestUserGuide`_
525
526 Prior to commencing the Functest environment preparation, we can check
527 the initial status of the environment. Issue the **functest env status**
528 command at the prompt::
529
530   functest env status
531   Functest environment is not installed.
532
533   Note: When the Functest environment is prepared, the command will
534   return the status: "Functest environment ready to run tests."
535
536 To prepare the Functest docker container for test case execution, issue
537 the **functest env prepare** command at the prompt::
538
539   functest env prepare
540
541 This script will make sure that the requirements to run the tests are
542 met and will install the needed libraries and tools by all Functest
543 test cases. It should be run only once every time the Functest docker
544 container is started from scratch. If you try to run this command, on
545 an already prepared enviroment, you will be prompted whether you really
546 want to continue or not::
547
548   functest env prepare
549   It seems that the environment has been already prepared.
550   Do you want to do it again? [y|n]
551
552   (Type 'n' to abort the request, or 'y' to repeat the
553    environment preparation)
554
555
556 To list some basic information about an already prepared Functest
557 docker container environment, issue the **functest env show** at the
558 prompt::
559
560   functest env show
561   +======================================================+
562   | Functest Environment info                            |
563   +======================================================+
564   |  INSTALLER: apex, 192.168.122.89                     |
565   |   SCENARIO: os-odl_l2-nofeature-ha                   |
566   |        POD: localhost                                |
567   | GIT BRANCH: master                                   |
568   |   GIT HASH: 5bf1647dec6860464eeb082b2875798f0759aa91 |
569   | DEBUG FLAG: false                                    |
570   +------------------------------------------------------+
571   |     STATUS: ready                                    |
572   +------------------------------------------------------+
573
574   Where:
575
576   INSTALLER:  Displays the INSTALLER_TYPE value
577               - here = "apex"
578               and the INSTALLER_IP value
579               - here = "192.168.122.89"
580   SCENARIO:   Displays the DEPLOY_SCENARIO value
581               - here = "os-odl_l2-nofeature-ha"
582   POD:        Displays the value passed in NODE_NAME
583               - here = "localhost"
584   GIT BRANCH: Displays the git branch of the OPNFV Functest
585               project repository included in the Functest
586               Docker Container.
587               - here = "master"
588                        (In first official colorado release
589                         would be "colorado.1.0")
590   GIT HASH:   Displays the git hash of the OPNFV Functest
591               project repository included in the Functest
592               Docker Container.
593               - here = "5bf1647dec6860464eeb082b2875798f0759aa91"
594   DEBUG FLAG: Displays the CI_DEBUG value
595               - here = "false"
596
597   NOTE: In Jenkins CI runs, an additional item "BUILD TAG"
598         would also be listed. The valaue is set by Jenkins CI.
599
600 Finally, the **functest** CLI has a **--help** options:
601
602 Some examples::
603
604   functest --help Usage: functest [OPTIONS] COMMAND [ARGS]...
605
606   Options:
607     --version  Show the version and exit.
608     -h, --help Show this message and exit.
609
610   Commands:
611     env
612     openstack
613     testcase
614     tier
615
616   functest env --help
617   Usage: functest env [OPTIONS] COMMAND [ARGS]...
618
619   Options:
620     -h, --help Show this message and exit.
621
622   Commands:
623     prepare  Prepares the Functest environment.
624     show     Shows information about the current...
625     status   Checks if the Functest environment is ready...
626
627 Checking Openstack and credentials
628 ----------------------------------
629 It is recommended and fairly straightforward to check that Openstack
630 and credentials are working as expected.
631
632 Once the credentials are there inside the container, they should be
633 sourced before running any Openstack commands::
634
635   source /home/opnfv/functest/conf/openstack.creds
636
637 After this, try to run any OpenStack command to see if you get any
638 output, for instance::
639
640   openstack user list
641
642 This will return a list of the actual users in the OpenStack
643 deployment. In any other case, check that the credentials are sourced::
644
645   env|grep OS_
646
647 This command must show a set of environment variables starting with
648 *OS_*, for example::
649
650   OS_REGION_NAME=RegionOne
651   OS_DEFAULT_DOMAIN=default
652   OS_PROJECT_NAME=admin
653   OS_PASSWORD=admin
654   OS_AUTH_STRATEGY=keystone
655   OS_AUTH_URL=http://172.30.10.3:5000/v2.0
656   OS_USERNAME=admin
657   OS_TENANT_NAME=admin
658   OS_ENDPOINT_TYPE=internalURL
659   OS_NO_CACHE=true
660
661 If the OpenStack command still does not show anything or complains
662 about connectivity issues, it could be due to an incorrect url given to
663 the OS_AUTH_URL environment variable. Check the deployment settings.
664
665 SSL Support
666 -----------
667 If you need to connect to a server that is TLS-enabled (the auth URL
668 begins with "https") and it uses a certificate from a private CA or a
669 self-signed certificate, then you will need to specify the path to an
670 appropriate CA certificate to use, to validate the server certificate
671 with the environment variable OS_CACERT::
672
673   echo $OS_CACERT
674   /etc/ssl/certs/ca.crt
675
676 However, this certificate does not exist in the container by default.
677 It has to be copied manually from the OpenStack deployment. This can be
678 done in 2 ways:
679
680   #. Create manually that file and copy the contents from the OpenStack
681      controller.
682   #. (Recommended) Add the file using a Docker volume when starting the
683      container::
684
685        -v <path_to_your_cert_file>:/etc/ssl/certs/ca.cert
686
687 You might need to export OS_CACERT environment variable inside the
688 container::
689
690   export OS_CACERT=/etc/ssl/certs/ca.crt
691
692 Certificate verification can be turned off using OS_INSECURE=true. For
693 example, Fuel uses self-signed cacerts by default, so an pre step would
694 be::
695
696   export OS_INSECURE=true
697
698 Proxy support
699 -------------
700 If your Jumphost node is operating behind a http proxy, then there are
701 2 places where some special actions may be needed to make operations
702 succeed:
703
704   #. Initial installation of docker engine First, try following the
705      official Docker documentation for Proxy settings. Some issues were
706      experienced on CentOS 7 based Jumphost. Some tips are documented
707      in section: `Docker Installation on CentOS behind http proxy`_
708      below.
709
710   #. Execution of the Functest environment preparation inside the
711      created docker container Functest needs internet access to
712      download some resources for some test cases. This might not
713      work properly if the Jumphost is connecting to internet
714      through a http Proxy.
715
716 If that is the case, make sure the resolv.conf and the needed
717 http_proxy and https_proxy environment variables, as well as the
718 'no_proxy' environment variable are set correctly::
719
720   # Make double sure that the 'no_proxy=...' line in the
721   # 'openstack.creds' file is commented out first. Otherwise, the
722   # values set into the 'no_proxy' environment variable below will
723   # be ovewrwritten, each time the command
724   # 'source ~/functest/conf/openstack.creds' is issued.
725
726   cd ~/functest/conf/
727   sed -i 's/export no_proxy/#export no_proxy/' openstack.creds
728   source ./openstack.creds
729
730   # Next calculate some IP addresses for which http_proxy
731   # usage should be excluded:
732
733   publicURL_IP=$(echo $OS_AUTH_URL | grep -Eo "([0-9]+\.){3}[0-9]+")
734
735   adminURL_IP=$(openstack catalog show identity | \
736   grep adminURL | grep -Eo "([0-9]+\.){3}[0-9]+")
737
738   export http_proxy="<your http proxy settings>"
739   export https_proxy="<your https proxy settings>"
740   export no_proxy="127.0.0.1,localhost,$publicURL_IP,$adminURL_IP"
741
742   # Ensure that "git" uses the http_proxy
743   # This may be needed if your firewall forbids SSL based git fetch
744   git config --global http.sslVerify True
745   git config --global http.proxy <Your http proxy settings>
746
747 Validation check: Before running **'functest env prepare'** CLI command,
748 make sure you can reach http and https sites from inside the Functest
749 docker container.
750
751 For example, try to use the **nc** command from inside the functest
752 docker container::
753
754   nc -v opnfv.org 80
755   Connection to opnfv.org 80 port [tcp/http] succeeded!
756
757   nc -v opnfv.org 443
758   Connection to opnfv.org 443 port [tcp/https] succeeded!
759
760 Note: In a Jumphost node based on the CentOS family OS, the **nc**
761 commands might not work. You can use the **curl** command instead.
762
763   curl http://www.opnfv.org:80
764   <HTML><HEAD><meta http-equiv="content-type"
765   .
766   .
767   </BODY></HTML>
768
769   curl https://www.opnfv.org:443
770   <HTML><HEAD><meta http-equiv="content-type"
771   .
772   .
773   </BODY></HTML>
774
775   (Ignore the content. If command returns a valid HTML page, it proves
776   the connection.)
777
778 Docker Installation on CentOS behind http proxy
779 -----------------------------------------------
780 This section is applicable for CentOS family OS on Jumphost which
781 itself is behind a proxy server. In that case, the instructions below
782 should be followed **before** installing the docker engine::
783
784   1) # Make a directory '/etc/systemd/system/docker.service.d'
785      # if it does not exist
786      sudo mkdir /etc/systemd/system/docker.service.d
787
788   2) # Create a file called 'env.conf' in that directory with
789      # the following contents:
790      [Service]
791      EnvironmentFile=-/etc/sysconfig/docker
792
793   3) # Set up a file called 'docker' in directory '/etc/sysconfig'
794      # with the following contents:
795      HTTP_PROXY="<Your http proxy settings>"
796      HTTPS_PROXY="<Your https proxy settings>"
797      http_proxy="${HTTP_PROXY}"
798      https_proxy="${HTTPS_PROXY}"
799
800   4) # Reload the daemon
801      systemctl daemon-reload
802
803   5) # Sanity check - check the following docker settings:
804      systemctl show docker | grep -i env
805
806      Expected result:
807      ----------------
808      EnvironmentFile=/etc/sysconfig/docker (ignore_errors=yes)
809      DropInPaths=/etc/systemd/system/docker.service.d/env.conf
810
811 Now follow the instructions in [`InstallDockerCentOS`_] to download
812 and install the **docker-engine**. The instructions conclude with a
813 "test pull" of a sample "Hello World" docker container. This should now
814 work with the above pre-requisite actions.
815
816 .. _dockerdocs: https://docs.docker.com/
817 .. _dockerhub: https://hub.docker.com/r/opnfv/functest/
818 .. _Proxy: https://docs.docker.com/engine/admin/systemd/#http-proxy
819 .. _FunctestDockerTags: https://hub.docker.com/r/opnfv/functest/tags/
820 .. _InstallDockerCentOS: https://docs.docker.com/engine/installation/linux/centos/
821 .. _OPNFV_FuncTestUserGuide: http://artifacts.opnfv.org/functest/docs/userguide/index.html