Commit 1706d794 authored by Federico Sismondi's avatar Federico Sismondi

Added to CLI command for sending iframe message to UI. Incremented version for pypi release.

parent 7ebe299a
......@@ -35,7 +35,7 @@ Essentially it allows you to:
>>> from messages import *
>>> m = MsgTestCaseSkip(testcase_id = 'some_testcase_id')
>>> m
MsgTestCaseSkip(_api_version = 1.2.10, description = Skip testcase, node = someNode, testcase_id = some_testcase_id, )
MsgTestCaseSkip(_api_version = 1.2.11, description = Skip testcase, node = someNode, testcase_id = some_testcase_id, )
>>> m.routing_key
'testsuite.testcase.skip'
>>> m.message_id # doctest: +SKIP
......@@ -46,24 +46,24 @@ MsgTestCaseSkip(_api_version = 1.2.10, description = Skip testcase, node = someN
# 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.10, description = Skip testcase, node = someNode, testcase_id = TD_COAP_CORE_03, )
MsgTestCaseSkip(_api_version = 1.2.11, 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.10", "description": "Skip testcase", "node": "someNode", "testcase_id": "TD_COAP_CORE_03"}'
'{"_api_version": "1.2.11", "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.10", "description": "Test suite START command"}'
'{"_api_version": "1.2.11", "description": "Test suite START command"}'
>>> json_message = m.to_json()
>>> obj=Message.load(json_message,'testsuite.start', None )
>>> obj
MsgTestSuiteStart(_api_version = 1.2.10, description = Test suite START command, )
MsgTestSuiteStart(_api_version = 1.2.11, description = Test suite START command, )
>>> type(obj) # doctest: +SKIP
<class 'messages.MsgTestSuiteStart'>
......@@ -75,7 +75,7 @@ MsgTestSuiteStart(_api_version = 1.2.10, 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.10, error_code = None, error_message = None, ok = False, )
MsgErrorReply(_api_version = 1.2.11, error_code = None, error_message = None, ok = False, )
# properties of the message are auto-generated:
>>> m.reply_to
......@@ -101,10 +101,10 @@ MsgErrorReply(_api_version = 1.2.10, error_code = None, error_message = None, ok
>>> m.routing_key
'sniffing.getcapture.request'
>>> m.to_json()
'{"_api_version": "1.2.10", "capture_id": "TD_COAP_CORE_01"}'
'{"_api_version": "1.2.11", "capture_id": "TD_COAP_CORE_01"}'
>>> json_message = m.to_json()
>>> json_message
'{"_api_version": "1.2.10", "capture_id": "TD_COAP_CORE_01"}'
'{"_api_version": "1.2.11", "capture_id": "TD_COAP_CORE_01"}'
>>> obj=Message.load(json_message,'testsuite.start', None )
>>> type(obj) # doctest
<class 'messages.MsgTestSuiteStart'>
......@@ -120,7 +120,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.10", "capture_id": "TD_COAP_CORE_01"}'
'{"_api_version": "1.2.11", "capture_id": "TD_COAP_CORE_01"}'
```
......@@ -168,7 +168,7 @@ Sending message..
[Event bus message] [<class 'messages.messages.MsgTestSuiteStart'>]
------------ ------------------------
_api_version 1.2.10
_api_version 1.2.11
description Test suite START command
------------ ------------------------
```
......@@ -178,22 +178,22 @@ but also for testing internal services provided by the tools
```
> _send_MsgTestSuiteGetTestCases
[User input] trying to send message: MsgTestSuiteGetTestCases(_api_version = 1.2.10, )
[User input] trying to send message: MsgTestSuiteGetTestCases(_api_version = 1.2.11, )
Sending message..
[Event bus message] [<class 'messages.messages.MsgTestSuiteGetTestCases'>]
------------ -----
_api_version 1.2.10
_api_version 1.2.11
------------ -----
[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.10, 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.11, ok = True, tc_list = [OrderedDict([('te
[Event bus message] [<class 'messages.messages.MsgTestSuiteGetTestCasesReply'>]
------------ --------------------------------------------------------------------------------------------------------------------
_api_version 1.2.10
_api_version 1.2.11
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}
......@@ -227,13 +227,13 @@ other example:
```
> _send_MsgAgentTunStart
[User input] trying to send message: MsgAgentTunStart(_api_version = 1.2.10, 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.11, 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.10
_api_version 1.2.11
ipv4_host
ipv4_netmask
ipv4_network
......@@ -287,7 +287,7 @@ and the message properties into Message python objects
[Event bus message] [<class 'messages.messages.MsgTestingToolComponentReady'>]
------------ -------------------------------
_api_version 1.2.10
_api_version 1.2.11
component amqp_listener_b49d7db4
description amqp_listener_b49d7db4 is READY
------------ -------------------------------
......@@ -311,7 +311,7 @@ No conversion from json to python objects, no data validation
routing_key : testsuite.testcases.list.request
------------------------------------------------------------------------------------------------------------------------
{
"_api_version": "1.2.10",
"_api_version": "1.2.11",
"content_type": "application/json",
"correlation_id": "00393e9e-d255-4309-8a9b-18ec608602f3",
"message_id": "00393e9e-d255-4309-8a9b-18ec608602f3",
......@@ -343,13 +343,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.10, ok = True, tc_list = [OrderedDict([('te"
"message": "PUBLISHING to routing_key: testsuite.testcases.list.reply, msg: MsgReply(_api_version = 1.2.11, ok = True, tc_list = [OrderedDict([('te"
}
------------------------------------------------------------------------------------------------------------------------
routing_key : testsuite.testcases.list.reply
------------------------------------------------------------------------------------------------------------------------
{
"_api_version": "1.2.10",
"_api_version": "1.2.11",
"content_type": "application/json",
"correlation_id": "00393e9e-d255-4309-8a9b-18ec608602f3",
"message_id": "619283ab-c6a1-4b91-8a65-8697b665e3a1",
......@@ -575,7 +575,7 @@ OrderedDict([('user_name', 'Walter White'), ('protocol', 'coap'), ('node', 'both
[Event bus message] [<class 'messages.MsgTestingToolComponentReady'>]
>>> ------------ -------------------------------
_api_version 1.2.10
_api_version 1.2.11
component amqp_listener_47607736
description amqp_listener_47607736 is READY
------------ -------------------------------
......@@ -585,7 +585,7 @@ description amqp_listener_47607736 is READY
[Event bus message] [<class 'messages.MsgTestSuiteGetTestCases'>]
------------ -----
_api_version 1.2.10
_api_version 1.2.11
------------ -----
[Error] Is testing tool up?
[Error] Response timeout! rkey: testsuite.testcases.list.request , request type: <class 'messages.MsgTestSuiteGetTestCases'>
......
......@@ -117,7 +117,7 @@ def repl():
_echo_log_message('saving CMD history at: {}'.format(history_path_file))
_echo_welcome_message()
_pre_configuration()
#_pre_configuration()
_echo_session_helper("\nYou can press TAB for the available commands at any time \n")
_echo_session_helper("\nThe command <action [param]> needs to be used for executing the test actions\n")
......@@ -269,6 +269,28 @@ def gui_display_message(text_message, user_id):
_echo_input("message display sent to {}".format(msg_display.routing_key))
@cli.command()
@click.option('--url', default="https://www.w3schools.com", help="")
def gui_iframe_display(url):
"""
Sends message to GUI
"""
global state
msg = MsgUiDisplayIFrame()
msg.fields = [
{
"value": url,
"type": "iframe"
}
]
_publish_message(msg)
_echo_input("message to GUI: {}".format(msg.routing_key))
@cli.command()
def clear():
"""
......
......@@ -26,7 +26,7 @@ Usage:
------
>>> m = MsgTestCaseSkip(testcase_id = 'some_testcase_id')
>>> m
MsgTestCaseSkip(_api_version = 1.2.10, description = Skip testcase, node = someNode, testcase_id = some_testcase_id, )
MsgTestCaseSkip(_api_version = 1.2.11, 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.10, description = Skip testcase, node = someN
# 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.10, description = Skip testcase, node = someNode, testcase_id = TD_COAP_CORE_03, )
MsgTestCaseSkip(_api_version = 1.2.11, 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.10", "description": "Skip testcase", "node": "someNode", "testcase_id": "TD_COAP_CORE_03"}'
'{"_api_version": "1.2.11", "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.10", "description": "Test suite START command"}'
'{"_api_version": "1.2.11", "description": "Test suite START command"}'
>>> json_message = m.to_json()
>>> obj=Message.load(json_message,'testsuite.start', None )
>>> obj
MsgTestSuiteStart(_api_version = 1.2.10, description = Test suite START command, )
MsgTestSuiteStart(_api_version = 1.2.11, description = Test suite START command, )
>>> type(obj) # doctest: +SKIP
<class 'messages.MsgTestSuiteStart'>
......@@ -66,7 +66,7 @@ MsgTestSuiteStart(_api_version = 1.2.10, 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.10, error_code = None, error_message = None, ok = False, )
MsgErrorReply(_api_version = 1.2.11, error_code = None, error_message = None, ok = False, )
# properties of the message are auto-generated:
>>> m.reply_to
......@@ -91,7 +91,7 @@ import uuid
logger = logging.getLogger(__name__)
API_VERSION = '1.2.10'
API_VERSION = '1.2.11'
class NonCompliantMessageFormatError(Exception):
......@@ -201,10 +201,10 @@ class Message(object):
>>> m.routing_key
'sniffing.getcapture.request'
>>> m.to_json()
'{"_api_version": "1.2.10", "capture_id": "TD_COAP_CORE_01"}'
'{"_api_version": "1.2.11", "capture_id": "TD_COAP_CORE_01"}'
>>> json_message = m.to_json()
>>> json_message
'{"_api_version": "1.2.10", "capture_id": "TD_COAP_CORE_01"}'
'{"_api_version": "1.2.11", "capture_id": "TD_COAP_CORE_01"}'
>>> obj=Message.load(json_message,'testsuite.start', None )
>>> type(obj) # doctest
<class 'messages.MsgTestSuiteStart'>
......@@ -1009,6 +1009,31 @@ class MsgUiDisplayMarkdownText(MsgUiDisplay):
}
class MsgUiDisplayIFrame(Message):
"""
Requirements: ...
Type: Event
Pub/Sub: TT -> UI
Description: Message for displaying iframing GUI and external server
"""
routing_key = "ui.user.all.display"
_msg_data_template = {
"level": None,
"tags": {},
"fields": [
{
"type": "iframe",
"name": "my_iframe",
"value": "https://www.w3schools.com"
},
]
}
# # # # # # AGENT MESSAGES # # # # # #
......
......@@ -5,7 +5,7 @@ from setuptools import setup
MAJOR = 1
MINOR = 2
PATCH = 10
PATCH = 11
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