Commit 80005e6a authored by YannGarcia's avatar YannGarcia
Browse files

Enhance virtualization support - Enhance Makefile & modules

parent e7fb1369
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ cd $(dirname $0)
run_dir=`pwd`

# Docker version 2
cd ./virtualization/docker
cd ./virtualization/docker-dev
./build.sh #--force-stfubuntu
ret_code=`echo $?`

+5 −5
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ outdir := $(TOPDIR)/build/$(ATS)
bindir := $(TOPDIR)/bin

sources     := $(sort $(all_sources))
includes    := $(outdir) $(outdir)/.. $(outdir)/../asn1 $(all_includes) $(NPCAP_INCLUDE)
includes    := $(outdir) $(outdir)/.. $(outdir)/../asn1 $(all_includes) -I/usr/lib/libxml2 $(NPCAP_INCLUDE)

ifeq (Windows_NT,$(OS))
  EXE=.exe
@@ -118,14 +118,14 @@ $(outdir) $(bindir):
	mkdir -p $@

$(bindir)/$(ATS)$(EXE): $(outdir)/../asn1/libItsAsn.a $(gen_objects) $(cc_objects) 
	g++ -g -O0 -o $@ $(LDFLAGS) $(gen_objects) $(cc_objects) $(outdir)/../asn1/libItsAsn.a $(libs)
	g++ -g -O0 -std=c++17 -o $@ $(LDFLAGS) $(gen_objects) $(cc_objects) $(outdir)/../asn1/libItsAsn.a $(libs)

$(gen_objects) :%.o :%.cc
	g++ -g -O0 -c $(addprefix -D, $(defines)) $(addprefix -I, $(includes)) -o $@ $<
	g++ -g -O0 -std=c++17 -c $(addprefix -D, $(defines)) $(addprefix -I, $(includes)) -o $@ $<

$(cc_objects) : $(outdir)/%.o : %.cc
	mkdir -p $(dir $@)
	g++ -g -O0 -c $(addprefix -D, $(defines)) $(addprefix -I, $(includes)) -o $@ $<
	g++ -g -O0 -std=c++17 -c $(addprefix -D, $(defines)) $(addprefix -I, $(includes)) -o $@ $<

#$(gen_sources):
#	$(TTCN3_DIR)/bin/compiler -n -e -L -R -U none -o $(outdir) $(tt_sources)
@@ -133,7 +133,7 @@ $(cc_objects) : $(outdir)/%.o : %.cc
$(gen_sources): $(outdir)/.generate

$(outdir)/.generate: Makefile $(tt_sources)
	$(TTCN3_DIR)/bin/compiler -w -d -e -f -g -l -L -R -U none -x -X  -o  $(outdir) $(tt_sources)
	$(TTCN3_DIR)/bin/compiler $(TTCN3_COMPILER_OPTIONS) -o  $(outdir) $(tt_sources)
	touch $@

$(bindir)/libItsAsn.so: $(outdir)/asn1/libItsAsn.so
+81 −27
Original line number Diff line number Diff line
@@ -63,53 +63,64 @@ Vagrant requires a virtual machine. You can use either VirtualBox or WMware.
Docker does not need a virtual machine, so it is the more efficant way.


#### Using Vagrant
### Using TITAN compiler on a Docker image

In this configuration, TITAN compiler is located on a Docker image and the sources and the outputs are located on the host.

Pre-requisites on your host machine:
- Install [Virtualbox](https://www.virtualbox.org/manual/ch01.html)
- Install [Vagrant](https://www.vagrantup.com/intro/getting-started/)
- Install Vagrant plugin vagrant-vbguest
- Credentials to access [ETSI forge](https://forge.etsi.org/gitlab/users/sign_in)
    - Set the environment variable USERNAME to your ETSI EOL account user name
    - Set the environment variable PASSWORD to your ETSI EOL account password
- Install Docker

Procedure:
- On your host machine, open a command line session (PuTTY, DOS window...)
- From the ETSI ITS protocols project, clone the Vagrant folder
- In the file Vagrantfile, modify the tag config.vm.provision replacing <username> & <password> strings by your ETSI credentials
- In the Vagrant folder (./virtualization/vagrant), execute the following commands:
Procedure on the host machine:
- Open a Terminal
- Clone the ETSI ITS Test System
- From the ETSI ITS Test System root directory, build the Docker image executing the following commands:

```sh
$ vagrant up --provider virtualbox --provision
...
$ cd ./virtualization/docker
$ docker build --no-cache --tag alpine-its -f Dockerfile --force-rm .
$ docker images
```

NOTE The creation and the installations will take some time to achieve
- Stop vagrant virtual machine
To build the ITS Test Suite, execute the following command:

```sh
$ vagrant halt
...
$ ./docker-run.sh build
```

- Update the file 'Vagrantfile' to match with your networks configuration
- Re-start the vagrant virtual machine and log to to the machine
Possble other options are 'clean' to remove all the build outputs or 'rebuild' to force a build of the Test Suite after a 'clean'.

To retrieve the list of the available test cases, execute the following command:

```sh
$ vagrant up
...
$ vagrant ssh
$ ./docker-run.sh list
```

- Switch to the next clause (Usage)
Before to execute the ITS Test Suite, prepare, edit and update the configuration file (e.g. CAM Test Suite):

NOTE The user password is vagrant.
```sh
$ ln -sf ../../etc/AtsCam/AtsCAM_xxx.cf_ ../../etc/AtsCam/AtsCAN.cfg
$ vi ../../etc/AtsCAM/AtsCAM.cfg # To update it
```

To execute the ITS Test Suite, execute the following command:

### Using Docker
```sh
$ ./docker-run.sh run
```

<b>Notes</b>:
- The ITS Test System is listening on port 442
- Updating the file etc/AtsCAM.cfg is about:
. Selecting the test(s) to be executed
. Updating value of PICs and PIXITs
. Updating HTTP port setting


### Using development Docker image

In this configuration, the TITAN compiler, the sources and the outputs are located on the Docker image.

Pre-requisites on your host machine:
- Install Virtualbox (For Windows host only)
- Install Docker

Procedure for a Windows host machine:
@@ -141,6 +152,49 @@ $ ./virtualization/docker/run-container.sh
- Switch to the next clause (Usage)


#### Using Vagrant

Pre-requisites on your host machine:
- Install [Virtualbox](https://www.virtualbox.org/manual/ch01.html)
- Install [Vagrant](https://www.vagrantup.com/intro/getting-started/)
- Install Vagrant plugin vagrant-vbguest
- Credentials to access [ETSI forge](https://forge.etsi.org/gitlab/users/sign_in)
    - Set the environment variable USERNAME to your ETSI EOL account user name
    - Set the environment variable PASSWORD to your ETSI EOL account password

Procedure:
- On your host machine, open a command line session (PuTTY, DOS window...)
- From the ETSI ITS protocols project, clone the Vagrant folder
- In the file Vagrantfile, modify the tag config.vm.provision replacing <username> & <password> strings by your ETSI credentials
- In the Vagrant folder (./virtualization/vagrant), execute the following commands:

```sh
$ vagrant up --provider virtualbox --provision
...
```

NOTE The creation and the installations will take some time to achieve
- Stop vagrant virtual machine

```sh
$ vagrant halt
...
```

- Update the file 'Vagrantfile' to match with your networks configuration
- Re-start the vagrant virtual machine and log to to the machine

```sh
$ vagrant up
...
$ vagrant ssh
```

- Switch to the next clause (Usage)

NOTE The user password is vagrant.


#### From scratch

Pre-requisites:
+268 −268
Original line number Diff line number Diff line
@@ -221,12 +221,12 @@ namespace LibItsGeoNetworking__EncdecDeclarations {
   * @param   value to encode
   * @return  encoded value
   ****************************************************/
  BITSTRING fx__enc__GnNonSecuredPacket(const LibItsGeoNetworking__TypesAndValues::GnNonSecuredPacket &p_gnNonSecuredPacket) {
    loggers::get_instance().log_msg(">>> fx__enc__GnNonSecuredPacket: ", p_gnNonSecuredPacket);
  BITSTRING fx__enc__GnNonSecuredPacket(const LibItsGeoNetworking__TypesAndValues::GnNonSecuredPacket &p_gn_non_secured_packet) {
    loggers::get_instance().log_msg(">>> fx__enc__GnNonSecuredPacket: ", p_gn_non_secured_packet);

    geonetworking_codec codec;
    OCTETSTRING         os;
    codec.encode(p_gnNonSecuredPacket, os);
    codec.encode(p_gn_non_secured_packet, os);
    return oct2bit(os);
  }

+100 −101
Original line number Diff line number Diff line
@@ -89,7 +89,6 @@ namespace LibItsGeoNetworking__TestSystem {
  void GeoNetworkingPort::receiveMsg(const LibItsGeoNetworking__TypesAndValues::GeoNetworkingInd &p_ind, const params& p_params) {
    //loggers::get_instance().log_msg(">>> GeoNetworkingPort::receive_msg: ", p_ind);
    const params_its& p = static_cast<const params_its&>(p_params);
    loggers::get_instance().log(">>> GeoNetworkingPort::receive_msg: %s", p.ll_address.c_str());
    // Sanity check
    if (!p_ind.is_bound()) {
      return;
Loading