pass over files using isort

This commit is contained in:
bharnden 2019-09-10 14:20:51 -07:00
parent a004285514
commit d5055f85d3
70 changed files with 260 additions and 307 deletions

View file

@ -5,5 +5,5 @@ repos:
name: isort name: isort
stages: [commit] stages: [commit]
language: system language: system
entry: bash -c 'cd daemon && pipenv run isort --atomic' entry: bash -c 'cd daemon && pipenv run isort --atomic -y'
types: [python] types: [python]

View file

@ -10,8 +10,7 @@ from contextlib import contextmanager
import grpc import grpc
from core.api.grpc import core_pb2 from core.api.grpc import core_pb2, core_pb2_grpc
from core.api.grpc import core_pb2_grpc
from core.nodes.ipaddress import Ipv4Prefix, Ipv6Prefix, MacAddress from core.nodes.ipaddress import Ipv4Prefix, Ipv6Prefix, MacAddress

View file

@ -4,17 +4,16 @@ import os
import re import re
import tempfile import tempfile
import time import time
import grpc
from builtins import int from builtins import int
from concurrent import futures from concurrent import futures
from queue import Queue, Empty from queue import Empty, Queue
from core.api.grpc import core_pb2 import grpc
from core.api.grpc import core_pb2_grpc
from core.emulator.data import NodeData, LinkData, EventData, ConfigData, ExceptionData, FileData from core.api.grpc import core_pb2, core_pb2_grpc
from core.emulator.emudata import NodeOptions, InterfaceData, LinkOptions from core.emulator.data import ConfigData, EventData, ExceptionData, FileData, LinkData, NodeData
from core.emulator.enumerations import NodeTypes, EventTypes, LinkTypes from core.emulator.emudata import InterfaceData, LinkOptions, NodeOptions
from core.emulator.enumerations import EventTypes, LinkTypes, NodeTypes
from core.location.mobility import BasicRangeModel, Ns2ScriptedMobility from core.location.mobility import BasicRangeModel, Ns2ScriptedMobility
from core.nodes import nodeutils from core.nodes import nodeutils
from core.nodes.base import CoreNetworkBase from core.nodes.base import CoreNetworkBase

View file

@ -12,23 +12,25 @@ import threading
from core import utils from core import utils
from core.api.tlv import coreapi from core.api.tlv import coreapi
from core.nodes.base import CoreNodeBase, CoreNetworkBase from core.emulator.enumerations import (
from core.emulator.enumerations import ConfigDataTypes ConfigDataTypes,
from core.emulator.enumerations import ConfigFlags ConfigFlags,
from core.emulator.enumerations import ConfigTlvs ConfigTlvs,
from core.emulator.enumerations import EventTlvs EventTlvs,
from core.emulator.enumerations import EventTypes EventTypes,
from core.emulator.enumerations import ExecuteTlvs ExecuteTlvs,
from core.emulator.enumerations import FileTlvs FileTlvs,
from core.emulator.enumerations import LinkTlvs LinkTlvs,
from core.emulator.enumerations import MessageFlags MessageFlags,
from core.emulator.enumerations import MessageTypes MessageTypes,
from core.emulator.enumerations import NodeTlvs NodeTlvs,
from core.emulator.enumerations import NodeTypes NodeTypes,
from core.emulator.enumerations import RegisterTlvs RegisterTlvs,
)
from core.nodes import nodeutils from core.nodes import nodeutils
from core.nodes.ipaddress import IpAddress from core.nodes.base import CoreNetworkBase, CoreNodeBase
from core.nodes.interface import GreTap from core.nodes.interface import GreTap
from core.nodes.ipaddress import IpAddress
from core.nodes.network import GreTapBridge from core.nodes.network import GreTapBridge
from core.nodes.physical import PhysicalNode from core.nodes.physical import PhysicalNode

View file

@ -7,26 +7,27 @@ CORE API messaging is leveraged for communication with the GUI.
import socket import socket
import struct import struct
from past.builtins import basestring
from enum import Enum from enum import Enum
from past.builtins import basestring
from core.api.tlv import structutils from core.api.tlv import structutils
from core.emulator.enumerations import ConfigTlvs from core.emulator.enumerations import (
from core.emulator.enumerations import EventTlvs ConfigTlvs,
from core.emulator.enumerations import EventTypes EventTlvs,
from core.emulator.enumerations import ExceptionTlvs EventTypes,
from core.emulator.enumerations import ExecuteTlvs ExceptionTlvs,
from core.emulator.enumerations import FileTlvs ExecuteTlvs,
from core.emulator.enumerations import InterfaceTlvs FileTlvs,
from core.emulator.enumerations import LinkTlvs InterfaceTlvs,
from core.emulator.enumerations import MessageFlags LinkTlvs,
from core.emulator.enumerations import MessageTypes MessageFlags,
from core.emulator.enumerations import NodeTlvs MessageTypes,
from core.emulator.enumerations import RegisterTlvs NodeTlvs,
from core.emulator.enumerations import SessionTlvs RegisterTlvs,
from core.nodes.ipaddress import IpAddress SessionTlvs,
from core.nodes.ipaddress import MacAddress )
from core.nodes.ipaddress import IpAddress, MacAddress
class CoreTlvData(object): class CoreTlvData(object):

View file

@ -6,44 +6,40 @@ import logging
import os import os
import shlex import shlex
import shutil import shutil
import socketserver
import sys import sys
import threading import threading
import time import time
from itertools import repeat
import socketserver
from builtins import range from builtins import range
from queue import Queue, Empty from itertools import repeat
from queue import Empty, Queue
from core import utils from core import utils
from core.api.tlv import coreapi, dataconversion, structutils from core.api.tlv import coreapi, dataconversion, structutils
from core.config import ConfigShim from core.config import ConfigShim
from core.emulator.data import ConfigData, ExceptionData from core.emulator.data import ConfigData, EventData, ExceptionData, FileData
from core.emulator.data import EventData from core.emulator.emudata import InterfaceData, LinkOptions, NodeOptions
from core.emulator.data import FileData from core.emulator.enumerations import (
from core.emulator.emudata import InterfaceData ConfigDataTypes,
from core.emulator.emudata import LinkOptions ConfigFlags,
from core.emulator.emudata import NodeOptions ConfigTlvs,
from core.emulator.enumerations import ConfigDataTypes EventTlvs,
from core.emulator.enumerations import ConfigFlags EventTypes,
from core.emulator.enumerations import ConfigTlvs ExceptionTlvs,
from core.emulator.enumerations import EventTlvs ExecuteTlvs,
from core.emulator.enumerations import EventTypes FileTlvs,
from core.emulator.enumerations import ExceptionTlvs LinkTlvs,
from core.emulator.enumerations import ExecuteTlvs LinkTypes,
from core.emulator.enumerations import FileTlvs MessageFlags,
from core.emulator.enumerations import LinkTlvs MessageTypes,
from core.emulator.enumerations import LinkTypes NodeTlvs,
from core.emulator.enumerations import MessageFlags NodeTypes,
from core.emulator.enumerations import MessageTypes RegisterTlvs,
from core.emulator.enumerations import NodeTlvs SessionTlvs,
from core.emulator.enumerations import NodeTypes )
from core.emulator.enumerations import RegisterTlvs
from core.emulator.enumerations import SessionTlvs
from core.location.mobility import BasicRangeModel from core.location.mobility import BasicRangeModel
from core.nodes import nodeutils from core.nodes import nodeutils
from core.services.coreservices import ServiceManager from core.services.coreservices import ServiceManager, ServiceShim
from core.services.coreservices import ServiceShim
class CoreHandler(socketserver.BaseRequestHandler): class CoreHandler(socketserver.BaseRequestHandler):

View file

@ -3,8 +3,7 @@ Converts CORE data objects into legacy API messages.
""" """
from core.api.tlv import coreapi, structutils from core.api.tlv import coreapi, structutils
from core.emulator.enumerations import ConfigTlvs from core.emulator.enumerations import ConfigTlvs, NodeTlvs
from core.emulator.enumerations import NodeTlvs
def convert_node(node_data): def convert_node(node_data):

View file

@ -3,6 +3,7 @@ Utilities for working with python struct data.
""" """
import logging import logging
from past.builtins import basestring from past.builtins import basestring

View file

@ -1,8 +1,7 @@
""" """
EMANE Bypass model for CORE EMANE Bypass model for CORE
""" """
from core.config import ConfigGroup from core.config import ConfigGroup, Configuration
from core.config import Configuration
from core.emane import emanemodel from core.emane import emanemodel
from core.emulator.enumerations import ConfigDataTypes from core.emulator.enumerations import ConfigDataTypes

View file

@ -4,12 +4,12 @@ commeffect.py: EMANE CommEffect model for CORE
import logging import logging
import os import os
from lxml import etree from lxml import etree
from past.builtins import basestring from past.builtins import basestring
from core.config import ConfigGroup from core.config import ConfigGroup
from core.emane import emanemanifest from core.emane import emanemanifest, emanemodel
from core.emane import emanemodel
from core.xml import emanexml from core.xml import emanexml
try: try:

View file

@ -7,13 +7,9 @@ import logging
import os import os
import threading import threading
from core import CoreCommandError, utils from core import CoreCommandError, constants, utils
from core import constants
from core.api.tlv import coreapi, dataconversion from core.api.tlv import coreapi, dataconversion
from core.config import ConfigGroup from core.config import ConfigGroup, ConfigShim, Configuration, ModelManager
from core.config import ConfigShim
from core.config import Configuration
from core.config import ModelManager
from core.emane import emanemanifest from core.emane import emanemanifest
from core.emane.bypass import EmaneBypassModel from core.emane.bypass import EmaneBypassModel
from core.emane.commeffect import EmaneCommEffectModel from core.emane.commeffect import EmaneCommEffectModel
@ -21,13 +17,15 @@ from core.emane.emanemodel import EmaneModel
from core.emane.ieee80211abg import EmaneIeee80211abgModel from core.emane.ieee80211abg import EmaneIeee80211abgModel
from core.emane.rfpipe import EmaneRfPipeModel from core.emane.rfpipe import EmaneRfPipeModel
from core.emane.tdma import EmaneTdmaModel from core.emane.tdma import EmaneTdmaModel
from core.emulator.enumerations import ConfigDataTypes from core.emulator.enumerations import (
from core.emulator.enumerations import ConfigFlags ConfigDataTypes,
from core.emulator.enumerations import ConfigTlvs ConfigFlags,
from core.emulator.enumerations import MessageFlags ConfigTlvs,
from core.emulator.enumerations import MessageTypes MessageFlags,
from core.emulator.enumerations import NodeTypes MessageTypes,
from core.emulator.enumerations import RegisterTlvs NodeTypes,
RegisterTlvs,
)
from core.nodes import nodeutils from core.nodes import nodeutils
from core.xml import emanexml from core.xml import emanexml

View file

@ -4,8 +4,7 @@ Defines Emane Models used within CORE.
import logging import logging
import os import os
from core.config import ConfigGroup from core.config import ConfigGroup, Configuration
from core.config import Configuration
from core.emane import emanemanifest from core.emane import emanemanifest
from core.emulator.enumerations import ConfigDataTypes from core.emulator.enumerations import ConfigDataTypes
from core.location.mobility import WirelessModel from core.location.mobility import WirelessModel

View file

@ -6,10 +6,8 @@ share the same MAC+PHY model.
import logging import logging
from core.emulator.enumerations import LinkTypes, NodeTypes, RegisterTlvs
from core.nodes.base import CoreNetworkBase from core.nodes.base import CoreNetworkBase
from core.emulator.enumerations import LinkTypes
from core.emulator.enumerations import NodeTypes
from core.emulator.enumerations import RegisterTlvs
try: try:
from emane.events import LocationEvent from emane.events import LocationEvent

