Commit 15086715 authored by Yann Garcia's avatar Yann Garcia
Browse files

Merge branch 'TTF_T027' into 'master'

Review typing for MEC 010-2 V3.1.1; Rebuild all test suites before starting...

See merge request !4
parents 5dd9e087 89745e75
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
[submodule "ttcn\\LibCommon"]
	path = ttcn\\LibCommon
[submodule "ttcn/LibCommon"]
	path = ttcn/LibCommon
	url = https://forge.etsi.org/rep/LIBS/LibCommon.git
[submodule "ttcn\\LibIts"]
	path = ttcn\\LibIts
	url = https://forge.etsi.org/rep/LIBS/LibIts
[submodule "titan-test-system-framework"]
	path = titan-test-system-framework
	url = https://labs.etsi.org/rep/cti-tools/titan-test-system-framework.git
	branch = devel
+13 −3
Original line number Diff line number Diff line
@@ -10,13 +10,23 @@ cd $(dirname $0)
run_dir=`pwd`

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

if [ $ret_code != 0 ]
then
   cd $run_dir
   exit -1
fi

#./run.sh

if [ "$1" == "--remove" ]
then
    docker rmi --force ttf_t012_mec:latest
    docker rmi --force mec_devel:latest
fi

cd -
cd $run_dir

exit 0
+6 −6
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ $$(foreach I, $$(includes), $$(eval all_includes += $(1)/$$(I)))
$$(foreach M, $$(modules),  $$(eval $$(call IncludeModule, $$(if $$(filter /%, $$(M)), $$(M), $(1)/$$(M)))))
endef

all_includes := $(TTCN3_DIR)/include $(TTCN3_DIR)/src $(TOPDIR)/ccsrc/Framework
all_includes := $(TTCN3_DIR)/include $(TTCN3_DIR)/src
defines  += TITAN_RUNTIME_2 _NO_SOFTLINKS_ $(ATS) AS_USE_SSL
libs     += $(TTCN3_DIR)/lib/libttcn3-rt2-parallel.a -lstdc++fs

@@ -47,7 +47,7 @@ outdir := $(TOPDIR)/build/$(ATS)
bindir := $(TOPDIR)/bin

sources     := $(sort $(all_sources))
includes    := $(outdir) $(outdir)/.. $(all_includes) $(NPCAP_INCLUDE)
includes    := $(outdir) $(outdir)/.. $(all_includes) /usr/include/libxml2 $(NPCAP_INCLUDE)

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

$(bindir)/$(ATS)$(EXE): $(gen_objects) $(cc_objects) 
	g++ -g -O0 -o $@ $(LDFLAGS) $(gen_objects) $(cc_objects) $(libs)
	g++ -g -O0 -std=c++17 -o $@ $(LDFLAGS) $(gen_objects) $(cc_objects) $(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)
@@ -123,7 +123,7 @@ $(cc_objects) : $(outdir)/%.o : %.cc
$(gen_sources): $(outdir)/.generate

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

$(foreach S, $(ttcn_sources),  $(eval $(outdir)/$(notdir $(patsubst %.ttcn, %.cc,  $(S))): $(S)))
+146 −52
Original line number Diff line number Diff line
# MEC Testing Framework in TTCN-3 - - GS 032-3

## Introduction
This repositories contains the test specifications and test adapter code for MEC API Conformance Testing in TTCN-3, GS 032-3.

More information and dowload of the standard at https://portal.etsi.org/webapp/WorkProgram/Report_WorkItem.asp?WKI_ID=56776.
This repositories contains the test specifications and test adapter code for MEC API Conformance Testing in TTCN-3, GS 032-2/3.

More information and download of the standard at https://portal.etsi.org/webapp/WorkProgram/Report_WorkItem.asp?WKI_ID=56776.

For more information on ETSI ISG Multi-access Edge Computing (MEC), visit https://www.etsi.org/technologies/multi-access-edge-computing.

@@ -17,25 +18,28 @@ Unless specified otherwise, the content of this repository and the files contain
See the attached LICENSE file or visit https://forge.etsi.org/legal-matters.

## Standard links
- Multi-access Edge Computating standards, accessible [here](https://www.etsi.org/standards#page=1&search=MEC&title=1&etsiNumber=1&content=1&version=0&onApproval=1&published=1&historical=1&startDate=1988-01-15&endDate=2019-05-06&harmonized=0&keyword=&TB=&stdType=&frequency=&mandate=&collection=&sort=1).
- Multi-access Edge Computating standards, accessible [here](https://www.etsi.org/standards#page=1&search=MEC&title=1&etsiNumber=1&content=1&version=0&onApproval=1&published=1&withdrawn=0&historical=0&isCurrent=1&superseded=1&startDate=1988-01-15&endDate=2029-12-06&harmonized=0&keyword=&TB=&stdType=&frequency=&mandate=&collection=&sort=1).

## RFC links
- RFC 7159 - The JavaScript Object Notation (JSON) Data Interchange Format, accessible [here](https://tools.ietf.org/html/rfc7159.html)

NOTE All draft can be found in the 'IETF XML Registry', accessible [here](https://www.iana.org/assignments/xml-registry/xml-registry.xhtml)

## Download required libraries
## STFs/TTFs

The following STFs were or are currently involved in the evolutions of the ETSI MEC protocols project:
- STF 569, STF 625, TTF T012

This projects requires the LibCommon and LibIts libraries to compile. The libraries location are git submodules of the current repository.

Once you have cloned the present repository, in order to install the libraries you want to execute:
# Installation

    git submodule init
    git submodule update
The ETSI MEC protocols project builds and tests regularly on the following platforms:

  - Linux (Ubuntu)
  - Windows ([Cygwin x64](https://cygwin.com/install.html), [Npcap SDK x64](https://nmap.org/npcap/#download) and [OpenSSL-Windows x64](https://www.openssl.org) are required)

Alternatively, you may clone the project together with the required libraries with the following command:
Note: The [OpenSSL](https://www.openssl.org) version >= 1.1.1 is also required.

    git clone --recurse-submodules <URL to the repository>

## Installation

@@ -45,6 +49,7 @@ The MEC Testing Framework project builds and tests regularly on the following pl

Note: The [OpenSSL](https://www.openssl.org) version > 1.1.x is also required.


### How to do it?

They are two different methods:
@@ -66,50 +71,82 @@ 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 MEC Testing Framework 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, execute the following commands:
Procedure on the host machine:
- Open a Terminal
- Clone the ETSI MEC Test System

```sh
$ vagrant up --provider virtualbox --provision
...
$ git clone --recurse-submodules --branch devel https://forge.etsi.org/rep/mec/gs032p3-ttcn-test-suite.git
```

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

```sh
$ vagrant halt
...
$ ./install.sh
```

- Update the file 'Vagrantfile' to match with your networks configuration
- Re-start the vagrant virtual machine and log to to the machine
- From the ETSI MEC Test System root directory, build the Docker image executing the following commands:

```sh
$ vagrant up
...
$ vagrant ssh
$ cd ./virtualization/docker
$ docker build --no-cache --tag alpine-mec -f Dockerfile --force-rm .
$ docker images
REPOSITORY              TAG       IMAGE ID       CREATED          SIZE
alpine-mec              latest    dafa00e36515   23 seconds ago   623MB
alpine                  latest    49176f190c7e   13 days ago      7.05MB
```

- Switch to the next clause (Usage)
To check that TITAN is well installed, execute the following command:

```sh
$ ./docker-run.sh version
```

To build the MEC Test Suite, execute the following command:

```sh
$ ./docker-run.sh build Mec_Location
```

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
$ ./docker-run.sh list Mec_Location
```

Before to execute the MEC Test Suite, prepare, edit and update the configuration file:

```sh
$ ln -sf ../../etc/AtsXxx/AtsXxx_yyy.cf_ ../../etc/AtsXxx/AtsXxx.cfg # e.g. ln -sf ../../etc/AtsMec_Location/AtsMec_Location_Sandbox.cf_ ../../etc/AtsMec_Location/AtsMec_Location.cfg
$ vi ../../etc/AtsXxx/AtsXxx.cfg # To update it, e.g. vi ../../etc/AtsMec_Location/AtsMec_Location.cfg
```

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

```sh
$ ./docker-run.sh run Mec_Location
```

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

NOTE The user password is vagrant.

### Using development Docker image

### Using Docker
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
@@ -136,6 +173,49 @@ $ ./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 MEC Testing Framework 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, 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:
@@ -203,28 +283,42 @@ Procedure:
- Clone the ETSI MEC Testing Framework project into $HOME/dev folder

```sh
$ git clone --recurse-submodules --branch TTF012_Mec https://forge.etsi.org/rep/mec/gs032p3-ttcn-test-suite.git ./TTF012_Mec
$ cd /home/etsi/dev/TTF012_Mec/ttcn/LibIts
$ rm -fr t3q
$ cd ttcn && rm -fr Common
$ git clone --recurse-submodules --branch devel https://forge.etsi.org/rep/mec/gs032p3-ttcn-test-suite.git ./gs032p3-ttcn-test-suite
```

- Apply patches

```sh
$ cd /home/etsi/dev/TTF012_Mec
$ cp ./ttcn/patch_lib_common_titan/module.mk ./ttcn/LibCommon/
$ cp ./ttcn/patch_lib_common_titan/*.ttcn ./ttcn/LibCommon/
$ cp ./ttcn/patch_lib_http/*.ttcn ./ttcn/LibIts/ttcn/Http/
$ cp  ./ttcn/patch_lib_its/module.mk ./ttcn/LibIts/
$ ./install.sh
```

- Update your default environment with the content of the script $HOME/dev/TTF012_Mec/scripts/devenv.bash.ubuntu
- Update your default environment with the content of the script $HOME/dev/gs032p3-ttcn-test-suite/scripts/devenv.bash.ubuntu

- Switch to the next clause (Usage)


## Usage
# Generate certificates for TLS and MEC security support 

This clause describes how generate certificates desrived from Let's encrypt certificate. These certificate will be used for TS mutual authentication and for MEC Security tests.
<b>NOTE:</b>
- Certficates shall be renewed every 3 months
- The port 80 shall be vailable for standalone validation

Pre-requisites:
- You need to install python and [certbot](https://manpages.ubuntu.com/manpages/impish/en/man1/certbot.1.html).

To generate certifcates, execute the following command:

```sh
$ export REQUESTS_CA_BUNDLE=$(dirname `python -c "import certifi; print(certifi.where())"`)
$ mkdir -p $HOME/var/ssl
$ sudo certbot certonly --debug --mec-tls-cert --config-dir $HOME/var/ssl --work-dir $HOME/var/ssl  --logs-dir $HOME/var/ssl --standalone --agree-tos --email <your email> -d <your domain> -w $HOME/var/ssl/
```

<b>NOTE:</b> For testing certificate generation and renewal, use the certbot's --dry-run option.


# Usage

This clause describes how to compile and execute an Abstract Test Suite.

@@ -237,16 +331,16 @@ Procedure using Eclipse TITAN:
- Start eclipse using a new workspace, (e.g. with the name workspace_titan)
- Download and follow the steps to install Eclipse plugins for TITAN, accessible [here]{https://www.eclipse.org/downloads/download.php?file=/titan/Eclipse_installationguide.pdf}
- Open the workspace_titan
- Create a new TITAN project (e.g. TTF012_Mec)
- Create a new TITAN project (e.g. gs032p3-ttcn-test-suite)
<TODO>

Procedure in TITAN command line:
- Open several SSH session (PuTTY...)
- Change to the directory ~/dev/TTF012_Mec/src/AtsMec/objs
- Change to the directory ~/dev/gs032p3-ttcn-test-suite/src/AtsMec/objs
- Build the test suite AtsMec

```sh
$ cd ~/dev/TTF012_Mec/ && export ATS=AtsMec
$ cd ~/dev/gs032p3-ttcn-test-suite/ && export ATS=AtsMec
$ make
...
```
@@ -258,7 +352,7 @@ $ make
- To run the test suite, execute the following command:

```sh
$ cd ~/dev/TTF012_Mec/scripts/
$ cd ~/dev/gs032p3-ttcn-test-suite/scripts/
$ ./run-all.bash
...
```
@@ -266,7 +360,7 @@ $ ./run-all.bash
- The log files are located in ../logs folder. You can edit them using any editor or using the Eclipse TITAN log plugins


## How to Report a Bug
# How to Report a Bug

The ETSI MEC Testing Framework project is under constant development, so it is possible that you will
encounter a bug while using it. Please report bugs at cti_support at etsi dot org.
+0 −28
Original line number Diff line number Diff line

#include "LibItsHttp_MessageBodyTypes.hh"

#include "http_codec.hh"

#include "loggers.hh"

namespace LibItsHttp__EncdecDeclarations {

  BITSTRING fx__enc__http__message(const LibItsHttp__TypesAndValues::HttpMessage& p) {
    loggers::get_instance().log_msg(">>> fx__enc__http__message: ", (const Base_Type&)p);

    OCTETSTRING os;
    http_codec codec;
    codec.encode(p, os);

    return oct2bit(os);
  }
  INTEGER fx__dec__http__message(BITSTRING& pdu, LibItsHttp__TypesAndValues::HttpMessage& p) {
    loggers::get_instance().log_msg(">>> fx__dec__http__message: ", pdu);

    OCTETSTRING os = bit2oct(pdu);
    http_codec codec;
    codec.decode(os, p);

    return 0;
  }
} // End of namespace LibItsHttp__EncdecDeclarations
Loading