Commit 92f9f099 authored by YannGarcia's avatar YannGarcia
Browse files

Create bases of the Test System

parent cf6f5c4a
Loading
Loading
Loading
Loading

.clang-format

0 → 100644
+115 −0
Original line number Diff line number Diff line
---
Language:        Cpp
# BasedOnStyle:  LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Right
AlignOperands:   true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BraceWrapping:   
  AfterClass:      false
  AfterControlStatement: false
  AfterEnum:       false
  AfterFunction:   false
  AfterNamespace:  false
  AfterObjCDeclaration: false
  AfterStruct:     false
  AfterUnion:      false
  AfterExternBlock: false
  BeforeCatch:     false
  BeforeElse:      false
  IndentBraces:    false
  SplitEmptyFunction: true
  SplitEmptyRecord: true
  SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit:     160
CommentPragmas:  '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 2
ContinuationIndentWidth: 2
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat:   false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:   
  - foreach
  - Q_FOREACH
  - BOOST_FOREACH
IncludeBlocks:   Preserve
IncludeCategories: 
  - Regex:           '^"(llvm|llvm-c|clang|clang-c)/'
    Priority:        2
  - Regex:           '^(<|"(gtest|gmock|isl|json)/)'
    Priority:        3
  - Regex:           '.*'
    Priority:        1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth:     2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd:   ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
RawStringFormats: 
  - Delimiter:       pb
    Language:        TextProto
    BasedOnStyle:    google
ReflowComments:  true
SortIncludes:    true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles:  false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard:        Cpp11
TabWidth:        8
UseTab:          Never
...

.gitmodules

0 → 100644
+8 −0
Original line number Diff line number Diff line
[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
[submodule "ttcn/LibCommon"]
	path = ttcn/LibCommon
	url = https://forge.etsi.org/rep/LIBS/LibCommon.git
	branch = master

.jenkins.sh

0 → 100755
+22 −0
Original line number 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 ./virtualization/docker
./build.sh #--force-stfubuntu
#./run.sh

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

cd -

Makefile

0 → 100644
+131 −0
Original line number Diff line number Diff line
-include config.mk

ifeq (,$(ATS))
 $(error ATS shall be defined)
endif

ifeq (,$(TOPDIR))
 TOPDIR := .
endif

ifeq (,$(TTCN3_DIR))
 $(error TTCN3_DIR shall be defined in config.mk)
endif
first: all

define IncludeModule
undefine sources
undefine modules
undefine includes
include $(1)/module.mk
$$(foreach S, $$(sources),  $$(eval all_sources +=  $(1)/$$(S)))
$$(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
defines  += TITAN_RUNTIME_2 _NO_SOFTLINKS_ $(ATS) AS_USE_SSL
libs     += $(TTCN3_DIR)/lib/libttcn3-rt2-parallel.a -lstdc++fs

ifeq (Windows_NT,$(OS))
# Silence linker warnings.
LDFLAGS += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc
defines += WIN32
libs += $(patsubst %, -L%/lib, $(OPENSSL_DIR))
all_includes += $(addsuffix /include, $(OPENSSL_DIR))
libs += $(WPCAP_DLL_PATH)
else
defines += LINUX
libs += -lpcap -lrt -lpthread
endif

libs += -lssl -lcrypto -lxml2

$(eval $(call IncludeModule, $(TOPDIR)/ttcn/$(ATS)))

outdir := $(TOPDIR)/build/$(ATS)
bindir := $(TOPDIR)/bin

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

ifeq (Windows_NT,$(OS))
  EXE=.exe
endif

ttcn_sources  := $(filter %.ttcn , $(sources))
ttcn3_sources := $(filter %.ttcn3, $(sources))

tt_sources    := $(ttcn_sources) $(ttcn3_sources)
cc_sources    := $(filter %.cc,    $(sources))

gen_ttcn_sources  := $(addprefix $(outdir)/, $(notdir $(patsubst %.ttcn,  %.cc, $(ttcn_sources))))
gen_ttcn_headers  := $(addprefix $(outdir)/, $(notdir $(patsubst %.ttcn,  %.hh, $(ttcn_sources))))
gen_ttcn3_sources := $(addprefix $(outdir)/, $(notdir $(patsubst %.ttcn3, %.cc, $(ttcn3_sources))))
gen_ttcn3_headers := $(addprefix $(outdir)/, $(notdir $(patsubst %.ttcn3, %.hh, $(ttcn3_sources))))

gen_sources := $(gen_ttcn_sources) $(gen_ttcn3_sources)
gen_headers := $(gen_ttcn_headers) $(gen_ttcn3_headers)

gen_objects := $(patsubst %.cc, %.o, $(gen_sources))
cc_objects  := $(patsubst  %.cc, $(outdir)/%.o, $(cc_sources))

.PHONY: all FORCE echo

all: $(bindir) $(outdir) $(bindir)/$(ATS)$(EXE)

echo_sources:
	@echo -e "$(addsuffix \n,$(all_sources))"

echo: echo_sources
	@echo -e "sources:\n $(addsuffix \n, $(sources))"
	@echo -e "gen_sources:\n $(addsuffix \n, $(gen_sources))"
	@echo -e "gen_objects:\n $(addsuffix \n, $(gen_objects))"
	@echo -e "cc_objects:\n $(addsuffix \n, $(cc_objects))"
	@echo -e "includes:\n $(addsuffix \n, $(includes))"
	@echo -e "defines: $(addsuffix \n, $(defines))"

clean:
	rm -f $(outdir)/$(ATS)$(EXE) $(gen_objects) $(gen_sources) $(gen_headers) $(cc_objects) $(outdir)/.generate

regen: force_regen $(outdir)/.generate
force_regen:
	rm -f $(outdir)/.generate

t3q: all
	@echo -e "Code checking in progress..."
	@java -Xmx3g -Xss512m -jar $(T3Q_PATH)/t3q.jar --config $(T3Q_PATH)/$(T3Q_CONFIG) $(tt_sources) > $(outdir)/t3q.out 2>&1 ; cd -
	@echo -e "Code checking in done..."
	@echo -e "Output file is located here: $(outdir)/t3q.out"

t3d: all
	@echo -e "TTCN-3 doc generation in progress..."
	@java -Xmx3g -Xss512m -jar $(T3D_PATH)/t3d.jar --config $(T3D_PATH)/$(T3D_CONFIG) $(tt_sources) > $(outdir)/t3d.out 2>&1 ; cd -
	@echo -e "TTCN-3 doc generation done..."
	@echo -e "Output file is located here: $(outdir)/t3d.out"

$(outdir) $(bindir):
	mkdir -p $@

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

$(gen_objects) :%.o :%.cc
	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 -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)

$(gen_sources): $(outdir)/.generate

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

$(foreach S, $(ttcn_sources),  $(eval $(outdir)/$(notdir $(patsubst %.ttcn, %.cc,  $(S))): $(S)))
$(foreach S, $(ttcn3_sources), $(eval $(outdir)/$(notdir $(patsubst %.ttcn3, %.cc, $(S))): $(S)))

README.md

0 → 100644
+271 −0
Original line number Diff line number Diff line
# CISE Testing Framework in TTCN-3

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

More information and dowload of the standard at [here](https://portal.etsi.org/webapp/WorkProgram/Report_WorkItem.asp?WKI_ID=66165).

For more information on ETSI ISG Commom Data MODEL (CDM), visit [here](https://www.etsi.org/technologies/maritime).

## Contact information

Email at `cti_support` at `etsi` dot `org`.

## License

Unless specified otherwise, the content of this repository and the files contained are released under the BSD-3-Clause license.
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=CISE&title=1&etsiNumber=1&content=1&version=0&onApproval=1&published=1&historical=1&startDate=1988-01-15&endDate=2022-11-07&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

This projects requires the LibCommon and Titan 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:

    git submodule init
    git submodule update

Alternatively, you may clone the project together with the required libraries with the following command:

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

## Installation

The CISE Testing Framework project builds and tests regularly on the following platforms:

  - Linux (Ubuntu)

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

### How to do it?

They are two different methods:
- Using [Vagrant](https://www.vagrantup.com/)
- Using [Docker](https://www.docker.com/)

How to choose one of these methods is depending of your host system.

NOTE: In all case, if you want to setup an continuous integration process (e.g. Jenkins), Docker is the best choice. 


#### The host system is Windows
The both methods require a virtual machine. You can use either VirtualBox or WMware.
In this case, the easiest way is to use Vagrant.


#### The host system is Linux
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

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 CISE 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.


### Using Docker

Pre-requisites on your host machine:
- Install Virtualbox
- Install Docker

Procedure for a Windows host machine:
- On your host machine, open a the Docker Quickstart Terminal
- On your host machine, clone the ETSI CISE Testing Framework project. NOTE that only Docker folder and .jenkins.sh script file are required
- From the ETSI CISE Testing Framework project root directory, execute the following commands:

```sh
$ ./.jenkins.sh
...
```

NOTE The creation and the installations will take some time to achieve
- Start the container

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

- Switch to the next clause (Usage)


### From scratch

Pre-requisites:
- Install Virtualbox

Procedure:
- Install a new Linux Virtual machine (Mint, Debian...)
- Update your system with the latest version of kernel and security packages
- Install the following packages (According to the Linux chosen, the package naming can be different)
    autoconf
    bison
    build-essential
    cmake
    curl
    dos2unix
    doxygen
    emacs
    expect
    flex
    g++:latest
    gcc:latest
    graphviz
    gdb 
    git-core
    gnutls-bin
    libglib2.0-dev
    libpcap-dev
    libgcrypt-dev
    libncurses5-dev
    libssl-dev
    libtool-bin
    libtool
    libwireshark-dev
    libxml2-dev
    lsof
    ntp
    pkg-config
    qt5-default
    qtmultimedia5-dev
    libqt5svg5-dev
    subversion
    sudo
    sshpass
    tcpdump
    texlive-font-utils
    tshark
    valgrind
    vim
    vsftpd
    xutils-dev 
    tree
    tzdata
    unzip
    wget
    xsltproc
- In your home directory, create the following folders: 
    - $HOME/frameworks, 
    - $HOME/dev
    - $HOME/lib
- In $HOME/frameworks, build the following package:
    - Eclipse IDE for C/C++ Developers, according the procedure specified [here](https://www.eclipse.org/cdt/)
    - TITAN, according the procedure specified [here](https://github.com/eclipse/titan.core)
    - Import the TITAN plugin into your Eclipse IDE, according the procedure specified [here](https://github.com/eclipse/titan.core)
- Clone the ETSI CISE Testing Framework project into $HOME/dev folder

```sh
$ git clone --recurse-submodules --branch --branch stf637 https://forge.etsi.org/rep/cdm/cise-data-model ./cise-devel
$ cd /home/etsi/dev/cise-devel/titan-test-system-framework
$ git checkout devel
$ cd /home/etsi/dev/cise-devel/titan-test-system-framework/ttcn/LibHttp
$ ln -sf module_cise.mk module.mk
```

- Apply patches

```sh
$ cd /home/etsi/dev/cise-devel
$ 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/
```

- Update your default environment with the content of the script $HOME/dev/cise-devel/scripts/devenv.bash.ubuntu

- Switch to the next clause (Usage)


## Usage

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


Pre-requisites:
- Your machine is installed following one of the installation method describes in the previous clause
- Your are logged as 'etsi' or 'vagrant' user

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. cise-devel)
<TODO>

Procedure in TITAN command line:
- Open several SSH session (PuTTY...)
- Change to the directory ~/dev/cise-devel/src/AtsCise/objs
- Build the test suite AtsCise

```sh
$ cd ~/dev/cise-devel/ && export ATS=AtsCise
$ make
...
```

- Edit the file ../etc/AtsCise.cfg
- Update the following fields:
    - PICS_HEADER_HOST, the HTTP host header value
    - system.httpPort.params
- To run the test suite, execute the following command:

```sh
$ cd ~/dev/cise-devel/scripts/
$ ./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

The ETSI CISE 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.
Loading