Commit 4b446145 authored by Federico Sismondi's avatar Federico Sismondi

messages updates & fix error on packet inject message format

parent d4c1f25e
......@@ -27,7 +27,7 @@ Usage:
>>> from messages import * # doctest: +SKIP
>>> m = MsgTestCaseSkip()
>>> m
MsgTestCaseSkip(_api_version = 0.1.35, _type = testcoordination.testcase.skip, testcase_id = TD_COAP_CORE_02_v01, )
MsgTestCaseSkip(_api_version = 0.1.38, _type = testcoordination.testcase.skip, testcase_id = TD_COAP_CORE_02_v01, )
>>> m.routing_key
'control.testcoordination'
>>> m.message_id # doctest: +SKIP
......@@ -38,18 +38,18 @@ MsgTestCaseSkip(_api_version = 0.1.35, _type = testcoordination.testcase.skip, t
# also we can modify some of the fields (rewrite the default ones)
>>> m = MsgTestCaseSkip(testcase_id = 'TD_COAP_CORE_03_v01')
>>> m
MsgTestCaseSkip(_api_version = 0.1.35, _type = testcoordination.testcase.skip, testcase_id = TD_COAP_CORE_03_v01, )
MsgTestCaseSkip(_api_version = 0.1.38, _type = testcoordination.testcase.skip, testcase_id = TD_COAP_CORE_03_v01, )
>>> m.testcase_id
'TD_COAP_CORE_03_v01'
# and even export the message in json format (for example for sending the message though the amqp event bus)
>>> m.to_json()
'{"_api_version": "0.1.35", "_type": "testcoordination.testcase.skip", "testcase_id": "TD_COAP_CORE_03_v01"}'
'{"_api_version": "0.1.38", "_type": "testcoordination.testcase.skip", "testcase_id": "TD_COAP_CORE_03_v01"}'
# We can use the Message class to import json into Message objects:
>>> m=MsgTestSuiteStart()
>>> m.to_json()
'{"_api_version": "0.1.35", "_type": "testcoordination.testsuite.start"}'
'{"_api_version": "0.1.38", "_type": "testcoordination.testsuite.start"}'
>>> json_message = m.to_json()
>>> obj=Message.from_json(json_message)
>>> type(obj)
......@@ -62,7 +62,7 @@ MsgTestCaseSkip(_api_version = 0.1.35, _type = testcoordination.testcase.skip, t
# the error reply (note that we pass the message of the request to build the reply):
>>> err = MsgErrorReply(m)
>>> err
MsgErrorReply(_api_version = 0.1.35, _type = sniffing.start, error_code = Some error code TBD, error_message = Some
MsgErrorReply(_api_version = 0.1.38, _type = sniffing.start, error_code = Some error code TBD, error_message = Some
error message TBD, ok = False, )
>>> m.reply_to
'control.sniffing.service.reply'
......@@ -81,7 +81,7 @@ import time
import json
import uuid
API_VERSION = '0.1.35'
API_VERSION = '0.1.38'
# TODO use metaclasses instead?
......@@ -284,17 +284,38 @@ class MsgAgentTunStart(Message):
}
class MsgAgentSerialStarted(Message):
"""
Description: Message for indicating that agent serial interface has been started
Type: Event
Pub/Sub: Testing Tool -> Agent
Description: TBD
"""
routing_key = "control.serial.from.tbd"
_msg_data_template = {
"_type": "serial.started",
"name": "tbd",
"port": "tbd",
"boudrate": "tbd",
}
class MsgAgentTunStarted(Message):
"""
Description: Message for indicating that agent tun has been started
Type: Event
Pub/Sub: Testing Tool -> Agent
Pub/Sub: Agent -> Testing Tool
Description: TBD
"""
routing_key = "control.tun.from.agent_TT"
routing_key = "control.tun.from.tbd"
_msg_data_template = {
"_type": "tun.started",
......@@ -308,6 +329,27 @@ class MsgAgentTunStarted(Message):
}
class MsgPacketInjectRaw(Message):
"""
Description: Message to be captured by the agent an push into the correct embedded interface (e.g. tun, serial, etc..)
Type: Event
Pub/Sub: Testing Tool -> Agent
Description: TBD
"""
routing_key = None # depends on the agent_id and the agent interface being used, re-write after creation
_msg_data_template = {
"_type": "packet.to_inject.raw",
"timestamp": "1488586183.45",
"interface_name": "tun0",
"data": [96, 0, 0, 0, 0, 36, 0, 1, 254, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 255, 2, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 22, 58, 0, 5, 2, 0, 0, 1, 0, 143, 0, 112, 7, 0, 0, 0, 1, 4, 0, 0, 0, 255, 2, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2]}
class MsgPacketSniffedRaw(Message):
"""
Description: Message captured by the agent in one of its embedded interfaces (e.g. tun, serial, etc..)
......@@ -386,6 +428,47 @@ class MsgTestingToolComponentReady(Message):
}
class MsgSessionChat(Message):
"""
Requirements: GUI should implement
Type: Event
Pub/Sub: UI 1 (2) -> UI 2 (1)
Description: Generic descriptor of chat messages
"""
routing_key = "log.warning.the_drummer"
_msg_data_template = {
"_type": "chat",
"user_name": "Ringo",
"iut_node": "tbd",
"description": "I've got blisters on my fingers!"
}
class MsgSessionLog(Message):
"""
Requirements: Testing Tool SHOULD implement
Type: Event
Pub/Sub: Any Testing tool's component -> user/devs interfaces
Description: Generic descriptor of log messages
"""
routing_key = "log.warning.the_drummer"
_msg_data_template = {
"_type": "log",
"component": "the_drummer",
"description": "I've got blisters on my fingers!"
}
# TODO delete "Interop" to generalize
class MsgInteropSessionConfiguration(Message):
"""
Requirements: Testing Tool MUST listen to event
......@@ -609,6 +692,8 @@ class MsgTestCaseStart(Message):
}
# TODO MsgTestCaseNotes, see https://portal.etsi.org/cti/downloads/TestSpecifications/6LoWPAN_Plugtests_TestDescriptions_1.0.pdf
class MsgTestCaseConfiguration(Message):
"""
Requirements: Testing Tool MAY publish event (if needed for executing the test case)
......@@ -1767,10 +1852,14 @@ class MsgPerformanceStats(Message):
message_types_dict = {
"log": MsgSessionLog, # Any -> Any
"chat": MsgSessionChat, # GUI_x -> GUI_y
"agent.configured": MsgAgentConfigured, # TestingTool -> GUI
"tun.start": MsgAgentTunStart, # TestingTool -> Agent
"tun.started": MsgAgentTunStarted, # Agent -> TestingTool
"serial.started": MsgAgentSerialStarted, # Agent -> TestingTool
"packet.sniffed.raw": MsgPacketSniffedRaw, # Agent -> TestingTool
"packet.to_inject.raw": MsgPacketInjectRaw, # TestingTool -> Agent
"session.interop.configuration": MsgInteropSessionConfiguration, # Orchestrator -> TestingTool
"testingtool.configured": MsgTestingToolConfigured, # TestingTool -> Orchestrator, GUI
"testingtool.component.ready": MsgTestingToolComponentReady, # Testing Tool internal
......
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