Commit 9b3d50fd authored by Yann Garcia's avatar Yann Garcia

Enhance docker to support LEWIS ETSI plateform

parent 536bda82
FROM ubuntu:18.04
FROM stfubuntu:18.04
MAINTAINER ETSI STF 569
MAINTAINER ETSI TTF T0002
LABEL description="STF569 Docker Image"
LABEL description="TTF0002 Docker Image"
ENV TERM=xterm
ENV HOSTNAME docker-titan-STF569
ENV TERM=linux \
HOME=/home/etsi \
HOSTNAME=docker-titan-TTF0002
RUN DEBIAN_FRONTEND=noninteractive apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install software-properties-common -y \
&& DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:linuxuprising/java -y
RUN DEBIAN_FRONTEND=noninteractive apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get --allow-unauthenticated install -y \
autoconf \
bison \
build-essential \
cmake \
curl \
dos2unix \
doxygen \
emacs \
expect \
flex \
g++-8 \
gcc-8 \
gdb \
git-core \
gnutls-bin \
graphviz \
inetutils-ping \
libglib2.0-dev \
libpcap-dev \
libgcrypt-dev \
libncurses5-dev \
libssl-dev \
libtool-bin \
libtool \
libwebsockets-dev \
libwireshark-dev \
libxml2-dev \
lsof \
ntp \
openssh-server \
pkg-config \
qt5-default \
qttools5-dev \
qtmultimedia5-dev \
libqt5svg5-dev \
subversion \
sudo \
sshpass \
tcpdump \
texlive-font-utils \
tshark \
tzdata \
valgrind \
vim \
vsftpd \
xutils-dev \
tree \
unzip \
wget \
xsltproc \
&& DEBIAN_FRONTEND=noninteractive apt-get autoremove --purge -y \
&& DEBIAN_FRONTEND=noninteractive apt-get autoclean \
&& rm -rf /var/lib/apt/lists/*
RUN echo "docker-titan-STF569" > /etc/hostname \
&& echo "root:etsi" | chpasswd
RUN useradd --create-home --shell /bin/bash --user-group etsi --groups sudo \
&& echo "etsi:etsi" | chpasswd \
&& adduser etsi sudo
RUN cd /home/etsi \
&& echo "" >> /home/etsi/.bashrc \
&& echo "export HOME=/home/etsi" >> /home/etsi/.bashrc \
&& echo "export LD_LIBRARY_PATH=/home/etsi/dev/etsi_mec/lib:$LD_LIBRARY_PATH" >> /home/etsi/.bashrc \
&& echo "export PATH=/home/etsi/bin:$PATH" >> /home/etsi/.bashrc \
&& echo "cd /home/etsi" >> /home/etsi/.bashrc \
&& echo ". ./devenv.bash" >> /home/etsi/.bashrc \
&& . /home/etsi/.bashrc \
&& mkdir -p bin lib include tmp frameworks docs man dev \
&& chown etsi:etsi bin lib include tmp frameworks docs man dev \
&& echo "etsi ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
USER etsi
# Seems that COPY does not work as expected, to be investaged
#==> Fallback to more secured solution
ADD . /home/etsi/dev/STF569_Mec
#COPY home home/etsi
# RUN git clone https://forge.etsi.org/gitlab/mec/gs032p3-ttcn-test-suite.git /home/etsi/dev/STF569_Mec
RUN chown -R etsi /home/etsi/dev/STF569_Mec/ && cd /home/etsi/dev/STF569_Mec
COPY home /home/etsi
USER etsi
RUN cd /home/etsi/frameworks \
&& git clone https://git.savannah.gnu.org/git/osip.git ./osip \
&& cd osip \
&& ./autogen.sh \
&& ./configure --prefix=/home/etsi \
&& make && make install
RUN cd ${HOME} \
sudo chown -R etsi:etsi ${HOME} \
&& export PATH=$HOME/bin:$PATH \
&& ls ${HOME}/etc/init.d/*.sh | while read S; do chmod 0750 "$S"; /bin/bash -c "$S" || exit 1; done
RUN cd /home/etsi/frameworks \
&& wget -q 'http://ftp.halifax.rwth-aachen.de/eclipse/technology/epp/downloads/release/photon/R/eclipse-cpp-photon-R-linux-gtk-x86_64.tar.gz' \
&& tar -zxvf ./eclipse-cpp-photon-R-linux-gtk-x86_64.tar.gz \
&& rm -f ./eclipse-cpp-photon-R-linux-gtk-x86_64.tar.gz \
&& cd /home/etsi/dev/STF569_Mec \
&& cd /home/etsi/dev/STF569_Mec/ttcn \
&& git clone https://forge.etsi.org/gitlab/LIBS/LibCommon.git ./LibCommon \
&& git clone -bSTF525 https://forge.etsi.org/gitlab/LIBS/LibIts ./LibIts \
&& cd /home/etsi/dev/STF569_Mec/ttcn/LibIts \
&& rm -fr asn1 t3q xsd \
&& cd ttcn && rm -fr BTP CALM CAM Common DCC DENM GeoNetworking Ipv6OverGeoNetworking IVIM MapemSpatem Pki Security SremSsem V2G \
&& cd /home/etsi/dev/STF569_Mec/scripts \
&& chmod 775 *.bash devenv.bash.* \
&& cd /home/etsi \
&& ln -sf /home/etsi/dev/STF569_Mec/scripts/devenv.bash.ubuntu /home/etsi/devenv.bash \
&& ls -ltr /home/etsi \
&& export HOME=/home/etsi \
&& . /home/etsi/devenv.bash \
&& cd /home/etsi/dev/STF569_Mec/scripts \
&& ./build_titan.bash \
&& . /home/etsi/devenv.bash \
&& ./update_mec_project.bash \
&& cd /home/etsi/dev/etsi_mec/src/AtsMec/objs \
&& ../bin/mec_generate_makefile.bash
CMD ["/bin/bash"]
# That's all Floks
FROM ubuntu:18.04
MAINTAINER ETSI STF
LABEL description="STF Docker Ubuntu image"
ENV TERM=linux \
HOSTNAME=docker-STF
RUN echo "docker-STF-dev" > /etc/hostname \
&& DEBIAN_FRONTEND=noninteractive apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade -y \
&& DEBIAN_FRONTEND=noninteractive apt-get install software-properties-common -y \
&& DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:linuxuprising/java -y \
&& DEBIAN_FRONTEND=noninteractive apt-get update \
&& ( echo "oracle-java14-installer shared/accepted-oracle-license-v1-2 boolean true" | debconf-set-selections -v ) \
&& DEBIAN_FRONTEND=noninteractive apt-get --allow-unauthenticated install -y \
autoconf \
bison \
build-essential \
cmake \
curl \
dos2unix \
doxygen \
emacs \
expect \
flex \
g++-8 \
gcc-8 \
gdb \
git-core \
gnutls-bin \
graphviz \
iputils-ping \
libffi-dev \
libglib2.0-dev \
libgcrypt-dev \
libncurses5-dev \
libpcap-dev \
libqt5svg5-dev \
libssl-dev \
libtool-bin \
libtool \
libwireshark-dev \
libxml2-dev \
libxml2-utils \
libyaml-dev \
lsof \
net-tools \
ntp \
oracle-java14-installer \
oracle-java14-set-default \
pkg-config \
python3-dev \
python3-pip \
python3-setuptools \
qt5-default \
qtmultimedia5-dev \
subversion \
sudo \
sshpass \
tcpdump \
texlive-font-utils \
tshark \
tzdata \
valgrind \
vim \
vsftpd \
xutils-dev \
tree \
unzip \
wget \
xsltproc \
&& DEBIAN_FRONTEND=noninteractive apt-get autoremove --purge -y \
&& DEBIAN_FRONTEND=noninteractive apt-get autoclean \
&& pip3 install --upgrade setuptools pip \
&& useradd --create-home --shell /bin/bash etsi \
&& echo "etsi:etsi" | chpasswd \
&& adduser etsi sudo \
&& echo "" >> /etc/profile \
&& echo 'export HOME=/home/etsi' >> /etc/profile \
&& echo 'export LD_LIBRARY_PATH=${HOME}/lib:$LD_LIBRARY_PATH' >> /etc/profile \
&& echo 'export PATH=${HOME}/bin:$PATH' >> /etc/profile \
&& echo 'cd ${HOME}' >> /etc/profile \
&& echo ". ./devenv.bash" >> /etc/profile \
&& cd /home/etsi \
&& mkdir -p bin lib include tmp frameworks docs man dev src \
&& chown -R etsi:etsi *
CMD ["/bin/bash"]
# That's all Floks
# HOWTO build docker images
## General imformation
Pre-requisites on your host machine:
- Install [Docker](https://docs.docker.com/install/)
#### From Windows host:
- Install [Virtualbox](https://www.virtualbox.org/manual/ch01.html)
- Install any X Server. For example [VcXsrv](https://sourceforge.net/projects/vcxsrv/)
#### From Mac host:
- Install [Virtualbox](https://www.virtualbox.org/manual/ch01.html)
- Install [XQuartz](https://www.xquartz.org)
#### From Linux host:
- No other requirements
## Build docker image
For Windows host, rename ```build.cmd.a``` and ```run.cmd.a``` to ```build.cmd``` and ```run.cmd``` respectivelly.
Special scrips ```build.sh``` (or ```build.cmd```) can be executed to automatically build all necessary images.
There are several build stages:
1. Build STF Ubuntu 18.04 image
2. Install Titan from Github
3. Install Eclipse and Titan Eclipse plugin into ~/frameworks/titan
4. Install asn1c into ~/frameworks/asn1c
5. Checkout STF569 sources from ETSI svn repository using default credentials
6. Build ASN.1 recoder library
7. Build certificate generation tool
## Import and build ITS project
### Run Docker image
#### From Windows host:
1. Authorize Docker container to interact with the XServer:
Go to the X Server installation directory and add the Docker container ip address to the file ```X0.hosts```:
```
localhost
inet6:localhost
192.168.99.100
```
Execute ```run.cmd``` or launch a command line window and run the command
```docker run -it --net=host -e DISPLAY=192.168.99.1:0 stf569_its:latest```
NOTE: Modify the IP address in the command for the address of 'VirtualBox Hot-Only Network'.
#### From Linux host:
Execute ```run.sh``` or launch a command line window and run the command
```sh
docker run -it --net=host -e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix stf569_its:latest
```
### Import eclipse project
1. Whithin the docker container, on the linux command prompt type:
```eclipse -data ~/dev/Workspace```
Eclipse IDE shall be shown on the hosts Screen.
Possible problems:
- eclipse not found: check the PATH environment variable. It shall contain $HOME/bin path. Otherwise add it:
```export PATH=$HOME/bin:$PATH```
2. Run "File -> Import" and import the ```~/dev/STF569_Its/STF569.tpd``` file.
This can take a time, be patient.
**Do not run build in eclipse**, we don't have enough time.
### Build the project
```cd ~/Workspace/STF569/bin```
```make```
Possible problems:
- Error in AbstractSocket build: Build it explicitly:
```cd ~/Workspace/Abstract_Socket_CNL113384/bin_ssl && make```
### Execute tests
1. Launch eclipse: ```eclipse -data ~/dev/Workspace```
2. Select configuration from the /etc/folder:
- AtsCAM/AtsCAM.cfg - CAM test suite.
- AtsDENM/AtsDENM.cfg - DENM test suite.
- AtsGenCert/AtsGenCert.cfg - Certificate generator
- AtsGeoNetworking/AtsGeoNetworking.cfg - GeoNetworking test suite
- AtsIVIM/AtsIVIM.cfg
- AtsMapemSpatem/AtsMapemSpatem.cfg
- AtsRSUsSimulator/AtsRSUSimulator.cfg
- AtsSecurity/AtsSecurity.cfg
- AtsSremSsem/AtsSremSsem.cfg
3. Right-click on the configuration file and select **Run As -> TITAN Parallel launcher**
#!/bin/bash
# Copyright ETSI 2019
# See: https://forge.etsi.org/etsi-forge-copyright-statement.txt
#set -e
set -vx
DOCKER_FILE=./docker/Dockerfile
if [ -f ${DOCKER_FILE} ]
then
#check and build stf569_mec image
DOCKER_ID=`docker ps -a | grep -e stf569_mec | awk '{ print $1 }'`
if [ ! -z "${DOCKER_ID}" ]
then
docker rm --force stf569_mec
fi
docker build --tag stf569_mec --force-rm -f ${DOCKER_FILE} .
if [ "$?" != "0" ]
then
echo "Docker build failed: $?"
exit -1
fi
docker image ls -a
docker inspect stf569_mec:latest
if [ "$?" != "0" ]
then
echo "Docker inspect failed: $?"
exit -2
fi
else
exit -3
fi
# That's all Floks
exit 0
#!/bin/bash
# Copyright ETSI 2018
# See: https://forge.etsi.org/etsi-forge-copyright-statement.txt
set -e
set -vx
#check and build stfubuntu image
if [ -z `docker images -q stfubuntu` ]; then
docker build --tag stfubuntu:18.04 -f Dockerfile.stfubuntu --force-rm . || exit 1
fi
docker build --tag stf569_mec --force-rm . || ( echo "Docker build failed: $?"; exit 1 )
docker images
docker inspect stf569_mec:latest || ( echo "Docker inspect failed: $?"; exit 1 )
# That's all Floks
exit 0
#!/bin/bash
#set -e
set -vx
echo -e "*****************************\n* Install titan\n*****************************\n"
SRC_DIR=${HOME}/src/titan
export TTCN3_DIR=$HOME/frameworks/titan
[ -f /usr/bin/java ] && export JAVA_HOME=`readlink -f /usr/bin/java | sed "s:bin/java::"`
TITAN_REPO=`cat ${HOME}/etc/titan_repos.txt | grep 'titan\.core\.git' | head -n 1`
export PATH=$PATH:$TTCN3_DIR/bin
mkdir -p "$SRC_DIR"
cd "$SRC_DIR" || exit 1
echo "export TTCN3_DIR=$TTCN3_DIR" >> $HOME/.bashrc
echo "export PATH=\$PATH:\$TTCN3_DIR/bin" >> $HOME/.bashrc
# Install titan core
git clone --progress "$TITAN_REPO" || exit 1
mkdir -p "$TTCN3_DIR"
cd titan.core || exit 1
cat >Makefile.personal <<EOF
TTCN3_DIR=$TTCN3_DIR
JNI=yes
GUI=yes
DEBUG=no
GEN_PDF=no
JDKDIR=$JAVA_HOME
EOF
make && make install || exit 1
# Install other repos
mkdir -p $TTCN3_DIR/../titan-modules
cd $TTCN3_DIR/../titan-modules || exit 1
cat ${HOME}/etc/titan_repos.txt | grep -v -e '^\s*#' -e 'titan\.core' | while read REPO; do
[ -z $ $REPO ] && continue
WS=`echo $REPO | sed -e 's|.*/||g' -e 's|\.git||g'`
if git clone --progress "${REPO}" "${WS}"; then
[ -f "$WS/Makefile" ] && make -C "$WS"
fi
done
exit 0
#!/bin/bash
#set -e
set -vx
echo -e "*****************************\n* Install eclipse\n*****************************\n"
mkdir -p ${HOME}/frameworks
cd ${HOME}/frameworks || exit 1
wget --progress=dot:mega 'https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/helios/SR2/eclipse-cpp-helios-SR2-linux-gtk-x86_64.tar.gz' -Oeclipse-cpp-helios-SR2-linux-gtk-x86_64.tar.gz || exit 1
tar -zxvf ./eclipse-cpp-helios-SR2-linux-gtk-x86_64.tar.gz || exit 1
ln -sf ${HOME}/frameworks/eclipse/eclipse ${HOME}/bin/eclipse
rm -f ./eclipse-cpp-helios-SR2-linux-gtk-x86_64.tar.gz
if wget --progress=dot:mega 'https://www.eclipse.org/downloads/download.php?file=/titan/TITAN_Designer_and_Executor_plugin-6.4.pl0.zip&r=1' -OTITAN_Designer_and_Executor_plugin.zip; then
eclipse/eclipse -noSplash -application org.eclipse.equinox.p2.director \
-destination ${HOME}/frameworks/eclipse \
-repository jar:file://${HOME}/frameworks/TITAN_Designer_and_Executor_plugin.zip!/ \
-installIU TITAN_Designer.feature.group,TITAN_Executor.feature.group,TITAN_Log_Viewer.feature.group,Titan_external_dependencies.feature.group,Titanium.feature.group,Titanium_external_dependencies.feature.group
rm -f TITAN_Designer_and_Executor_plugin.zip
fi
exit 0
#!/bin/bash
#set -e
set -vx
echo -e "*****************************\n* Install osip\n*****************************\n"
cd ${HOME}/frameworks
git clone https://git.savannah.gnu.org/git/osip.git ./osip
cd osip
./autogen.sh
./configure --prefix=/home/etsi
make && sudo make install
cd ${HOME}
exit 0
#!/bin/bash
#set -e
set -vx
echo -e "*****************************\n* Install osip\n*****************************\n"
cd ${HOME}/frameworks
git clone https://github.com/fsismondi/ioppytest-utils ./ioppytest-utils
cd ./ioppytest-utils
pip3 install -r ./requirements.txt
cd ${HOME}
exit 0
#!/bin/bash
echo -e "*****************************\n* Checkout STF569 sources\n*****************************\n"
mkdir -p ${HOME}/dev && cd ${HOME}/dev || exit 1
git clone --recurse-submodules -b latest-open-draft --single-branch https://forge.etsi.org/rep/mec/gs032p3-ttcn-test-suite.git STF569_Mec
cd /home/etsi/dev/STF569_Mec/ttcn
git clone https://forge.etsi.org/gitlab/LIBS/LibCommon.git ./LibCommon
git clone -bTTF0002 https://forge.etsi.org/gitlab/LIBS/LibIts ./LibIts
cd /home/etsi/dev/STF569_Mec/ttcn/LibIts
rm -fr asn1 t3q xsd
cd ttcn && rm -fr BTP CAM Common DENM GeoNetworking Ipv6OverGeoNetworking IVIM MapemSpatem Pki Security SremSsem
cd /home/etsi/dev/STF569_Mec/scripts
chmod 775 *.bash devenv.bash.*
cd /home/etsi
ln -sf /home/etsi/dev/STF569_Mec/scripts/devenv.bash.ubuntu /home/etsi/devenv.bash
ls -ltr /home/etsi
export HOME=/home/etsi
. /home/etsi/devenv.bash
cd /home/etsi/dev/STF569_Mec/scripts
./build_titan.bash
. /home/etsi/devenv.bash
./update_mec_project.bash
cd /home/etsi/dev/etsi_mec/src/AtsMec/objs
../bin/mec_generate_makefile.bash
echo -e "*****************************\n* Init Eclipse Workspace\n*****************************\n"
mkdir -p ${HOME}/dev/Workspace/STF569/bin/
cd ${HOME}/dev/Workspace/STF569
exit 0
https://github.com/eclipse/titan.core.git
https://github.com/eclipse/titan.TestPorts.Common_Components.Abstract_Socket.git
https://github.com/eclipse/titan.TestPorts.HTTPmsg.git
https://github.com/eclipse/titan.TestPorts.LANL2asp.git
https://github.com/eclipse/titan.TestPorts.PCAPasp.git
https://github.com/eclipse/titan.TestPorts.PIPEasp.git
https://github.com/eclipse/titan.TestPorts.SCTPasp.git
https://github.com/eclipse/titan.TestPorts.SIPmsg.git
https://github.com/eclipse/titan.TestPorts.SQLasp.git
https://github.com/eclipse/titan.TestPorts.TCPasp.git
https://github.com/eclipse/titan.TestPorts.TELNETasp.git
https://github.com/eclipse/titan.TestPorts.UDPasp.git
https://github.com/eclipse/titan.ProtocolModules.COMMON.git
https://github.com/eclipse/titan.ProtocolModules.DHCP.git
https://github.com/eclipse/titan.ProtocolModules.DHCPv6.git
https://github.com/eclipse/titan.ProtocolModules.DIAMETER_ProtocolModule_Generator.git
https://github.com/eclipse/titan.ProtocolModules.DNS.git
https://github.com/eclipse/titan.ProtocolModules.ICMP.git
https://github.com/eclipse/titan.ProtocolModules.ICMPv6.git
https://github.com/eclipse/titan.ProtocolModules.IP.git
https://github.com/eclipse/titan.ProtocolModules.RTP.git
https://github.com/eclipse/titan.ProtocolModules.RTSP.git
https://github.com/eclipse/titan.ProtocolModules.SMPP.git
https://github.com/eclipse/titan.ProtocolModules.SMTP.git
https://github.com/eclipse/titan.ProtocolModules.SNMP.git
https://github.com/eclipse/titan.ProtocolModules.TCP.git
https://github.com/eclipse/titan.ProtocolModules.UDP.git
https://github.com/eclipse/titan.ProtocolModules.XMPP.git
https://github.com/eclipse/titan.misc.git
https://github.com/eclipse/titan.TestPorts.LDAPasp_RFC4511.git
https://github.com/eclipse/titan.TestPorts.LDAPmsg.git
https://github.com/eclipse/titan.TestPorts.Common_Components.Socket-API.git
https://github.com/eclipse/titan.TestPorts.SSHCLIENTasp.git
https://github.com/eclipse/titan.TestPorts.STDINOUTmsg.git
https://github.com/eclipse/titan.TestPorts.SUNRPCasp.git
https://github.com/eclipse/titan.TestPorts.UNIX_DOMAIN_SOCKETasp.git
https://github.com/eclipse/titan.TestPorts.IPL4asp.git
https://github.com/eclipse/titan.ProtocolModules.FrameRelay.git
https://github.com/eclipse/titan.ProtocolModules.H248_v2.git
https://github.com/eclipse/titan.ProtocolModules.IMAP_4rev1.git
https://github.com/eclipse/titan.ProtocolModules.ICAP.git
https://github.com/eclipse/titan.ProtocolModules.IKEv2.git
https://github.com/eclipse/titan.ProtocolModules.IPsec.git
https://github.com/eclipse/titan.ProtocolModules.IUA.git
https://github.com/eclipse/titan.ProtocolModules.JSON_v07_2006.git
https://github.com/eclipse/titan.ProtocolModules.L2TP.git
https://github.com/eclipse/titan.ProtocolModules.M3UA.git
https://github.com/eclipse/titan.ProtocolModules.MIME.git
https://github.com/eclipse/titan.ProtocolModules.MSRP.git
https://github.com/eclipse/titan.ProtocolModules.PPP.git
https://github.com/eclipse/titan.ProtocolModules.ProtoBuff.git
https://github.com/eclipse/titan.ProtocolModules.RADIUS_ProtocolModule_Generator.git
https://github.com/eclipse/titan.ProtocolModules.SRTP.git
https://github.com/eclipse/titan.ProtocolModules.WebSocket.git
https://github.com/eclipse/titan.ProtocolModules.HTTP2.0.git
https://github.com/eclipse/titan.Libraries.TCCUsefulFunctions.git
#!/bin/bash
# Copyright ETSI 2019
# Copyright ETSI 2018
# See: https://forge.etsi.org/etsi-forge-copyright-statement.txt
#set -e
#set -vx
set -vx
docker run stf569_mec:latest "/bin/bash" \
-c "source /home/etsi/devenv.bash \
&& cd /home/etsi/dev/etsi_mec/src/AtsMec/objs \
&& ../bin/run_all.bash \
&& ls -ltr ../logs"
docker run -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --cap-add=NET_RAW --cap-add=NET_ADMIN stf569_mec:latest
# That's all Floks
exit 0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment