Commit 0970caed authored by YannGarcia's avatar YannGarcia
Browse files

Restore ITS Test System environment for CD/CI

parent 58456f67
Loading
Loading
Loading
Loading

.jenkins.sh

0 → 100755
+15 −0
Original line number Original line Diff line number Diff line
#!/bin/bash
# Copyright ETSI 2018-2021
# See: https://forge.etsi.org/etsi-forge-copyright-statement.txt

set -vx
#set -e

cd $(dirname $0)

run_dir=`pwd`

# Docker version 2
cd docker
./build.sh #--force-stfubuntu
#./run.sh

docker/Dockerfile

0 → 100644
+26 −0
Original line number Original line Diff line number Diff line
FROM stfubuntu:18.04

MAINTAINER ETSI TTF 011

LABEL description="TTF011 Docker Image"

ENV TERM=linux \
    HOME=/home/etsi \
    HOSTNAME=docker-titan-TTF011

COPY home /home/etsi

RUN cd /home/etsi \
    && chown -R etsi:etsi . \
    && ls ./etc/init.d/*.sh | while read S; do chmod 0750 "$S" || exit 1; done

USER etsi

RUN cd ${HOME} \
    && export PATH=$HOME/bin:$PATH \
    && ls ${HOME}/etc/init.d/*.sh | while read S; do /bin/bash -c "$S" || exit 1; done \
    && rm -fr ${HOME}/etc

CMD ["/bin/bash"]

# That's all Floks
+105 −0
Original line number Original line Diff line number Diff line
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-java16-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 \
      libedit2 \
      libedit-dev \
      libffi-dev \
      libglib2.0-dev \
      libgcrypt-dev \
      libjsoncpp-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-java16-installer \
      oracle-java16-set-default \
      openssh-server \
      pkg-config \
      python3-dev \
      python3-pip \
      python3-setuptools \
      qt5-default \
      qtmultimedia5-dev \
      subversion \
      sudo \
      sshpass \
      tcpdump \
      texlive-font-utils \
      texlive-latex-extra \
      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 \
    && echo "" >> ./.profile \
    && echo 'export HOME=/home/etsi' >> ./.profile \
    && echo 'export LD_LIBRARY_PATH=${HOME}/lib:$LD_LIBRARY_PATH' >> ./.profile \
    && echo 'export PATH=${HOME}/bin:$PATH' >> ./.profile \
    && echo 'cd ${HOME}' >> ./.profile \
    && echo ". ./devenv.bash" >> ./.profile \
    && mkdir -p bin lib include tmp frameworks docs man dev \
    && chown -R etsi:etsi *

EXPOSE 22

CMD ["/bin/bash"]

# That's all Floks

docker/README.md

0 → 100644
+107 −0
Original line number Original line Diff line number Diff line
# 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 TTF011 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 stf525_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 stf525_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/TTF011_Its/TTF011.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/TTF011/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**

docker/build.sh

0 → 100755
+25 −0
Original line number Original line Diff line number Diff line
#!/bin/bash
# Copyright ETSI 2018-2021
# See: https://forge.etsi.org/etsi-forge-copyright-statement.txt

set -e
set -vx

# Force removing stfubuntu docker image
if [ "$1" == "--force-stfubuntu" ]; then
    if [ -n `docker images -q stfubuntu` ]; then
        docker rmi --force `docker images -q stfubuntu` || exit 1
    fi
fi
# Check and build stfubuntu image
if [ -z `docker images -q stfubuntu` ]; then
    docker build --no-cache --tag stfubuntu:18.04 -f Dockerfile.stfubuntu --force-rm  . || exit 1
fi

docker build --no-cache --tag etsiforge/etsi-its-ts --force-rm  . || ( echo "Docker build failed: $?"; exit 1 )

docker images
docker inspect etsiforge/etsi-its-ts:latest || ( echo "Docker inspect failed: $?"; exit 1 )

# That's all Floks
exit 0
Loading