switched to making use of logzero for logging, provides nicer color output, and an easier path to switch to rotating log files
This commit is contained in:
parent
76bec9950d
commit
e4b280196b
53 changed files with 57 additions and 202 deletions
|
@ -1,17 +1,9 @@
|
|||
# Copyright (c)2010-2012 the Boeing Company.
|
||||
# See the LICENSE file included in this distribution.
|
||||
import logzero
|
||||
|
||||
"""
|
||||
core
|
||||
# configure custom format with function name
|
||||
_format_template = "%(color)s[%(levelname)1.1s %(asctime)s %(module)s:%(funcName)s:" \
|
||||
"%(lineno)d]%(end_color)s %(message)s"
|
||||
_formatter = logzero.LogFormatter(fmt=_format_template)
|
||||
logzero.formatter(_formatter)
|
||||
|
||||
Top-level Python package containing CORE components.
|
||||
|
||||
See http://www.nrl.navy.mil/itd/ncs/products/core for more information on CORE.
|
||||
|
||||
Pieces can be imported individually, for example
|
||||
|
||||
from core.netns import vnode
|
||||
"""
|
||||
|
||||
# Automatically import all add-ons listed in addons.__all__
|
||||
from addons import *
|
||||
logger = logzero.logger
|
||||
|
|
|
@ -10,6 +10,7 @@ import struct
|
|||
|
||||
from enum import Enum
|
||||
|
||||
from core import logger
|
||||
from core.enumerations import ConfigTlvs
|
||||
from core.enumerations import EventTlvs
|
||||
from core.enumerations import EventTypes
|
||||
|
@ -27,8 +28,6 @@ from core.misc import log, structutils
|
|||
from core.misc.ipaddress import IpAddress
|
||||
from core.misc.ipaddress import MacAddress
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
|
||||
class CoreTlvData(object):
|
||||
"""
|
||||
|
|
|
@ -2,13 +2,11 @@
|
|||
Converts CORE data objects into legacy API messages.
|
||||
"""
|
||||
|
||||
from core import logger
|
||||
from core.api import coreapi
|
||||
from core.enumerations import NodeTlvs
|
||||
from core.misc import log
|
||||
from core.misc import structutils
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
|
||||
def convert_node(node_data):
|
||||
"""
|
||||
|
|
|
@ -9,6 +9,7 @@ import select
|
|||
import socket
|
||||
import threading
|
||||
|
||||
from core import logger
|
||||
from core.api import coreapi
|
||||
from core.conf import ConfigurableManager
|
||||
from core.coreobj import PyCoreNet
|
||||
|
@ -26,15 +27,12 @@ from core.enumerations import MessageTypes
|
|||
from core.enumerations import NodeTlvs
|
||||
from core.enumerations import NodeTypes
|
||||
from core.enumerations import RegisterTlvs
|
||||
from core.misc import log
|
||||
from core.misc import nodeutils
|
||||
from core.misc.ipaddress import IpAddress
|
||||
from core.netns.vif import GreTap
|
||||
from core.netns.vnet import GreTapBridge
|
||||
from core.phys.pnodes import PhysicalNode
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
|
||||
# TODO: name conflict with main core server, probably should rename
|
||||
class CoreServer(object):
|
||||
|
|
|
@ -15,6 +15,7 @@ import socket
|
|||
import subprocess
|
||||
|
||||
from core import constants
|
||||
from core import logger
|
||||
from core.api import coreapi
|
||||
from core.bsd.netgraph import connectngnodes
|
||||
from core.bsd.netgraph import ngloadkernelmodule
|
||||
|
@ -26,11 +27,8 @@ from core.enumerations import LinkTypes
|
|||
from core.enumerations import NodeTypes
|
||||
from core.enumerations import RegisterTlvs
|
||||
from core.misc import ipaddress
|
||||
from core.misc import log
|
||||
from core.misc import utils
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
utils.check_executables([constants.IFCONFIG_BIN])
|
||||
|
||||
|
||||
|
|
|
@ -11,14 +11,12 @@ vnet.py: NetgraphNet and NetgraphPipeNet classes that implement virtual networks
|
|||
using the FreeBSD Netgraph subsystem.
|
||||
"""
|
||||
|
||||
from core import logger
|
||||
from core.bsd.netgraph import connectngnodes
|
||||
from core.bsd.netgraph import createngnode
|
||||
from core.bsd.netgraph import destroyngnode
|
||||
from core.bsd.netgraph import ngmessage
|
||||
from core.coreobj import PyCoreNet
|
||||
from core.misc import log
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
|
||||
class NetgraphNet(PyCoreNet):
|
||||
|
|
|
@ -16,15 +16,13 @@ import subprocess
|
|||
import threading
|
||||
|
||||
from core import constants
|
||||
from core import logger
|
||||
from core.bsd.netgraph import createngnode
|
||||
from core.bsd.netgraph import destroyngnode
|
||||
from core.coreobj import PyCoreNetIf
|
||||
from core.coreobj import PyCoreNode
|
||||
from core.misc import log
|
||||
from core.misc import utils
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
utils.check_executables([constants.IFCONFIG_BIN, constants.VIMAGE_BIN])
|
||||
|
||||
|
||||
|
|
|
@ -4,12 +4,10 @@ Common support for configurable CORE objects.
|
|||
|
||||
import string
|
||||
|
||||
from core import logger
|
||||
from core.data import ConfigData
|
||||
from core.enumerations import ConfigDataTypes
|
||||
from core.enumerations import ConfigFlags
|
||||
from core.misc import log
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
|
||||
class ConfigurableManager(object):
|
||||
|
|
|
@ -12,6 +12,7 @@ import threading
|
|||
import time
|
||||
|
||||
from core import coreobj
|
||||
from core import logger
|
||||
from core.api import coreapi
|
||||
from core.coreserver import CoreServer
|
||||
from core.data import ConfigData
|
||||
|
@ -31,7 +32,6 @@ from core.enumerations import NodeTlvs
|
|||
from core.enumerations import NodeTypes
|
||||
from core.enumerations import RegisterTlvs
|
||||
from core.enumerations import SessionTlvs
|
||||
from core.misc import log
|
||||
from core.misc import nodeutils
|
||||
from core.misc import structutils
|
||||
from core.misc import utils
|
||||
|
@ -39,8 +39,6 @@ from core.netns import nodes
|
|||
from core.xml.xmlsession import open_session_xml
|
||||
from core.xml.xmlsession import save_session_xml
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
|
||||
class CoreRequestHandler(SocketServer.BaseRequestHandler):
|
||||
"""
|
||||
|
|
|
@ -10,9 +10,7 @@ import threading
|
|||
from socket import AF_INET
|
||||
from socket import AF_INET6
|
||||
|
||||
from core.api import coreapi
|
||||
from core.data import NodeData, LinkData
|
||||
from core.enumerations import LinkTlvs
|
||||
from core.enumerations import LinkTypes
|
||||
from core.misc import ipaddress
|
||||
|
||||
|
|
|
@ -8,14 +8,12 @@ import os
|
|||
import threading
|
||||
import time
|
||||
|
||||
from core import logger
|
||||
from core.api import coreapi
|
||||
from core.enumerations import EventTypes
|
||||
from core.enumerations import SessionTlvs
|
||||
from core.misc import log
|
||||
from core.session import Session
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
|
||||
class CoreServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
|
||||
"""
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
import subprocess
|
||||
|
||||
from core.misc import log
|
||||
from core import logger
|
||||
from core.misc import utils
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
EMANEUNK = 0
|
||||
EMANE074 = 7
|
||||
EMANE081 = 8
|
||||
|
|
|
@ -3,11 +3,9 @@ commeffect.py: EMANE CommEffect model for CORE
|
|||
"""
|
||||
|
||||
from core import emane
|
||||
from core import logger
|
||||
from core.emane.emanemodel import EmaneModel
|
||||
from core.enumerations import ConfigDataTypes
|
||||
from core.misc import log
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
try:
|
||||
import emaneeventservice
|
||||
|
|
|
@ -9,6 +9,7 @@ from xml.dom.minidom import parseString
|
|||
|
||||
from core import constants
|
||||
from core import emane
|
||||
from core import logger
|
||||
from core.api import coreapi
|
||||
from core.conf import ConfigurableManager
|
||||
from core.emane.bypass import EmaneBypassModel
|
||||
|
@ -23,14 +24,11 @@ from core.enumerations import ConfigTlvs
|
|||
from core.enumerations import MessageFlags
|
||||
from core.enumerations import MessageTypes
|
||||
from core.enumerations import RegisterTlvs
|
||||
from core.misc import log
|
||||
from core.misc import nodeutils
|
||||
from core.misc import utils
|
||||
from core.misc.ipaddress import MacAddress
|
||||
from core.xml import xmlutils
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
# EMANE 0.7.4/0.8.1
|
||||
try:
|
||||
import emaneeventservice
|
||||
|
|
|
@ -3,13 +3,11 @@ Defines Emane Models used within CORE.
|
|||
"""
|
||||
|
||||
from core import emane
|
||||
from core.misc import log
|
||||
from core import logger
|
||||
from core.misc import utils
|
||||
from core.mobility import WirelessModel
|
||||
from core.xml import xmlutils
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
|
||||
class EmaneModel(WirelessModel):
|
||||
"""
|
||||
|
|
|
@ -6,9 +6,6 @@ from core import emane
|
|||
from core.emane.emanemodel import EmaneModel
|
||||
from core.emane.universal import EmaneUniversalModel
|
||||
from core.enumerations import ConfigDataTypes
|
||||
from core.misc import log
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
|
||||
class EmaneIeee80211abgModel(EmaneModel):
|
||||
|
|
|
@ -7,13 +7,11 @@ share the same MAC+PHY model.
|
|||
from os import path
|
||||
|
||||
from core import emane
|
||||
from core import logger
|
||||
from core.coreobj import PyCoreNet
|
||||
from core.enumerations import LinkTypes
|
||||
from core.enumerations import NodeTypes
|
||||
from core.enumerations import RegisterTlvs
|
||||
from core.misc import log
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
try:
|
||||
from emanesh.events import LocationEvent
|
||||
|
|
|
@ -6,9 +6,6 @@ from core import emane
|
|||
from core.emane.emanemodel import EmaneModel
|
||||
from core.emane.universal import EmaneUniversalModel
|
||||
from core.enumerations import ConfigDataTypes
|
||||
from core.misc import log
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
|
||||
class EmaneRfPipeModel(EmaneModel):
|
||||
|
|
|
@ -6,9 +6,6 @@ from core import emane
|
|||
from core.emane.emanemodel import EmaneModel
|
||||
from core.emane.universal import EmaneUniversalModel
|
||||
from core.enumerations import ConfigDataTypes
|
||||
from core.misc import log
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
|
||||
class EmaneTdmaModel(EmaneModel):
|
||||
|
|
|
@ -6,9 +6,6 @@ used for the Universal PHY.
|
|||
from core import emane
|
||||
from core.emane.emanemodel import EmaneModel
|
||||
from core.enumerations import ConfigDataTypes
|
||||
from core.misc import log
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
|
||||
class EmaneUniversalModel(EmaneModel):
|
||||
|
|
|
@ -5,13 +5,11 @@ systems. Depends on utm contributed module, from
|
|||
https://pypi.python.org/pypi/utm (version 0.3.0).
|
||||
"""
|
||||
|
||||
from core import logger
|
||||
from core.conf import ConfigurableManager
|
||||
from core.enumerations import RegisterTlvs
|
||||
from core.misc import log
|
||||
from core.misc import utm
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
|
||||
class CoreLocation(ConfigurableManager):
|
||||
"""
|
||||
|
|
|
@ -6,9 +6,7 @@ import heapq
|
|||
import threading
|
||||
import time
|
||||
|
||||
from core.misc import log
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
from core import logger
|
||||
|
||||
|
||||
class Timer(threading.Thread):
|
||||
|
|
|
@ -8,9 +8,7 @@ import struct
|
|||
from socket import AF_INET
|
||||
from socket import AF_INET6
|
||||
|
||||
from core.misc import log
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
from core import logger
|
||||
|
||||
|
||||
class MacAddress(object):
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
"""
|
||||
Convenience methods to setup logging.
|
||||
"""
|
||||
|
||||
import logging
|
||||
|
||||
_LOG_LEVEL = logging.INFO
|
||||
_LOG_FORMAT = "%(levelname)-7s %(asctime)s %(name)-15s %(funcName)-15s %(lineno)-4d: %(message)s"
|
||||
_INITIAL = True
|
||||
|
||||
|
||||
def setup(level=_LOG_LEVEL, log_format=_LOG_FORMAT):
|
||||
"""
|
||||
Configure a logging with a basic configuration, output to console.
|
||||
|
||||
:param logging.LEVEL level: level for logger, defaults to module defined format
|
||||
:param int log_format: format for logger, default to DEBUG
|
||||
:return: nothing
|
||||
"""
|
||||
logging.basicConfig(level=level, format=log_format)
|
||||
|
||||
|
||||
def get_logger(name):
|
||||
"""
|
||||
Retrieve a logger for logging.
|
||||
|
||||
:param str name: name for logger to retrieve
|
||||
:return: logging.logger
|
||||
"""
|
||||
global _INITIAL
|
||||
if _INITIAL:
|
||||
setup()
|
||||
_INITIAL = False
|
||||
|
||||
return logging.getLogger(name)
|
|
@ -4,9 +4,7 @@ Serves as a global point for storing and retrieving node types needed during sim
|
|||
|
||||
import pprint
|
||||
|
||||
from core.misc import log
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
from core import logger
|
||||
|
||||
_NODE_MAP = None
|
||||
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
Utilities for working with python struct data.
|
||||
"""
|
||||
|
||||
from core.misc import log
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
from core import logger
|
||||
|
||||
|
||||
def pack_values(clazz, packers):
|
||||
|
|
|
@ -8,9 +8,7 @@ import subprocess
|
|||
import fcntl
|
||||
import resource
|
||||
|
||||
from core.misc import log
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
from core import logger
|
||||
|
||||
|
||||
def closeonexec(fd):
|
||||
|
|
|
@ -9,6 +9,7 @@ import subprocess
|
|||
import threading
|
||||
import time
|
||||
|
||||
from core import logger
|
||||
from core.conf import Configurable
|
||||
from core.conf import ConfigurableManager
|
||||
from core.coreobj import PyCoreNode
|
||||
|
@ -20,11 +21,8 @@ from core.enumerations import MessageFlags
|
|||
from core.enumerations import MessageTypes
|
||||
from core.enumerations import NodeTlvs
|
||||
from core.enumerations import RegisterTlvs
|
||||
from core.misc import log
|
||||
from core.misc.ipaddress import IpAddress
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
|
||||
class MobilityManager(ConfigurableManager):
|
||||
"""
|
||||
|
|
|
@ -10,6 +10,7 @@ from socket import AF_INET
|
|||
from socket import AF_INET6
|
||||
|
||||
from core import constants
|
||||
from core import logger
|
||||
from core.coreobj import PyCoreNetIf
|
||||
from core.coreobj import PyCoreNode
|
||||
from core.coreobj import PyCoreObj
|
||||
|
@ -18,14 +19,11 @@ from core.enumerations import LinkTypes
|
|||
from core.enumerations import NodeTypes
|
||||
from core.enumerations import RegisterTlvs
|
||||
from core.misc import ipaddress
|
||||
from core.misc import log
|
||||
from core.misc import utils
|
||||
from core.netns.vnet import GreTapBridge
|
||||
from core.netns.vnet import LxBrNet
|
||||
from core.netns.vnode import LxcNode
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
|
||||
class CtrlNet(LxBrNet):
|
||||
"""
|
||||
|
|
|
@ -9,21 +9,19 @@ from socket import AF_INET
|
|||
from socket import AF_INET6
|
||||
|
||||
from core import constants
|
||||
from core import logger
|
||||
from core.coreobj import PyCoreNet
|
||||
from core.data import LinkData
|
||||
from core.enumerations import LinkTypes
|
||||
from core.enumerations import NodeTypes
|
||||
from core.enumerations import RegisterTlvs
|
||||
from core.misc import ipaddress
|
||||
from core.misc import log
|
||||
from core.misc import utils
|
||||
from core.netns.vif import GreTap
|
||||
from core.netns.vif import VEth
|
||||
from core.netns.vnet import EbtablesQueue
|
||||
from core.netns.vnet import GreTapBridge
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
# a global object because all WLANs share the same queue
|
||||
# cannot have multiple threads invoking the ebtables commnd
|
||||
ebtables_queue = EbtablesQueue()
|
||||
|
|
|
@ -6,14 +6,12 @@ import subprocess
|
|||
import time
|
||||
|
||||
from core import constants
|
||||
from core import logger
|
||||
from core.coreobj import PyCoreNetIf
|
||||
from core.enumerations import NodeTypes
|
||||
from core.misc import log
|
||||
from core.misc import nodeutils
|
||||
from core.misc import utils
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
utils.check_executables([constants.IP_BIN])
|
||||
|
||||
|
||||
|
|
|
@ -9,14 +9,12 @@ import threading
|
|||
import time
|
||||
|
||||
from core import constants
|
||||
from core import logger
|
||||
from core.coreobj import PyCoreNet
|
||||
from core.misc import log
|
||||
from core.misc import utils
|
||||
from core.netns.vif import GreTap
|
||||
from core.netns.vif import VEth
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
utils.check_executables([
|
||||
constants.BRCTL_BIN,
|
||||
constants.IP_BIN,
|
||||
|
|
|
@ -11,18 +11,16 @@ import subprocess
|
|||
import threading
|
||||
|
||||
from core import constants
|
||||
from core import logger
|
||||
from core.coreobj import PyCoreNetIf
|
||||
from core.coreobj import PyCoreNode
|
||||
from core.enumerations import NodeTypes
|
||||
from core.misc import log
|
||||
from core.misc import nodeutils
|
||||
from core.misc import utils
|
||||
from core.netns import vnodeclient
|
||||
from core.netns.vif import TunTap
|
||||
from core.netns.vif import VEth
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
utils.check_executables([constants.IP_BIN])
|
||||
|
||||
|
||||
|
|
|
@ -10,9 +10,7 @@ import stat
|
|||
import subprocess
|
||||
|
||||
from core import constants
|
||||
from core.misc import log
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
from core import logger
|
||||
|
||||
USE_VCMD_MODULE = True
|
||||
|
||||
|
|
|
@ -7,14 +7,12 @@ import subprocess
|
|||
import threading
|
||||
|
||||
from core import constants
|
||||
from core import logger
|
||||
from core.coreobj import PyCoreNode
|
||||
from core.misc import log
|
||||
from core.misc import utils
|
||||
from core.netns.vnet import GreTap
|
||||
from core.netns.vnet import LxBrNet
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
|
||||
class PhysicalNode(PyCoreNode):
|
||||
def __init__(self, session, objid=None, name=None, nodedir=None, start=True):
|
||||
|
|
|
@ -6,6 +6,7 @@ import socket
|
|||
from urlparse import urlparse
|
||||
|
||||
from core import constants
|
||||
from core import logger
|
||||
from core.api import coreapi
|
||||
from core.coreobj import PyCoreNet
|
||||
from core.coreobj import PyCoreObj
|
||||
|
@ -16,11 +17,8 @@ from core.enumerations import MessageFlags
|
|||
from core.enumerations import MessageTypes
|
||||
from core.enumerations import NodeTlvs
|
||||
from core.enumerations import NodeTypes
|
||||
from core.misc import log
|
||||
from core.misc import nodeutils
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
|
||||
# TODO: A named tuple may be more appropriate, than abusing a class dict like this
|
||||
class Bunch(object):
|
||||
|
|
|
@ -15,6 +15,7 @@ import sys
|
|||
import time
|
||||
from itertools import repeat
|
||||
|
||||
from core import logger
|
||||
from core.conf import Configurable
|
||||
from core.conf import ConfigurableManager
|
||||
from core.data import ConfigData
|
||||
|
@ -25,11 +26,8 @@ from core.enumerations import ConfigFlags
|
|||
from core.enumerations import EventTypes
|
||||
from core.enumerations import MessageFlags
|
||||
from core.enumerations import RegisterTlvs
|
||||
from core.misc import log
|
||||
from core.misc import utils
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
|
||||
def _valid_module(path, file_name):
|
||||
"""
|
||||
|
@ -120,28 +118,28 @@ class ServiceManager(object):
|
|||
:return: list of core services
|
||||
:rtype: list
|
||||
"""
|
||||
# validate path exists for importing
|
||||
logger.info("getting custom services from: %s", path)
|
||||
parent_path = os.path.dirname(path)
|
||||
if parent_path not in sys.path:
|
||||
logger.info("adding parent path to allow imports: %s", parent_path)
|
||||
sys.path.append(parent_path)
|
||||
|
||||
# retrieve potential service modules, and filter out invalid modules
|
||||
base_module = os.path.basename(path)
|
||||
module_names = os.listdir(path)
|
||||
module_names = filter(lambda x: _valid_module(path, x), module_names)
|
||||
module_names = map(lambda x: x[:-3], module_names)
|
||||
|
||||
# custom_services = []
|
||||
# import and add all service modules in the path
|
||||
for module_name in module_names:
|
||||
import_statement = "%s.%s" % (base_module, module_name)
|
||||
logger.info("importing custom service module: %s", import_statement)
|
||||
module = importlib.import_module(import_statement)
|
||||
members = inspect.getmembers(module, lambda x: _is_service(module, x))
|
||||
for member in members:
|
||||
# custom_services.append(member[1])
|
||||
cls.add(member[1])
|
||||
|
||||
# return custom_services
|
||||
|
||||
|
||||
class CoreServices(ConfigurableManager):
|
||||
"""
|
||||
|
|
|
@ -6,11 +6,8 @@ __all__ is automatically loaded by the main core module.
|
|||
"""
|
||||
import os
|
||||
|
||||
from core.misc import log
|
||||
from core.service import ServiceManager
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
_PATH = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
|
||||
|
|
|
@ -97,12 +97,10 @@ Limitations:
|
|||
depending on how many nodes you have.
|
||||
"""
|
||||
|
||||
from core.misc import log
|
||||
from core import logger
|
||||
from core.service import CoreService
|
||||
from core.service import ServiceManager
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
try:
|
||||
from docker import Client
|
||||
except ImportError:
|
||||
|
|
|
@ -4,12 +4,10 @@ firewall)
|
|||
"""
|
||||
|
||||
from core import constants
|
||||
from core.misc import log
|
||||
from core import logger
|
||||
from core.service import CoreService
|
||||
from core.service import ServiceManager
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
|
||||
class VPNClient(CoreService):
|
||||
_name = "VPNClient"
|
||||
|
|
|
@ -2,12 +2,10 @@
|
|||
xorp.py: defines routing services provided by the XORP routing suite.
|
||||
"""
|
||||
|
||||
from core.misc import log
|
||||
from core import logger
|
||||
from core.service import CoreService
|
||||
from core.service import ServiceManager
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
|
||||
class XorpRtrmgr(CoreService):
|
||||
"""
|
||||
|
|
|
@ -17,6 +17,7 @@ import time
|
|||
import pwd
|
||||
|
||||
from core import constants
|
||||
from core import logger
|
||||
from core.api import coreapi
|
||||
from core.broker import CoreBroker
|
||||
from core.conf import Configurable
|
||||
|
@ -36,7 +37,6 @@ from core.enumerations import MessageTypes
|
|||
from core.enumerations import NodeTypes
|
||||
from core.enumerations import RegisterTlvs
|
||||
from core.location import CoreLocation
|
||||
from core.misc import log
|
||||
from core.misc import nodeutils
|
||||
from core.misc import utils
|
||||
from core.misc.event import EventLoop
|
||||
|
@ -50,8 +50,6 @@ from core.service import CoreServices
|
|||
from core.xen.xenconfig import XenConfigManager
|
||||
from core.xml.xmlsession import save_session_xml
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
|
||||
class SessionManager(object):
|
||||
"""
|
||||
|
|
|
@ -14,16 +14,14 @@ import threading
|
|||
import crypt
|
||||
|
||||
from core import constants
|
||||
from core import logger
|
||||
from core.coreobj import PyCoreNetIf
|
||||
from core.coreobj import PyCoreNode
|
||||
from core.enumerations import NodeTypes
|
||||
from core.misc import log
|
||||
from core.misc import nodeutils
|
||||
from core.misc import utils
|
||||
from core.netns.vnode import LxcNode
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
try:
|
||||
import parted
|
||||
except ImportError:
|
||||
|
|
|
@ -17,6 +17,7 @@ import os
|
|||
import string
|
||||
|
||||
from core import constants
|
||||
from core import logger
|
||||
from core.api import coreapi
|
||||
from core.conf import Configurable
|
||||
from core.conf import ConfigurableManager
|
||||
|
@ -24,9 +25,6 @@ from core.enumerations import ConfigDataTypes
|
|||
from core.enumerations import ConfigFlags
|
||||
from core.enumerations import ConfigTlvs
|
||||
from core.enumerations import RegisterTlvs
|
||||
from core.misc import log
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
|
||||
class XenConfigManager(ConfigurableManager):
|
||||
|
|
|
@ -4,6 +4,7 @@ import subprocess
|
|||
|
||||
from core import constants
|
||||
from core import emane
|
||||
from core import logger
|
||||
from core.enumerations import NodeTypes
|
||||
from core.misc import ipaddress
|
||||
from core.misc import log
|
||||
|
@ -11,8 +12,6 @@ from core.misc import nodeutils
|
|||
from core.netns import nodes
|
||||
from core.xml import xmlutils
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
|
||||
class CoreDeploymentWriter(object):
|
||||
def __init__(self, dom, root, session):
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
from xml.dom.minidom import parse
|
||||
|
||||
from core import logger
|
||||
from core.enumerations import NodeTypes
|
||||
from core.misc import log
|
||||
from core.misc import nodeutils
|
||||
from core.service import ServiceManager
|
||||
from core.xml import xmlutils
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
|
||||
class CoreDocumentParser0(object):
|
||||
def __init__(self, session, filename, options):
|
||||
|
|
|
@ -3,15 +3,13 @@ from xml.dom.minidom import Node
|
|||
from xml.dom.minidom import parse
|
||||
|
||||
from core import constants
|
||||
from core import logger
|
||||
from core.enumerations import NodeTypes
|
||||
from core.misc import log
|
||||
from core.misc import nodeutils
|
||||
from core.misc.ipaddress import MacAddress
|
||||
from core.service import ServiceManager
|
||||
from core.xml import xmlutils
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
|
||||
class CoreDocumentParser1(object):
|
||||
layer2_device_types = 'hub', 'switch'
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
from xml.dom.minidom import Node
|
||||
|
||||
from core.misc import log
|
||||
from core import logger
|
||||
from core.netns import nodes
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
|
||||
def add_elements_from_list(dom, parent, iterable, name, attr_name):
|
||||
"""
|
||||
|
|
|
@ -3,14 +3,12 @@ from xml.dom.minidom import Document
|
|||
|
||||
import pwd
|
||||
|
||||
from core import logger
|
||||
from core.coreobj import PyCoreNet
|
||||
from core.coreobj import PyCoreNode
|
||||
from core.enumerations import RegisterTlvs
|
||||
from core.misc import log
|
||||
from core.xml import xmlutils
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
|
||||
class CoreDocumentWriter0(Document):
|
||||
"""
|
||||
|
|
|
@ -5,18 +5,16 @@ from xml.dom.minidom import Document
|
|||
import pwd
|
||||
|
||||
from core import coreobj
|
||||
from core import logger
|
||||
from core.enumerations import EventTypes
|
||||
from core.enumerations import NodeTypes
|
||||
from core.enumerations import RegisterTlvs
|
||||
from core.misc import ipaddress
|
||||
from core.misc import log
|
||||
from core.misc import nodeutils
|
||||
from core.netns import nodes
|
||||
from core.xml import xmlutils
|
||||
from core.xml.xmldeployment import CoreDeploymentWriter
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
|
||||
class Alias:
|
||||
ID = "COREID"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
enum34==1.1.6
|
||||
logzero==1.3.0
|
||||
grpcio==1.0.0
|
||||
grpcio-tools==1.0.0
|
||||
mock==1.3.0
|
||||
|
|
|
@ -17,7 +17,6 @@ message handlers are defined and some support for sending messages.
|
|||
import ConfigParser
|
||||
import atexit
|
||||
import importlib
|
||||
import logging
|
||||
import optparse
|
||||
import os
|
||||
import signal
|
||||
|
@ -30,19 +29,17 @@ from core import constants
|
|||
from core import corehandlers
|
||||
from core import coreserver
|
||||
from core import enumerations
|
||||
from core import logger
|
||||
from core import services
|
||||
from core.api import coreapi
|
||||
from core.corehandlers import CoreDatagramRequestHandler
|
||||
from core.enumerations import MessageFlags
|
||||
from core.enumerations import RegisterTlvs
|
||||
from core.misc import log
|
||||
from core.misc import nodemaps
|
||||
from core.misc import nodeutils
|
||||
from core.misc.utils import closeonexec
|
||||
from core.misc.utils import daemonize
|
||||
|
||||
logger = log.get_logger(__name__)
|
||||
|
||||
DEFAULT_MAXFD = 1024
|
||||
|
||||
|
||||
|
@ -337,8 +334,6 @@ def main():
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
log.setup(level=logging.INFO)
|
||||
|
||||
# configure nodes to use
|
||||
node_map = nodemaps.CLASSIC_NODES
|
||||
if len(sys.argv) == 2 and sys.argv[1] == "ovs":
|
||||
|
|
|
@ -26,6 +26,7 @@ setup(name="core-python",
|
|||
],
|
||||
install_requires=[
|
||||
"enum34"
|
||||
"logzero"
|
||||
],
|
||||
setup_requires=[
|
||||
"pytest-runner"
|
||||
|
|
Loading…
Reference in a new issue