View file

@ -7,8 +7,7 @@ import sys
import core.services import core.services
from core.emulator.emudata import IdGen from core.emulator.emudata import IdGen
from core.emulator.session import Session from core.emulator.session import Session
from core.nodes import nodemaps from core.nodes import nodemaps, nodeutils
from core.nodes import nodeutils
from core.services.coreservices import ServiceManager from core.services.coreservices import ServiceManager

View file

@ -1,10 +1,7 @@
from core.emulator.enumerations import LinkTypes from core.emulator.enumerations import LinkTypes, NodeTypes
from core.emulator.enumerations import NodeTypes
from core.nodes import nodeutils from core.nodes import nodeutils
from core.nodes.base import CoreNetworkBase from core.nodes.base import CoreNetworkBase
from core.nodes.ipaddress import Ipv4Prefix from core.nodes.ipaddress import Ipv4Prefix, Ipv6Prefix, MacAddress
from core.nodes.ipaddress import Ipv6Prefix
from core.nodes.ipaddress import MacAddress
class IdGen(object): class IdGen(object):

View file

@ -15,23 +15,21 @@ import time
from multiprocessing.pool import ThreadPool from multiprocessing.pool import ThreadPool
import core.nodes.base import core.nodes.base
from core import constants from core import constants, utils
from core import utils
from core.api.tlv import coreapi from core.api.tlv import coreapi
from core.api.tlv.broker import CoreBroker from core.api.tlv.broker import CoreBroker
from core.emane.emanemanager import EmaneManager from core.emane.emanemanager import EmaneManager
from core.emulator.data import EventData, NodeData from core.emulator.data import EventData, ExceptionData, NodeData
from core.emulator.data import ExceptionData from core.emulator.emudata import (
from core.emulator.emudata import IdGen IdGen,
from core.emulator.emudata import LinkOptions, NodeOptions LinkOptions,
from core.emulator.emudata import create_interface NodeOptions,
from core.emulator.emudata import is_net_node create_interface,
from core.emulator.emudata import link_config is_net_node,
from core.emulator.enumerations import EventTypes, LinkTypes link_config,
from core.emulator.enumerations import ExceptionLevels )
from core.emulator.enumerations import NodeTypes from core.emulator.enumerations import EventTypes, ExceptionLevels, LinkTypes, NodeTypes
from core.emulator.sessionconfig import SessionConfig from core.emulator.sessionconfig import SessionConfig, SessionMetaData
from core.emulator.sessionconfig import SessionMetaData
from core.location.corelocation import CoreLocation from core.location.corelocation import CoreLocation
from core.location.event import EventLoop from core.location.event import EventLoop
from core.location.mobility import MobilityManager from core.location.mobility import MobilityManager
@ -40,8 +38,7 @@ from core.nodes.base import CoreNodeBase
from core.nodes.ipaddress import MacAddress from core.nodes.ipaddress import MacAddress
from core.plugins.sdt import Sdt from core.plugins.sdt import Sdt
from core.services.coreservices import CoreServices from core.services.coreservices import CoreServices
from core.xml import corexml from core.xml import corexml, corexmldeployment
from core.xml import corexmldeployment
from core.xml.corexml import CoreXmlReader, CoreXmlWriter from core.xml.corexml import CoreXmlReader, CoreXmlWriter

View file

@ -1,8 +1,5 @@
from core.config import ConfigurableManager from core.config import ConfigurableManager, ConfigurableOptions, Configuration
from core.config import ConfigurableOptions from core.emulator.enumerations import ConfigDataTypes, RegisterTlvs
from core.config import Configuration
from core.emulator.enumerations import ConfigDataTypes
from core.emulator.enumerations import RegisterTlvs
from core.plugins.sdt import Sdt from core.plugins.sdt import Sdt

View file

@ -5,6 +5,7 @@ event.py: event loop implementation using a heap queue and threads.
import heapq import heapq
import threading import threading
import time import time
from past.builtins import cmp from past.builtins import cmp

View file

@ -12,19 +12,17 @@ from builtins import int
from functools import total_ordering from functools import total_ordering
from core import utils from core import utils
from core.config import ConfigGroup from core.config import ConfigGroup, ConfigurableOptions, Configuration, ModelManager
from core.config import ConfigurableOptions from core.emulator.data import EventData, LinkData
from core.config import Configuration from core.emulator.enumerations import (
from core.config import ModelManager ConfigDataTypes,
from core.emulator.data import EventData EventTypes,
from core.emulator.data import LinkData LinkTypes,
from core.emulator.enumerations import ConfigDataTypes MessageFlags,
from core.emulator.enumerations import EventTypes MessageTypes,
from core.emulator.enumerations import LinkTypes NodeTlvs,
from core.emulator.enumerations import MessageFlags RegisterTlvs,
from core.emulator.enumerations import MessageTypes )
from core.emulator.enumerations import NodeTlvs
from core.emulator.enumerations import RegisterTlvs
from core.nodes.base import CoreNodeBase from core.nodes.base import CoreNodeBase
from core.nodes.ipaddress import IpAddress from core.nodes.ipaddress import IpAddress

View file

@ -11,17 +11,14 @@ import signal
import socket import socket
import string import string
import threading import threading
from builtins import range
from socket import AF_INET, AF_INET6 from socket import AF_INET, AF_INET6
from builtins import range from core import CoreCommandError, constants, utils
from core.emulator.data import LinkData, NodeData
from core import CoreCommandError, utils from core.emulator.enumerations import LinkTypes, NodeTypes
from core import constants from core.nodes import client, ipaddress, nodeutils
from core.emulator.data import NodeData, LinkData from core.nodes.interface import CoreInterface, TunTap, Veth
from core.emulator.enumerations import NodeTypes, LinkTypes
from core.nodes import client, nodeutils, ipaddress
from core.nodes.interface import TunTap, CoreInterface
from core.nodes.interface import Veth
_DEFAULT_MTU = 1500 _DEFAULT_MTU = 1500

View file

@ -6,11 +6,9 @@ The control channel can be accessed via calls using the vcmd shell.
import logging import logging
import os import os
from subprocess import PIPE, Popen
from subprocess import Popen, PIPE from core import CoreCommandError, constants, utils
from core import CoreCommandError, utils
from core import constants
class VnodeClient(object): class VnodeClient(object):

View file

@ -2,7 +2,7 @@ import json
import logging import logging
import os import os
from core import utils, CoreCommandError from core import CoreCommandError, utils
from core.emulator.enumerations import NodeTypes from core.emulator.enumerations import NodeTypes
from core.nodes.base import CoreNode from core.nodes.base import CoreNode

View file

@ -4,11 +4,9 @@ virtual ethernet classes that implement the interfaces available under Linux.
import logging import logging
import time import time
from builtins import int from builtins import int, range
from builtins import range
from core import CoreCommandError, utils from core import CoreCommandError, constants, utils
from core import constants
from core.emulator.enumerations import NodeTypes from core.emulator.enumerations import NodeTypes
from core.nodes import nodeutils from core.nodes import nodeutils

View file

@ -6,10 +6,8 @@ import logging
import random import random
import socket import socket
import struct import struct
from builtins import bytes from builtins import bytes, range
from builtins import range from socket import AF_INET, AF_INET6
from socket import AF_INET
from socket import AF_INET6
class MacAddress(object): class MacAddress(object):

View file

@ -3,7 +3,7 @@ import logging
import os import os
import time import time
from core import utils, CoreCommandError from core import CoreCommandError, utils
from core.emulator.enumerations import NodeTypes from core.emulator.enumerations import NodeTypes
from core.nodes.base import CoreNode from core.nodes.base import CoreNode

View file

