Commit 4b8b4b88 authored by Federico Sismondi's avatar Federico Sismondi
Browse files

Merge branch 'wot_vpn_setup' into 'develop'

- Modifications and enhacements on GUI adaptor: new message factory for WoT which enables less coordinated test suites to be run (used a simple VPN playground)
- Added make entry points for building WoT implementations and WoT testing tool
- Added WoT “arenahub” and “thingweb” automated implementation dockerfiles and supervisord conf files for processes
- Added WoT testing tool dockerfiles and supervisord conf files for processes.
- Updated packet router implementation
- Refact code for WoT message factory for GUI adapter
- Changed method for building packet router's routing table. Fixed missing TD CFG file in list
- Modifications and enhacements on GUI adaptor: new message factory for WoT which enables a non structured 

See merge request !109
parents 3bdac616 a90740d6
Pipeline #3130 passed with stage
in 0 seconds
......@@ -84,6 +84,7 @@ build-tools: ## builds all testing tool docker images (only testing tool)
$(MAKE) _docker-build-onem2m
$(MAKE) _docker-build-lwm2m
$(MAKE) _docker-build-comi
$(MAKE) _docker-build-wot
build-automated-iuts: ## Build all automated-iut docker images
@echo "Starting to build docker images.. "
......@@ -91,6 +92,7 @@ build-automated-iuts: ## Build all automated-iut docker images
$(MAKE) _docker-build-comi-additional-resources
$(MAKE) _docker-build-onem2m-additional-resources
$(MAKE) _docker-build-lwm2m-additional-resources
$(MAKE) _docker-build-wot-additional-resources
build-all: ## Build all testing tool in docker images, and other docker image resources too
@echo $(info_message)
......@@ -247,6 +249,16 @@ _docker-build-lwm2m:
# tag all last version images also with a version-less name
docker tag testing_tool-interoperability-lwm2m-v$(version):latest testing_tool-interoperability-lwm2m
_docker-build-wot:
@echo "Starting to build the wot testing tools.."
# let's build the testing tool image (same for interop and conformance)
docker build --quiet -t testing_tool-interoperability-wot-v$(version) -f envs/wot_testing_tool/Dockerfile .
# tag all last version images also with a version-less name
docker tag testing_tool-interoperability-wot-v$(version):latest testing_tool-interoperability-wot
_docker-build-onem2m:
@echo "Starting to build the oneM2M testing tools.."
......@@ -331,6 +343,14 @@ _docker-build-lwm2m-additional-resources:
docker tag automated_iut-lwm2m_client-leshan-v$(version):latest automated_iut-lwm2m_client-leshan
docker tag automated_iut-lwm2m_server-leshan-v$(version):latest automated_iut-lwm2m_server-leshan
_docker-build-wot-additional-resources:
@echo "Starting to build wot-additional-resources.. "
docker build --quiet -t automated_iut-wot_arenahub-v$(version) -f automation/wot_arenahub/Dockerfile .
docker build --quiet -t automated_iut-wot_thingweb-v$(version) -f automation/wot_thingweb/Dockerfile .
docker tag automated_iut-wot_arenahub-v$(version):latest automated_iut-wot_arenahub
docker tag automated_iut-wot_thingweb-v$(version):latest automated_iut-wot_thingweb
_docker-build-onem2m-additional-resources:
@echo "Starting to build onem2m-additional-resources.. "
......
FROM node:10
# Create app directory
WORKDIR /usr/src/app
# Bundle app source
# COPY . .
# ioppytest standard docker build procedure:
RUN apt-get -y -qq update
RUN apt-get -y -qq install apt-utils
RUN apt-get -y -qq install python3-dev
RUN apt-get -y -qq install build-essential
RUN apt-get -y -qq install python3-setuptools
RUN apt-get -y -qq install python3-pip
RUN apt-get -y -qq install python-pip
RUN apt-get -y -qq install supervisor
RUN apt-get -y -qq install net-tools
RUN apt-get -y install iputils-ping
RUN apt-get -y -qq install make
# upgrade pip
RUN python -m pip install --upgrade pip
RUN python3 -m pip install --upgrade pip
# install aux ioppytest packages
RUN python -m pip install ioppytest-agent
RUN python3 -m pip install ioppytest-utils
# node-wot install procedure :
RUN git clone https://github.com/draggett/arena-webhub
WORKDIR arena-webhub
RUN npm install
EXPOSE 8888
# copy supervisor processes configs
ADD automation/wot_arenahub/supervisor.conf.ini supervisor.conf.ini
# launch processes
CMD ["/usr/bin/supervisord", "--nodaemon", "--configuration", "supervisor.conf.ini"]
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
[supervisord]
logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (log level;default info; others: debug,warn,trace)
pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false ; (start in foreground if true;default false)
minfds=1024 ; (min. avail startup file descriptors;default 1024)
minprocs=200 ; (min. avail process descriptors;default 200)
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
[program:agent]
command = ioppytest-agent connect
--url %(ENV_AMQP_URL)s
--exchange %(ENV_AMQP_EXCHANGE)s
--name wot_arenahub
--force-bootstrap
--ipv6-prefix bbbb
--ipv6-host 102
user=root
stopsignal=INT
stopasgroup=true
autorestart=false
loglevel=debug
; for sending logs to docker
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
;redirect_stderr=true
;stdout_logfile = /var/log/agent-thing-stdout.log
;stdout_logfile_maxbytes = 10MB
;stdout_logfile_backups = 5
[program:thing]
command = sh -c "sleep 6;cd examples/Getting\ Started/; npm install; node light.js"
user=root
autorestart=false
stopsignal=INT
stopasgroup=true
loglevel=debug
; for sending logs to docker
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
;redirect_stderr=true
;stdout_logfile = /var/log/thing-stdout.log
FROM node:10
# Create app directory
WORKDIR /usr/src/app
# Bundle app source
# COPY . .
# ioppytest standard docker build procedure:
RUN apt-get -y -qq update
RUN apt-get -y -qq install apt-utils
RUN apt-get -y -qq install python3-dev
RUN apt-get -y -qq install build-essential
RUN apt-get -y -qq install python3-setuptools
RUN apt-get -y -qq install python3-pip
RUN apt-get -y -qq install python-pip
RUN apt-get -y -qq install supervisor
RUN apt-get -y -qq install net-tools
RUN apt-get -y install iputils-ping
RUN apt-get -y -qq install make
# upgrade pip
RUN python -m pip install --upgrade pip
RUN python3 -m pip install --upgrade pip
# install aux ioppytest packages
RUN python -m pip install ioppytest-agent
RUN python3 -m pip install ioppytest-utils
# node-wot install procedure :
RUN git clone https://github.com/eclipse/thingweb.node-wot
WORKDIR thingweb.node-wot
RUN npm install
#RUN curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
#RUN apt-get install -y nodejs
#RUN npm install
# If you are building your code for production
# RUN npm install --only=production
RUN npm run build
EXPOSE 8080
#CMD [ "node", "packages/cli/dist/cli.js", "examples/scripts/counter.js"]
# copy supervisor processes configs
ADD automation/wot_thingweb/supervisor.conf.ini supervisor.conf.ini
# launch processes
CMD ["/usr/bin/supervisord", "--nodaemon", "--configuration", "supervisor.conf.ini"]
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
[supervisord]
logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (log level;default info; others: debug,warn,trace)
pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false ; (start in foreground if true;default false)
minfds=1024 ; (min. avail startup file descriptors;default 1024)
minprocs=200 ; (min. avail process descriptors;default 200)
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
[program:agent]
command = ioppytest-agent connect
--url %(ENV_AMQP_URL)s
--exchange %(ENV_AMQP_EXCHANGE)s
--name wot_thingweb
--force-bootstrap
--ipv6-prefix bbbb
--ipv6-host 101
user=root
stopsignal=INT
stopasgroup=true
autorestart=false
loglevel=debug
; for sending logs to docker
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
;redirect_stderr=true
;stdout_logfile = /var/log/agent-thing-stdout.log
;stdout_logfile_maxbytes = 10MB
;stdout_logfile_backups = 5
[program:thing]
command = sh -c "sleep 6; node packages/cli/dist/cli.js examples/scripts/counter.js"
user=root
autorestart=false
stopsignal=INT
stopasgroup=true
loglevel=debug
; for sending logs to docker
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
;redirect_stderr=true
;stdout_logfile = /var/log/thing-stdout.log
FROM ubuntu:16.04
MAINTAINER federico.sismondi@inria.fr
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update
RUN apt-get -y -qq install apt-utils
RUN apt-get -y -qq install python3-dev
RUN apt-get -y -qq install build-essential
RUN apt-get -y -qq install python3-setuptools
RUN apt-get -y -qq install python3-pip
RUN apt-get -y -qq install python-pip
RUN apt-get -y -qq install supervisor
RUN apt-get -y -qq install net-tools
RUN apt-get -y -qq install make
RUN apt-get -y -qq install locales && locale-gen en_US.UTF-8
# Set the locale
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
#RUN apt-get -y -qq install tcpdump
## HACK to avoid "cannot open shared object file: Permission denied" , see https://github.com/dotcloud/docker/issues/5490
#RUN mv /usr/sbin/tcpdump /usr/bin/tcpdump
# upgrade pip
RUN python -m pip install --upgrade pip
RUN python3 -m pip install --upgrade pip
ADD . /ioppytest
ENV PATH="/ioppytest:$PATH"
WORKDIR /ioppytest
# Makefile entrypoint
RUN make install-python-dependencies
#RUN groupadd -g 500 coap && useradd -u 500 -g 500 coap
#USER coap
# launch processes
CMD ["/usr/bin/supervisord", "--nodaemon", "--configuration", "envs/wot_testing_tool/supervisor.docker.conf.ini"]
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
[supervisord]
logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (log level;default info; others: debug,warn,trace)
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
; no need of finterop UI when running tool as standalone
[program:ui-adaptor]
command = /usr/bin/python3 -m ioppytest.ui_adaptor wot
autorestart=false
stopsignal=INT
stopasgroup=true
loglevel=debug
redirect_stderr=true
stdout_logfile = /var/log/ui_adaptor-stdout.log
stdout_logfile_maxbytes = 10MB
stdout_logfile_backups = 5
;[program:test-coordinator]
;command = /usr/bin/python3 -m ioppytest.test_coordinator wot
;autorestart=false
;stopsignal=INT
;stopasgroup=true
;loglevel=debug
;redirect_stderr=true
;stdout_logfile = /var/log/test_coordinator-stdout.log
;stdout_logfile_maxbytes = 10MB
;stdout_logfile_backups = 5
[program:tat]
directory= ./ioppytest/test_analysis_tool
command = sh -c "sleep 3;/usr/bin/python3 -m ttproto service_amqp --dissector --protocol coap "
autorestart=false
stopsignal=INT
stopasgroup=true
loglevel=debug
redirect_stderr=true
stdout_logfile = /var/log/tat-stdout.log
stdout_logfile_maxbytes = 10MB
stdout_logfile_backups = 5
[program:packet-router]
command = sh -c "sleep 7;/usr/bin/python3 -m ioppytest.packet_router WOT_CFG_01"
autorestart=false
stopsignal=INT
stopasgroup=true
loglevel=debug
redirect_stderr=true
stdout_logfile = /var/log/packet_router-stdout.log
stdout_logfile_maxbytes = 10MB
stdout_logfile_backups = 5
[program:packet-sniffer]
command = sh -c "sleep 10;/usr/bin/python3 -m ioppytest.packet_sniffer ipv6_tun"
user=root
stopsignal=INT
stopasgroup=true
autorestart=false
loglevel=info
stdout_logfile = /var/log/packet_sniffer-stdout.log
stdout_logfile_maxbytes = 10MB
stdout_logfile_backups = 5
redirect_stderr=true
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
[supervisord]
logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (log level;default info; others: debug,warn,trace)
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
[program:welcome_message]
command = /usr/bin/python3 -m ioppytest_cli gui_display_message "Starting ioppytest testing tool.."
startretries=0
autorestart=false
stopsignal=INT
stopasgroup=true
loglevel=debug
; for sending logs to docker stdout
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
[program:ui-adaptor]
command = /usr/bin/python3 -m ioppytest.ui_adaptor wot
autorestart=false
stopsignal=INT
stopasgroup=true
loglevel=debug
; for sending logs to docker stdout
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
[program:tat] ; no timeout, given that TAT takes a lot of time to load
directory= ./ioppytest/test_analysis_tool
command = /usr/bin/python3 -m ttproto service_amqp --dissector --protocol coap
autorestart=false
stopsignal=INT
stopasgroup=true
loglevel=debug
; for sending logs to docker stdout
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
[program:packet-router]
command = sh -c "sleep 7;/usr/bin/python3 -m ioppytest.packet_router WOT_CFG_01"
autorestart=false
stopsignal=INT
stopasgroup=true
loglevel=debug
; for sending logs to docker stdout
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
[program:packet-sniffer]
command = sh -c "sleep 10;/usr/bin/python3 -m ioppytest.packet_sniffer ipv6_tun"
user=root
stopsignal=INT
stopasgroup=true
autorestart=false
loglevel=info
; for sending logs to docker stdout
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
......@@ -68,7 +68,7 @@ TD_DIR = os.path.join(project_dir, 'ioppytest', 'test_descriptions')
# fixme: refact the code so TD_XXX is a list of yaml files containing test cases from several groups
TD_DUMMY_CFG = os.path.join(TD_DIR, "TD_DUMMY_CFG.yaml")
TD_WOT_CFG = os.path.join(TD_DIR, "TD_WOT_CFG.yaml")
TD_COAP_CORE = os.path.join(TD_DIR, "TD_COAP_CORE.yaml")
TD_COAP_CFG = os.path.join(TD_DIR, "TD_COAP_CFG.yaml")
TD_COAP = [
......@@ -126,6 +126,7 @@ TEST_DESCRIPTIONS_CONFIGS = [
TD_ONEM2M_CFG,
TD_COMI_CFG,
TD_LWM2M_CFG,
TD_WOT_CFG
]
TEST_DESCRIPTIONS_CONFIGS_DICT = {
......@@ -135,6 +136,7 @@ TEST_DESCRIPTIONS_CONFIGS_DICT = {
'onem2m': [TD_ONEM2M_CFG],
'comi': [TD_COMI_CFG],
'lwm2m': [TD_LWM2M_CFG],
'wot': [TD_WOT_CFG],
}
AUTO_DISSECTION_FILE = os.path.join(project_dir, '/data/auto_dissection.json')
......
......@@ -3,13 +3,13 @@
import argparse
import sys
import threading
import tabulate
import pika
import yaml
from messages import *
from ioppytest import AMQP_URL, AMQP_EXCHANGE, LOG_LEVEL, TEST_DESCRIPTIONS_CONFIGS, LOGGER_FORMAT
from ioppytest.test_suite.testsuite import TestConfig
from ioppytest.test_suite.testsuite import TestConfig, get_dict_of_all_test_cases_configurations
from event_bus_utils import publish_message
from event_bus_utils.rmq_handler import RabbitMQHandler, JsonFormatter
......@@ -171,90 +171,77 @@ class PacketRouter(threading.Thread):
def generate_routing_table_from_test_configuration(testconfig: TestConfig):
"""
Builds routing table (not IP based, but using amqp topics), example for COAP_CFG_01
---------------------------------------------- ------------------------------------------------------------------------------------------------
data.serial.fromAgent.coap_client ['data.serial.toAgent.coap_server', 'data.serial.toAgent.agent_TT']
fromAgent.coap_client.802154.serial.packet.raw ['toAgent.coap_server.802154.serial.packet.raw', 'toAgent.agent_TT.802154.serial.packet.raw']
fromAgent.coap_client.ip.tun.packet.raw ['toAgent.coap_server.ip.tun.packet.raw', 'toAgent.agent_TT.ip.tun.packet.raw']
data.serial.fromAgent.coap_server ['data.serial.toAgent.coap_client', 'data.serial.toAgent.agent_TT']
fromAgent.coap_server.802154.serial.packet.raw ['toAgent.coap_client.802154.serial.packet.raw', 'toAgent.agent_TT.802154.serial.packet.raw']
fromAgent.coap_server.ip.tun.packet.raw ['toAgent.coap_client.ip.tun.packet.raw', 'toAgent.agent_TT.ip.tun.packet.raw']
data.serial.fromAgent.agent_TT ['data.serial.toAgent.coap_client', 'data.serial.toAgent.coap_server']
fromAgent.agent_TT.802154.serial.packet.raw ['toAgent.coap_client.802154.serial.packet.raw', 'toAgent.coap_server.802154.serial.packet.raw']
fromAgent.agent_TT.ip.tun.packet.raw ['toAgent.coap_client.ip.tun.packet.raw', 'toAgent.coap_server.ip.tun.packet.raw']
---------------------------------------------- ------------------------------------------------------------------------------------------------
:param testconfig:
:return:
"""
assert testconfig.nodes
assert len(testconfig.nodes) >= 2
agent_tt = 'agent_TT'
routing_table = dict()
for link in testconfig.topology:
# I assume node to node links (this MUST be like this for any ioppytest interop test)
assert len(link['nodes']) == 2
link_routes = {}
nodes = link['nodes']
# I assume node to node links (this MUST be like this for any ioppytest interop test)
nodes = link['nodes'].copy()
nodes.append(agent_tt) # every single packet needs to be forwarded to agent TT
logging.info("Configuring routing tables for nodes: %s" % nodes)
# routes for agents' serial interfaces (802.15.4 nodes)
serial_routes = {
# TODO deprecate API v0.1
'data.serial.fromAgent.%s' % nodes[0]:
[
'data.serial.toAgent.%s' % nodes[1],
'data.serial.toAgent.%s' % 'agent_TT',
],
'data.serial.fromAgent.%s' % nodes[1]:
[
'data.serial.toAgent.%s' % nodes[0],
'data.serial.toAgent.%s' % 'agent_TT',
],
# TODO deprecate old API from 802.15.4 based test suites like sixlowpan
table_entry_from_serial_v0 = "data.serial.fromAgent.{node}"
table_entry_to_serial_v0 = "data.serial.toAgent.{node}"
table_entry_from_serial_v1 = "fromAgent.{node}.802154.serial.packet.raw"
table_entry_to_serial_v1 = "toAgent.{node}.802154.serial.packet.raw"
table_entry_from_tun = "fromAgent.{node}.ip.tun.packet.raw"
table_entry_to_tun = "toAgent.{node}.ip.tun.packet.raw"
for i in nodes:
# # routes for agents' serial interfaces (802.15.4 nodes) # #
# API version v.0.1 (ToDO deprecate legacy stuff)
link_routes[table_entry_from_serial_v0.format(node=i)] = [table_entry_to_serial_v0.format(node=j) for j in
nodes if j != i]
# API v.1.0 [toAgent|fromAgent.*.802154.serial.packet.raw]
'fromAgent.%s.802154.serial.packet.raw' % nodes[0]:
[
'toAgent.%s.802154.serial.packet.raw' % nodes[1],
'toAgent.%s.802154.serial.packet.raw' % 'agent_TT',
],
'fromAgent.%s.802154.serial.packet.raw' % nodes[1]:
[
'toAgent.%s.802154.serial.packet.raw' % nodes[0],
'toAgent.%s.802154.serial.packet.raw' % 'agent_TT',
],
}
# routes for agents' TUNs interfaces (ipv6 nodes)
tun_routes = {
# TODO deprecate API v0.1
'data.tun.fromAgent.%s' % nodes[0]:
[
'data.tun.toAgent.%s' % nodes[1],
'data.tun.toAgent.%s' % 'agent_TT',
],
'data.tun.fromAgent.%s' % nodes[1]:
[
'data.tun.toAgent.%s' % nodes[0],
'data.tun.toAgent.%s' % 'agent_TT',
],
link_routes[table_entry_from_serial_v1.format(node=i)] = [table_entry_to_serial_v1.format(node=j) for j in
nodes if j != i]
# # routes for agents' TUNs interfaces (ipv6 nodes) # #
# API v.1.0 [toAgent|fromAgent.*.ip.tun.packet.raw]
'fromAgent.%s.ip.tun.packet.raw' % nodes[0]:
[
'toAgent.%s.ip.tun.packet.raw' % nodes[1],
'toAgent.%s.ip.tun.packet.raw' % 'agent_TT',
],
'fromAgent.%s.ip.tun.packet.raw' % nodes[1]:
[
'toAgent.%s.ip.tun.packet.raw' % nodes[0],
'toAgent.%s.ip.tun.packet.raw' % 'agent_TT',
],
}