Update kube_bench split in doc
[functest.git] / docs / testing / user / configguide / configguide.rst
1 .. SPDX-License-Identifier: CC-BY-4.0
2
3 Installation and configuration
4 ==============================
5
6 Alpine containers have been introduced in Euphrates.
7 Alpine allows Functest testing in several very light containers and thanks to
8 the refactoring on dependency management should allow the creation of light and
9 fully customized docker images.
10
11
12 Functest Dockers for OpenStack deployment
13 -----------------------------------------
14 Docker images are available on the dockerhub:
15
16   * opnfv/functest-healthcheck
17   * opnfv/functest-smoke
18   * opnfv/functest-smoke-cntt
19   * opnfv/functest-benchmarking
20   * opnfv/functest-benchmarking-cntt
21   * opnfv/functest-vnf
22
23
24 Preparing your environment
25 ^^^^^^^^^^^^^^^^^^^^^^^^^^
26
27 cat env::
28
29   DEPLOY_SCENARIO=XXX  # if not os-nosdn-nofeature-noha scenario
30   NAMESERVER=XXX  # if not 8.8.8.8
31   EXTERNAL_NETWORK=XXX # if not first network with router:external=True
32   DASHBOARD_URL=XXX  # else tempest_horizon will be skipped
33   NEW_USER_ROLE=XXX # if not member
34   SDN_CONTROLLER_IP=XXX  # if odl scenario
35   VOLUME_DEVICE_NAME=XXX  # if not vdb
36   FLAVOR_EXTRA_SPECS=hw:mem_page_size:large    # if fdio scenarios
37
38 See section on environment variables for details.
39
40 cat env_file::
41
42   export OS_AUTH_URL=XXX
43   export OS_USER_DOMAIN_NAME=XXX
44   export OS_PROJECT_DOMAIN_NAME=XXX
45   export OS_USERNAME=XXX
46   export OS_PROJECT_NAME=XXX
47   export OS_PASSWORD=XXX
48   export OS_IDENTITY_API_VERSION=3
49   export OS_REGION_NAME=XXX
50
51 See section on OpenStack credentials for details.
52
53 Create a directory for the different images (attached as a Docker volume)::
54
55   mkdir -p images && wget -q -O- https://git.opnfv.org/functest/plain/functest/ci/download_images.sh | bash -s -- images && ls -1 images/*
56
57   images/cirros-0.5.1-aarch64-disk.img
58   images/cirros-0.5.1-x86_64-disk.img
59   images/cloudify-docker-manager-community-19.01.24.tar
60   images/Fedora-Cloud-Base-30-1.2.x86_64.qcow2
61   images/shaker-image-1.3.0+stretch.qcow2
62   images/ubuntu-14.04-server-cloudimg-amd64-disk1.img
63   images/ubuntu-14.04-server-cloudimg-arm64-uefi1.img
64   images/ubuntu-16.04-server-cloudimg-amd64-disk1.img
65   images/vyos-1.1.8-amd64.qcow2
66
67 Testing healthcheck suite
68 ^^^^^^^^^^^^^^^^^^^^^^^^^
69
70 Run healthcheck suite::
71
72   sudo docker run --env-file env \
73       -v $(pwd)/openstack.creds:/home/opnfv/functest/conf/env_file \
74       -v $(pwd)/images:/home/opnfv/functest/images \
75       opnfv/functest-healthcheck
76
77 Results shall be displayed as follows::
78
79   +--------------------------+------------------+---------------------+------------------+----------------+
80   |        TEST CASE         |     PROJECT      |         TIER        |     DURATION     |     RESULT     |
81   +--------------------------+------------------+---------------------+------------------+----------------+
82   |     connection_check     |     functest     |     healthcheck     |      00:03       |      PASS      |
83   |      tenantnetwork1      |     functest     |     healthcheck     |      00:05       |      PASS      |
84   |      tenantnetwork2      |     functest     |     healthcheck     |      00:06       |      PASS      |
85   |         vmready1         |     functest     |     healthcheck     |      00:06       |      PASS      |
86   |         vmready2         |     functest     |     healthcheck     |      00:08       |      PASS      |
87   |        singlevm1         |     functest     |     healthcheck     |      00:32       |      PASS      |
88   |        singlevm2         |     functest     |     healthcheck     |      00:37       |      PASS      |
89   |        vping_ssh         |     functest     |     healthcheck     |      00:46       |      PASS      |
90   |      vping_userdata      |     functest     |     healthcheck     |      00:39       |      PASS      |
91   |       cinder_test        |     functest     |     healthcheck     |      01:05       |      PASS      |
92   |      tempest_smoke       |     functest     |     healthcheck     |      05:39       |      PASS      |
93   |     tempest_horizon      |     functest     |     healthcheck     |      01:05       |      PASS      |
94   |           odl            |     functest     |     healthcheck     |      00:00       |      SKIP      |
95   +--------------------------+------------------+---------------------+------------------+----------------+
96
97 NOTE: the duration is a reference and it might vary depending on your SUT.
98
99 Testing smoke suite
100 ^^^^^^^^^^^^^^^^^^^
101
102 Run smoke suite::
103
104   sudo docker run --env-file env \
105       -v $(pwd)/openstack.creds:/home/opnfv/functest/conf/env_file \
106       -v $(pwd)/images:/home/opnfv/functest/images \
107       opnfv/functest-smoke
108
109 Results shall be displayed as follows::
110
111   +---------------------------+------------------+---------------+------------------+----------------+
112   |         TEST CASE         |     PROJECT      |      TIER     |     DURATION     |     RESULT     |
113   +---------------------------+------------------+---------------+------------------+----------------+
114   |      tempest_neutron      |     functest     |     smoke     |      15:30       |      PASS      |
115   |       tempest_cinder      |     functest     |     smoke     |      02:01       |      PASS      |
116   |      tempest_keystone     |     functest     |     smoke     |      01:17       |      PASS      |
117   |        tempest_heat       |     functest     |     smoke     |      22:14       |      PASS      |
118   |     tempest_telemetry     |     functest     |     smoke     |      00:00       |      SKIP      |
119   |        rally_sanity       |     functest     |     smoke     |      17:24       |      PASS      |
120   |      refstack_compute     |     functest     |     smoke     |      07:03       |      PASS      |
121   |      refstack_object      |     functest     |     smoke     |      02:09       |      PASS      |
122   |     refstack_platform     |     functest     |     smoke     |      07:31       |      PASS      |
123   |        tempest_full       |     functest     |     smoke     |      41:52       |      PASS      |
124   |      tempest_scenario     |     functest     |     smoke     |      08:42       |      PASS      |
125   |        tempest_slow       |     functest     |     smoke     |      43:42       |      PASS      |
126   |          patrole          |     functest     |     smoke     |      02:42       |      PASS      |
127   |      tempest_barbican     |     functest     |     smoke     |      02:30       |      PASS      |
128   |      tempest_octavia      |     functest     |     smoke     |      00:00       |      SKIP      |
129   +---------------------------+------------------+---------------+------------------+----------------+
130
131 Note: if the scenario does not support some tests, they are indicated as SKIP.
132 See User guide for details.
133
134 Testing smoke CNTT suite
135 ^^^^^^^^^^^^^^^^^^^^^^^^
136
137 Run smoke-cntt suite::
138
139   sudo docker run --env-file env \
140       -v $(pwd)/openstack.creds:/home/opnfv/functest/conf/env_file \
141       -v $(pwd)/images:/home/opnfv/functest/images \
142       opnfv/functest-smoke-cntt
143
144 Results shall be displayed as follows::
145
146   +-------------------------------+------------------+---------------+------------------+----------------+
147   |           TEST CASE           |     PROJECT      |      TIER     |     DURATION     |     RESULT     |
148   +-------------------------------+------------------+---------------+------------------+----------------+
149   |      tempest_neutron_cntt     |     functest     |     smoke     |      11:35       |      PASS      |
150   |      tempest_cinder_cntt      |     functest     |     smoke     |      01:58       |      PASS      |
151   |     tempest_keystone_cntt     |     functest     |     smoke     |      01:13       |      PASS      |
152   |       tempest_heat_cntt       |     functest     |     smoke     |      22:32       |      PASS      |
153   |       rally_sanity_cntt       |     functest     |     smoke     |      17:16       |      PASS      |
154   |       tempest_full_cntt       |     functest     |     smoke     |      41:13       |      PASS      |
155   |     tempest_scenario_cntt     |     functest     |     smoke     |      08:57       |      PASS      |
156   |       tempest_slow_cntt       |     functest     |     smoke     |      35:58       |      PASS      |
157   +-------------------------------+------------------+---------------+------------------+----------------+
158
159 Testing benchmarking suite
160 ^^^^^^^^^^^^^^^^^^^^^^^^^^
161
162 Run benchmarking suite::
163
164   sudo docker run --env-file env \
165       -v $(pwd)/openstack.creds:/home/opnfv/functest/conf/env_file \
166       -v $(pwd)/images:/home/opnfv/functest/images \
167       opnfv/functest-benchmarking
168
169 Results shall be displayed as follows::
170
171   +--------------------+------------------+----------------------+------------------+----------------+
172   |     TEST CASE      |     PROJECT      |         TIER         |     DURATION     |     RESULT     |
173   +--------------------+------------------+----------------------+------------------+----------------+
174   |     rally_full     |     functest     |     benchmarking     |      93:03       |      PASS      |
175   |     rally_jobs     |     functest     |     benchmarking     |      27:05       |      PASS      |
176   |        vmtp        |     functest     |     benchmarking     |      17:56       |      PASS      |
177   |       shaker       |     functest     |     benchmarking     |      24:02       |      PASS      |
178   +--------------------+------------------+----------------------+------------------+----------------+
179
180 Note: if the scenario does not support some tests, they are indicated as SKIP.
181 See User guide for details.
182
183 Testing benchmarking CNTT suite
184 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
185
186 Run benchmarking-cntt suite::
187
188   sudo docker run --env-file env \
189       -v $(pwd)/openstack.creds:/home/opnfv/functest/conf/env_file \
190       -v $(pwd)/images:/home/opnfv/functest/images \
191       opnfv/functest-benchmarking-cntt
192
193 Results shall be displayed as follows::
194
195   +-------------------------+------------------+----------------------+------------------+----------------+
196   |        TEST CASE        |     PROJECT      |         TIER         |     DURATION     |     RESULT     |
197   +-------------------------+------------------+----------------------+------------------+----------------+
198   |     rally_full_cntt     |     functest     |     benchmarking     |      89:52       |      PASS      |
199   |     rally_jobs_cntt     |     functest     |     benchmarking     |      19:39       |      PASS      |
200   |           vmtp          |     functest     |     benchmarking     |      16:59       |      PASS      |
201   |          shaker         |     functest     |     benchmarking     |      23:43       |      PASS      |
202   +-------------------------+------------------+----------------------+------------------+----------------+
203
204 Testing vnf suite
205 ^^^^^^^^^^^^^^^^^
206
207 Run vnf suite::
208
209   sudo docker run --env-file env \
210       -v $(pwd)/openstack.creds:/home/opnfv/functest/conf/env_file \
211       -v $(pwd)/images:/home/opnfv/functest/images \
212       opnfv/functest-vnf
213
214 Results shall be displayed as follows::
215
216   +----------------------+------------------+--------------+------------------+----------------+
217   |      TEST CASE       |     PROJECT      |     TIER     |     DURATION     |     RESULT     |
218   +----------------------+------------------+--------------+------------------+----------------+
219   |       cloudify       |     functest     |     vnf      |      05:08       |      PASS      |
220   |     cloudify_ims     |     functest     |     vnf      |      24:46       |      PASS      |
221   |       heat_ims       |     functest     |     vnf      |      33:12       |      PASS      |
222   |     vyos_vrouter     |     functest     |     vnf      |      15:53       |      PASS      |
223   |       juju_epc       |     functest     |     vnf      |      27:52       |      PASS      |
224   +----------------------+------------------+--------------+------------------+----------------+
225
226 Functest Dockers for Kubernetes deployment
227 ------------------------------------------
228 Docker images are available on the dockerhub:
229
230   * opnfv/functest-kubernetes-healthcheck
231   * opnfv/functest-kubernetes-smoke
232   * opnfv/functest-kubernetes-security
233   * opnfv/functest-kubernetes-benchmarking
234   * opnfv/functest-kubernetes-cnf
235
236 Preparing your environment
237 ^^^^^^^^^^^^^^^^^^^^^^^^^^
238
239 cat env::
240
241   DEPLOY_SCENARIO=k8s-XXX
242
243 Testing healthcheck suite
244 ^^^^^^^^^^^^^^^^^^^^^^^^^
245
246 Run healthcheck suite::
247
248   sudo docker run -it --env-file env \
249       -v $(pwd)/config:/root/.kube/config \
250       opnfv/functest-kubernetes-healthcheck
251
252 A config file in the current dir 'config' is also required, which should be
253 volume mapped to ~/.kube/config inside kubernetes container.
254
255 Results shall be displayed as follows::
256
257   +-------------------+------------------+---------------------+------------------+----------------+
258   |     TEST CASE     |     PROJECT      |         TIER        |     DURATION     |     RESULT     |
259   +-------------------+------------------+---------------------+------------------+----------------+
260   |     k8s_quick     |     functest     |     healthcheck     |      00:18       |      PASS      |
261   |     k8s_smoke     |     functest     |     healthcheck     |      01:14       |      PASS      |
262   +-------------------+------------------+---------------------+------------------+----------------+
263
264 Testing smoke suite
265 ^^^^^^^^^^^^^^^^^^^
266
267 Run smoke suite::
268
269   sudo docker run -it --env-file env \
270       -v $(pwd)/config:/root/.kube/config \
271       opnfv/functest-kubernetes-smoke
272
273 Results shall be displayed as follows::
274
275   +---------------------------+------------------+---------------+------------------+----------------+
276   |         TEST CASE         |     PROJECT      |      TIER     |     DURATION     |     RESULT     |
277   +---------------------------+------------------+---------------+------------------+----------------+
278   |      k8s_conformance      |     functest     |     smoke     |      94:26       |      PASS      |
279   |     xrally_kubernetes     |     functest     |     smoke     |      13:05       |      PASS      |
280   +---------------------------+------------------+---------------+------------------+----------------+
281
282 Testing security suite
283 ^^^^^^^^^^^^^^^^^^^^^^
284
285 Run smoke suite::
286
287   sudo docker run -it --env-file env \
288       -v $(pwd)/config:/root/.kube/config \
289       opnfv/functest-kubernetes-security
290
291 Results shall be displayed as follows::
292
293   +---------------------------+------------------+------------------+------------------+----------------+
294   |         TEST CASE         |     PROJECT      |       TIER       |     DURATION     |     RESULT     |
295   +---------------------------+------------------+------------------+------------------+----------------+
296   |        kube_hunter        |     functest     |     security     |      00:19       |      PASS      |
297   |     kube_bench_master     |     functest     |     security     |      00:02       |      PASS      |
298   |      kube_bench_node      |     functest     |     security     |      00:01       |      PASS      |
299   +---------------------------+------------------+------------------+------------------+----------------+
300
301 Testing benchmarking suite
302 ^^^^^^^^^^^^^^^^^^^^^^^^^^
303
304 Run benchmarking suite::
305
306   sudo docker run -it --env-file env \
307       -v $(pwd)/config:/root/.kube/config \
308       opnfv/functest-kubernetes-benchmarking
309
310 Results shall be displayed as follows::
311
312   +--------------------------------+------------------+----------------------+------------------+----------------+
313   |           TEST CASE            |     PROJECT      |         TIER         |     DURATION     |     RESULT     |
314   +--------------------------------+------------------+----------------------+------------------+----------------+
315   |     xrally_kubernetes_full     |     functest     |     benchmarking     |      34:16       |      PASS      |
316   +--------------------------------+------------------+----------------------+------------------+----------------+
317
318 Testing cnf suite
319 ^^^^^^^^^^^^^^^^^
320
321 Run cnf suite::
322
323   sudo docker run -it --env-file env \
324       -v $(pwd)/config:/root/.kube/config \
325       opnfv/functest-kubernetes-cnf
326
327 Results shall be displayed as follows::
328
329   +-------------------------+------------------+--------------+------------------+----------------+
330   |        TEST CASE        |     PROJECT      |     TIER     |     DURATION     |     RESULT     |
331   +-------------------------+------------------+--------------+------------------+----------------+
332   |     cnf_conformance     |     functest     |     cnf      |      05:30       |      PASS      |
333   |         k8s_vims        |     functest     |     cnf      |      20:28       |      PASS      |
334   +-------------------------+------------------+--------------+------------------+----------------+
335
336 Environment variables
337 =====================
338
339 Several environment variables may be specified:
340
341   * INSTALLER_IP=<Specific IP Address>
342   * DEPLOY_SCENARIO=<vim>-<controller>-<nfv_feature>-<ha_mode>
343   * NAMESERVER=XXX  # if not 8.8.8.8
344   * VOLUME_DEVICE_NAME=XXX  # if not vdb
345   * EXTERNAL_NETWORK=XXX # if not first network with router:external=True
346   * NEW_USER_ROLE=XXX # if not member
347
348 INSTALLER_IP is required by Barometer in order to access the installer node and
349 the deployment.
350
351 The format for the DEPLOY_SCENARIO env variable can be described as follows:
352   * vim: (os|k8s) = OpenStack or Kubernetes
353   * controller is one of ( nosdn | odl )
354   * nfv_feature is one or more of ( ovs | kvm | sfc | bgpvpn | nofeature )
355   * ha_mode (high availability) is one of ( ha | noha )
356
357 If several features are pertinent then use the underscore character '_' to
358 separate each feature (e.g. ovs_kvm). 'nofeature' indicates that no OPNFV
359 feature is deployed.
360
361 The list of supported scenarios per release/installer is indicated in the
362 release note.
363
364 **NOTE:** The scenario name is mainly used to automatically detect
365 if a test suite is runnable or not (e.g. it will prevent ODL test suite to be
366 run on 'nosdn' scenarios). If not set, Functest will try to run the default
367 test cases that might not include SDN controller or a specific feature.
368
369 **NOTE:** An HA scenario means that 3 OpenStack controller nodes are
370 deployed. It does not necessarily mean that the whole system is HA. See
371 installer release notes for details.
372
373 Finally, three additional environment variables can also be passed in
374 to the Functest Docker Container, using the -e
375 "<EnvironmentVariable>=<Value>" mechanism. The first two parameters are
376 only relevant to Jenkins CI invoked testing and **should not be used**
377 when performing manual test scenarios:
378
379   * INSTALLER_TYPE=(apex|compass|daisy|fuel)
380   * NODE_NAME=<Test POD Name>
381   * BUILD_TAG=<Jenkins Build Tag>
382
383 where:
384
385   * <Test POD Name> = Symbolic name of the POD where the tests are run.
386                       Visible in test results files, which are stored
387                       to the database. This option is only used when
388                       tests are activated under Jenkins CI control.
389                       It indicates the POD/hardware where the test has
390                       been run. If not specified, then the POD name is
391                       defined as "Unknown" by default.
392                       DO NOT USE THIS OPTION IN MANUAL TEST SCENARIOS.
393   * <Jenkins Build tag> = Symbolic name of the Jenkins Build Job.
394                          Visible in test results files, which are stored
395                          to the database. This option is only set when
396                          tests are activated under Jenkins CI control.
397                          It enables the correlation of test results,
398                          which are independently pushed to the results database
399                          from different Jenkins jobs.
400                          DO NOT USE THIS OPTION IN MANUAL TEST SCENARIOS.
401
402
403 Openstack credentials
404 =====================
405 OpenStack credentials are mandatory and must be provided to Functest.
406 When running the command "functest env prepare", the framework  will
407 automatically look for the Openstack credentials file
408 "/home/opnfv/functest/conf/env_file" and will exit with
409 error if it is not present or is empty.
410
411 There are 2 ways to provide that file:
412
413   * by using a Docker volume with -v option when creating the Docker container.
414     This is referred to in docker documentation as "Bind Mounting".
415     See the usage of this parameter in the following chapter.
416   * or creating manually the file '/home/opnfv/functest/conf/env_file'
417     inside the running container and pasting the credentials in it. Consult
418     your installer guide for further details. This is however not
419     instructed in this document.
420
421 In proxified environment you may need to change the credentials file.
422 There are some tips in chapter: `Proxy support`_
423
424 SSL Support
425 -----------
426 If you need to connect to a server that is TLS-enabled (the auth URL
427 begins with "https") and it uses a certificate from a private CA or a
428 self-signed certificate, then you will need to specify the path to an
429 appropriate CA certificate to use, to validate the server certificate
430 with the environment variable OS_CACERT::
431
432   echo $OS_CACERT
433   /etc/ssl/certs/ca.crt
434
435 However, this certificate does not exist in the container by default.
436 It has to be copied manually from the OpenStack deployment. This can be
437 done in 2 ways:
438
439   #. Create manually that file and copy the contents from the OpenStack
440      controller.
441   #. (Recommended) Add the file using a Docker volume when starting the
442      container::
443
444        -v <path_to_your_cert_file>:/etc/ssl/certs/ca.cert
445
446 You might need to export OS_CACERT environment variable inside the
447 credentials file::
448
449   export OS_CACERT=/etc/ssl/certs/ca.crt
450
451 Certificate verification can be turned off using OS_INSECURE=true. For
452 example, Fuel uses self-signed cacerts by default, so an pre step would
453 be::
454
455   export OS_INSECURE=true
456
457
458 Logs
459 ====
460 By default all the logs are put un /home/opnfv/functest/results/functest.log.
461 If you want to have more logs in console, you may edit the logging.ini file
462 manually.
463 Connect on the docker then edit the file located in
464 /usr/lib/python3.8/site-packages/xtesting/ci/logging.ini
465
466 Change wconsole to console in the desired module to get more traces.
467
468
469 Configuration
470 =============
471
472 You may also directly modify the python code or the configuration file (e.g.
473 testcases.yaml used to declare test constraints) under
474 /usr/lib/python3.8/site-packages/xtesting and
475 /usr/lib/python3.8/site-packages/functest
476
477
478 Tips
479 ====
480
481 Docker
482 ------
483 When typing **exit** in the container prompt, this will cause exiting
484 the container and probably stopping it. When stopping a running Docker
485 container all the changes will be lost, there is a keyboard shortcut
486 to quit the container without stopping it: <CTRL>-P + <CTRL>-Q. To
487 reconnect to the running container **DO NOT** use the *run* command
488 again (since it will create a new container), use the *exec* or *attach*
489 command instead::
490
491   docker ps  # <check the container ID from the output>
492   docker exec -ti <CONTAINER_ID> /bin/bash
493
494 There are other useful Docker commands that might be needed to manage possible
495 issues with the containers.
496
497 List the running containers::
498
499   docker ps
500
501 List all the containers including the stopped ones::
502
503   docker ps -a
504
505 Start a stopped container named "FunTest"::
506
507   docker start FunTest
508
509 Attach to a running container named "StrikeTwo"::
510
511   docker attach StrikeTwo
512
513 It is useful sometimes to remove a container if there are some problems::
514
515   docker rm <CONTAINER_ID>
516
517 Use the *-f* option if the container is still running, it will force to
518 destroy it::
519
520   docker rm -f <CONTAINER_ID>
521
522 Check the Docker documentation [`dockerdocs`_] for more information.
523
524
525 Checking Openstack and credentials
526 ----------------------------------
527 It is recommended and fairly straightforward to check that Openstack
528 and credentials are working as expected.
529
530 Once the credentials are there inside the container, they should be
531 sourced before running any Openstack commands::
532
533   source /home/opnfv/functest/conf/env_file
534
535 After this, try to run any OpenStack command to see if you get any
536 output, for instance::
537
538   openstack user list
539
540 This will return a list of the actual users in the OpenStack
541 deployment. In any other case, check that the credentials are sourced::
542
543   env|grep OS_
544
545 This command must show a set of environment variables starting with
546 *OS_*, for example::
547
548   OS_REGION_NAME=RegionOne
549   OS_USER_DOMAIN_NAME=Default
550   OS_PROJECT_NAME=admin
551   OS_AUTH_VERSION=3
552   OS_IDENTITY_API_VERSION=3
553   OS_PASSWORD=da54c27ae0d10dfae5297e6f0d6be54ebdb9f58d0f9dfc
554   OS_AUTH_URL=http://10.1.0.9:5000/v3
555   OS_USERNAME=admin
556   OS_TENANT_NAME=admin
557   OS_ENDPOINT_TYPE=internalURL
558   OS_INTERFACE=internalURL
559   OS_NO_CACHE=1
560   OS_PROJECT_DOMAIN_NAME=Default
561
562
563 If the OpenStack command still does not show anything or complains
564 about connectivity issues, it could be due to an incorrect url given to
565 the OS_AUTH_URL environment variable. Check the deployment settings.
566
567 .. _`Proxy support`:
568
569 Proxy support
570 -------------
571 If your Jumphost node is operating behind a http proxy, then there are
572 2 places where some special actions may be needed to make operations
573 succeed:
574
575   #. Initial installation of docker engine First, try following the
576      official Docker documentation for Proxy settings. Some issues were
577      experienced on CentOS 7 based Jumphost. Some tips are documented
578      in section: :ref:`Docker Installation on CentOS behind http proxy`
579      below.
580
581 If that is the case, make sure the resolv.conf and the needed
582 http_proxy and https_proxy environment variables, as well as the
583 'no_proxy' environment variable are set correctly::
584
585   # Make double sure that the 'no_proxy=...' line in the
586   # 'env_file' file is commented out first. Otherwise, the
587   # values set into the 'no_proxy' environment variable below will
588   # be ovewrwritten, each time the command
589   # 'source ~/functest/conf/env_file' is issued.
590
591   cd ~/functest/conf/
592   sed -i 's/export no_proxy/#export no_proxy/' env_file
593   source ./env_file
594
595   # Next calculate some IP addresses for which http_proxy
596   # usage should be excluded:
597
598   publicURL_IP=$(echo $OS_AUTH_URL | grep -Eo "([0-9]+\.){3}[0-9]+")
599
600   adminURL_IP=$(openstack catalog show identity | \
601   grep adminURL | grep -Eo "([0-9]+\.){3}[0-9]+")
602
603   export http_proxy="<your http proxy settings>"
604   export https_proxy="<your https proxy settings>"
605   export no_proxy="127.0.0.1,localhost,$publicURL_IP,$adminURL_IP"
606
607   # Ensure that "git" uses the http_proxy
608   # This may be needed if your firewall forbids SSL based git fetch
609   git config --global http.sslVerify True
610   git config --global http.proxy <Your http proxy settings>
611
612 For example, try to use the **nc** command from inside the functest
613 docker container::
614
615   nc -v opnfv.org 80
616   Connection to opnfv.org 80 port [tcp/http] succeeded!
617
618   nc -v opnfv.org 443
619   Connection to opnfv.org 443 port [tcp/https] succeeded!
620
621 Note: In a Jumphost node based on the CentOS family OS, the **nc**
622 commands might not work. You can use the **curl** command instead.
623
624   curl https://www.opnfv.org/
625
626   <HTML><HEAD><meta http-equiv="content-type"
627   .
628   .
629   </BODY></HTML>
630
631   curl https://www.opnfv.org:443
632
633   <HTML><HEAD><meta http-equiv="content-type"
634   .
635   .
636   </BODY></HTML>
637
638   (Ignore the content. If command returns a valid HTML page, it proves
639   the connection.)
640
641 .. _`Docker Installation on CentOS behind http proxy`:
642
643 Docker Installation on CentOS behind http proxy
644 -----------------------------------------------
645 This section is applicable for CentOS family OS on Jumphost which
646 itself is behind a proxy server. In that case, the instructions below
647 should be followed **before** installing the docker engine::
648
649   1) # Make a directory '/etc/systemd/system/docker.service.d'
650      # if it does not exist
651      sudo mkdir /etc/systemd/system/docker.service.d
652
653   2) # Create a file called 'env.conf' in that directory with
654      # the following contents:
655      [Service]
656      EnvironmentFile=-/etc/sysconfig/docker
657
658   3) # Set up a file called 'docker' in directory '/etc/sysconfig'
659      # with the following contents:
660      HTTP_PROXY="<Your http proxy settings>"
661      HTTPS_PROXY="<Your https proxy settings>"
662      http_proxy="${HTTP_PROXY}"
663      https_proxy="${HTTPS_PROXY}"
664
665   4) # Reload the daemon
666      systemctl daemon-reload
667
668   5) # Sanity check - check the following docker settings:
669      systemctl show docker | grep -i env
670
671      Expected result:
672      ----------------
673      EnvironmentFile=/etc/sysconfig/docker (ignore_errors=yes)
674      DropInPaths=/etc/systemd/system/docker.service.d/env.conf
675
676 Now follow the instructions in [`Install Docker on CentOS`_] to download
677 and install the **docker-engine**. The instructions conclude with a
678 "test pull" of a sample "Hello World" docker container. This should now
679 work with the above pre-requisite actions.
680
681
682 .. _`dockerdocs`: https://docs.docker.com/
683 .. _`Proxy`: https://docs.docker.com/engine/admin/systemd/#http-proxy
684 .. _`Install Docker on CentOS`: https://docs.docker.com/engine/installation/linux/centos/
685 .. _`Functest User Guide`: http://docs.opnfv.org/en/stable-danube/submodules/functest/docs/testing/user/userguide/index.html
686 .. _`images/CentOS-7-x86_64-GenericCloud.qcow2`: https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2
687 .. _`images/cirros-0.5.1-x86_64-disk.img`: http://download.cirros-cloud.net/0.5.1/cirros-0.5.1-x86_64-disk.img
688 .. _`images/ubuntu-14.04-server-cloudimg-amd64-disk1.img`: https://cloud-images.ubuntu.com/releases/14.04/release/ubuntu-14.04-server-cloudimg-amd64-disk1.img