@ -9,14 +9,12 @@ import threading
import time import time
from socket import AF_INET, AF_INET6 from socket import AF_INET, AF_INET6
from core import CoreCommandError, utils from core import CoreCommandError, constants, utils
from core import constants
from core.nodes.base import CoreNetworkBase
from core.emulator.data import LinkData from core.emulator.data import LinkData
from core.emulator.enumerations import NodeTypes, LinkTypes, RegisterTlvs from core.emulator.enumerations import LinkTypes, NodeTypes, RegisterTlvs
from core.nodes import ipaddress from core.nodes import ipaddress
from core.nodes.interface import GreTap from core.nodes.base import CoreNetworkBase
from core.nodes.interface import Veth from core.nodes.interface import GreTap, Veth
utils.check_executables([ utils.check_executables([
constants.BRCTL_BIN, constants.BRCTL_BIN,

View file

@ -6,11 +6,10 @@ import core.nodes.docker
import core.nodes.lxd import core.nodes.lxd
import core.nodes.network import core.nodes.network
import core.nodes.physical import core.nodes.physical
from core.emane.nodes import EmaneNet from core.emane.nodes import EmaneNet, EmaneNode
from core.emane.nodes import EmaneNode
from core.emulator.enumerations import NodeTypes from core.emulator.enumerations import NodeTypes
from core.nodes.network import GreTapBridge
from core.nodes import physical from core.nodes import physical
from core.nodes.network import GreTapBridge
# legacy core nodes, that leverage linux bridges # legacy core nodes, that leverage linux bridges
NODES = { NODES = {

View file

@ -5,21 +5,15 @@ TODO: probably goes away, or implement the usage of "unshare", or docker formal.
import logging import logging
import socket import socket
import threading import threading
from socket import AF_INET from socket import AF_INET, AF_INET6
from socket import AF_INET6
from core import CoreCommandError, utils from core import CoreCommandError, constants, utils
from core import constants
from core.nodes.base import CoreNetworkBase
from core.emulator.data import LinkData from core.emulator.data import LinkData
from core.emulator.enumerations import LinkTypes from core.emulator.enumerations import LinkTypes, NodeTypes, RegisterTlvs
from core.emulator.enumerations import NodeTypes
from core.emulator.enumerations import RegisterTlvs
from core.nodes import ipaddress from core.nodes import ipaddress
from core.nodes.interface import GreTap from core.nodes.base import CoreNetworkBase
from core.nodes.interface import Veth from core.nodes.interface import GreTap, Veth
from core.nodes.network import EbtablesQueue from core.nodes.network import EbtablesQueue, GreTapBridge
from core.nodes.network import GreTapBridge
# a global object because all WLANs share the same queue # a global object because all WLANs share the same queue
# cannot have multiple threads invoking the ebtables commnd # cannot have multiple threads invoking the ebtables commnd

View file

@ -7,13 +7,11 @@ import os
import subprocess import subprocess
import threading import threading
from core import CoreCommandError, utils from core import CoreCommandError, constants, utils
from core import constants from core.emulator.enumerations import NodeTypes
from core.nodes.base import CoreNodeBase from core.nodes.base import CoreNodeBase
from core.nodes.interface import CoreInterface from core.nodes.interface import CoreInterface
from core.emulator.enumerations import NodeTypes from core.nodes.network import CoreNetwork, GreTap
from core.nodes.network import GreTap
from core.nodes.network import CoreNetwork
class PhysicalNode(CoreNodeBase): class PhysicalNode(CoreNodeBase):

View file

@ -4,18 +4,21 @@ sdt.py: Scripted Display Tool (SDT3D) helper
import logging import logging
import socket import socket
from future.moves.urllib.parse import urlparse from future.moves.urllib.parse import urlparse
from core import constants from core import constants
from core.emulator.enumerations import EventTypes from core.emulator.enumerations import (
from core.emulator.enumerations import LinkTlvs EventTypes,
from core.emulator.enumerations import LinkTypes LinkTlvs,
from core.emulator.enumerations import MessageFlags LinkTypes,
from core.emulator.enumerations import MessageTypes MessageFlags,
from core.emulator.enumerations import NodeTlvs MessageTypes,
from core.emulator.enumerations import NodeTypes NodeTlvs,
NodeTypes,
)
from core.nodes import nodeutils from core.nodes import nodeutils
from core.nodes.base import NodeBase, CoreNetworkBase from core.nodes.base import CoreNetworkBase, NodeBase
# TODO: A named tuple may be more appropriate, than abusing a class dict like this # TODO: A named tuple may be more appropriate, than abusing a class dict like this

View file

@ -15,8 +15,7 @@ from multiprocessing.pool import ThreadPool
from core import CoreCommandError, utils from core import CoreCommandError, utils
from core.constants import which from core.constants import which
from core.emulator.data import FileData from core.emulator.data import FileData
from core.emulator.enumerations import MessageFlags from core.emulator.enumerations import MessageFlags, RegisterTlvs
from core.emulator.enumerations import RegisterTlvs
class ServiceBootError(Exception): class ServiceBootError(Exception):

View file

@ -99,8 +99,7 @@ Limitations:
import logging import logging
from core.services.coreservices import CoreService from core.services.coreservices import CoreService, ServiceManager
from core.services.coreservices import ServiceManager
try: try:
from docker import Client from docker import Client

View file

@ -5,7 +5,7 @@ Assumes installation of FRR via https://deb.frrouting.org/
from core import constants from core import constants
from core.emulator.enumerations import LinkTypes, NodeTypes from core.emulator.enumerations import LinkTypes, NodeTypes
from core.nodes import nodeutils, ipaddress from core.nodes import ipaddress, nodeutils
from core.services.coreservices import CoreService from core.services.coreservices import CoreService

View file

@ -4,7 +4,7 @@ quagga.py: defines routing services provided by Quagga.
from core import constants from core import constants
from core.emulator.enumerations import LinkTypes, NodeTypes from core.emulator.enumerations import LinkTypes, NodeTypes
from core.nodes import nodeutils, ipaddress from core.nodes import ipaddress, nodeutils
from core.services.coreservices import CoreService from core.services.coreservices import CoreService

View file

@ -159,4 +159,3 @@ class Nat(CoreService):
cfg += cls.generateifcnatrule(ifc) cfg += cls.generateifcnatrule(ifc)
cfg += "\n" cfg += "\n"
return cfg return cfg

View file

@ -4,10 +4,8 @@ utility.py: defines miscellaneous utility services.
import os import os
from core import CoreCommandError, utils from core import CoreCommandError, constants, utils
from core import constants from core.nodes.ipaddress import Ipv4Prefix, Ipv6Prefix
from core.nodes.ipaddress import Ipv4Prefix
from core.nodes.ipaddress import Ipv6Prefix
from core.services.coreservices import CoreService from core.services.coreservices import CoreService

View file

@ -11,6 +11,7 @@ import os
import shlex import shlex
import subprocess import subprocess
import sys import sys
from past.builtins import basestring from past.builtins import basestring
from core import CoreCommandError from core import CoreCommandError

View file

@ -1,14 +1,13 @@
import logging import logging
from core.nodes.base import CoreNetworkBase
from lxml import etree from lxml import etree
import core.nodes.base import core.nodes.base
import core.nodes.physical import core.nodes.physical
from core.emulator.emudata import InterfaceData from core.emulator.emudata import InterfaceData, LinkOptions, NodeOptions
from core.emulator.emudata import LinkOptions
from core.emulator.emudata import NodeOptions
from core.emulator.enumerations import NodeTypes from core.emulator.enumerations import NodeTypes
from core.nodes import nodeutils from core.nodes import nodeutils
from core.nodes.base import CoreNetworkBase
from core.nodes.ipaddress import MacAddress from core.nodes.ipaddress import MacAddress

View file

@ -4,9 +4,9 @@ import socket
from lxml import etree from lxml import etree
from core import constants, utils from core import constants, utils
from core.nodes.base import CoreNodeBase
from core.emulator.enumerations import NodeTypes from core.emulator.enumerations import NodeTypes
from core.nodes import nodeutils, ipaddress from core.nodes import ipaddress, nodeutils
from core.nodes.base import CoreNodeBase
def add_type(parent_element, name): def add_type(parent_element, name):

View file

@ -3,9 +3,9 @@
# Example CORE Python script that attaches N nodes to an EMANE 802.11abg network. # Example CORE Python script that attaches N nodes to an EMANE 802.11abg network.
import datetime import datetime
import parser
from builtins import range from builtins import range
import parser
from core import load_logging_config from core import load_logging_config
from core.emane.ieee80211abg import EmaneIeee80211abgModel from core.emane.ieee80211abg import EmaneIeee80211abgModel
from core.emulator.coreemu import CoreEmu from core.emulator.coreemu import CoreEmu

View file

@ -6,13 +6,13 @@
# nodestep # nodestep
import datetime import datetime
import parser
from builtins import range from builtins import range
import parser
from core import load_logging_config from core import load_logging_config
from core.emulator.coreemu import CoreEmu from core.emulator.coreemu import CoreEmu
from core.emulator.emudata import IpPrefixes from core.emulator.emudata import IpPrefixes
from core.emulator.enumerations import NodeTypes, EventTypes from core.emulator.enumerations import EventTypes, NodeTypes
load_logging_config() load_logging_config()

View file

@ -8,7 +8,7 @@ from builtins import range
from core import load_logging_config from core import load_logging_config
from core.emulator.emudata import IpPrefixes from core.emulator.emudata import IpPrefixes
from core.emulator.enumerations import NodeTypes, EventTypes from core.emulator.enumerations import EventTypes, NodeTypes
load_logging_config() load_logging_config()

View file

@ -6,13 +6,13 @@
# nodestep # nodestep
import datetime import datetime
import parser
from builtins import range from builtins import range
import parser
from core import load_logging_config from core import load_logging_config
from core.emulator.coreemu import CoreEmu from core.emulator.coreemu import CoreEmu
from core.emulator.emudata import IpPrefixes, NodeOptions from core.emulator.emudata import IpPrefixes, NodeOptions
from core.emulator.enumerations import NodeTypes, EventTypes from core.emulator.enumerations import EventTypes, NodeTypes
from core.location.mobility import BasicRangeModel from core.location.mobility import BasicRangeModel
load_logging_config() load_logging_config()

View file

@ -2,8 +2,7 @@ import logging
from core.emulator.coreemu import CoreEmu from core.emulator.coreemu import CoreEmu
from core.emulator.emudata import IpPrefixes, NodeOptions from core.emulator.emudata import IpPrefixes, NodeOptions
from core.emulator.enumerations import NodeTypes, EventTypes from core.emulator.enumerations import EventTypes, NodeTypes
if __name__ == "__main__": if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG) logging.basicConfig(level=logging.DEBUG)

View file

@ -2,8 +2,7 @@ import logging
from core.emulator.coreemu import CoreEmu from core.emulator.coreemu import CoreEmu
from core.emulator.emudata import IpPrefixes, NodeOptions from core.emulator.emudata import IpPrefixes, NodeOptions
from core.emulator.enumerations import NodeTypes, EventTypes from core.emulator.enumerations import EventTypes, NodeTypes
if __name__ == "__main__": if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG) logging.basicConfig(level=logging.DEBUG)

View file

@ -2,8 +2,7 @@ import logging
from core.emulator.coreemu import CoreEmu from core.emulator.coreemu import CoreEmu
from core.emulator.emudata import IpPrefixes, NodeOptions from core.emulator.emudata import IpPrefixes, NodeOptions
from core.emulator.enumerations import NodeTypes, EventTypes from core.emulator.enumerations import EventTypes, NodeTypes
if __name__ == "__main__": if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG) logging.basicConfig(level=logging.DEBUG)

View file

@ -2,8 +2,7 @@ import logging
from core.emulator.coreemu import CoreEmu from core.emulator.coreemu import CoreEmu
from core.emulator.emudata import IpPrefixes, NodeOptions from core.emulator.emudata import IpPrefixes, NodeOptions
from core.emulator.enumerations import NodeTypes, EventTypes from core.emulator.enumerations import EventTypes, NodeTypes
if __name__ == "__main__": if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG) logging.basicConfig(level=logging.DEBUG)

View file

@ -2,8 +2,7 @@ import logging
from core.emulator.coreemu import CoreEmu from core.emulator.coreemu import CoreEmu
from core.emulator.emudata import IpPrefixes, NodeOptions from core.emulator.emudata import IpPrefixes, NodeOptions
from core.emulator.enumerations import NodeTypes, EventTypes from core.emulator.enumerations import EventTypes, NodeTypes
if __name__ == "__main__": if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG) logging.basicConfig(level=logging.DEBUG)

View file

@ -2,8 +2,7 @@ import logging
from core.emulator.coreemu import CoreEmu from core.emulator.coreemu import CoreEmu
from core.emulator.emudata import IpPrefixes, NodeOptions from core.emulator.emudata import IpPrefixes, NodeOptions
from core.emulator.enumerations import NodeTypes, EventTypes from core.emulator.enumerations import EventTypes, NodeTypes
if __name__ == "__main__": if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG) logging.basicConfig(level=logging.DEBUG)

View file

@ -2,8 +2,7 @@
Example custom emane model. Example custom emane model.
""" """
from core.emane import emanemanifest from core.emane import emanemanifest, emanemodel
from core.emane import emanemodel
class ExampleModel(emanemodel.EmaneModel): class ExampleModel(emanemodel.EmaneModel):

View file

@ -2,8 +2,7 @@
Simple example for a user-defined service. Simple example for a user-defined service.
""" """
from core.services.coreservices import CoreService from core.services.coreservices import CoreService, ServiceMode
from core.services.coreservices import ServiceMode
class MyService(CoreService): class MyService(CoreService):

View file

@ -19,14 +19,16 @@ import core.nodes.base
import core.nodes.network import core.nodes.network
from core.api.tlv import coreapi, dataconversion from core.api.tlv import coreapi, dataconversion
from core.api.tlv.coreapi import CoreExecuteTlv from core.api.tlv.coreapi import CoreExecuteTlv
from core.emulator.enumerations import CORE_API_PORT from core.emulator.enumerations import (
from core.emulator.enumerations import EventTlvs CORE_API_PORT,
from core.emulator.enumerations import EventTypes EventTlvs,
from core.emulator.enumerations import ExecuteTlvs EventTypes,
from core.emulator.enumerations import LinkTlvs ExecuteTlvs,
from core.emulator.enumerations import LinkTypes LinkTlvs,
from core.emulator.enumerations import MessageFlags LinkTypes,
from core.emulator.enumerations import MessageTypes MessageFlags,
MessageTypes,
)
from core.emulator.session import Session from core.emulator.session import Session
from core.nodes import ipaddress from core.nodes import ipaddress

View file

@ -18,7 +18,14 @@ import core.nodes.base
import core.nodes.network import core.nodes.network
from core import constants from core import constants
from core.api.tlv import coreapi, dataconversion from core.api.tlv import coreapi, dataconversion
from core.emulator.enumerations import CORE_API_PORT, EventTypes, EventTlvs, LinkTlvs, LinkTypes, MessageFlags from core.emulator.enumerations import (
CORE_API_PORT,
EventTlvs,
EventTypes,
LinkTlvs,
LinkTypes,
MessageFlags,
)
from core.emulator.session import Session from core.emulator.session import Session
from core.nodes import ipaddress from core.nodes import ipaddress

View file

