Merge "[docs] Fix links to remove references to submodules"
[yardstick.git] / docs / testing / user / userguide / 04-installation.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International
2 .. License.
3 .. http://creativecommons.org/licenses/by/4.0
4 .. (c) OPNFV, Ericsson AB, Huawei Technologies Co.,Ltd and others.
5
6 ======================
7 Yardstick Installation
8 ======================
9
10
11 Yardstick supports installation by Docker or directly in Ubuntu. The
12 installation procedure for Docker and direct installation are detailed in
13 the sections below.
14
15 To use Yardstick you should have access to an OpenStack environment, with at
16 least Nova, Neutron, Glance, Keystone and Heat installed.
17
18 The steps needed to run Yardstick are:
19
20 1. Install Yardstick.
21 2. Load OpenStack environment variables.
22 3. Create Yardstick flavor.
23 4. Build a guest image and load it into the OpenStack environment.
24 5. Create the test configuration ``.yaml`` file and run the test case/suite.
25
26
27 Prerequisites
28 -------------
29
30 The OPNFV deployment is out of the scope of this document and can be found in
31 `User Guide & Configuration Guide`_. The OPNFV platform is considered as the
32 System Under Test (SUT) in this document.
33
34 Several prerequisites are needed for Yardstick:
35
36 1. A Jumphost to run Yardstick on
37 2. A Docker daemon or a virtual environment installed on the Jumphost
38 3. A public/external network created on the SUT
39 4. Connectivity from the Jumphost to the SUT public/external network
40
41 .. note:: *Jumphost* refers to any server which meets the previous
42    requirements. Normally it is the same server from where the OPNFV
43    deployment has been triggered.
44
45 .. warning:: Connectivity from Jumphost is essential and it is of paramount
46    importance to make sure it is working before even considering to install
47    and run Yardstick. Make also sure you understand how your networking is
48    designed to work.
49
50 .. note:: If your Jumphost is operating behind a company http proxy and/or
51    Firewall, please first consult `Proxy Support`_ section which is towards
52    the end of this document. That section details some tips/tricks which *may*
53    be of help in a proxified environment.
54
55
56 Install Yardstick using Docker (first option) (**recommended**)
57 ---------------------------------------------------------------
58
59 Yardstick has a Docker image. It is recommended to use this Docker image to run
60 Yardstick test.
61
62 Prepare the Yardstick container
63 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
64
65 Install docker on your guest system with the following command, if not done
66 yet::
67
68    wget -qO- https://get.docker.com/ | sh
69
70 Pull the Yardstick Docker image (``opnfv/yardstick``) from the public dockerhub
71 registry under the OPNFV account in dockerhub_, with the following docker
72 command::
73
74    sudo -EH docker pull opnfv/yardstick:stable
75
76 After pulling the Docker image, check that it is available with the
77 following docker command::
78
79    [yardsticker@jumphost ~]$ docker images
80    REPOSITORY         TAG       IMAGE ID        CREATED      SIZE
81    opnfv/yardstick    stable    a4501714757a    1 day ago    915.4 MB
82
83 Run the Docker image to get a Yardstick container::
84
85    docker run -itd --privileged -v /var/run/docker.sock:/var/run/docker.sock \
86       -p 8888:5000 --name yardstick opnfv/yardstick:stable
87
88 Description of the parameters used with ``docker run`` command
89
90   +------------------------+--------------------------------------------------+
91   | Parameters             | Detail                                           |
92   +========================+==================================================+
93   | -itd                   |  -i: interactive, Keep STDIN open even if not    |
94   |                        |  attached                                        |
95   |                        +--------------------------------------------------+
96   |                        |  -t: allocate a pseudo-TTY detached mode, in the |
97   |                        |  background                                      |
98   +------------------------+--------------------------------------------------+
99   | --privileged           | If you want to build ``yardstick-image`` in      |
100   |                        | Yardstick container, this parameter is needed    |
101   +------------------------+--------------------------------------------------+
102   | -p 8888:5000           | Redirect the a host port (8888) to a container   |
103   |                        | port (5000)                                      |
104   +------------------------+--------------------------------------------------+
105   | -v /var/run/docker.sock| If you want to use yardstick env                 |
106   | :/var/run/docker.sock  | grafana/influxdb to create a grafana/influxdb    |
107   |                        | container out of Yardstick container             |
108   +------------------------+--------------------------------------------------+
109   | --name yardstick       | The name for this container                      |
110   +------------------------+--------------------------------------------------+
111
112
113 If the host is restarted
114 ^^^^^^^^^^^^^^^^^^^^^^^^
115
116 The yardstick container must be started if the host is rebooted::
117
118     docker start yardstick
119
120 Configure the Yardstick container environment
121 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
122
123 There are three ways to configure environments for running Yardstick, explained
124 in the following sections. Before that, access the Yardstick container::
125
126    docker exec -it yardstick /bin/bash
127
128 and then configure Yardstick environments in the Yardstick container.
129
130 Using the CLI command ``env prepare`` (first way) (**recommended**)
131 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
132
133 In the Yardstick container, the Yardstick repository is located in the
134 ``/home/opnfv/repos`` directory. Yardstick provides a CLI to prepare OpenStack
135 environment variables and create Yardstick flavor and guest images
136 automatically::
137
138    yardstick env prepare
139
140 .. note:: Since Euphrates release, the above command will not be able to
141   automatically configure the ``/etc/yardstick/openstack.creds`` file. So before
142   running the above command, it is necessary to create the
143   ``/etc/yardstick/openstack.creds`` file and save OpenStack environment
144   variables into it manually. If you have the openstack credential file saved
145   outside the Yardstick Docker container, you can do this easily by mapping the
146   credential file into Yardstick container using::
147
148      '-v /path/to/credential_file:/etc/yardstick/openstack.creds'
149
150   when running the Yardstick container. For details of the required OpenStack
151   environment variables please refer to section `Export OpenStack environment
152   variables`_.
153
154 The ``env prepare`` command may take up to 6-8 minutes to finish building
155 yardstick-image and other environment preparation. Meanwhile if you wish to
156 monitor the env prepare process, you can enter the Yardstick container in a new
157 terminal window and execute the following command::
158
159   tail -f /var/log/yardstick/uwsgi.log
160
161
162 Manually exporting the env variables and initializing OpenStack (second way)
163 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
164
165 Export OpenStack environment variables
166 ######################################
167
168 Before running Yardstick it is necessary to export OpenStack environment
169 variables::
170
171    source openrc
172
173 Environment variables in the ``openrc`` file have to include at least::
174
175    OS_AUTH_URL
176    OS_USERNAME
177    OS_PASSWORD
178    OS_PROJECT_NAME
179    EXTERNAL_NETWORK
180
181 A sample ``openrc`` file may look like this::
182
183   export OS_PASSWORD=console
184   export OS_PROJECT_NAME=admin
185   export OS_AUTH_URL=http://172.16.1.222:35357/v2.0
186   export OS_USERNAME=admin
187   export OS_VOLUME_API_VERSION=2
188   export EXTERNAL_NETWORK=net04_ext
189
190
191 Manual creation of Yardstick flavor and guest images
192 ####################################################
193
194 Before executing Yardstick test cases, make sure that Yardstick flavor and
195 guest image are available in OpenStack. Detailed steps about creating the
196 Yardstick flavor and building the Yardstick guest image can be found below.
197
198 Most of the sample test cases in Yardstick are using an OpenStack flavor called
199 ``yardstick-flavor`` which deviates from the OpenStack standard ``m1.tiny``
200 flavor by the disk size; instead of 1GB it has 3GB. Other parameters are the
201 same as in ``m1.tiny``.
202
203 Create ``yardstick-flavor``::
204
205    openstack flavor create --disk 3 --vcpus 1 --ram 512 --swap 100 \
206       yardstick-flavor
207
208 Most of the sample test cases in Yardstick are using a guest image called
209 ``yardstick-image`` which deviates from an Ubuntu Cloud Server image
210 containing all the required tools to run test cases supported by Yardstick.
211 Yardstick has a tool for building this custom image. It is necessary to have
212 ``sudo`` rights to use this tool.
213
214 Also you may need install several additional packages to use this tool, by
215 follwing the commands below::
216
217    sudo -EH apt-get update && sudo -EH apt-get install -y qemu-utils kpartx
218
219 This image can be built using the following command in the directory where
220 Yardstick is installed::
221
222    export YARD_IMG_ARCH='amd64'
223    echo "Defaults env_keep += \'YARD_IMG_ARCH\'" | sudo tee --append \
224       /etc/sudoers > /dev/null
225    sudo -EH tools/yardstick-img-modify tools/ubuntu-server-cloudimg-modify.sh
226
227 .. warning:: Before building the guest image inside the Yardstick container,
228   make sure the container is granted with privilege. The script will create files
229   by default in ``/tmp/workspace/yardstick`` and the files will be owned by root.
230
231 The created image can be added to OpenStack using the OpenStack client or via
232 the OpenStack Dashboard::
233
234    openstack image create --disk-format qcow2 --container-format bare \
235       --public --file /tmp/workspace/yardstick/yardstick-image.img \
236        yardstick-image
237
238
239 Some Yardstick test cases use a `Cirros 0.3.5`_ image and/or a `Ubuntu 16.04`_
240 image. Add Cirros and Ubuntu images to OpenStack::
241
242    openstack image create --disk-format qcow2 --container-format bare \
243       --public --file $cirros_image_file cirros-0.3.5
244    openstack image create --disk-format qcow2 --container-format bare \
245       --file $ubuntu_image_file Ubuntu-16.04
246
247
248 Automatic initialization of OpenStack (third way)
249 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
250
251 Similar to the second way, the first step is also to
252 `Export OpenStack environment variables`_. Then the following steps should be
253 done.
254
255 Automatic creation of Yardstick flavor and guest images
256 #######################################################
257
258 Yardstick has a script for automatically creating Yardstick flavor and building
259 Yardstick guest images. This script is mainly used for CI and can be also used
260 in the local environment::
261
262    source $YARDSTICK_REPO_DIR/tests/ci/load_images.sh
263
264
265 The Yardstick container GUI
266 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
267
268 In Euphrates release, Yardstick implemented a GUI for Yardstick Docker
269 container. After booting up Yardstick container, you can visit the GUI at
270 ``<container_host_ip>:8888/gui/index.html``.
271
272 For usage of Yardstick GUI, please watch our demo video at
273 `Yardstick GUI demo`_.
274
275 .. note:: The Yardstick GUI is still in development, the GUI layout and
276   features may change.
277
278 Delete the Yardstick container
279 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
280
281 If you want to uninstall Yardstick, just delete the Yardstick container::
282
283    sudo docker stop yardstick && docker rm yardstick
284
285
286
287 Install Yardstick directly in Ubuntu (second option)
288 ----------------------------------------------------
289
290 .. _install-framework:
291
292 Alternatively you can install Yardstick framework directly in Ubuntu or in an
293 Ubuntu Docker image. No matter which way you choose to install Yardstick, the
294 following installation steps are identical.
295
296 If you choose to use the Ubuntu Docker image, you can pull the Ubuntu
297 Docker image from Docker hub::
298
299    sudo -EH docker pull ubuntu:16.04
300
301
302 Install Yardstick
303 ^^^^^^^^^^^^^^^^^
304
305 Prerequisite preparation::
306
307    sudo -EH apt-get update && sudo -EH apt-get install -y \
308       git python-setuptools python-pip
309    sudo -EH easy_install -U setuptools==30.0.0
310    sudo -EH pip install appdirs==1.4.0
311    sudo -EH pip install virtualenv
312
313 Download the source code and install Yardstick from it::
314
315    git clone https://gerrit.opnfv.org/gerrit/yardstick
316    export YARDSTICK_REPO_DIR=~/yardstick
317    cd ~/yardstick
318    sudo -EH ./install.sh
319
320 If the host is ever restarted, nginx and uwsgi need to be restarted::
321
322    service nginx restart
323    uwsgi -i /etc/yardstick/yardstick.ini
324
325 Configure the Yardstick environment (**Todo**)
326 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
327
328 For installing Yardstick directly in Ubuntu, the ``yardstick env`` command is
329 not available. You need to prepare OpenStack environment variables and create
330 Yardstick flavor and guest images manually.
331
332
333 Uninstall Yardstick
334 ^^^^^^^^^^^^^^^^^^^
335
336 For uninstalling Yardstick, just delete the virtual environment::
337
338    rm -rf ~/yardstick_venv
339
340
341 Install Yardstick directly in OpenSUSE
342 --------------------------------------
343
344 .. _install-framework:
345
346 You can install Yardstick framework directly in OpenSUSE.
347
348
349 Install Yardstick
350 ^^^^^^^^^^^^^^^^^
351
352 Prerequisite preparation::
353
354    sudo -EH zypper -n install -y gcc \
355       wget \
356       git \
357       sshpass \
358       qemu-tools \
359       kpartx \
360       libffi-devel \
361       libopenssl-devel \
362       python \
363       python-devel \
364       python-virtualenv \
365       libxml2-devel \
366       libxslt-devel \
367       python-setuptools-git
368
369 Create a virtual environment::
370
371    virtualenv ~/yardstick_venv
372    export YARDSTICK_VENV=~/yardstick_venv
373    source ~/yardstick_venv/bin/activate
374    sudo -EH easy_install -U setuptools
375
376 Download the source code and install Yardstick from it::
377
378    git clone https://gerrit.opnfv.org/gerrit/yardstick
379    export YARDSTICK_REPO_DIR=~/yardstick
380    cd yardstick
381    sudo -EH python setup.py install
382    sudo -EH pip install -r requirements.txt
383
384 Install missing python modules::
385
386    sudo -EH pip install pyyaml \
387       oslo_utils \
388       oslo_serialization \
389       oslo_config \
390       paramiko \
391       python.heatclient \
392       python.novaclient \
393       python.glanceclient \
394       python.neutronclient \
395       scp \
396       jinja2
397
398
399 Configure the Yardstick environment
400 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
401
402 Source the OpenStack environment variables::
403
404    source DEVSTACK_DIRECTORY/openrc
405
406 Export the Openstack external network. The default installation of Devstack
407 names the external network public::
408
409    export EXTERNAL_NETWORK=public
410    export OS_USERNAME=demo
411
412 Change the API version used by Yardstick to v2.0 (the devstack openrc sets it
413 to v3)::
414
415    export OS_AUTH_URL=http://PUBLIC_IP_ADDRESS:5000/v2.0
416
417
418 Uninstall Yardstick
419 ^^^^^^^^^^^^^^^^^^^
420
421 For unistalling Yardstick, just delete the virtual environment::
422
423    rm -rf ~/yardstick_venv
424
425
426 Verify the installation
427 -----------------------
428
429 It is recommended to verify that Yardstick was installed successfully
430 by executing some simple commands and test samples. Before executing Yardstick
431 test cases make sure ``yardstick-flavor`` and ``yardstick-image`` can be found
432 in OpenStack and the ``openrc`` file is sourced. Below is an example invocation
433 of Yardstick ``help`` command and ``ping.py`` test sample::
434
435    yardstick -h
436    yardstick task start samples/ping.yaml
437
438 .. note:: The above commands could be run in both the Yardstick container and
439   the Ubuntu directly.
440
441 Each testing tool supported by Yardstick has a sample configuration file.
442 These configuration files can be found in the ``samples`` directory.
443
444 Default location for the output is ``/tmp/yardstick.out``.
445
446
447 Automatic installation of Yardstick using ansible
448 -------------------------------------------------
449
450 Automatic installation can be used as an alternative to the manual.
451 Yardstick can be installed on the bare metal and to the container. Yardstick
452 container can be either pulled or built.
453
454 Bare metal installation
455 ^^^^^^^^^^^^^^^^^^^^^^^
456
457 Use ansible script ``install.yaml`` to install Yardstick on Ubuntu server:
458
459 .. code-block:: console
460
461     ansible-playbook -i install-inventory.ini install.yaml \
462     -e YARDSTICK_DIR=<path to Yardstick folder>
463
464 .. note:: By default ``INSTALLATION_MODE`` is ``baremetal``.
465
466 .. note:: By default Ubuntu 16.04 is chosen (xenial). It can be changed to
467    Ubuntu 18.04 (bionic) by passing ``-e OS_RELEASE=bionic`` parameter.
468
469 .. note:: To install Yardstick in virtual environment pass parameter
470    ``-e VIRTUAL_ENVIRONMENT=True``.
471
472 To build Yardstick NSB image pass ``IMG_PROPERTY=nsb`` as input parameter:
473
474 .. code-block:: console
475
476     ansible-playbook -i install-inventory.ini install.yaml \
477     -e IMAGE_PROPERTY=nsb \
478     -e YARDSTICK_DIR=<path to Yardstick folder>
479
480 .. note:: In this ``INSTALLATION_MODE`` mode either Yardstick image or SampleVNF
481    images will be built. Image type is defined by parameter ``IMAGE_PROPERTY``.
482    By default Yardstick image will be built.
483
484 Container installation
485 ^^^^^^^^^^^^^^^^^^^^^^
486
487 Use ansible script ``install.yaml`` to pull or build Yardstick
488 container. To pull Yardstick image and start container run:
489
490 .. code-block:: console
491
492     ansible-playbook -i install-inventory.ini install.yaml \
493     -e YARDSTICK_DIR=<path to Yardstick folder> \
494     -e INSTALLATION_MODE=container_pull
495
496 .. note:: In this ``INSTALLATION_MODE`` mode either Yardstick image or SampleVNF
497    images will be built. Image type is defined by variable ``IMG_PROPERTY`` in
498    file ``ansible/group_vars/all.yml``. By default Yardstick image will be
499    built.
500
501 .. note:: Open question: How to know if Docker image is built on Ubuntu 16.04 and 18.04?
502    Do we need separate tag to be used?
503
504 To build Yardstick image run:
505
506 .. code-block:: console
507
508     ansible-playbook -i install-inventory.ini install.yaml \
509     -e YARDSTICK_DIR=<path to Yardstick folder> \
510     -e INSTALLATION_MODE=container
511
512 .. note:: In this ``INSTALLATION_MODE`` mode neither Yardstick image nor SampleVNF
513    image will be built.
514
515 .. note:: By default Ubuntu 16.04 is chosen (xenial). It can be changed to
516    Ubuntu 18.04 (bionic) by passing ``-e OS_RELEASE=bionic`` parameter.
517
518 Parameters for ``install.yaml``
519 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
520
521 Description of the parameters used with ``install.yaml`` script
522
523   +-------------------------+-------------------------------------------------+
524   | Parameters              | Detail                                          |
525   +=========================+=================================================+
526   | -i install-inventory.ini| Installs package dependency to remote servers   |
527   |                         | Mandatory parameter                             |
528   |                         | By default no remote servers are provided       |
529   |                         | Needed packages will be installed on localhost  |
530   +-------------------------+-------------------------------------------------+
531   | -e YARDSTICK_DIR        | Path to Yardstick folder                        |
532   |                         | Mandatory parameter                             |
533   +-------------------------+-------------------------------------------------+
534   | -e INSTALLATION_MODE    | baremetal: Yardstick is installed to the bare   |
535   |                         | metal                                           |
536   |                         | Default parameter                               |
537   |                         +-------------------------------------------------+
538   |                         | container: Yardstick is installed in container  |
539   |                         | Container is built from Dockerfile              |
540   |                         +-------------------------------------------------+
541   |                         | container_pull: Yardstick is installed in       |
542   |                         | container                                       |
543   |                         | Container is pulled from docker hub             |
544   +-------------------------+-------------------------------------------------+
545   | -e OS_RELEASE           | xenial or bionic: Ubuntu version to be used     |
546   |                         | Default is Ubuntu 16.04 (xenial)                |
547   +-------------------------+-------------------------------------------------+
548   | -e IMAGE_PROPERTY       | normal or nsb: Type of the VM image to be built |
549   |                         | Default image is Yardstick                      |
550   +-------------------------+-------------------------------------------------+
551   | -e VIRTUAL_ENVIRONMENT  | False or True: Whether install in virtualenv    |
552   |                         | Default is False                                |
553   +-------------------------+-------------------------------------------------+
554
555
556 Deploy InfluxDB and Grafana using Docker
557 ----------------------------------------
558
559 Without InfluxDB, Yardstick stores results for running test case in the file
560 ``/tmp/yardstick.out``. However, it's inconvenient to retrieve and display
561 test results. So we will show how to use InfluxDB to store data and use
562 Grafana to display data in the following sections.
563
564 Automatic deployment of InfluxDB and Grafana containers (**recommended**)
565 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
566
567 Firstly, enter the Yardstick container::
568
569    sudo -EH docker exec -it yardstick /bin/bash
570
571 Secondly, create InfluxDB container and configure with the following command::
572
573    yardstick env influxdb
574
575 Thirdly, create and configure Grafana container::
576
577    yardstick env grafana
578
579 Then you can run a test case and visit http://host_ip:1948
580 (``admin``/``admin``) to see the results.
581
582 .. note:: Executing ``yardstick env`` command to deploy InfluxDB and Grafana
583   requires Jumphost's docker API version => 1.24. Run the following command to
584   check the docker API version on the Jumphost::
585
586     docker version
587
588
589 Manual deployment of InfluxDB and Grafana containers
590 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
591
592 You can also deploy influxDB and Grafana containers manually on the Jumphost.
593 The following sections show how to do.
594
595 Pull docker images::
596
597    sudo -EH docker pull tutum/influxdb
598    sudo -EH docker pull grafana/grafana
599
600 Run influxDB::
601
602    sudo -EH docker run -d --name influxdb \
603       -p 8083:8083 -p 8086:8086 --expose 8090 --expose 8099 \
604       tutum/influxdb
605    docker exec -it influxdb bash
606
607 Configure influxDB::
608
609    influx
610       >CREATE USER root WITH PASSWORD 'root' WITH ALL PRIVILEGES
611       >CREATE DATABASE yardstick;
612       >use yardstick;
613       >show MEASUREMENTS;
614
615 Run Grafana::
616
617    sudo -EH docker run -d --name grafana -p 1948:3000 grafana/grafana
618
619 Log on http://{YOUR_IP_HERE}:1948 using ``admin``/``admin`` and configure
620 database resource to be ``{YOUR_IP_HERE}:8086``.
621
622 .. image:: images/Grafana_config.png
623    :width: 800px
624    :alt: Grafana data source configuration
625
626 Configure ``yardstick.conf``::
627
628    sudo -EH docker exec -it yardstick /bin/bash
629    sudo cp etc/yardstick/yardstick.conf.sample /etc/yardstick/yardstick.conf
630    sudo vi /etc/yardstick/yardstick.conf
631
632 Modify ``yardstick.conf``::
633
634    [DEFAULT]
635    debug = True
636    dispatcher = influxdb
637
638    [dispatcher_influxdb]
639    timeout = 5
640    target = http://{YOUR_IP_HERE}:8086
641    db_name = yardstick
642    username = root
643    password = root
644
645 Now you can run Yardstick test cases and store the results in influxDB.
646
647
648 Deploy InfluxDB and Grafana directly in Ubuntu (**Todo**)
649 ---------------------------------------------------------
650
651
652 Proxy Support
653 -------------
654
655 To configure the Jumphost to access Internet through a proxy its necessary to
656 export several variables to the environment, contained in the following
657 script::
658
659    #!/bin/sh
660    _proxy=<proxy_address>
661    _proxyport=<proxy_port>
662    _ip=$(hostname -I | awk '{print $1}')
663
664    export ftp_proxy=http://$_proxy:$_proxyport
665    export FTP_PROXY=http://$_proxy:$_proxyport
666    export http_proxy=http://$_proxy:$_proxyport
667    export HTTP_PROXY=http://$_proxy:$_proxyport
668    export https_proxy=http://$_proxy:$_proxyport
669    export HTTPS_PROXY=http://$_proxy:$_proxyport
670    export no_proxy=127.0.0.1,localhost,$_ip,$(hostname),<.localdomain>
671    export NO_PROXY=127.0.0.1,localhost,$_ip,$(hostname),<.localdomain>
672
673 To enable Internet access from a container using ``docker``, depends on the OS
674 version. On Ubuntu 14.04 LTS, which uses SysVinit, ``/etc/default/docker`` must
675 be modified::
676
677    .......
678    # If you need Docker to use an HTTP proxy, it can also be specified here.
679    export http_proxy="http://<proxy_address>:<proxy_port>/"
680    export https_proxy="https://<proxy_address>:<proxy_port>/"
681
682 Then its necessary to restart the ``docker`` service::
683
684    sudo -EH service docker restart
685
686 In Ubuntu 16.04 LTS, which uses Systemd, its necessary to create a drop-in
687 directory::
688
689    sudo mkdir /etc/systemd/system/docker.service.d
690
691 Then, the proxy configuration will be stored in the following file::
692
693    # cat /etc/systemd/system/docker.service.d/http-proxy.conf
694    [Service]
695    Environment="HTTP_PROXY=https://<proxy_address>:<proxy_port>/"
696    Environment="HTTPS_PROXY=https://<proxy_address>:<proxy_port>/"
697    Environment="NO_PROXY=localhost,127.0.0.1,<localaddress>,<.localdomain>"
698
699 The changes need to be flushed and the ``docker`` service restarted::
700
701    sudo systemctl daemon-reload
702    sudo systemctl restart docker
703
704 Any container is already created won't contain these modifications. If needed,
705 stop and delete the container::
706
707    sudo docker stop yardstick
708    sudo docker rm yardstick
709
710 .. warning:: Be careful, the above ``rm`` command will delete the container
711   completely. Everything on this container will be lost.
712
713 Then follow the previous instructions `Prepare the Yardstick container`_ to
714 rebuild the Yardstick container.
715
716
717 References
718 ----------
719
720 .. _`User Guide & Configuration Guide`: http://docs.opnfv.org/en/latest/release/userguide.introduction.html
721 .. _dockerhub: https://hub.docker.com/r/opnfv/yardstick/
722 .. _`Cirros 0.3.5`: http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img
723 .. _`Ubuntu 16.04`: https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img
724 .. _`Yardstick GUI demo`: https://www.youtube.com/watch?v=M3qbJDp6QBk