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