@ -22,8 +22,8 @@ import time
import core.nodes.base import core.nodes.base
import core.nodes.network import core.nodes.network
from core import constants from core import constants
from core.nodes import ipaddress
from core.emulator.session import Session from core.emulator.session import Session
from core.nodes import ipaddress
GBD = 1024.0 * 1024.0 GBD = 1024.0 * 1024.0

View file

@ -47,14 +47,11 @@ from core.emulator.session import Session
from core.nodes import ipaddress from core.nodes import ipaddress
try: try:
import emaneeventservice from emane.events import EventService
import emaneeventpathloss from emane.events import PathlossEvent
except Exception as e: except ImportError:
try: from emanesh.events import EventService
from emanesh.events import EventService from emanesh.events import PathlossEvent
from emanesh.events import PathlossEvent
except Exception as e2:
raise ImportError("failed to import EMANE Python bindings:\n%s\n%s" % (e, e2))
# global Experiment object (for interaction with "python -i") # global Experiment object (for interaction with "python -i")
exp = None exp = None

View file

@ -9,7 +9,7 @@ import optparse
import socket import socket
from core.api.tlv import coreapi from core.api.tlv import coreapi
from core.emulator.enumerations import MessageFlags, SessionTlvs, CORE_API_PORT from core.emulator.enumerations import CORE_API_PORT, MessageFlags, SessionTlvs
def main(): def main():

View file

@ -10,16 +10,12 @@ import logging
import sys import sys
import threading import threading
import time import time
from configparser import ConfigParser from configparser import ConfigParser
from core import constants from core import constants, load_logging_config
from core import load_logging_config
from core.api.grpc.server import CoreGrpcServer from core.api.grpc.server import CoreGrpcServer
from core.api.tlv.corehandlers import CoreHandler from core.api.tlv.corehandlers import CoreHandler, CoreUdpHandler
from core.api.tlv.corehandlers import CoreUdpHandler from core.api.tlv.coreserver import CoreServer, CoreUdpServer
from core.api.tlv.coreserver import CoreServer
from core.api.tlv.coreserver import CoreUdpServer
from core.emulator import enumerations from core.emulator import enumerations
from core.utils import close_onexec from core.utils import close_onexec

View file

@ -9,10 +9,7 @@ import socket
import sys import sys
from core.api.tlv import coreapi from core.api.tlv import coreapi
from core.emulator.enumerations import CORE_API_PORT from core.emulator.enumerations import CORE_API_PORT, MessageFlags, MessageTypes, SessionTlvs
from core.emulator.enumerations import MessageFlags
from core.emulator.enumerations import MessageTypes
from core.emulator.enumerations import SessionTlvs
def print_available_tlvs(t, tlv_class): def print_available_tlvs(t, tlv_class):

View file

@ -2,6 +2,7 @@
test=pytest test=pytest
[isort] [isort]
skip_glob=*_pb2*.py
multi_line_output=3 multi_line_output=3
include_trailing_comma=True include_trailing_comma=True
force_grid_wrap=0 force_grid_wrap=0

View file

@ -7,8 +7,6 @@ import threading
import time import time
import pytest import pytest
from mock.mock import MagicMock
from core.api.grpc.client import InterfaceHelper from core.api.grpc.client import InterfaceHelper
from core.api.grpc.server import CoreGrpcServer from core.api.grpc.server import CoreGrpcServer
from core.api.tlv.coreapi import CoreConfMessage, CoreEventMessage from core.api.tlv.coreapi import CoreConfMessage, CoreEventMessage
@ -16,11 +14,10 @@ from core.api.tlv.corehandlers import CoreHandler
from core.api.tlv.coreserver import CoreServer from core.api.tlv.coreserver import CoreServer
from core.emulator.coreemu import CoreEmu from core.emulator.coreemu import CoreEmu
from core.emulator.emudata import IpPrefixes from core.emulator.emudata import IpPrefixes
from core.emulator.enumerations import CORE_API_PORT, EventTlvs from core.emulator.enumerations import CORE_API_PORT, ConfigTlvs, EventTlvs, EventTypes
from core.emulator.enumerations import ConfigTlvs
from core.emulator.enumerations import EventTypes
from core.nodes import ipaddress from core.nodes import ipaddress
from core.services.coreservices import ServiceManager from core.services.coreservices import ServiceManager
from mock.mock import MagicMock
EMANE_SERVICES = "zebra|OSPFv3MDR|IPForward" EMANE_SERVICES = "zebra|OSPFv3MDR|IPForward"

View file

@ -1,14 +1,27 @@
""" """
Unit tests for testing CORE with distributed networks. Unit tests for testing CORE with distributed networks.
""" """
from core.api.tlv.coreapi import (
CoreConfMessage,
CoreEventMessage,
CoreExecMessage,
CoreLinkMessage,
CoreNodeMessage,
)
from core.emane.ieee80211abg import EmaneIeee80211abgModel from core.emane.ieee80211abg import EmaneIeee80211abgModel
from core.emulator.enumerations import (
from core.api.tlv.coreapi import CoreExecMessage, CoreNodeMessage, CoreLinkMessage, CoreEventMessage, CoreConfMessage ConfigFlags,
from core.emulator.enumerations import EventTypes, NodeTlvs, LinkTlvs, LinkTypes, EventTlvs, ConfigTlvs, ConfigFlags ConfigTlvs,
from core.emulator.enumerations import ExecuteTlvs EventTlvs,
from core.emulator.enumerations import MessageFlags EventTypes,
from core.emulator.enumerations import NodeTypes ExecuteTlvs,
from core.nodes.ipaddress import IpAddress, MacAddress, Ipv4Prefix LinkTlvs,
LinkTypes,
MessageFlags,
NodeTlvs,
NodeTypes,
)
from core.nodes.ipaddress import IpAddress, Ipv4Prefix, MacAddress
def set_emane_model(node_id, model): def set_emane_model(node_id, model):

View file

