Commit 07197a26 authored by Federico Sismondi's avatar Federico Sismondi
Browse files

Merge branch 'develop' into 'master'

Develop

See merge request !117
parents 1c4cc0c9 723e027b
=========================
Contributing to ioppytest
=========================
====================================================
Thank you for considering contributing to ioppytest!
====================================================
List of devs and network testers that contributed to the tool:
==============================================================
Federico Sismondi (fsismondi)
Constant (cdx)
Benjamin (btu)
Erwan Le Flem (BhzErlb)
Ghada Gharbi (ggharbi)
Mahdi Ben Alaya (mbenalaya)
Nicolas Le Gall
Thijs Walcarius
Pauline Gaudet-Chardonnet
Miguel Angel Reina
ETSI CTI
Thank you for considering contributing to ttproto!
.. contents:: Table of content
Git workflow - Merge request guidelines
=======================================
......@@ -25,16 +37,6 @@ request is as follows:
.. [#] Push the commit(s) to your fork
.. [#] Submit a merge request (MR) to the master branch / develop branch (depending if it's a fix or new feature)
Some other comments:
.. [#] The MR title should describe the change you want to make
.. [#] The MR description should give a motive for your change and the method you used to achieve it.
.. [#] If you are proposing core/substantial changes to the tools please create an issue first to discuss it beforehand.
.. [#] Mention the issue(s) your merge request solves, using the Solves #XXX or Closes #XXX syntax.
.. [#] Please keep the change in a single MR as small as possible.
.. [#] For examples of feedback on merge requests please look at already closed merge requests.
.. [#] Merging will be done by main maintainer after reviewing the changes.
When having your code reviewed and when reviewing merge requests please take the
code review guidelines into account.
This diff is collapsed.
......@@ -42,9 +42,12 @@ LIST = automated_iut-coap_client-coapthon \
testing_tool-interoperability-lwm2m \
reference_iut-coap_server \
reference_iut-coap_client \
automated_iut-onem2m_adn \
automated_iut-onem2m_server-eclipse_om2m \
automated_iut-lwm2m_server-leshan \
automated_iut-lwm2m_client-leshan \
info:
@echo $(info_message)
......@@ -81,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.. "
......@@ -88,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)
......@@ -215,7 +220,6 @@ install-python-dependencies: ## installs all py2 and py3 pip dependencies
@python -m pip -qq install ioppytest-agent
@echo "installing py3 submodule's dependencies..."
@python3 -m pip -qq install pytest
@python3 -m pip -qq install ioppytest-utils
@echo "installing py3 ioppytest's dependencies..."
......@@ -245,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.."
......@@ -317,9 +331,9 @@ _docker-build-coap-additional-resources:
docker build --quiet -t automated_iut-coap_client-libcoap-v$(version) -f automation/coap_client_libcoap/Dockerfile .
docker tag automated_iut-coap_client-libcoap-v$(version):latest automated_iut-coap_client-libcoap
# automated_iut-coap_server-august_cellars (WIP)
docker build --quiet -t automated_iut-coap_server-august_cellars-v$(version) -f automation/coap_server_august_cellars/Dockerfile .
docker tag automated_iut-coap_server-august_cellars-v$(version):latest automated_iut-coap_server-august_cellars
# # automated_iut-coap_server-august_cellars (WIP)
# docker build --quiet -t automated_iut-coap_server-august_cellars-v$(version) -f automation/coap_server_august_cellars/Dockerfile .
# docker tag automated_iut-coap_server-august_cellars-v$(version):latest automated_iut-coap_server-august_cellars
_docker-build-lwm2m-additional-resources:
@echo "Starting to build lwm2m-additional-resources.. "
......@@ -329,9 +343,22 @@ _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.. "
@echo "TBD"
docker build --quiet -t automated_iut-onem2m_server-eclipse_om2m-v$(version) -f automation/onem2m_cse_eclipse_om2m/Dockerfile .
docker tag automated_iut-onem2m_server-eclipse_om2m-v$(version):latest automated_iut-onem2m_server-eclipse_om2m
docker build --quiet -t automated_iut-onem2m_adn-v$(version) -f automation/onem2m_adn_etsi_implementation/Dockerfile .
docker tag automated_iut-onem2m_adn-v$(version):latest automated_iut-onem2m_adn
_docker-build-comi-additional-resources:
@echo "Starting to build comi-additional-resources.. "
......@@ -379,6 +406,13 @@ _run-coap-mini-interop-libcoap-cli-vs-august-cellars-server:
docker run -d --rm --env AMQP_EXCHANGE=$(AMQP_EXCHANGE) --env AMQP_URL=$(AMQP_URL) --sysctl net.ipv6.conf.all.disable_ipv6=0 --privileged --name automated_iut-coap_client-libcoap automated_iut-coap_client-libcoap
docker run -d --rm --env AMQP_EXCHANGE=$(AMQP_EXCHANGE) --env AMQP_URL=$(AMQP_URL) --sysctl net.ipv6.conf.all.disable_ipv6=0 --privileged --name automated_iut-coap_server-august_cellars automated_iut-coap_server-august_cellars
_run-coap-mini-interop-aiocoap-cli-vs-august_cellars-server:
@echo "Using AMQP env vars: {url : $(AMQP_URL), exchange : $(AMQP_EXCHANGE)}"
@echo "running $@"
$(MAKE) run-coap-testing-tool
docker run -d --rm --env AMQP_EXCHANGE=$(AMQP_EXCHANGE) --env AMQP_URL=$(AMQP_URL) --sysctl net.ipv6.conf.all.disable_ipv6=0 --privileged --name automated_iut-coap_client-aiocoap automated_iut-coap_client-aiocoap
docker run -d --rm --env AMQP_EXCHANGE=$(AMQP_EXCHANGE) --env AMQP_URL=$(AMQP_URL) --sysctl net.ipv6.conf.all.disable_ipv6=0 --privileged --name automated_iut-coap_server-august_cellars automated_iut-coap_server-august_cellars
_run-coap-mini-interop-aiocoap-cli-vs-coapthon-server:
@echo "Using AMQP env vars: {url : $(AMQP_URL), exchange : $(AMQP_EXCHANGE)}"
@echo "running $@"
......@@ -414,9 +448,21 @@ _run-lwm2m-mini-interop-leshan-cli-vs-leshan-server:
@echo "Using AMQP env vars: {url : $(AMQP_URL), exchange : $(AMQP_EXCHANGE)}"
@echo "running $@"
$(MAKE) run-lwm2m-testing-tool
$(MAKE) _setup-coap-mini-interop-leshan-cli-vs-leshan-server
$(MAKE) _setup-lwm2m-mini-interop-leshan-cli-vs-leshan-server
_run-onem2m-mini-interop-etsi-adn-vs-eclipse-cse:
@echo "Using AMQP env vars: {url : $(AMQP_URL), exchange : $(AMQP_EXCHANGE)}"
@echo "running $@"
$(MAKE) run-onem2m-testing-tool
$(MAKE) _setup-onem2m-mini-interop-etsi-adn-vs-eclipse-cse
_setup-onem2m-mini-interop-etsi-adn-vs-eclipse-cse:
@echo "Using AMQP env vars: {url : $(AMQP_URL), exchange : $(AMQP_EXCHANGE)}"
@echo "running $@"
docker run -d --rm --env AMQP_EXCHANGE=$(AMQP_EXCHANGE) --env AMQP_URL=$(AMQP_URL) --sysctl net.ipv6.conf.all.disable_ipv6=0 --privileged --name automated_iut-onem2m_adn automated_iut-onem2m_adn
docker run -d --rm --env AMQP_EXCHANGE=$(AMQP_EXCHANGE) --env AMQP_URL=$(AMQP_URL) --sysctl net.ipv6.conf.all.disable_ipv6=0 --privileged --name automated_iut-onem2m_server-eclipse_om2m automated_iut-onem2m_server-eclipse_om2m
_setup-coap-mini-interop-leshan-cli-vs-leshan-server:
_setup-lwm2m-mini-interop-leshan-cli-vs-leshan-server:
@echo "Using AMQP env vars: {url : $(AMQP_URL), exchange : $(AMQP_EXCHANGE)}"
@echo "running $@"
docker run -d --rm --env AMQP_EXCHANGE=$(AMQP_EXCHANGE) --env AMQP_URL=$(AMQP_URL) --sysctl net.ipv6.conf.all.disable_ipv6=0 --privileged --name automated_iut-lwm2m_client-leshan automated_iut-lwm2m_client-leshan
......
ioppytest framework:
--------------------
ioppytest is a framework for running interoperability tests.
This initial version tackles technical interoperability testing (CoAP,
LwM2M, 6LoWPAN and OneM2M interop tests).
ioppytest is a framework for building interoperability testing tools.
This repo contains all necessary software (and their dependencies) for
running a interoperability test sessions between two implementations
under test (IUT).
This can be run as standalone software and also integrated to f-interop
platform (go.f-interop.eu)
Handles requirements coming from:
- interop testing best practises for network protocols
- distributed execution of the tests (IUTs may be in remote locations)
- test coordination between users (user-assisted test)
- driving automated IUTs, in a generic, program-language-agnostic way
- tunneling mechanism for enabling remote interop test over
distant locations and bypass middle-box.
Some of the features include:
tunneling, sniffing, test coordination, dissection, traces analysis,
test spec online server, etc. Each of these are independent python
modules, they communicate using json messages over AMQP.
For more about this check out the AMQP API defined in the `messages`
package which is installed with
(ioppytest-utils)*[https://pypi.org/project/ioppytest-utils/]:
Test suites
-----------
currently ioppytest includes interop tests for:
- coap
- 6lowpan
- onem2m
- lwm2m
- wot
see http://doc.f-interop.eu/testsuites/
ioppytest is parametrized for running the different test suites using
the files in env/<test_suite_folder> and ioppytest/test_descriptions
Either if you are a testing tool developers or test suite users,
you can opt to disable some features. You can do this just by modifying
supervisor.conf.ini in env/<test_suite_folder> directory.
How can I use it?
-----------------
You can either go to (F-Interop Platform)*[https://go.f-interop.eu]
which builds and deploys the tool automatically for you, this provides
also a nice looking web-based GUI (recommended).
Run in a stanalone less user friendly way. Some docker images builds,
and setting up of a RMQ server is needed. User will then use the CLI
for interfacing with the testin tool.
for more info about the standalone deployment, continue reading..
Implemented test suites in the ioppytest framework:
---------------------------------------------------
......@@ -26,8 +71,6 @@ framework are:
- LwM2M Test Suite (between two users' IUT) (WIP)
- oneM2M Test Suite (between two users' IUT) (WIP)
Test setup:
-----------
......@@ -39,51 +82,52 @@ All interactions between components take place using the AMQP event bus
(AMQP pub/sub mechanism)
```
+----------------------------+ +----------------------------+ +----------------------------+
| | | | | |
| ioppytest Test Tool | | User Interface | | User Interface |
|(CoAP, 6LoWPAN, OneM2M, etc)| | (user 1) | | (user 2) |
| | | | | |
| | | | | |
+----------------------------+ +----------------------------+ +----------------------------+
^ + ^ + ^ +
| | | | | |
| | | | | |
| | | | | |
fromAgent.agent_x.tun.packet | | toAgent.agent_y.tun.packet | | ui.user1.step_verify.reply | |
| | | | | |
fromAgent.agent_y.tun.packet | | toAgent.agent_x.tun.packet | | | |
| | | | | |
| | ui.user1.step_verify.request | | | |
+ v + v + v
+------------------------------------------------------------------------------------------------------------------------------------------------>
AMQP Event Bus
<-------------------------------------------------------------------------------------------------------------------------------------------------+
+ ^ + ^
| | toAgent.agent_x.tun.packetet | | fromAgent.agent_y.tun.packet
data.tun.toAgent.agent_x | | | |
| | toAgent.agent_y.tun.packet| |
v | v |
PC +------------+-----+-------------+ +-----------+-----+--------------+
user 1 | | | |
| Agent (agent_x) | | Agent (agent_y) |
| (tun mode) | | (tun mode) |
| | | |
| | | |
| +-----+tun interface+-------+ | | +-----+tun interface+-------+ |
| | | |
| +----------------------------+ | | +----------------------------+ |
| | IPv6+based | | | | IPv6+based | |
| | communicating | | | | communicating | |
| | piece of software | | | | piece of software | |
| | (e.g. coap client) | | | | (e.g. coap server) | |
| | | | | | | |
| +----------------------------+ | | +----------------------------+ |
| | | |
+--------------------------------+ +--------------------------------+
+----------------------------+
| |
| ioppytest Test Tool |
|(CoAP, 6LoWPAN, OneM2M, etc)|
| |
| |
+----------------------------+
^ +
| |
| |
| |
packet.fromAgent.agent_x| | packet.toAgent_agent_y
| |
packet.fromAgent.agent_x| | packet.toAgent_agent_y
| |
ui.user_1.reply | | ui.user_1.request
+ v
+------------------------------------------------------------------------------------------------------------------------------------------------>
AMQP Event Bus
<-------------------------------------------------------------------------------------------------------------------------------------------------+
| ^ ^ | | ^ ^ |
| | packet.fromAgent.agent_x | | packet.toAgent_agent_x | | packet.fromAgent.agent_y | | packet.toAgent_agent_y
ui.user_1| | | | | | | |
.request| | ui.user_1.reply | | ui.user_2.request| | ui.user_2.reply | |
| | | | | | | |
| | | v | | | v
+-------v-------------+ +--------------------------------+ +-------v-------------+ +--------------------------------+
| | | +---------------------------+ | | | | +---------------------------+ |
| User Interface | | | Agent (agent_x) | | | User Interface | | | Agent (agent_y) | |
| (user 1) | | | (tun mode) | | | (user 2) | | | (tun mode) | |
| | | +---------------------------+ | | | | +---------------------------+ |
+---------------------+ | | +---------------------+ | |
| +-----+tun interface+-------+ | | +-----+tun interface+-------+ |
| | | |
| +----------------------------+ | | +----------------------------+ |
| | Implementation under test | | | | Implementation under test | |
| | using IP | | | | using IP | |
| | (e.g. coapoclient) | | | | (e.g. coaposerver) | |
| +----------------------------+ | | +----------------------------+ |
+--------------------------------+ +--------------------------------+
```
Event Bus API:
......
- name: "aiocoap-cli-vs-californium-server"
target_start: "_setup-coap-mini-interop-aiocoap-cli-vs-californium-server"
target_start: "_run-coap-mini-interop-aiocoap-cli-vs-californium-server"
target_stop: "stop-all"
delim: "aiocoap-cli-vs-californium-server"
- name: "libcoap-cli-vs-californium-server"
target_start: "_setup-coap-mini-interop-libcoap-cli-vs-californium-server"
target_start: "_run-coap-mini-interop-libcoap-cli-vs-californium-server"
target_stop: "stop-all"
delim: "libcoap-cli-vs-californium-server"
- name: "californium-cli-vs-californium-server"
target_start: "_setup-coap-mini-interop-californium-cli-vs-californium-server"
target_start: "_run-coap-mini-interop-californium-cli-vs-californium-server"
target_stop: "stop-all"
delim: "californium-cli-vs-californium-server"
- name: "coapthon-cli-vs-californium-server"
target_start: "_setup-coap-mini-interop-coapthon-cli-vs-californium-server"
target_start: "_run-coap-mini-interop-coapthon-cli-vs-californium-server"
target_stop: "stop-all"
delim: "coapthon-cli-vs-californium-server"
- name: "californium-cli-vs-coapthon-server"
target_start: "_setup-coap-mini-interop-californium-cli-vs-coapthon-server"
target_start: "_run-coap-mini-interop-californium-cli-vs-coapthon-server"
target_stop: "stop-all"
delim: "californium-cli-vs-coapthon-server"
- name: "coapthon-cli-vs-coapthon-server"
target_start: "_setup-coap-mini-interop-coapthon-cli-vs-coapthon-server"
target_start: "_run-coap-mini-interop-coapthon-cli-vs-coapthon-server"
target_stop: "stop-all"
delim: "coapthon-cli-vs-coapthon-server"
# -*- coding: utf-8 -*-
import logging
import os
import threading
import time
import json
import pika
import base64
import threading
import logging
from collections import OrderedDict
from event_bus_utils import AmqpListener, publish_message
from event_bus_utils.rmq_handler import RabbitMQHandler, JsonFormatter
from ioppytest import get_from_environment, AMQP_URL, AMQP_EXCHANGE, RESULTS_DIR
from event_bus_utils import AmqpListener, publish_message
from messages import MsgTestingToolTerminate, MsgSessionLog, MsgTestCaseReady, MsgTestingToolReady, \
MsgTestingToolConfigured, MsgTestSuiteReport, MsgTestCaseVerdict, MsgStepVerifyExecute, \
MsgTestingToolComponentReady, Message, MsgStepVerifyExecuted, MsgTestSuiteStart, MsgTestCaseStart, MsgTestCaseSkip, \
MsgTestingToolComponentShutdown
from ioppytest.ui_adaptor.message_rendering import (testsuite_results_to_ascii_table,
testcase_verdict_to_ascii_table,
testsuite_state_to_ascii_table)
from messages import (MsgTestingToolTerminate, MsgSessionLog,
MsgTestCaseReady, MsgTestingToolReady,
MsgTestingToolConfigured, MsgTestSuiteReport,
MsgTestCaseVerdict, MsgStepVerifyExecute,
MsgTestingToolComponentReady, Message,
MsgStepVerifyExecuted, MsgTestSuiteStart,
MsgTestCaseStart, MsgTestCaseSkip,
MsgTestingToolComponentShutdown, MsgSniffingGetCaptureReply,
MsgUiRequestSessionConfiguration, MsgUiSessionConfigurationReply)
logger = logging.getLogger(__name__)
INTERACTIVE_SESSION = get_from_environment("INTERACTIVE_SESSION", True)
COAP_CLIENT_HOST = get_from_environment("COAP_CLIENT_HOST", 'bbbb::1')
COAP_SERVER_HOST = get_from_environment("COAP_SERVER_HOST", 'bbbb::2')
COAP_SERVER_PORT = get_from_environment("COAP_SERVER_PORT", '5683')
TESTSUITE_NAME = os.environ.get('TESTNAME', 'noname')
TESTSUITE_REPORT_DELIM = os.environ.get('DELIM', '===TESTRESULT===')
LOG_LEVEL = 30
MAX_LINE_LENGTH = 120
default_configuration = {
"testsuite.testcases": None # None => default config (all test cases)
}
def log_all_received_messages(event_list: list):
logger.info("Events sniffed in bus: %s" % len(event_list))
......@@ -59,6 +76,140 @@ COMPLETE LOG TRACE from log messages in event bus (MsgSessionLog)
logger.debug(traces_of_all_messages_in_event_bus)
class ResultsLogToFile(AmqpListener):
def __init__(self, amqp_url, amqp_exchange, results_dir=RESULTS_DIR):
AmqpListener.__init__(self, amqp_url, amqp_exchange,
callback=self.process_message,
topics=['#'],
use_message_typing=True)
self.results_dir = results_dir
self.messages_list = []
self.messages_by_type_dict = {}
def process_message(self, message):
if isinstance(message, MsgTestSuiteReport):
# Save report
json_file = os.path.join(self.results_dir, 'final_report.json')
with open(json_file, 'w') as f:
f.write(message.to_json())
logger.info("Saved test suite report file %s" % json_file)
elif isinstance(message, MsgSniffingGetCaptureReply):
if message.ok:
file_path = os.path.join(self.results_dir, message.filename)
with open(file_path, "wb") as pcap_file:
nb = pcap_file.write(base64.b64decode(message.value))
logger.info("Saved pcap file %s with %s bytes" % (file_path, nb))
else:
logger.warning("Got Capture result reply with NOK field")
elif isinstance(message, MsgTestCaseVerdict):
# Save verdict
json_file = os.path.join(self.results_dir, message.testcase_id + '_verdict.json')
with open(json_file, 'w') as f:
f.write(message.to_json())
logger.info("Saved verdict file %s for testcase %s" % (json_file, message.testcase_id))
elif isinstance(message, MsgTestingToolTerminate):
logger.info("Received termination message. Stopping %s" % self.__class__.__name__)
self.stop()
else:
logger.debug("Ignoring msg: %s" % type(message))
class ResultsLogToStdout(AmqpListener):
"""
This listener just listens to certain AMQP messages and logs stuff using pretty formatting
"""
def __init__(self, amqp_url, amqp_exchange, use_special_delimiters_for_report=True):
self.use_special_delimiters_for_report = use_special_delimiters_for_report
topics = [
MsgTestingToolTerminate.routing_key,
MsgTestCaseVerdict.routing_key,
MsgTestSuiteReport.routing_key,
]
AmqpListener.__init__(self, amqp_url, amqp_exchange,
callback=self.process_message,
topics=topics,
use_message_typing=True)
def process_message(self, message):
if isinstance(message, MsgTestSuiteReport):
verdict_content = OrderedDict()
verdict_content['testname'] = TESTSUITE_NAME
verdict_content.update(message.to_odict())
# note TESTSUITE_REPORT_DELIM is parsed by continuous interop testing automation components.
if self.use_special_delimiters_for_report:
logger.info(
"%s %s %s", TESTSUITE_REPORT_DELIM, json.dumps(verdict_content, indent=4), TESTSUITE_REPORT_DELIM)
else:
logger.info(
"%s: \n%s ", "Test Suite Table Report", testsuite_results_to_ascii_table(message.tc_results))
elif isinstance(message, MsgTestCaseVerdict):
verdict_content = OrderedDict()
verdict_content['testname'] = TESTSUITE_NAME
verdict_content.update(message.to_odict())
ascii_table, _ = testcase_verdict_to_ascii_table(message.to_dict())
logger.info("%s: \n%s ", "Test Case verdict issued", ascii_table)
elif isinstance(message, MsgTestingToolTerminate):
logger.info("Received termination message. Stopping %s" % self.__class__.__name__)
self.stop()
else:
logger.warning('Got not expected message type %s' % type(message))
class UIStub(AmqpListener):
"""
This stub listens and replies to configuration messages (normally responded by the user interface services)
"""
def __init__(self, amqp_url, amqp_exchange):
topics = [
MsgTestingToolTerminate.routing_key,
MsgUiRequestSessionConfiguration.routing_key,
]
AmqpListener.__init__(self, amqp_url, amqp_exchange,
callback=self.process_message,
topics=topics,
use_message_typing=True)
def process_message(self, message):
if isinstance(message, MsgUiRequestSessionConfiguration):
resp = {
"configuration": default_configuration,
"id": '666',
"testSuite": "someTestingToolName",
"users": ['pablo', 'bengoechea'],
}
m = MsgUiSessionConfigurationReply(
message,
**resp
)
publish_message(self.connection, m)
elif isinstance(message, MsgTestingToolTerminate):
logger.info("Received termination message. Stopping %s" % self.__class__.__name__)
self.stop()
else:
logger.warning('Got not expected message type %s' % type(message))
class MessageLogger(AmqpListener):
def __init__(self, amqp_url, amqp_exchange):
AmqpListener.__init__(self, amqp_url, amqp_exchange,
......@@ -70,12 +221,12 @@ class MessageLogger(AmqpListener):
self.messages_by_type_dict = {}
def process_message(self, message):
# logger.debug('[%s]: %s' % (sys._getframe().f_code.co_name, repr(message)[:MAX_LINE_LENGTH]))
# logger.debug('[%s]: %s' % (sys._getframe().f_code.co_name, repr(message)[:MAX_LINE_LENGTH]))
self.messages_list.append(message)
self.messages_by_type_dict[type(message)] = message
if isinstance(message, MsgTestingToolTerminate):
logger.info("Received termination message. Stopping logging")
logger.info("Received termination message. Stopping %s" % self.__class__.__name__)
self.stop()
......@@ -85,7 +236,6 @@ class UserMock(threading.Thread):
Behaviour:
- if iut_testcases is None => all testcases are executed.
- if iut_to_mock_verifications_for is None => no verif.executed is sent to bus.
"""
component_id = 'user_mock'
......@@ -196,19 +346,7 @@ class UserMock(threading.Thread):
self.log('Event pushed: %s' % m)
def handle_testing_tool_ready(self, event):
# m = MsgSessionConfiguration(
# configuration={
# "testsuite.testcases": [
# "http://doc.f-interop.eu/tests/TD_COAP_CORE_01",
# "http://doc.f-interop.eu/tests/TD_COAP_CORE_02",
# "http://doc.f-interop.eu/tests/TD_COAP_CORE_03",
# ]
# }
# ) # from TC1 to TC3
#
# publish_message(self.connection, m)
self.log('Event received: %s' % type(event))
# self.log('Event pushed %s' % m)
self.log('Event ignored: %s' % type(event))
def handle_test_case_ready(self, event):
self.log('Event received: %s' % type(event))
......@@ -263,4 +401,4 @@ class UserMock(threading.Thread):
while self.shutdown is False:
self.connection.process_data_events()
time.sleep(0.3)
self.log('%s shutting down..' % self.component_id)
\ No newline at end of file