e8cef3c0cfed52a0e58ba04187bce13b99a5aa4c
[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/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 ARG BRANCH=master
32 ARG TEMPEST_TAG=12.2.0
33 ARG RALLY_TAG=0.7.0
34 ARG ODL_TAG=release/beryllium-sr3
35 ARG OPENSTACK_TAG=stable/mitaka
36 ARG KINGBIRD_TAG=0.2.2
37 ARG VIMS_TAG=stable
38 ENV HOME /home/opnfv
39 ENV repos_dir /home/opnfv/repos
40 ENV creds /home/opnfv/functest/conf/openstack.creds
41 ENV TERM xterm
42 ENV COLORTERM gnome-terminal
43 ENV PYTHONPATH $PYTHONPATH:/home/opnfv/repos/
44 ENV CONFIG_FUNCTEST_YAML /home/opnfv/repos/functest/functest/ci/config_functest.yaml
45 ENV PYTHONPATH $PYTHONPATH:/home/opnfv/repos/:/home/opnfv/repos/functest
46 WORKDIR /home/opnfv
47
48 # Packaged dependencies
49 RUN apt-get update && apt-get install -y \
50 ssh \
51 sshpass \
52 curl \
53 git \
54 gcc \
55 wget \
56 python-dev \
57 python-mock \
58 python-pip \
59 bundler \
60 postgresql \
61 build-essential \
62 libpq-dev \
63 libxslt-dev \
64 libssl-dev \
65 libgmp3-dev \
66 libxml2-dev \
67 libffi-dev \
68 crudini \
69 ruby1.9.1-dev \
70 --no-install-recommends
71
72 RUN pip install --upgrade pip
73
74 RUN mkdir -p ${repos_dir}
75 RUN mkdir -p /home/opnfv/functest/results
76 RUN mkdir -p /home/opnfv/functest/conf
77 RUN mkdir -p /root/.ssh
78 RUN chmod 700 /root/.ssh
79
80 RUN git config --global http.sslVerify false
81
82 # OPNFV repositories
83 RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/functest ${repos_dir}/functest
84 RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/copper ${repos_dir}/copper
85 RUN git clone --depth 1 -b $BRANCH https://gerrit.opnfv.org/gerrit/moon ${repos_dir}/moon
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/ovno ${repos_dir}/ovno
91 RUN git clone --depth 1 https://github.com/opnfv/promise ${repos_dir}/promise
92 RUN git clone --depth 1 https://gerrit.opnfv.org/gerrit/securityscanning ${repos_dir}/securityscanning
93 RUN git clone --depth 1 https://gerrit.opnfv.org/gerrit/releng ${repos_dir}/releng
94
95
96 # OpenStack repositories
97 RUN git clone --depth 1 -b $OPENSTACK_TAG https://github.com/openstack/networking-bgpvpn ${repos_dir}/bgpvpn
98 RUN git clone --depth 1 -b $KINGBIRD_TAG https://github.com/openstack/kingbird.git ${repos_dir}/kingbird
99 RUN git clone --depth 1 -b $RALLY_TAG https://github.com/openstack/rally.git ${repos_dir}/rally
100 RUN git clone --depth 1 -b $TEMPEST_TAG https://github.com/openstack/tempest.git ${repos_dir}/tempest
101
102 # other repositories
103 RUN git clone --depth 1 -b $ODL_TAG https://git.opendaylight.org/gerrit/p/integration/test.git ${repos_dir}/odl_test
104 RUN git clone --depth 1 -b $VIMS_TAG https://github.com/boucherv-orange/clearwater-live-test ${repos_dir}/vims-test
105 RUN git clone --depth 1 https://github.com/wuwenbin2/OnosSystemTest.git ${repos_dir}/onos
106
107 RUN pip install -r ${repos_dir}/functest/docker/requirements.pip
108 RUN pip install -r ${repos_dir}/rally/requirements.txt
109 RUN pip install -r ${repos_dir}/tempest/requirements.txt
110
111 RUN find ${repos_dir}/functest -name "*.py" \
112     -not -path *unit_tests* |xargs grep __main__ |cut -d\: -f 1 |xargs chmod -c 755
113 RUN find ${repos_dir}/functest -name "*.sh" |xargs grep \#\! |cut -d\:  -f 1 |xargs chmod -c 755
114
115 RUN /bin/bash ${repos_dir}/parser/tests/parser_install.sh ${repos_dir}
116 RUN ${repos_dir}/rally/install_rally.sh --yes
117
118 ADD http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img /home/opnfv/functest/data/
119 ADD http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-lxc.tar.gz /home/opnfv/functest/data/
120 ADD http://205.177.226.237:9999/onosfw/firewall_block_image.img /home/opnfv/functest/data/
121
122 RUN gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
123 RUN curl -L https://get.rvm.io | bash -s stable
124
125 # SNAPS integration
126 RUN git clone --depth 1 https://gerrit.cablelabs.com/snaps-provisioning ${repos_dir}/snaps
127 RUN pip install -e ${repos_dir}/snaps/
128
129 RUN /bin/bash -c ". /home/opnfv/repos/functest/functest/opnfv_tests/features/sfc/tacker_client_install.sh"
130 RUN cd ${repos_dir}/bgpvpn && pip install .
131 #RUN cd ${repos_dir}/kingbird && pip install -e .
132 RUN cd ${repos_dir}/moon/moonclient/ && python setup.py install
133
134 RUN /bin/bash -c ". /etc/profile.d/rvm.sh \
135     && cd /home/opnfv/repos/vims-test \
136     && rvm autolibs enable"
137 RUN /bin/bash -c ". /etc/profile.d/rvm.sh \
138     && cd /home/opnfv/repos/vims-test \
139     && rvm install 1.9.3"
140 RUN /bin/bash -c ". /etc/profile.d/rvm.sh \
141     && cd /home/opnfv/repos/vims-test \
142     && rvm use 1.9.3"
143 RUN /bin/bash -c ". /etc/profile.d/rvm.sh \
144     && cd /home/opnfv/repos/vims-test \
145     && bundle install"
146
147 RUN sh -c 'curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -'
148 RUN sudo apt-get install -y nodejs
149 RUN cd ${repos_dir}/promise && sudo npm -g install npm@latest
150 RUN cd ${repos_dir}/promise && npm install
151
152 RUN echo "set nocompatible \n\
153 set backspace=2" \
154 >> /home/opnfv/.vimrc
155 RUN echo set nocompatible >> /home/opnfv/.exrc
156 RUN echo "alias ll='ls -lh' \n\
157 . /home/opnfv/repos/functest/functest/cli/functest-complete.sh" \
158 >> /home/opnfv/.bashrc
159 RUN cd ${repos_dir}/functest/functest/cli && pip install .