Commit 9ab34d3a authored by Federico Sismondi's avatar Federico Sismondi

Merge branch 'new_cli'

parents 330a5cb9 a7ed7d38
......@@ -92,7 +92,7 @@ class NullLogHandler(logging.Handler):
class AmqpSniffer(threading.Thread):
COMPONENT_ID = 'amqp_sniffer'
COMPONENT_ID = 'amqp_sniffer_%s' % uuid.uuid1()
DEFAULT_EXCHAGE = 'amq.topic'
def __init__(self, conn, exchange=None, topics=None):
......@@ -542,7 +542,7 @@ if __name__ == '__main__':
'snif0': MsgSniffingStart(
capture_id='TD_COAP_CORE_01',
filter_if='tun0',
filter_proto='udp port 5683'
filter_proto='udp'
),
'snif1': MsgSniffingStop(),
# get a particular capture file
......@@ -629,7 +629,8 @@ if __name__ == '__main__':
# 'tt11': MsgStepCheckExecute(step_id="TD_COAP_CORE_01_v01_step_02"),
# 'tt12': MsgStepCheckExecute(step_id="TD_COAP_CORE_01_v01_step_03"),
'tt13': MsgStepVerifyExecute(step_id="TD_COAP_CORE_01_v01_step_04"),
'tt100': MsgTestSuiteReport(),
'ttver':MsgTestCaseVerdict(),
'ttrepo': MsgTestSuiteReport(),
# for 6lowpan TT tests
's_hc_01': MsgStepStimuliExecute(step_id='TD_6LowPAN_HC_01_step_01', node='eut1'),
's_hc_02': MsgStepStimuliExecute(step_id='TD_6LowPAN_HC_02_step_01', node='eut1'),
......
......@@ -461,7 +461,7 @@ class MsgSessionLog(Message):
_msg_data_template = {
"_type": "log",
"component": "the_drummer",
"description": "I've got blisters on my fingers!"
"message": "I've got blisters on my fingers!"
}
......@@ -1346,7 +1346,7 @@ class MsgSniffingStart(Message):
"_type": "sniffing.start",
"capture_id": "TD_COAP_CORE_01",
"filter_if": "tun0",
"filter_proto": "udp port 5683"
"filter_proto": "udp"
}
......
This diff is collapsed.
......@@ -268,18 +268,20 @@ class AmqpSniffer(threading.Thread):
self.channel = self.connection.channel()
self.services_queu_name = 'services_queue@%s' % self.COMPONENT_ID
self.channel.queue_declare(queue=self.services_queu_name, auto_delete=True)
self.services_queue_name = 'services_queue@%s' % self.COMPONENT_ID
self.channel.queue_declare(queue=self.services_queue_name,
auto_delete = True,
arguments = {'x-max-length': 100})
if topics: # susbscribe only to passed list
for t in topics:
self.channel.queue_bind(exchange=AMQP_EXCHANGE,
queue=self.services_queu_name,
queue=self.services_queue_name,
routing_key=t)
else: # subscribe to all events
self.channel.queue_bind(exchange=AMQP_EXCHANGE,
queue=self.services_queu_name,
queue=self.services_queue_name,
routing_key='#')
# Hello world message
......@@ -293,10 +295,10 @@ class AmqpSniffer(threading.Thread):
)
self.channel.basic_qos(prefetch_count=1)
self.channel.basic_consume(self.on_request, queue=self.services_queu_name)
self.channel.basic_consume(self.on_request, queue=self.services_queue_name)
def stop(self):
self.channel.queue_delete(self.services_queu_name)
self.channel.queue_delete(self.services_queue_name)
self.channel.stop_consuming()
self.connection.close()
......
import click
from prompt_toolkit import prompt
from prompt_toolkit.history import FileHistory
from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
from prompt_toolkit.contrib.completers import WordCompleter
SQLCompleter = WordCompleter(['select', 'from', 'insert', 'update', 'delete', 'drop'],
ignore_case=True)
if __name__ == '__main__':
cli = click.Group(
short_help='hola'
)
session_url = click.Option(
param_decls=["--url"],
default="amqp://guest:guest@localhost/",
required=True,
help="AMQP url provided by F-Interop")
connect_command = click.Command(
"connect",
callback=print,
params=[
session_url,
],
short_help="Connect with authentication AMQP_URL, and some other basic agent configurations."
)
cli.add_command(connect_command)
while 1:
user_input = prompt('SQL>',
history=FileHistory('history.txt'),
auto_suggest=AutoSuggestFromHistory(),
completer=SQLCompleter,
)
print('# entered: ' + user_input)
#click.echo_via_pager(user_input)
try:
cli()
except Exception as e:
print(e)
\ No newline at end of file
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