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