Commit 38fbcfcc authored by Ghada Gharbi's avatar Ghada Gharbi

makefile update

parents cfd5c43e 36a18b85
Pipeline #3110 running with stage
This diff is collapsed.
......@@ -44,6 +44,9 @@ LIST = automated_iut-coap_client-coapthon \
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)
......@@ -95,6 +98,10 @@ build-all: ## Build all testing tool in docker images, and other docker image re
$(MAKE) build-tools
$(MAKE) build-automated-iuts
clean: ## clean data directory
@echo "running $@"
rm *.pcap
rm data/results/*.json
# # # # Testing Tool & other resources RUN commands # # # #
......@@ -288,11 +295,11 @@ _docker-build-coap-additional-resources:
# automated_iut-coap_server-californium & automated_iut-coap_client-californium
# build without using caché packages (slower builds)
# docker build --quiet -t automated_iut-coap_server-californium-v$(version) -f automation/coap_server_californium/Dockerfile . --no-cache
# docker build --quiet -t automated_iut-coap_client-californium-v$(version) -f automation/coap_client_californium/Dockerfile . --no-cache
docker build --quiet -t automated_iut-coap_server-californium-v$(version) -f automation/coap_server_californium/Dockerfile . --no-cache
#docker build --quiet -t automated_iut-coap_client-californium-v$(version) -f automation/coap_client_californium/Dockerfile . --no-cache
# automated_iut-coap_server-californium & automated_iut-coap_client-californium
docker build --quiet -t automated_iut-coap_server-californium-v$(version) -f automation/coap_server_californium/Dockerfile .
#docker build --quiet -t automated_iut-coap_server-californium-v$(version) -f automation/coap_server_californium/Dockerfile .
docker build --quiet -t automated_iut-coap_client-californium-v$(version) -f automation/coap_client_californium/Dockerfile .
docker tag automated_iut-coap_client-californium-v$(version):latest automated_iut-coap_client-californium
docker tag automated_iut-coap_server-californium-v$(version):latest automated_iut-coap_server-californium
......@@ -367,6 +374,11 @@ _setup-coap-mini-interop-libcoap-cli-vs-californium-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-californium automated_iut-coap_server-californium
_setup-coap-mini-interop-libcoap-cli-vs-august_cellars-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-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-libcoap-cli-vs-august-cellars-server:
@echo "Using AMQP env vars: {url : $(AMQP_URL), exchange : $(AMQP_EXCHANGE)}"
......@@ -375,6 +387,14 @@ _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 $@"
......@@ -400,6 +420,24 @@ _run-coap-mini-interop-libcoap-cli-vs-californium-server:
$(MAKE) run-coap-testing-tool
$(MAKE) _setup-coap-mini-interop-libcoap-cli-vs-californium-server
_run-coap-mini-interop-libcoap-cli-vs-august_cellars-server:
@echo "Using AMQP env vars: {url : $(AMQP_URL), exchange : $(AMQP_EXCHANGE)}"
@echo "running $@"
$(MAKE) run-coap-testing-tool
$(MAKE) _setup-coap-mini-interop-libcoap-cli-vs-august_cellars-server
_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
_setup-coap-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
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_server-leshan automated_iut-lwm2m_server-leshan
_setup-coap-mini-interop-californium-cli-vs-coapthon-server:
@echo "Using AMQP env vars: {url : $(AMQP_URL), exchange : $(AMQP_EXCHANGE)}"
@echo "running $@"
......
This diff is collapsed.
......@@ -3,15 +3,16 @@ import logging
import os
import threading
import time
import base64
import pika
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
MsgTestingToolComponentShutdown, MsgSniffingGetCaptureReply
logger = logging.getLogger(__name__)
......@@ -59,6 +60,55 @@ COMPLETE LOG TRACE from log messages in event bus (MsgSessionLog)
logger.debug(traces_of_all_messages_in_event_bus)
class ResultsLogger(AmqpListener):
def __init__(self, amqp_url, amqp_exchange):
AmqpListener.__init__(self, amqp_url, amqp_exchange,
callback=self.process_message,
topics=['#'],
use_message_typing=True)
self.messages_list = []
self.messages_by_type_dict = {}
@classmethod
def process_message(cls, message):
print('Event received: %s' % type(message))
if isinstance(message, MsgTestSuiteReport):
# Save report
json_file = os.path.join(
RESULTS_DIR,
'final_report.json'
)
with open(json_file, 'w') as f:
f.write(message.to_json())
print("Saved test suite report")
elif isinstance(message, MsgSniffingGetCaptureReply):
if message.ok:
file_path = os.path.join(RESULTS_DIR, message.filename)
with open(file_path, "wb") as pcap_file:
nb = pcap_file.write(base64.b64decode(message.value))
print("Saved pcap file with %s bytes" % nb)
else:
print("Got Capture result reply with NOK field")
elif isinstance(message, MsgTestCaseVerdict):
# Save verdict
json_file = os.path.join(
RESULTS_DIR,
message.testcase_id + '_verdict.json'
)
with open(json_file, 'w') as f:
f.write(message.to_json())
print("Verdict saved: %s" % message.testcase_id)
else:
print("No handler defined for msg: %s" % type(message))
class MessageLogger(AmqpListener):
def __init__(self, amqp_url, amqp_exchange):
AmqpListener.__init__(self, amqp_url, amqp_exchange,
......@@ -70,7 +120,7 @@ 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
......@@ -82,12 +132,13 @@ class MessageLogger(AmqpListener):
class UserMock(threading.Thread):
"""
this class servers for moking user inputs into GUI
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'
# e.g. for TD COAP CORE from 1 to 31
DEFAULT_TC_LIST = ['TD_COAP_CORE_%02d' % tc for tc in range(1, 32)]
def __init__(self, iut_testcases=None, iut_to_mock_verifications_for=None):
self._init_logger()
......@@ -112,12 +163,10 @@ class UserMock(threading.Thread):
self.message_count = 0
# queues & default exchange declaration
if iut_testcases:
self.implemented_testcases_list = iut_testcases
else:
self.implemented_testcases_list = UserMock.DEFAULT_TC_LIST
# if implemented_testcases_list is None then all test cases should be executed
self.implemented_testcases_list = iut_testcases
# queues & default exchange declaration
queue_name = '%s::eventbus_subscribed_messages' % self.component_id
self.channel.queue_declare(queue=queue_name, auto_delete=True)
......@@ -215,15 +264,12 @@ class UserMock(threading.Thread):
self.log('Event received: %s' % type(event))
self.log('Event description: %s' % event.description)
# m = MsgTestCaseStart()
# publish_message(self.connection, m)
if event.testcase_id in self.implemented_testcases_list:
m = MsgTestCaseStart()
if self.implemented_testcases_list and event.testcase_id not in self.implemented_testcases_list:
m = MsgTestCaseSkip(testcase_id=event.testcase_id)
publish_message(self.connection, m)
self.log('Event pushed: %s' % m)
else:
m = MsgTestCaseSkip(testcase_id=event.testcase_id)
m = MsgTestCaseStart()
publish_message(self.connection, m)
self.log('Event pushed: %s' % m)
......@@ -267,4 +313,5 @@ 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
self.log('%s shutting down..' % self.component_id)
# -*- coding: utf-8 -*-
# !/usr/bin/env python3
import os
import pika
import pprint
# messages and event_bus_utils are packages that are installed with `pip3 install ioppytest-utils`
from event_bus_utils import publish_message, amqp_request, AmqpSynchCallTimeoutError
from messages import *
from automation.ui_stub import default_configuration, UIStub
from automation import MessageLogger, log_all_received_messages, UserMock
from ioppytest import AMQP_URL, AMQP_EXCHANGE
"""
The automation code used the event bus API as stimulation and evaluation point.
Evaluates a normal test cycle with real automated IUTs.
......@@ -64,27 +52,46 @@ TEST SETUP:
+-----------------------------+
| |
| automated interop driver |
| (this component) |
| (this module) |
| |
+-----------------------------+
"""
import os
import pika
import pprint
import traceback
import argparse
# messages and event_bus_utils are modules are installed with `pip3 install ioppytest-utils`
from automation.ui_stub import default_configuration, UIStub
from event_bus_utils import publish_message, amqp_request, AmqpSynchCallTimeoutError
from messages import *
from ioppytest import AMQP_URL, AMQP_EXCHANGE
from ioppytest.ui_adaptor.message_rendering import testsuite_state_to_ascii_table
from automation import MessageLogger, log_all_received_messages, UserMock, ResultsLogger
COMPONENT_ID = 'perform_testsuite'
SESSION_TIMEOUT = 300
SESSION_TIMEOUT = 900
EXECUTE_ALL_TESTS = os.environ.get('CI', 'False') == 'True'
LOG_WARNINGS_ONLY = os.environ.get('LOG_WARNINGS_ONLY', 'False') == 'True'
COAP_CLIENT_IS_AUTOMATED = os.environ.get('COAP_CLIENT_IS_AUTOMATED', 'True') == 'True'
COAP_SERVER_IS_AUTOMATED = os.environ.get('COAP_SERVER_IS_AUTOMATED', 'True') == 'True'
logging.basicConfig(format='%(levelname)s [%(name)s]:%(message)s', level=logging.DEBUG)
logging.getLogger('pika').setLevel(logging.WARNING)
logging.getLogger('ioppytest.utils.event_bus_utils').setLevel(logging.WARNING)
if LOG_WARNINGS_ONLY:
logging.basicConfig(format='%(levelname)s [%(name)s]:%(message)s', level=logging.WARNING)
else:
logging.basicConfig(format='%(levelname)s [%(name)s]:%(message)s', level=logging.INFO)
logging.getLogger('pika').setLevel(logging.WARNING)
logging.getLogger('event_bus_utils').setLevel(logging.WARNING)
logging.getLogger('messages').setLevel(logging.WARNING)
logger = logging.getLogger(__name__)
class PerformFullTest(object):
def __init__(self):
self.error_state = False
......@@ -92,8 +99,9 @@ class PerformFullTest(object):
self.channel = self.connection.channel()
if EXECUTE_ALL_TESTS:
self.tc_list = ['TD_COAP_CORE_%02d' % i for i in range(1, 10)]
logger.info("Detected CI environment. Executing all tests supported by both Californium and CoAPthon")
# self.tc_list = ['TD_COAP_CORE_%02d' % i for i in range(1, 32)]
self.tc_list = None # if tc_list is None => all TCs are executed
logger.info("Detected CI environment. Executing all test cases.")
else:
self.tc_list = [
'TD_COAP_CORE_01',
......@@ -160,7 +168,9 @@ class PerformFullTest(object):
self.get_status()
if t >= SESSION_TIMEOUT:
r = amqp_request(self.connection, MsgTestSuiteGetStatus(), COMPONENT_ID)
r = amqp_request(self.connection,
MsgTestSuiteGetStatus(),
COMPONENT_ID)
logger.warning('Test TIMED-OUT! Test suite status:\n%s' % pprint.pformat(r.to_dict()))
else:
assert MsgTestSuiteReport in self.msglogger.messages_by_type_dict
......@@ -176,6 +186,8 @@ class PerformFullTest(object):
except Exception as e:
self.error_state = True
logger.error("Exception encountered in PerformTestsuite:\n%s", e)
logger.error("Traceback:\n%s", traceback.format_exc())
finally:
if MsgTestingToolTerminate not in self.msglogger.messages_by_type_dict:
......@@ -232,7 +244,7 @@ class PerformFullTest(object):
) # get status
if isinstance(current_status, MsgTestSuiteGetStatusReply):
logger.info("Testsuite status: %s", current_status)
logger.info("Testsuite status: \n%s", testsuite_state_to_ascii_table(current_status.to_dict()))
else:
logger.warning("Could not get testsuite status: unexpected reply")
pass
......@@ -247,6 +259,22 @@ class PerformFullTest(object):
if __name__ == '__main__':
pft = PerformFullTest()
pft.run()
pft.stop()
# be careful with the order of the items as it's used along the main
parser = argparse.ArgumentParser()
parser.add_argument("--result-logger",
help="Run (ONLY) a component to log all the results into files",
action="store_true")
args = parser.parse_args()
result_logger = args.result_logger
if result_logger:
print("Starting RESULTS LOGGER..")
r_logger = ResultsLogger(AMQP_URL, AMQP_EXCHANGE)
r_logger.run()
else:
# action==actions[1]:
print("Starting AUTOMATED INTEROP DRIVER..")
pft = PerformFullTest()
pft.run()
pft.stop()
......@@ -233,7 +233,7 @@ class AutomatedIUT(threading.Thread):
if event is None:
return
self.log('Event received: %s' % repr(event))
self.log('Event received: %s' % type(event))
if type(event) in self.event_to_handler_map:
callback = self.event_to_handler_map[type(event)]
......@@ -254,11 +254,23 @@ class AutomatedIUT(threading.Thread):
self.log('IUT %s (%s) READY to handle test case: %s' % (self.component_id, self.node, event.testcase_id))
def handle_stimuli_execute(self, event):
if event.node == self.node and event.step_id in self.implemented_stimuli_list:
# TODO should we check if stimuli is implemented or not?
if event.node == self.node and self.implemented_stimuli_list and event.step_id not in self.implemented_stimuli_list:
self.log('[%s] STIMULI (%s) doesnt seem to be implemented by automated IUT:' %
(
self.node if self.node else "misc.",
event.step_id,
))
if event.node == self.node:
step = event.step_id
addr = event.target_address # may be None
self._execute_stimuli(step, addr) # blocking till stimuli execution
publish_message(self.connection, MsgStepStimuliExecuted(node=self.node))
try:
self._execute_stimuli(step, addr) # blocking till stimuli execution
publish_message(self.connection, MsgStepStimuliExecuted(node=self.node))
except NotImplementedError as e: # either method not overriden, or stimuli step not implemented :/
publish_message(self.connection, MsgStepStimuliExecuted(description=str(e), node=self.node))
else:
self.log('[%s] Event received and ignored: \n\tEVENT:%s \n\tNODE:%s \n\tSTEP: %s' %
(
......@@ -285,9 +297,9 @@ class AutomatedIUT(threading.Thread):
))
def handle_test_suite_report(self, event):
self.log('Got final test suite report: %s' % event.to_json())
self.log('Got final test suite report')
if self.process_log_file:
contents = open(self.process_log_file).read()
contents = open(self.process_log_file, "r", encoding="utf-8").read()
self.log('*' * 72)
self.log('AUTOMATED_IUT LOGS %s' % self.process_log_file)
self.log('*' * 72)
......
......@@ -27,12 +27,13 @@ WORKDIR /ioppytest
RUN python -m pip install ioppytest-agent
RUN python3 -m pip install ioppytest-utils
#py3 requirements
RUN python3 -m pip install -r automation/coap_client_aiocoap/requirements.txt
# requirements on automated-iut python code
RUN python3 -m pip install -r automation/requirements.txt
#RUN cp automation/coap_client_aiocoap/supervisor.conf supervisor.conf
# install aiocoap from PyPI
RUN python3 -m pip install aiocoap
EXPOSE 5671 5672
#RUN cp automation/coap_client_aiocoap/supervisor.conf supervisor.conf
# launch processes
CMD ["/usr/bin/supervisord", "--nodaemon", "--configuration", "automation/coap_client_aiocoap/supervisor.conf"]
......@@ -207,6 +207,7 @@ stimuli_to_aiocoap_cli_call = {
"TD_COAP_CORE_20_step_05": (
get, {"base_url": default_coap_server_base_url, "resource": "/multi-format", "accept_option": "application/xml"}),
"TD_COAP_CORE_21_step_01": (get, {"base_url": default_coap_server_base_url, "resource": "/validate"}),
"TD_COAP_CORE_21_step_05": (get, {"base_url": default_coap_server_base_url, "resource": "/validate"}),
"TD_COAP_CORE_22_step_01": (get, {"base_url": default_coap_server_base_url, "resource": "/validate"}),
# "TD_COAP_CORE_22_step_04": "TD_COAP_CORE_22",
"TD_COAP_CORE_22_step_08": (put, {"base_url": default_coap_server_base_url, "resource": "/validate"}),
......@@ -305,7 +306,7 @@ class AutomatedAiocoapClient(AutomatedIUT):
try:
func, args = stimuli_to_aiocoap_cli_call[stimuli_step_id]
except KeyError:
raise Exception("Received request to execute unimplemented stimuli %s", stimuli_step_id)
raise NotImplementedError("Received request to execute unimplemented stimuli %s", stimuli_step_id)
args['base_url'] = self.base_url # update with target url received from event
func(**args) # spawn stimuli process
......
......@@ -33,13 +33,7 @@ WORKDIR /ioppytest
# requirements on automated-iut python code
RUN python3 -m pip install -r automation/requirements.txt
## temp PATCH for avoiding https://github.com/celery/py-amqp/issues/191
#RUN python3 -m pip install -Iv amqp==2.3.1
#RUN python -m pip install -Iv amqp==2.3.1
#RUN cp automation/coap_client_californium/supervisor.conf /etc/supervisor/supervisor.conf
EXPOSE 5671 5672
# launch processes
CMD ["/usr/bin/supervisord", "--nodaemon", "--configuration", "automation/coap_client_californium/supervisor.conf"]
\ No newline at end of file
......@@ -40,6 +40,17 @@ stderr_logfile_maxbytes=0
;stdout_logfile_maxbytes = 10MB
;stdout_logfile_backups = 5
[program:automated-iut-extra-ipv6-routes-config]
command = sh -c "sleep 10;ip -6 route add cccc::/64 dev tun0"
autorestart=false
stopsignal=INT
loglevel=debug
; for sending logs to docker
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
[program:automated-iut]
command = sh -c "sleep 6;/usr/bin/python3 -m automation.coap_client_californium.automated_iut"
autorestart=false
......
......@@ -47,7 +47,7 @@ class AutomatedCoapthonCoapClient(AutomatedIUT):
}
implemented_stimuli_list = list(stimuli_to_testcase_map.keys())
implemented_testcases_list = ['TD_COAP_CORE_%02d' % tc for tc in range(1, len(stimuli_to_testcase_map) + 1)]
implemented_testcases_list = ['TD_COAP_CORE_%02d' % tc for tc in range(1, 32)]
def _execute_verify(self, verify_step_id):
logger.warning('Ignoring: %s. No auto-iut mechanism for verify step implemented.' % verify_step_id)
......
......@@ -55,10 +55,6 @@ RUN make
RUN make install
ENV PATH="/ioppytest/automation/coap_client_libcoap/libcoap/libcoap/examples:$PATH"
## temp PATCH for avoiding https://github.com/celery/py-amqp/issues/191
#RUN python3 -m pip install -Iv amqp==2.3.1
#RUN python -m pip install -Iv amqp==2.3.1
WORKDIR /ioppytest
# launch processes
......
......@@ -265,6 +265,7 @@ stimuli_to_libcoap_cli_call = {
"TD_COAP_CORE_20_step_01": (get, {"base_url": default_coap_server_base_url, "resource": "/multi-format", "accept_option":"text/plain"}),
"TD_COAP_CORE_20_step_05": (get, {"base_url": default_coap_server_base_url, "resource": "/multi-format", "accept_option":"application/xml"}),
"TD_COAP_CORE_21_step_01": (get, {"base_url": default_coap_server_base_url, "resource": "/validate"}),
"TD_COAP_CORE_21_step_05": (get, {"base_url": default_coap_server_base_url, "resource": "/validate"}),
"TD_COAP_CORE_22_step_01": (get, {"base_url": default_coap_server_base_url, "resource": "/validate"}),
# "TD_COAP_CORE_22_step_04": "TD_COAP_CORE_22",
"TD_COAP_CORE_22_step_08": (put, {"base_url": default_coap_server_base_url, "resource": "/validate"}),
......@@ -318,7 +319,8 @@ aux_stimuli_to_libcoap_cli_call = {
class AutomatedLibcoapClient(AutomatedIUT):
# CoAP CoRE
implemented_testcases_list = ['TD_COAP_CORE_%02d' % tc for tc in range(1, 24)]
#implemented_testcases_list = ['TD_COAP_CORE_%02d' % tc for tc in range(1, 24)]
implemented_testcases_list = ['TD_COAP_CORE_%02d' % tc for tc in range(1, 32)] # let those not implemented crash
# OBS
implemented_testcases_list += ['TD_COAP_OBS_%02d' % tc for tc in range(1, 11)]
# Link
......@@ -373,7 +375,7 @@ class AutomatedLibcoapClient(AutomatedIUT):
else:
func, args = stimuli_to_libcoap_cli_call[stimuli_step_id]
except KeyError:
raise Exception("Received request to execute unimplemented stimuli %s", stimuli_step_id)
raise NotImplementedError("Received request to execute unimplemented stimuli %s", stimuli_step_id)
args['base_url'] = self.base_url # update with target url received from event
func(**args) # spawn stimuli process
......
......@@ -40,6 +40,17 @@ stderr_logfile_maxbytes=0
;stdout_logfile_maxbytes = 10MB
;stdout_logfile_backups = 5
[program:automated-iut-extra-ipv6-routes-config]
command = sh -c "sleep 10;ip -6 route add cccc::/64 dev tun0"
autorestart=false
stopsignal=INT
loglevel=debug
; for sending logs to docker
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
[program:automated-iut]
command = sh -c "sleep 6;/usr/bin/python3 -m automation.coap_client_libcoap.automated_iut"
autorestart=false
......
......@@ -24,10 +24,14 @@ RUN python3 -m pip install --upgrade pip
RUN python -m pip install ioppytest-agent
RUN python3 -m pip install ioppytest-utils
# get ioppytest code for automating the IUT: `RUN git clone` instead of `ADD` for having a standalone dockerfile
# TODO put ioppytest in pypi and install as python package
RUN git clone https://gitlab.f-interop.eu/f-interop-contributors/ioppytest.git -b develop --single-branch /ioppytest
## get ioppytest code for automating the IUT: either from local source code (option1), or from git (option2)
# option1) This is for the case Dockerfile is used from within ioppytest project
ADD . /ioppytest
ENV PATH="/ioppytest:$PATH"
# option2)This is for the case Dockerfile is used standalone ()
#RUN git clone https://gitlab.f-interop.eu/f-interop-contributors/ioppytest.git -b develop --single-branch /ioppytest
# requirements on automated-iut python code
RUN python3 -m pip install -r /ioppytest/automation/requirements.txt
......@@ -46,8 +50,5 @@ RUN msbuild /p:Configuration=Debug TestServer.Net462.sln
# run implementation
#ENTRYPOINT mono /AugustCellarsTestServer/TestServer/bin/Debug/TestServer.exe --ipaddress=127.0.0.1 --interop-test=CoapCore
# temp PATCH for avoiding https://github.com/celery/py-amqp/issues/191
RUN python -m pip install -Iv amqp==2.3.1
# launch processes
CMD ["/usr/bin/supervisord", "--nodaemon", "--configuration", "/ioppytest/automation/coap_server_august_cellars/supervisor.docker.ini"]
\ No newline at end of file
......@@ -21,7 +21,7 @@ This is a terminal application and not a GUI application.
TestServer.exe --ipaddress=127.0.0.1 --interop-test=CoapCore
mono bin/debug/TestServer.exe --ipaddress=127.0.0.1 --demon --interop-test=CoapCore
This will limit the set of resources to those that are needed by the CoAP Core test suite, although not all of the methods are implemented given that I just used the list at the top and did not look at all of the test cases until I started doing client testing this morning.
......
......@@ -28,7 +28,9 @@ command = ioppytest-agent connect
user=root
stopsignal=INT
stopasgroup=false
autorestart=false
autorestart=true
startretries=3
startsecs=5
loglevel=debug
; for sending logs to docker
stdout_logfile=/dev/stdout
......@@ -40,6 +42,10 @@ stderr_logfile_maxbytes=0
;stdout_logfile_maxbytes = 10MB
;stdout_logfile_backups = 5
; supervisord has a different restart mechanism for when the process is starting
; up (the process is in the STARTING state). Retries during process startup are
; controlled by startsecs and startretries.
[program:automated-iut]
directory= /ioppytest
command = sh -c "sleep 9;/usr/bin/python3 -m automation.coap_server_august_cellars.automated_iut"
......
......@@ -33,11 +33,5 @@ WORKDIR /ioppytest
# requirements on automated-iut python code
RUN python3 -m pip install -r automation/requirements.txt
## temp PATCH for avoiding https://github.com/celery/py-amqp/issues/191
#RUN python3 -m pip install -Iv amqp==2.3.1
#RUN python -m pip install -Iv amqp==2.3.1
EXPOSE 5671 5672
# launch processes
CMD ["/usr/bin/supervisord", "--nodaemon", "--configuration", "automation/coap_server_californium/supervisor.conf"]
\ No newline at end of file
......@@ -37,9 +37,5 @@ RUN git clone https://github.com/fsismondi/CoAPthon.git automation/coap_server_c
#py3 IUT requirements
RUN python3 -m pip install -r automation/coap_server_coapthon/CoAPthon/requirements.txt
## temp PATCH for avoiding https://github.com/celery/py-amqp/issues/191
#RUN python3 -m pip install -Iv amqp==2.3.1
#RUN python -m pip install -Iv amqp==2.3.1
# launch processes
CMD ["/usr/bin/supervisord", "--nodaemon", "--configuration", "automation/coap_server_coapthon/supervisor.conf"]
\ No newline at end of file
......@@ -34,10 +34,6 @@ RUN python3 -m pip install -r automation/requirements.txt
#ADD automation/comi_server_acklio/serverComi /CoMI/
#ADD automation/comi_server_acklio/examples /CoMI/examples/
## temp PATCH for avoiding https://github.com/celery/py-amqp/issues/191
#RUN python3 -m pip install -Iv amqp==2.3.1
#RUN python -m pip install -Iv amqp==2.3.1
# launch processes
CMD ["/usr/bin/supervisord", "--nodaemon", "--configuration", "automation/comi_client_acklio/supervisor.conf.ini"]
......
......@@ -35,10 +35,6 @@ ADD automation/comi_server_acklio/serverComi /CoMI/
RUN chmod +x /CoMI/serverComi
ADD automation/comi_server_acklio/interop /CoMI/interop/
## temp PATCH for avoiding https://github.com/celery/py-amqp/issues/191
#RUN python3 -m pip install -Iv amqp==2.3.1
#RUN python -m pip install -Iv amqp==2.3.1
# launch processes
CMD ["/usr/bin/supervisord", "--nodaemon", "--configuration", "automation/comi_server_acklio/supervisor.conf.ini"]
......
# -*- coding: utf-8 -*-
# !/usr/bin/env python3
import subprocess
from automation.automated_iut import *
from ioppytest import TMPDIR, TD_LWM2M, TD_LWM2M_CFG
......@@ -52,7 +51,7 @@ class LwM2MClient(AutomatedIUT):
def _execute_configuration(self, testcase_id, node):
# shoud we restart the process?
return None
return "{}::{}".format(lwm2m_client_ip_prefix,lwm2m_client_ip_host)
if __name__ == '__main__':
......
# -*- coding: utf-8 -*-
# !/usr/bin/env python3
import subprocess
from automation import COAP_SERVER_HOST, COAP_SERVER_PORT, COAP_CLIENT_HOST, LOG_LEVEL
from automation.automated_iut import *
from ioppytest import TMPDIR, TD_LWM2M, TD_LWM2M_CFG
from ioppytest.test_suite.testsuite import TestSuite
logger = logging.getLogger()
logger.setLevel(LOG_LEVEL)
coap_host_address = COAP_SERVER_HOST
lwm2m_client_ip_prefix, lwm2m_client_ip_host = TestSuite(TD_LWM2M, TD_LWM2M_CFG).get_node_address('lwm2m_client')
lwm2m_server_ip_prefix, lwm2m_server_ip_host = TestSuite(TD_LWM2M, TD_LWM2M_CFG).get_node_address('lwm2m_server')
class LeshanServerTrigger(AutomatedIUT):
"""
......@@ -20,7 +21,6 @@ class LeshanServerTrigger(AutomatedIUT):
node = 'lwm2m_server'
iut_base_cmd = 'nodejs automation/lwm2m_server_leshan/trigger.js'
def __init__(self):
super().__init__(self.node)
logger.info('starting %s [ %s ]' % (self.node, self.component_id))
......@@ -61,7 +61,7 @@ class LeshanServerTrigger(AutomatedIUT):
def _execute_configuration(self, testcase_id, node):
# no config / reset needed for implementation
return coap_host_address
return "{}::{}".format(lwm2m_server_ip_prefix, lwm2m_server_ip_host)