removed daemon addons directory and refereces

This commit is contained in:
Blake J. Harnden 2018-01-12 09:50:56 -08:00
parent 5344d62a7a
commit 17d5503fb2
9 changed files with 4 additions and 101 deletions

View file

@ -4,6 +4,7 @@
- moved ns3 and netns directories to the top of the repo - moved ns3 and netns directories to the top of the repo
- changes to make use of fpm as the tool for building packages - changes to make use of fpm as the tool for building packages
- removed usage of logzero to avoid dependency issues for built packages - removed usage of logzero to avoid dependency issues for built packages
- removed daemon addons directory
* TEST: * TEST:
- fixed some broken tests - fixed some broken tests
* BUGFIXES: * BUGFIXES:

View file

@ -122,7 +122,7 @@ dist-hook:
rm -rf `find $(distdir)/ -name .svn` `find $(distdir)/ -name '*.pyc'` rm -rf `find $(distdir)/ -name .svn` `find $(distdir)/ -name '*.pyc'`
DISTCLEANFILES = Makefile.in core/*.pyc MANIFEST doc/Makefile.in doc/Makefile \ DISTCLEANFILES = Makefile.in core/*.pyc MANIFEST doc/Makefile.in doc/Makefile \
doc/conf.py core/addons/*.pyc doc/conf.py
# files to include with distribution tarball # files to include with distribution tarball
EXTRA_DIST = $(SETUPPY) MANIFEST.in core doc $(LOGROTATE_FILE) EXTRA_DIST = $(SETUPPY) MANIFEST.in core doc $(LOGROTATE_FILE)

View file

@ -1,6 +0,0 @@
"""
Optional add ons can be put in this directory. Everything listed in __all__ is automatically
loaded by the main core module.
"""
__all__ = []

View file

@ -1137,10 +1137,9 @@ class CoreRequestHandler(SocketServer.BaseRequestHandler):
if execute_server: if execute_server:
try: try:
logger.info("executing: %s", execute_server) logger.info("executing: %s", execute_server)
# TODO: remove this, unless we want to support udp/aux at any level
if not isinstance(self.server, CoreServer): # CoreUdpServer): if not isinstance(self.server, CoreServer): # CoreUdpServer):
server = self.server.mainserver server = self.server.mainserver
# elif isinstance(self.server, CoreAuxServer):
# server = self.server.mainserver
else: else:
server = self.server server = self.server
if message.flags & MessageFlags.STRING.value: if message.flags & MessageFlags.STRING.value:

View file

@ -38,8 +38,6 @@ class CoreServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
self.sessions = {} self.sessions = {}
self.udpserver = None self.udpserver = None
self.udpthread = None self.udpthread = None
self.auxserver = None
self.auxthread = None
self._sessions_lock = threading.Lock() self._sessions_lock = threading.Lock()
CoreServer.add_server(self) CoreServer.add_server(self)
SocketServer.TCPServer.__init__(self, server_address, handler_class) SocketServer.TCPServer.__init__(self, server_address, handler_class)
@ -317,59 +315,3 @@ class CoreUdpServer(SocketServer.ThreadingMixIn, SocketServer.UDPServer):
:return: nothing :return: nothing
""" """
self.serve_forever() self.serve_forever()
class CoreAuxServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
"""
An auxiliary TCP server.
"""
daemon_threads = True
allow_reuse_address = True
def __init__(self, server_address, handler_class, main_server):
"""
Create a CoreAuxServer instance.
:param tuple[str, int] server_address: server address
:param class handler_class: class for handling requests
:param main_server: main server to associate with
"""
self.mainserver = main_server
logger.info("auxiliary server started, listening on: %s", server_address)
SocketServer.TCPServer.__init__(self, server_address, handler_class)
def start(self):
"""
Start the core auxiliary server.
:return: nothing
"""
self.serve_forever()
def set_session_master(self, handler):
"""
Set the session master handler.
:param func handler: session master handler
:return:
"""
return self.mainserver.set_session_master(handler)
def get_session(self, session_id=None):
"""
Retrieve a session.
:param int session_id: id of session to retrieve
:return: core.session.Session
"""
return self.mainserver.get_session(session_id)
def to_session_message(self, flags=0):
"""
Retrieve a session message.
:param flags: message flags
:return: session message
"""
return self.mainserver.to_session_message(flags)

View file

@ -162,7 +162,7 @@ class CoreServices(ConfigurableManager):
config_type = RegisterTlvs.UTILITY.value config_type = RegisterTlvs.UTILITY.value
_invalid_custom_names = ( _invalid_custom_names = (
'core', 'addons', 'api', 'bsd', 'emane', 'misc', 'netns', 'phys', 'services', 'xen' 'core', 'api', 'bsd', 'emane', 'misc', 'netns', 'phys', 'services', 'xen'
) )
def __init__(self, session): def __init__(self, session):

View file

@ -61,5 +61,3 @@ emane_models = RfPipe, Ieee80211abg, CommEffect, Bypass, Tdma
# EMANE log level range [0,4] default: 2 # EMANE log level range [0,4] default: 2
#emane_log_level = 2 #emane_log_level = 2
emane_realtime = True emane_realtime = True
#aux_request_handler = core.addons.api2handler.CoreApi2RequestHandler:12222

View file

@ -59,28 +59,6 @@ def startudp(core_server, server_address):
return core_server.udpserver return core_server.udpserver
def startaux(core_server, aux_address, aux_handler):
"""
Start a thread running an auxiliary TCP server on the given address.
This server will communicate with client requests using a handler
using the aux_handler class. The aux_handler can provide an alternative
API to CORE.
:param core.coreserver.CoreServer core_server: core server instance
:param tuple[str, int] aux_address: auxiliary server address
:param str aux_handler: auxiliary handler string to import
:return: auxiliary server
"""
handlermodname, dot, handlerclassname = aux_handler.rpartition(".")
handlermod = importlib.import_module(handlermodname)
handlerclass = getattr(handlermod, handlerclassname)
core_server.auxserver = coreserver.CoreAuxServer(aux_address, handlerclass, core_server)
core_server.auxthread = threading.Thread(target=core_server.auxserver.start)
core_server.auxthread.daemon = True
core_server.auxthread.start()
return core_server.auxserver
def banner(): def banner():
""" """
Output the program banner printed to the terminal or log file. Output the program banner printed to the terminal or log file.
@ -113,12 +91,6 @@ def cored(cfg=None):
udpserver = startudp(server, (host, port)) udpserver = startudp(server, (host, port))
closeonexec(udpserver.fileno()) closeonexec(udpserver.fileno())
auxreqhandler = cfg["aux_request_handler"]
if auxreqhandler:
handler, auxport = auxreqhandler.rsplit(":")
auxserver = startaux(server, (host, int(auxport)), handler)
closeonexec(auxserver.fileno())
server.serve_forever() server.serve_forever()
@ -212,7 +184,6 @@ def get_merged_config(filename):
"daemonize": "False", "daemonize": "False",
"debug": "False", "debug": "False",
"execfile": None, "execfile": None,
"aux_request_handler": None,
} }
usagestr = "usage: %prog [-h] [options] [args]\n\n" + \ usagestr = "usage: %prog [-h] [options] [args]\n\n" + \

View file

@ -321,8 +321,6 @@ fi
%{python_sitelib}/core/sdt.py* %{python_sitelib}/core/sdt.py*
%{python_sitelib}/core/service.py* %{python_sitelib}/core/service.py*
%{python_sitelib}/core/coreserver.py* %{python_sitelib}/core/coreserver.py*
%dir %{python_sitelib}/core/addons
%{python_sitelib}/core/addons/__init__.py*
%dir %{python_sitelib}/core/api %dir %{python_sitelib}/core/api
%{python_sitelib}/core/api/coreapi.py* %{python_sitelib}/core/api/coreapi.py*
%{python_sitelib}/core/api/data.py* %{python_sitelib}/core/api/data.py*