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