Commit 7d1e46b3 authored by Federico Sismondi's avatar Federico Sismondi

added generic SessionConfiguration message for any type of testing tool

parent 0dc1bf4a
......@@ -366,6 +366,7 @@ def _handle_testcase_select():
def _handle_get_testcase_list():
# requires testing tool to implement GetTestCases feature, see MsgTestSuiteGetTestCases
if _connection_ok():
temp_channel = state['connection'].channel()
request_message = MsgTestSuiteGetTestCases()
......@@ -606,7 +607,7 @@ def get_session_parameters():
def _connection_ok():
conn_ok = False
try:
conn_ok = state['connection'] is not None
conn_ok = state['connection'] is not None and state['connection'].is_open
except AttributeError as ae:
pass
except TypeError as ae:
......
......@@ -27,7 +27,7 @@ Usage:
>>> from messages import * # doctest: +SKIP
>>> m = MsgTestCaseSkip(testcase_id = 'some_testcase_id')
>>> m
MsgTestCaseSkip(_api_version = 0.1.47, _type = testcoordination.testcase.skip, description = Skip testcase, node = someNode, testcase_id = some_testcase_id, )
MsgTestCaseSkip(_api_version = 0.1.48, _type = testcoordination.testcase.skip, description = Skip testcase, node = someNode, testcase_id = some_testcase_id, )
>>> m.routing_key
'control.testcoordination'
>>> m.message_id # doctest: +SKIP
......@@ -38,18 +38,18 @@ MsgTestCaseSkip(_api_version = 0.1.47, _type = testcoordination.testcase.skip, d
# also we can modify some of the fields (rewrite the default ones)
>>> m = MsgTestCaseSkip(testcase_id = 'TD_COAP_CORE_03')
>>> m
MsgTestCaseSkip(_api_version = 0.1.47, _type = testcoordination.testcase.skip, description = Skip testcase, node = someNode, testcase_id = TD_COAP_CORE_03, )
MsgTestCaseSkip(_api_version = 0.1.48, _type = testcoordination.testcase.skip, 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": "0.1.47", "_type": "testcoordination.testcase.skip", "description": "Skip testcase", "node": "someNode", "testcase_id": "TD_COAP_CORE_03"}'
'{"_api_version": "0.1.48", "_type": "testcoordination.testcase.skip", "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.to_json()
'{"_api_version": "0.1.47", "_type": "testcoordination.testsuite.start", "description": "Event test suite START"}'
'{"_api_version": "0.1.48", "_type": "testcoordination.testsuite.start", "description": "Event test suite START"}'
>>> json_message = m.to_json()
>>> obj=Message.from_json(json_message)
>>> type(obj)
......@@ -62,7 +62,7 @@ MsgTestCaseSkip(_api_version = 0.1.47, _type = testcoordination.testcase.skip, d
# 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.47, _type = sniffing.start, error_code = Some error code TBD, error_message = Some error message TBD, ok = False, )
MsgErrorReply(_api_version = 0.1.48, _type = sniffing.start, error_code = Some error code TBD, error_message = Some error message TBD, ok = False, )
>>> m.reply_to
'control.sniffing.service.reply'
>>> err.routing_key
......@@ -80,7 +80,7 @@ import time
import json
import uuid
API_VERSION = '0.1.47'
API_VERSION = '0.1.48'
# TODO use metaclasses instead?
......@@ -464,8 +464,36 @@ class MsgSessionLog(Message):
}
# TODO delete "Interop" to generalize
class MsgSessionConfiguration(Message):
"""
Requirements: Testing Tool MUST listen to event
Type: Event
Pub/Sub: Orchestrator -> Testing Tool
Description: Testing tool MUST listen to this message and configure the testsuite correspondingly
"""
routing_key = "control.session"
_msg_data_template = {
"_type": "session.configuration",
"session_id": "666",
"configuration": {
'testsuite.testcases': [
'someTestCaseId1',
'someTestCaseId2'
]
},
"testing_tools": "f-interop/someTestToolId",
"users": [
"u1",
"f-interop"
],
}
# TODO deprecate this in favor of the generic MsgSessionConfiguration
class MsgInteropSessionConfiguration(Message):
"""
Requirements: Testing Tool MUST listen to event
......@@ -481,29 +509,19 @@ class MsgInteropSessionConfiguration(Message):
_msg_data_template = {
"_type": "session.interop.configuration",
"session_id": "TBD",
"configuration":
{
'testsuite.testcases': [
'http://doc.f-interop.eu/tests/TD_COAP_CORE_01',
'http://doc.f-interop.eu/tests/TD_COAP'
]
},
"testing_tools": "f-interop/interoperability-coap",
"users": [
"u1",
"f-interop"
],
"iuts": [
{
"id": "someImplementationFromAUser",
"role": "coap_server",
"execution_mode": "user-assisted",
"location": "user-facilities",
"owner": "someUserName",
"version": "0.1"
},
{
"id": "automated_iut-coap_client-coapthon-v0.1",
"role": "coap_client",
"execution_mode": "automated-iut",
"location": "central-server-docker",
"owner": "f-interop",
"version": "0.1"
}
],
"tests": [
{
"testcase_ref": "http://doc.f-interop.eu/tests/TD_COAP_CORE_01",
......@@ -622,6 +640,7 @@ class MsgTestSuiteStart(Message):
"description": "Event test suite START"
}
class MsgTestSuiteStarted(Message):
"""
Requirements: Testing Tool SHOULD publish to event
......@@ -640,6 +659,7 @@ class MsgTestSuiteStarted(Message):
"description": "Event test suite STARTED"
}
class MsgTestSuiteFinish(Message):
"""
Requirements: Testing Tool MUST listen to event
......@@ -1166,6 +1186,7 @@ class MsgTestCaseAbort(Message):
"description": "Event ABORT current testcase"
}
class MsgTestSuiteGetStatus(Message):
"""
Requirements: Testing Tool SHOULD implement (other components should not subscribe to event)
......@@ -1971,6 +1992,7 @@ class MsgPerformanceStats(Message):
message_types_dict = {
"log": MsgSessionLog, # Any -> Any
"chat": MsgSessionChat, # GUI_x -> GUI_y
"session.configuration": MsgSessionConfiguration, # GUI-> SO -> TestingTool
"agent.configured": MsgAgentConfigured, # TestingTool -> GUI
"tun.start": MsgAgentTunStart, # TestingTool -> Agent
"tun.started": MsgAgentTunStarted, # Agent -> TestingTool
......@@ -1984,7 +2006,7 @@ message_types_dict = {
"testingtool.ready": MsgTestingToolReady, # Testing Tool -> GUI
"testingtool.terminate": MsgTestingToolTerminate, # orchestrator -> TestingTool
"testcoordination.testsuite.start": MsgTestSuiteStart, # GUI -> TestingTool
"testcoordination.testsuite.started": MsgTestSuiteStarted,# Testing Tool -> GUI
"testcoordination.testsuite.started": MsgTestSuiteStarted, # Testing Tool -> GUI
"testcoordination.testsuite.finish": MsgTestSuiteFinish, # GUI -> TestingTool
"testcoordination.testcase.ready": MsgTestCaseReady, # TestingTool -> GUI
"testcoordination.testcase.start": MsgTestCaseStart, # GUI -> TestingTool
......
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