Commit 2dfa8c51 authored by Federico Sismondi's avatar Federico Sismondi

added messages for requesting automated IUT to launch reachability tests,...

added messages for requesting automated IUT to launch reachability tests, added also entrypoint to CLI
parent ad5379a3
Pipeline #2712 passed with stage
in 0 seconds
......@@ -30,7 +30,7 @@ Essentially it allows you to:
>>> from messages import *
>>> m = MsgTestCaseSkip(testcase_id = 'some_testcase_id')
>>> m
MsgTestCaseSkip(_api_version = 1.2.2, description = Skip testcase, node = someNode, testcase_id = some_testcase_id, )
MsgTestCaseSkip(_api_version = 1.2.4, description = Skip testcase, node = someNode, testcase_id = some_testcase_id, )
>>> m.routing_key
'testsuite.testcase.skip'
>>> m.message_id # doctest: +SKIP
......@@ -41,24 +41,24 @@ MsgTestCaseSkip(_api_version = 1.2.2, description = Skip testcase, node = someNo
# also we can modify some of the fields (rewrite the default ones)
>>> m = MsgTestCaseSkip(testcase_id = 'TD_COAP_CORE_03')
>>> m
MsgTestCaseSkip(_api_version = 1.2.2, description = Skip testcase, node = someNode, testcase_id = TD_COAP_CORE_03, )
MsgTestCaseSkip(_api_version = 1.2.4, description = Skip testcase, node = someNode, testcase_id = TD_COAP_CORE_03, )
>>> m.testcase_id
'TD_COAP_CORE_03'
# and even export the message in json format (for example for sending the message though the amqp event bus)
>>> m.to_json()
'{"_api_version": "1.2.2", "description": "Skip testcase", "node": "someNode", "testcase_id": "TD_COAP_CORE_03"}'
'{"_api_version": "1.2.4", "description": "Skip testcase", "node": "someNode", "testcase_id": "TD_COAP_CORE_03"}'
# We can use the Message class to import json into Message objects:
>>> m=MsgTestSuiteStart()
>>> m.routing_key
'testsuite.start'
>>> m.to_json()
'{"_api_version": "1.2.2", "description": "Test suite START command"}'
'{"_api_version": "1.2.4", "description": "Test suite START command"}'
>>> json_message = m.to_json()
>>> obj=Message.load(json_message,'testsuite.start', None )
>>> obj
MsgTestSuiteStart(_api_version = 1.2.2, description = Test suite START command, )
MsgTestSuiteStart(_api_version = 1.2.4, description = Test suite START command, )
>>> type(obj) # doctest: +SKIP
<class 'messages.MsgTestSuiteStart'>
......@@ -70,7 +70,7 @@ MsgTestSuiteStart(_api_version = 1.2.2, description = Test suite START command,
# the error reply (note that we pass the message of the request to build the reply):
>>> err = MsgErrorReply(m)
>>> err
MsgErrorReply(_api_version = 1.2.2, error_code = None, error_message = None, ok = False, )
MsgErrorReply(_api_version = 1.2.4, error_code = None, error_message = None, ok = False, )
# properties of the message are auto-generated:
>>> m.reply_to
......@@ -96,10 +96,10 @@ MsgErrorReply(_api_version = 1.2.2, error_code = None, error_message = None, ok
>>> m.routing_key
'sniffing.getcapture.request'
>>> m.to_json()
'{"_api_version": "1.2.2", "capture_id": "TD_COAP_CORE_01"}'
'{"_api_version": "1.2.4", "capture_id": "TD_COAP_CORE_01"}'
>>> json_message = m.to_json()
>>> json_message
'{"_api_version": "1.2.2", "capture_id": "TD_COAP_CORE_01"}'
'{"_api_version": "1.2.4", "capture_id": "TD_COAP_CORE_01"}'
>>> obj=Message.load(json_message,'testsuite.start', None )
>>> type(obj) # doctest
<class 'messages.MsgTestSuiteStart'>
......@@ -116,7 +116,7 @@ Build a message from a pika's returned values on consume:
>>> m.routing_key
'sniffing.getcapture.request'
>>> m.to_json()
'{"_api_version": "1.2.2", "capture_id": "TD_COAP_CORE_01"}'
'{"_api_version": "1.2.4", "capture_id": "TD_COAP_CORE_01"}'
```
......@@ -161,7 +161,7 @@ Sending message..
[Event bus message] [<class 'messages.messages.MsgTestSuiteStart'>]
------------ ------------------------
_api_version 1.2.2
_api_version 1.2.4
description Test suite START command
------------ ------------------------
......@@ -172,22 +172,22 @@ but also for testing internal services provided by the tools
```
> _send_MsgTestSuiteGetTestCases
[User input] trying to send message: MsgTestSuiteGetTestCases(_api_version = 1.2.2, )
[User input] trying to send message: MsgTestSuiteGetTestCases(_api_version = 1.2.4, )
Sending message..
[Event bus message] [<class 'messages.messages.MsgTestSuiteGetTestCases'>]
------------ -----
_api_version 1.2.2
_api_version 1.2.4
------------ -----
[log][test_coordinator|amqp_connector] RECEIVED request: <class 'ioppytest.utils.messages.messages.MsgTestSuiteGetTestCases'>
[log][test_coordinator|amqp_connector] HANDLING request: <class 'ioppytest.utils.messages.messages.MsgTestSuiteGetTestCases'>
[log][test_coordinator|amqp_connector] PUBLISHING to routing_key: testsuite.testcases.list.reply, msg: MsgReply(_api_version = 1.2.2, ok = True, tc_list = [OrderedDict([('te
[log][test_coordinator|amqp_connector] PUBLISHING to routing_key: testsuite.testcases.list.reply, msg: MsgReply(_api_version = 1.2.4, ok = True, tc_list = [OrderedDict([('te
[Event bus message] [<class 'messages.messages.MsgTestSuiteGetTestCasesReply'>]
------------ --------------------------------------------------------------------------------------------------------------------
_api_version 1.2.2
_api_version 1.2.4
ok True
tc_list {'testcase_id': 'TD_COAP_CORE_01', 'testcase_ref': 'http://doc.f-interop.eu/tests/TD_COAP_CORE_01', 'state': None}
{'testcase_id': 'TD_COAP_CORE_02', 'testcase_ref': 'http://doc.f-interop.eu/tests/TD_COAP_CORE_02', 'state': None}
......@@ -221,13 +221,13 @@ other example:
```
> _send_MsgAgentTunStart
[User input] trying to send message: MsgAgentTunStart(_api_version = 1.2.2, ipv4_host = None, ipv4_netmask = None, ipv4_network = None, ipv6_host = :3, ipv6_no_forwarding = False, ipv6_prefix = bbbb, name = agent_TT, re_route_packets_host = None, re_route_packets_if = None, re_route_packets_prefix = None, )
[User input] trying to send message: MsgAgentTunStart(_api_version = 1.2.4, ipv4_host = None, ipv4_netmask = None, ipv4_network = None, ipv6_host = :3, ipv6_no_forwarding = False, ipv6_prefix = bbbb, name = agent_TT, re_route_packets_host = None, re_route_packets_if = None, re_route_packets_prefix = None, )
Sending message..
[Event bus message] [<class 'messages.messages.MsgAgentTunStart'>]
----------------------- --------
_api_version 1.2.2
_api_version 1.2.4
ipv4_host
ipv4_netmask
ipv4_network
......@@ -281,7 +281,7 @@ and the message properties into Message python objects
[Event bus message] [<class 'messages.messages.MsgTestingToolComponentReady'>]
------------ -------------------------------
_api_version 1.2.2
_api_version 1.2.4
component amqp_listener_b49d7db4
description amqp_listener_b49d7db4 is READY
------------ -------------------------------
......@@ -304,7 +304,7 @@ No conversion from json to python objects, no data validation
routing_key : testsuite.testcases.list.request
------------------------------------------------------------------------------------------------------------------------
{
"_api_version": "1.2.2",
"_api_version": "1.2.4",
"content_type": "application/json",
"correlation_id": "00393e9e-d255-4309-8a9b-18ec608602f3",
"message_id": "00393e9e-d255-4309-8a9b-18ec608602f3",
......@@ -336,13 +336,13 @@ routing_key : log.info.test_coordinator|amqp_connector
"_api_version": "1.0.8",
"component": "test_coordinator|amqp_connector",
"content_type": "application/json",
"message": "PUBLISHING to routing_key: testsuite.testcases.list.reply, msg: MsgReply(_api_version = 1.2.2, ok = True, tc_list = [OrderedDict([('te"
"message": "PUBLISHING to routing_key: testsuite.testcases.list.reply, msg: MsgReply(_api_version = 1.2.4, ok = True, tc_list = [OrderedDict([('te"
}
------------------------------------------------------------------------------------------------------------------------
routing_key : testsuite.testcases.list.reply
------------------------------------------------------------------------------------------------------------------------
{
"_api_version": "1.2.2",
"_api_version": "1.2.4",
"content_type": "application/json",
"correlation_id": "00393e9e-d255-4309-8a9b-18ec608602f3",
"message_id": "619283ab-c6a1-4b91-8a65-8697b665e3a1",
......
......@@ -565,7 +565,7 @@ def enter_debug_context():
"""
Stimuli to be executed by IUT1, targeting IUT2
"""
_echo_input("Executing debug message %s" % sys._getframe().f_code.co_name)
_echo_session_helper("Executing test message function %s" % sys._getframe().f_code.co_name)
msg = MsgStepStimuliExecute(
node=node,
step_id=step_id,
......@@ -586,7 +586,7 @@ def enter_debug_context():
"""
Request IUT to verify a step, normally they respond with a dummy verify ok
"""
_echo_input("Executing debug message %s" % sys._getframe().f_code.co_name)
_echo_session_helper("Executing test message function %s" % sys._getframe().f_code.co_name)
msg = MsgStepVerifyExecute(
node=node,
step_id=step_id,
......@@ -608,7 +608,7 @@ def enter_debug_context():
if testcase_id is None:
testcase_id = 'PCAP_TEST'
_echo_input("Executing debug message %s" % sys._getframe().f_code.co_name)
_echo_session_helper("Executing test message function %s" % sys._getframe().f_code.co_name)
msg = MsgSniffingStart(capture_id=testcase_id,
filter_if='tun0',
filter_proto='udp')
......@@ -619,7 +619,7 @@ def enter_debug_context():
"""
Sniffer stop
"""
_echo_input("Executing debug message %s" % sys._getframe().f_code.co_name)
_echo_session_helper("Executing test message function %s" % sys._getframe().f_code.co_name)
msg = MsgSniffingStop()
_publish_message(msg)
......@@ -628,7 +628,7 @@ def enter_debug_context():
"""
Sniffer get last capture
"""
_echo_input("Executing debug message %s" % sys._getframe().f_code.co_name)
_echo_session_helper("Executing test message function %s" % sys._getframe().f_code.co_name)
msg = MsgSniffingGetCaptureLast()
_publish_message(msg)
......@@ -637,7 +637,7 @@ def enter_debug_context():
"""
Send example configuration message for perf TT
"""
_echo_input("Executing debug message %s" % sys._getframe().f_code.co_name)
_echo_session_helper("Executing test message function %s" % sys._getframe().f_code.co_name)
from message_examples import PERF_TT_CONFIGURATION
message = MsgSessionConfiguration(**PERF_TT_CONFIGURATION) # builds a config for the perf TT
_publish_message(message)
......@@ -647,7 +647,7 @@ def enter_debug_context():
"""
Send example configuration message for CoMI TT
"""
_echo_input("Executing debug message %s" % sys._getframe().f_code.co_name)
_echo_session_helper("Executing test message function %s" % sys._getframe().f_code.co_name)
from message_examples import COMI_TT_CONFIGURATION
message = MsgSessionConfiguration(**COMI_TT_CONFIGURATION) # builds a config message
_publish_message(message)
......@@ -657,7 +657,7 @@ def enter_debug_context():
"""
Send example configuration message for SIXLOWPAN TT
"""
_echo_input("Executing debug message %s" % sys._getframe().f_code.co_name)
_echo_session_helper("Executing test message function %s" % sys._getframe().f_code.co_name)
from message_examples import SIXLOWPAN_TT_CONFIGURATION
message = MsgSessionConfiguration(**SIXLOWPAN_TT_CONFIGURATION) # builds a config message
_publish_message(message)
......@@ -667,7 +667,7 @@ def enter_debug_context():
"""
Send example 6lowpan tat analysis request
"""
_echo_input("Executing debug message %s" % sys._getframe().f_code.co_name)
_echo_session_helper("Executing test message function %s" % sys._getframe().f_code.co_name)
from message_examples import SIXLOWPAN_TAT_ANALYZE
message = MsgInteropTestCaseAnalyze(**SIXLOWPAN_TAT_ANALYZE)
_publish_message(message)
......@@ -677,7 +677,7 @@ def enter_debug_context():
"""
Send example configuration message for CoAP TT
"""
_echo_input("Executing debug message %s" % sys._getframe().f_code.co_name)
_echo_session_helper("Executing test message function %s" % sys._getframe().f_code.co_name)
from message_examples import COAP_TT_CONFIGURATION
message = MsgSessionConfiguration(**COAP_TT_CONFIGURATION) # builds a config message
_publish_message(message)
......@@ -687,7 +687,7 @@ def enter_debug_context():
"""
Get session config from UI
"""
_echo_input("Executing debug message %s" % sys._getframe().f_code.co_name)
_echo_session_helper("Executing test message function %s" % sys._getframe().f_code.co_name)
req = MsgUiRequestSessionConfiguration()
_publish_message(req)
......@@ -697,7 +697,7 @@ def enter_debug_context():
"""
Skip a particular testcase
"""
_echo_input("Executing debug message %s" % sys._getframe().f_code.co_name)
_echo_session_helper("Executing test message function %s" % sys._getframe().f_code.co_name)
msg = MsgTestCaseSkip(
testcase_id=testcase_id
......@@ -710,7 +710,7 @@ def enter_debug_context():
"""
Send message to GUI
"""
_echo_input("Executing debug message %s" % sys._getframe().f_code.co_name)
_echo_session_helper("Executing test message function %s" % sys._getframe().f_code.co_name)
msg = MsgUiDisplayMarkdownText()
......@@ -733,7 +733,7 @@ def enter_debug_context():
"""
Send button to GUI
"""
_echo_input("Executing debug message %s" % sys._getframe().f_code.co_name)
_echo_session_helper("Executing test message function %s" % sys._getframe().f_code.co_name)
msg = MsgUiRequestConfirmationButton()
......@@ -753,7 +753,7 @@ def enter_debug_context():
"""
Send button to GUI
"""
_echo_input("Executing debug message %s" % sys._getframe().f_code.co_name)
_echo_session_helper("Executing test message function %s" % sys._getframe().f_code.co_name)
msg = MsgSessionLog(
component=COMPONENT_ID,
......@@ -769,7 +769,7 @@ def enter_debug_context():
"""
Send button to GUI
"""
_echo_input("Executing debug message %s" % sys._getframe().f_code.co_name)
_echo_session_helper("Executing test message function %s" % sys._getframe().f_code.co_name)
msg = MsgSessionLog(
component=COMPONENT_ID,
......@@ -782,6 +782,24 @@ def enter_debug_context():
_echo_session_helper("Entering debugger context, added extra CMDs, please type --help for more info")
@cli.command()
@click.option('--target-host', default='bbbb::2', help="ICMPv6 destination address")
@click.option('--origin-node', default='coap_client', help="Origin Node id (related to the automated IUT role)")
def _test_automated_iut_reaches_another_other_implementation(target_host, origin_node):
"""
Request automated IUT to send a ping request to a certain ip destination
"""
_echo_session_helper("Executing test message function %s" % sys._getframe().f_code.co_name)
msg = MsgAutomatedIutTestPing(
node=origin_node,
target_address=target_host
)
resp = _amqp_request(msg, COMPONENT_ID, 15)
assert resp.ok, '%s cannot reach destination %s' % (origin_node, target_host)
@cli.command()
@click.argument('message', nargs=-1)
def chat(message):
......
......@@ -26,7 +26,7 @@ Usage:
------
>>> m = MsgTestCaseSkip(testcase_id = 'some_testcase_id')
>>> m
MsgTestCaseSkip(_api_version = 1.2.2, description = Skip testcase, node = someNode, testcase_id = some_testcase_id, )
MsgTestCaseSkip(_api_version = 1.2.4, description = Skip testcase, node = someNode, testcase_id = some_testcase_id, )
>>> m.routing_key
'testsuite.testcase.skip'
>>> m.message_id # doctest: +SKIP
......@@ -37,24 +37,24 @@ MsgTestCaseSkip(_api_version = 1.2.2, description = Skip testcase, node = someNo
# also we can modify some of the fields (rewrite the default ones)
>>> m = MsgTestCaseSkip(testcase_id = 'TD_COAP_CORE_03')
>>> m
MsgTestCaseSkip(_api_version = 1.2.2, description = Skip testcase, node = someNode, testcase_id = TD_COAP_CORE_03, )
MsgTestCaseSkip(_api_version = 1.2.4, description = Skip testcase, node = someNode, testcase_id = TD_COAP_CORE_03, )
>>> m.testcase_id
'TD_COAP_CORE_03'
# and even export the message in json format (for example for sending the message though the amqp event bus)
>>> m.to_json()
'{"_api_version": "1.2.2", "description": "Skip testcase", "node": "someNode", "testcase_id": "TD_COAP_CORE_03"}'
'{"_api_version": "1.2.4", "description": "Skip testcase", "node": "someNode", "testcase_id": "TD_COAP_CORE_03"}'
# We can use the Message class to import json into Message objects:
>>> m=MsgTestSuiteStart()
>>> m.routing_key
'testsuite.start'
>>> m.to_json()
'{"_api_version": "1.2.2", "description": "Test suite START command"}'
'{"_api_version": "1.2.4", "description": "Test suite START command"}'
>>> json_message = m.to_json()
>>> obj=Message.load(json_message,'testsuite.start', None )
>>> obj
MsgTestSuiteStart(_api_version = 1.2.2, description = Test suite START command, )
MsgTestSuiteStart(_api_version = 1.2.4, description = Test suite START command, )
>>> type(obj) # doctest: +SKIP
<class 'messages.MsgTestSuiteStart'>
......@@ -66,7 +66,7 @@ MsgTestSuiteStart(_api_version = 1.2.2, description = Test suite START command,
# the error reply (note that we pass the message of the request to build the reply):
>>> err = MsgErrorReply(m)
>>> err
MsgErrorReply(_api_version = 1.2.2, error_code = None, error_message = None, ok = False, )
MsgErrorReply(_api_version = 1.2.4, error_code = None, error_message = None, ok = False, )
# properties of the message are auto-generated:
>>> m.reply_to
......@@ -91,7 +91,7 @@ import time
import json
import uuid
API_VERSION = '1.2.2'
API_VERSION = '1.2.4'
class NonCompliantMessageFormatError(Exception):
......@@ -201,10 +201,10 @@ class Message(object):
>>> m.routing_key
'sniffing.getcapture.request'
>>> m.to_json()
'{"_api_version": "1.2.2", "capture_id": "TD_COAP_CORE_01"}'
'{"_api_version": "1.2.4", "capture_id": "TD_COAP_CORE_01"}'
>>> json_message = m.to_json()
>>> json_message
'{"_api_version": "1.2.2", "capture_id": "TD_COAP_CORE_01"}'
'{"_api_version": "1.2.4", "capture_id": "TD_COAP_CORE_01"}'
>>> obj=Message.load(json_message,'testsuite.start', None )
>>> type(obj) # doctest
<class 'messages.MsgTestSuiteStart'>
......@@ -1314,6 +1314,44 @@ class MsgSessionCreated(Message):
}
class MsgAutomatedIutTestPing(Message):
"""
Requirements: Automated IUTs SHOULD implement (other components should not subscribe to event)
Type: Event
Pub/Sub: Any Testing tool's component -> automated IUT
Description: tbd
"""
routing_key = "testingtool.component.test.ping.request"
_msg_data_template = {
"description": "Automated IUT ping request",
"node": None,
"target_address": None
}
class MsgAutomatedIutTestPingReply(MsgReply):
"""
Requirements: Automated IUTs SHOULD implement (other components should not subscribe to event)
Type: Event
Pub/Sub: automated IUT -> any Testing tool's component
Description: tbd
"""
routing_key = "testingtool.component.test.ping.reply"
_msg_data_template = {
"description": "Automated IUT reply to executed ping request",
"node": None,
"target_address": None
}
class MsgTestingToolComponentShutdown(Message):
"""
Requirements: Testing Tool SHOULD implement (other components should not subscribe to event)
......@@ -2828,6 +2866,9 @@ rk_pattern_to_message_type_map = RoutingKeyToMessageMap(
"testingtool.terminate": MsgTestingToolTerminate, # GUI, orchestrator -> TestingTool
"testingtool.component.ready": MsgTestingToolComponentReady, # Testing Tool internal
"testingtool.component.shutdown": MsgTestingToolComponentShutdown, # Testing Tool internal
"testingtool.component.test.ping.request": MsgAutomatedIutTestPing, # Testing Tool internal
"testingtool.component.test.ping.reply": MsgAutomatedIutTestPingReply, # Testing Tool internal
# ioppytest API: Test Suite messages (they all trigger interactions into GUI)
"testsuite.start": MsgTestSuiteStart, # GUI -> TestingTool
......
......@@ -6,7 +6,7 @@ from setuptools import setup, find_packages
MAJOR = 1
MINOR = 2
PATCH = 3
PATCH = 4
VERSION = "{}.{}.{}".format(MAJOR, MINOR, PATCH)
name = 'ioppytest-utils'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment