Commit 562fc0f4 authored by Federico Sismondi's avatar Federico Sismondi

added uplink and downlink banners on reception and publishing data packets

parent b924f2cc
......@@ -37,6 +37,8 @@ from connectors.ping import PingConnector
from connectors.zeromq import ZMQConnector
from connectors.serialconn import SerialConnector
from utils import arrow_down, arrow_up, finterop_banner
try:
from urllib.parse import urlparse
except ImportError:
......@@ -51,20 +53,6 @@ logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger(__name__)
logging.getLogger('amqp').setLevel(logging.INFO)
finteorp_banner = \
"""
______ _____ _
| ____| |_ _| | |
| |__ ______| | _ __ | |_ ___ _ __ ___ _ __
| __|______| | | '_ \| __/ _ \ '__/ _ \| '_ \
| | _| |_| | | | || __/ | | (_) | |_) |
|_| |_____|_| |_|\__\___|_| \___/| .__/
| |
|_|
"""
class Agent(object):
"""
......@@ -83,7 +71,7 @@ For more information, visit: http://doc.f-interop.eu
def __init__(self):
print(finteorp_banner)
print(finterop_banner)
self.cli = click.Group(
add_help_option=Agent.header,
......
......@@ -8,32 +8,13 @@ import threading
from connectors.base import BaseController, BaseConsumer
from utils.serial_listener import SerialListener
from utils import arrow_down, arrow_up, finterop_banner
__version__ = (0, 0, 1)
log = logging.getLogger(__name__)
arrow_down = """
___
| |
| |
| |
| |
| |
| |
| |
| |
__! !__,
\\ / \O
\\ / \/|
\\ / |
\\ / / \\
Y _/ _\\
"""
class SerialConsumer(BaseConsumer):
"""
AMQP helper
......
......@@ -9,6 +9,7 @@ import sys
import datetime
from kombu import Producer
from connectors.base import BaseController, BaseConsumer
from utils import arrow_down, arrow_up, finterop_banner
from utils.opentun import OpenTunLinux, OpenTunMACOS
__version__ = (0, 0, 1)
......@@ -127,7 +128,7 @@ class TunConsumer(BaseConsumer):
return
self.packet_count += 1
print(arrow_down)
self.log.debug('\n* * * * * * HANDLE DATA (%s) * * * * * * *' % self.packet_count)
self.log.debug("TIME: %s" % datetime.datetime.time(datetime.datetime.now()))
self.log.debug(" - - - ")
......
......@@ -10,3 +10,58 @@ def get_from_environment(variable, default):
logging.warning("Using default variable %s=%s" % (variable, default))
return v
arrow_up = """
_
/ \\
/ \\
/ \\
/ \\
/__ __\\
| | _ _ _
| | | (_) | |
| | _ _ _ __ | |_ _ __ | | __
| | | | | | '_ \| | | '_ \\| |/ /
| | | |_| | |_) | | | | | | <
| | \__,_| .__/|_|_|_| |_|_|\_\\
| | | |
| | |_|
!___!
\\ O /
\\/|\/
|
/ \\
_/ \\ _
"""
arrow_down = """
___
| |
| | _ _ _ _
| | | | | (_) | |
| | __| | _____ ___ __ | |_ _ __ | | __
| | / _` |/ _ \\ \\ /\\ / / '_ \\| | | '_ '\\| |/ /
| | | (_| | (_) \\ V V /| | | | | | | | | <
| | \\__,_|\\___/ \\_/\\_/ |_| |_|_|_|_| |_|_|\_\\
| |
__! !__,
\\ / \O
\\ / \/|
\\ / |
\\ / / \\
Y _/ _\\
"""
finterop_banner = \
"""
______ _____ _
| ____| |_ _| | |
| |__ ______| | _ __ | |_ ___ _ __ ___ _ __
| __|______| | | '_ \\| __/ _ \\ '__/ _ \\| '_ \\
| | _| |_| | | | || __/ | | (_) | |_) |
|_| |_____|_| |_|\\__\\___|_| \\___/| .__/
| |
|_|
"""
\ No newline at end of file
......@@ -7,12 +7,13 @@ import struct
import threading
import time
import traceback
import uuid
from fcntl import ioctl
import sys
from kombu import Exchange
from utils import arrow_down, arrow_up, finterop_banner
DEFAULT_IPV6_PREFIX = 'bbbb'
logging.basicConfig(level=logging.DEBUG)
......@@ -506,7 +507,7 @@ class OpenTunLinux(object):
"timestamp": str(time.time()),
"data": data
}
print(arrow_up)
log.info('\n # # # # # # # # # # # # OPEN TUN # # # # # # # # # # # # ' +
'\n data packet TUN -> EventBus' +
'\n' + json.dumps(msg) +
......@@ -717,7 +718,7 @@ class OpenTunMACOS(object):
"timestamp": str(time.time()),
"data": data
}
print(arrow_up)
log.info('\n # # # # # # # # # # # # OPEN TUN # # # # # # # # # # # # ' +
'\n data packet TUN -> EventBus' +
'\n' + json.dumps(msg) +
......
......@@ -11,6 +11,7 @@ import sys
from kombu import Exchange
from collections import OrderedDict
from utils import arrow_down, arrow_up, finterop_banner
STATE_OK = 0
STATE_ESC = 1
......@@ -24,29 +25,7 @@ logging.basicConfig(level=logging.DEBUG)
log = logging.getLogger(__name__)
arrow_up = """
_
/ \\
/ \\
/ \\
/ \\
/__ __\\
| | _ _ _
| | | (_) | |
| | _ _ _ __ | |_ _ __ | | __
| | | | | | '_ \| | | '_ \\| |/ /
| | | |_| | |_) | | | | | | <
| | \__,_| .__/|_|_|_| |_|_|\_\\
| | | |
| | |_|
!___!
\\ O /
\\/|\/
|
/ \\
_/ \\ _
"""
class SerialListener(object):
......
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