Merge "Make sure we have installed python_novaclient==6.0.0"
[functest.git] / docker / Dockerfile
1 ########################################
2 #   Docker container for FUNCTEST
3 ########################################
4 # Purpose: run all the tests against the POD
5 #          from a pre-installed docker image
6 #
7 # Maintained by Jose Lausuch
8 # Build:
9 #    $ docker build -t opnfv/functest:tag .
10 #
11 # Execution:
12 #    $ docker run -t -i \
13 #      -e "INSTALLER_TYPE=fuel|apex|compass|joid \
14 #      -e "INSTALLER_IP=10.20.0.2" \
15 #      -v $(pwd)/config_functest.yaml:/home/opnfv/repos/functest/functest/ci/config_functest.yaml
16 #      opnfv/functest /bin/bash
17 #
18 # NOTE: providing config_functest.yaml is optional. If not provided, it will
19 #       use the default one located in the repo
20 #
21 # All rights reserved. This program and the accompanying materials
22 # are made available under the terms of the Apache License, Version 2.0
23 # which accompanies this distribution, and is available at
24 # http://www.apache.org/licenses/LICENSE-2.0
25 #
26
27 FROM ubuntu:14.04
28 MAINTAINER Jose Lausuch <jose.lausuch@ericsson.com>
29 LABEL version="0.1" description="OPNFV Functest Docker container"
30
31 # Environment variables
32 ARG BRANCH=master
33 ARG TEMPEST_TAG=14.0.0
34 ARG ODL_TAG=release/beryllium-sr4
35 ARG OPENSTACK_TAG=stable/mitaka
36 ARG KINGBIRD_TAG=0.2.2
37 ARG VIMS_TAG=stable
38 ARG REPOS_DIR=/home/opnfv/repos
39 ARG FUNCTEST_BASE_DIR=/home/opnfv/functest
40 ARG FUNCTEST_CONF_DIR=${FUNCTEST_BASE_DIR}/conf
41 ARG FUNCTEST_DATA_DIR=${FUNCTEST_BASE_DIR}/data
42 ARG FUNCTEST_RESULTS_DIR=${FUNCTEST_BASE_DIR}/results
43 ARG FUNCTEST_REPO_DIR=${REPOS_DIR}/functest
44 ARG FUNCTEST_TEST_DIR=${FUNCTEST_REPO_DIR}/functest/opnfv_tests
45 ARG RELENG_MODULE_DIR=${REPOS_DIR}/releng/modules
46 ARG REPOS_VNFS_DIR=${REPOS_DIR}/vnfs
47
48 # Environment variables
49 ENV HOME /home/opnfv
50 ENV CONFIG_FUNCTEST_YAML ${FUNCTEST_REPO_DIR}/functest/ci/config_functest.yaml
51 ENV REPOS_DIR ${HOME}/repos
52 ENV creds ${FUNCTEST_CONF_DIR}/openstack.creds
53 ENV TERM xterm
54 ENV COLORTERM gnome-terminal
55
56 WORKDIR ${HOME}
57
58 # Packaged dependencies
59 RUN apt-get update && apt-get install -y \
60 build-essential \
61 bundler \
62 crudini \
63 curl \
64 gcc \
65 git \
66 libffi-dev \
67 libgmp3-dev \
68 libpq-dev \
69 libssl-dev \
70 libxml2-dev \
71 libxslt-dev \
72 python-dev \
73 python-mock \
74 python-pip \
75 postgresql \
76 ruby1.9.1-dev \
77 ssh \
78 sshpass \
79 wget \
80 --no-install-recommends
81
82 RUN pip install --upgrade pip
83
84 RUN mkdir -p ${REPOS_DIR} \
85     && mkdir -p ${REPOS_VNFS_DIR} \
86     && mkdir -p ${FUNCTEST_BASE_DIR}/results \
87     && mkdir -p ${FUNCTEST_BASE_DIR}/conf \
88     && mkdir -p /root/.ssh \
89     && chmod 700 /root/.ssh
90
91 RUN git config --global http.sslVerify false
92
93 # OPNFV repositories
94 RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/functest ${REPOS_DIR}/functest
95 RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/copper ${REPOS_DIR}/copper
96 RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/moon ${REPOS_DIR}/moon
97 RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/sdnvpn ${REPOS_DIR}/sdnvpn
98 RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/domino ${REPOS_DIR}/domino
99 RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/parser ${REPOS_DIR}/parser
100 RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/doctor ${REPOS_DIR}/doctor
101 RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/ovno ${REPOS_DIR}/ovno
102 RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/promise ${REPOS_DIR}/promise
103 RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/sfc ${REPOS_DIR}/sfc
104 RUN git clone --depth 1 https://gerrit.opnfv.org/gerrit/securityscanning ${REPOS_DIR}/securityscanning
105 RUN git clone --depth 1 https://gerrit.opnfv.org/gerrit/releng ${REPOS_DIR}/releng
106
107 # OpenStack repositories
108 RUN git clone --depth 1 -b $OPENSTACK_TAG https://github.com/openstack/networking-bgpvpn ${REPOS_DIR}/bgpvpn
109 #RUN git clone --depth 1 -b $KINGBIRD_TAG https://github.com/openstack/kingbird.git ${REPOS_DIR}/kingbird
110 RUN git clone https://github.com/openstack/rally.git ${REPOS_DIR}/rally
111 RUN git clone --depth 1 -b $TEMPEST_TAG https://github.com/openstack/tempest.git ${REPOS_DIR}/tempest
112
113 # other repositories
114 RUN git clone --depth 1 -b $ODL_TAG https://git.opendaylight.org/gerrit/p/integration/test.git ${REPOS_DIR}/odl_test
115 RUN git clone --depth 1 -b $VIMS_TAG https://github.com/boucherv-orange/clearwater-live-test ${REPOS_VNFS_DIR}/vims-test
116 RUN git clone --depth 1 https://github.com/wuwenbin2/OnosSystemTest.git ${REPOS_DIR}/onos
117
118 RUN pip install -r ${REPOS_DIR}/rally/requirements.txt
119 RUN pip install -r ${REPOS_DIR}/tempest/requirements.txt
120
121 RUN cd ${FUNCTEST_REPO_DIR} \
122     && pip install -r requirements.txt \
123     && pip install .
124
125 RUN cd ${RELENG_MODULE_DIR} \
126     && pip install .
127
128 RUN find ${FUNCTEST_REPO_DIR} -name "*.py" \
129     -not -path "*tests/unit*" |xargs grep __main__ |cut -d\: -f 1 |xargs chmod -c 755 \
130     && find ${FUNCTEST_REPO_DIR} -name "*.sh" |xargs grep \#\! |cut -d\:  -f 1 |xargs chmod -c 755
131
132 RUN /bin/bash ${REPOS_DIR}/parser/tests/parser_install.sh ${REPOS_DIR}
133 RUN ${REPOS_DIR}/rally/install_rally.sh --yes
134
135 ADD http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img ${FUNCTEST_BASE_DIR}/data/
136 ADD http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-lxc.tar.gz ${FUNCTEST_BASE_DIR}/data/
137 ADD http://205.177.226.237:9999/onosfw/firewall_block_image.img ${FUNCTEST_BASE_DIR}/data/
138
139 RUN gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
140 RUN curl -L https://get.rvm.io | bash -s stable
141
142 # SNAPS integration
143 RUN git clone --depth 1 https://gerrit.cablelabs.com/snaps-provisioning ${REPOS_DIR}/snaps
144 RUN pip install -e ${REPOS_DIR}/snaps/
145
146 # SFC integration
147 RUN /bin/bash -c ". ${REPOS_DIR}/sfc/sfc/tests/functest/setup_scripts/tacker_client_install.sh"
148 RUN cd ${REPOS_DIR}/sfc && pip install .
149
150 # SDNVPN integration
151 RUN cd ${REPOS_DIR}/sdnvpn && pip install .
152
153 RUN cd ${REPOS_DIR}/bgpvpn && pip install .
154 #RUN cd ${REPOS_DIR}/kingbird && pip install -e .
155 RUN cd ${REPOS_DIR}/moon/moonclient/ && python setup.py install
156
157 RUN /bin/bash -c ". /etc/profile.d/rvm.sh \
158     && cd ${REPOS_VNFS_DIR}/vims-test \
159     && rvm autolibs enable"
160 RUN /bin/bash -c ". /etc/profile.d/rvm.sh \
161     && cd ${REPOS_VNFS_DIR}/vims-test \
162     && rvm install 1.9.3"
163 RUN /bin/bash -c ". /etc/profile.d/rvm.sh \
164     && cd ${REPOS_VNFS_DIR}/vims-test \
165     && rvm use 1.9.3"
166 RUN /bin/bash -c ". /etc/profile.d/rvm.sh \
167     && cd ${REPOS_VNFS_DIR}/vims-test \
168     && bundle install"
169
170 RUN sh -c 'curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -' \
171     && sudo apt-get install -y nodejs \
172     && cd ${REPOS_DIR}/promise && sudo npm -g install npm@latest \
173     && cd ${REPOS_DIR}/promise/source && npm install
174
175 RUN echo "set nocompatible \n\
176 set backspace=2" \
177 >> ${HOME}/.vimrc
178 RUN echo set nocompatible >> ${HOME}/.exrc
179 RUN echo "alias ll='ls -lh' \n\
180 . ${FUNCTEST_REPO_DIR}/functest/cli/functest-complete.sh" \
181 >> ${HOME}/.bashrc