@ -1,12 +1,7 @@
import pytest import pytest
from core.config import ConfigurableManager, ConfigurableOptions, Configuration, ModelManager
from core.config import ConfigurableManager
from core.config import ConfigurableOptions
from core.config import Configuration
from core.config import ModelManager
from core.emane.ieee80211abg import EmaneIeee80211abgModel from core.emane.ieee80211abg import EmaneIeee80211abgModel
from core.emulator.enumerations import ConfigDataTypes from core.emulator.enumerations import ConfigDataTypes, NodeTypes
from core.emulator.enumerations import NodeTypes
from core.location.mobility import BasicRangeModel from core.location.mobility import BasicRangeModel

View file

@ -8,12 +8,9 @@ import subprocess
import threading import threading
import pytest import pytest
from core.emulator.emudata import NodeOptions from core.emulator.emudata import NodeOptions
from core.emulator.enumerations import MessageFlags from core.emulator.enumerations import MessageFlags, NodeTypes
from core.emulator.enumerations import NodeTypes from core.location.mobility import BasicRangeModel, Ns2ScriptedMobility
from core.location.mobility import BasicRangeModel
from core.location.mobility import Ns2ScriptedMobility
from core.nodes.client import VnodeClient from core.nodes.client import VnodeClient
_PATH = os.path.abspath(os.path.dirname(__file__)) _PATH = os.path.abspath(os.path.dirname(__file__))

View file

@ -4,7 +4,6 @@ Unit tests for testing CORE EMANE networks.
import os import os
import pytest import pytest
from conftest import ping from conftest import ping
from core.emane.bypass import EmaneBypassModel from core.emane.bypass import EmaneBypassModel
from core.emane.commeffect import EmaneCommEffectModel from core.emane.commeffect import EmaneCommEffectModel

View file

@ -1,17 +1,17 @@
import time import time
import grpc
import pytest
from builtins import int from builtins import int
from queue import Queue from queue import Queue
import grpc
import pytest
from core.api.grpc import core_pb2 from core.api.grpc import core_pb2
from core.api.grpc.client import CoreGrpcClient from core.api.grpc.client import CoreGrpcClient
from core.config import ConfigShim from core.config import ConfigShim
from core.emane.ieee80211abg import EmaneIeee80211abgModel from core.emane.ieee80211abg import EmaneIeee80211abgModel
from core.emulator.data import EventData from core.emulator.data import EventData
from core.emulator.emudata import NodeOptions from core.emulator.emudata import NodeOptions
from core.emulator.enumerations import NodeTypes, EventTypes, ConfigFlags, ExceptionLevels from core.emulator.enumerations import ConfigFlags, EventTypes, ExceptionLevels, NodeTypes
from core.location.mobility import BasicRangeModel, Ns2ScriptedMobility from core.location.mobility import BasicRangeModel, Ns2ScriptedMobility

View file

@ -6,15 +6,22 @@ import time
import mock import mock
import pytest import pytest
from core.api.tlv import coreapi from core.api.tlv import coreapi
from core.emane.ieee80211abg import EmaneIeee80211abgModel from core.emane.ieee80211abg import EmaneIeee80211abgModel
from core.emulator.enumerations import EventTlvs, SessionTlvs, EventTypes, FileTlvs, RegisterTlvs, ConfigTlvs, \ from core.emulator.enumerations import (
ConfigFlags ConfigFlags,
from core.emulator.enumerations import ExecuteTlvs ConfigTlvs,
from core.emulator.enumerations import LinkTlvs EventTlvs,
from core.emulator.enumerations import MessageFlags EventTypes,
from core.emulator.enumerations import NodeTypes, NodeTlvs ExecuteTlvs,
FileTlvs,
LinkTlvs,
MessageFlags,
NodeTlvs,
NodeTypes,
RegisterTlvs,
SessionTlvs,
)
from core.location.mobility import BasicRangeModel from core.location.mobility import BasicRangeModel
from core.nodes.ipaddress import Ipv4Prefix from core.nodes.ipaddress import Ipv4Prefix

View file

@ -1,6 +1,6 @@
from core import utils
from core.emulator.emudata import LinkOptions from core.emulator.emudata import LinkOptions
from core.emulator.enumerations import NodeTypes from core.emulator.enumerations import NodeTypes
from core import utils
def create_ptp_network(session, ip_prefixes): def create_ptp_network(session, ip_prefixes):

View file

@ -2,10 +2,9 @@ import os
import time import time
import pytest import pytest
from core import utils
from core.emulator.emudata import NodeOptions from core.emulator.emudata import NodeOptions
from core.emulator.enumerations import NodeTypes from core.emulator.enumerations import NodeTypes
from core import utils
MODELS = [ MODELS = [
"router", "router",

View file

@ -1,10 +1,7 @@
import os import os
import pytest import pytest
from core.services.coreservices import CoreService, ServiceDependencies, ServiceManager
from core.services.coreservices import CoreService
from core.services.coreservices import ServiceDependencies
from core.services.coreservices import ServiceManager
_PATH = os.path.abspath(os.path.dirname(__file__)) _PATH = os.path.abspath(os.path.dirname(__file__))
_SERVICES_PATH = os.path.join(_PATH, "myservices") _SERVICES_PATH = os.path.join(_PATH, "myservices")

View file

@ -1,9 +1,8 @@
from xml.etree import ElementTree from xml.etree import ElementTree
import pytest import pytest
from core.emane.ieee80211abg import EmaneIeee80211abgModel from core.emane.ieee80211abg import EmaneIeee80211abgModel
from core.emulator.emudata import NodeOptions, LinkOptions from core.emulator.emudata import LinkOptions, NodeOptions
from core.emulator.enumerations import NodeTypes from core.emulator.enumerations import NodeTypes
from core.location.mobility import BasicRangeModel from core.location.mobility import BasicRangeModel
from core.services.utility import SshService from core.services.utility import SshService