updated all classes to be created without using (object), in python3 all classes are new style classes
This commit is contained in:
parent
39c40d2a8c
commit
6a0a9e7698
24 changed files with 48 additions and 48 deletions
|
@ -14,7 +14,7 @@ from core.api.grpc import core_pb2, core_pb2_grpc
|
||||||
from core.nodes.ipaddress import Ipv4Prefix, Ipv6Prefix, MacAddress
|
from core.nodes.ipaddress import Ipv4Prefix, Ipv6Prefix, MacAddress
|
||||||
|
|
||||||
|
|
||||||
class InterfaceHelper(object):
|
class InterfaceHelper:
|
||||||
"""
|
"""
|
||||||
Convenience class to help generate IP4 and IP6 addresses for gRPC clients.
|
Convenience class to help generate IP4 and IP6 addresses for gRPC clients.
|
||||||
"""
|
"""
|
||||||
|
@ -133,7 +133,7 @@ def start_streamer(stream, handler):
|
||||||
thread.start()
|
thread.start()
|
||||||
|
|
||||||
|
|
||||||
class CoreGrpcClient(object):
|
class CoreGrpcClient:
|
||||||
"""
|
"""
|
||||||
Provides convenience methods for interfacing with the CORE grpc server.
|
Provides convenience methods for interfacing with the CORE grpc server.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -27,7 +27,7 @@ from core.emulator.enumerations import (
|
||||||
from core.nodes.ipaddress import IpAddress, MacAddress
|
from core.nodes.ipaddress import IpAddress, MacAddress
|
||||||
|
|
||||||
|
|
||||||
class CoreTlvData(object):
|
class CoreTlvData:
|
||||||
"""
|
"""
|
||||||
Helper base class used for packing and unpacking values using struct.
|
Helper base class used for packing and unpacking values using struct.
|
||||||
"""
|
"""
|
||||||
|
@ -348,7 +348,7 @@ class CoreTlvDataMacAddr(CoreTlvDataObj):
|
||||||
return MacAddress(address=value[2:])
|
return MacAddress(address=value[2:])
|
||||||
|
|
||||||
|
|
||||||
class CoreTlv(object):
|
class CoreTlv:
|
||||||
"""
|
"""
|
||||||
Base class for representing CORE TLVs.
|
Base class for representing CORE TLVs.
|
||||||
"""
|
"""
|
||||||
|
@ -670,7 +670,7 @@ class CoreExceptionTlv(CoreTlv):
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class CoreMessage(object):
|
class CoreMessage:
|
||||||
"""
|
"""
|
||||||
Base class for representing CORE messages.
|
Base class for representing CORE messages.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -8,7 +8,7 @@ from collections import OrderedDict
|
||||||
from core.emulator.data import ConfigData
|
from core.emulator.data import ConfigData
|
||||||
|
|
||||||
|
|
||||||
class ConfigShim(object):
|
class ConfigShim:
|
||||||
"""
|
"""
|
||||||
Provides helper methods for converting newer configuration values into TLV compatible formats.
|
Provides helper methods for converting newer configuration values into TLV compatible formats.
|
||||||
"""
|
"""
|
||||||
|
@ -102,7 +102,7 @@ class ConfigShim(object):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class Configuration(object):
|
class Configuration:
|
||||||
"""
|
"""
|
||||||
Represents a configuration options.
|
Represents a configuration options.
|
||||||
"""
|
"""
|
||||||
|
@ -131,7 +131,7 @@ class Configuration(object):
|
||||||
return f"{self.__class__.__name__}(id={self.id}, type={self.type}, default={self.default}, options={self.options})"
|
return f"{self.__class__.__name__}(id={self.id}, type={self.type}, default={self.default}, options={self.options})"
|
||||||
|
|
||||||
|
|
||||||
class ConfigurableManager(object):
|
class ConfigurableManager:
|
||||||
"""
|
"""
|
||||||
Provides convenience methods for storing and retrieving configuration options for nodes.
|
Provides convenience methods for storing and retrieving configuration options for nodes.
|
||||||
"""
|
"""
|
||||||
|
@ -240,7 +240,7 @@ class ConfigurableManager(object):
|
||||||
return self.node_configurations.get(node_id)
|
return self.node_configurations.get(node_id)
|
||||||
|
|
||||||
|
|
||||||
class ConfigGroup(object):
|
class ConfigGroup:
|
||||||
"""
|
"""
|
||||||
Defines configuration group tabs used for display by ConfigurationOptions.
|
Defines configuration group tabs used for display by ConfigurationOptions.
|
||||||
"""
|
"""
|
||||||
|
@ -258,7 +258,7 @@ class ConfigGroup(object):
|
||||||
self.stop = stop
|
self.stop = stop
|
||||||
|
|
||||||
|
|
||||||
class ConfigurableOptions(object):
|
class ConfigurableOptions:
|
||||||
"""
|
"""
|
||||||
Provides a base for defining configuration options within CORE.
|
Provides a base for defining configuration options within CORE.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -29,7 +29,7 @@ signal.signal(signal.SIGUSR1, signal_handler)
|
||||||
signal.signal(signal.SIGUSR2, signal_handler)
|
signal.signal(signal.SIGUSR2, signal_handler)
|
||||||
|
|
||||||
|
|
||||||
class CoreEmu(object):
|
class CoreEmu:
|
||||||
"""
|
"""
|
||||||
Provides logic for creating and configuring CORE sessions and the nodes within them.
|
Provides logic for creating and configuring CORE sessions and the nodes within them.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -21,7 +21,7 @@ LOCK = threading.Lock()
|
||||||
CMD_HIDE = True
|
CMD_HIDE = True
|
||||||
|
|
||||||
|
|
||||||
class DistributedServer(object):
|
class DistributedServer:
|
||||||
"""
|
"""
|
||||||
Provides distributed server interactions.
|
Provides distributed server interactions.
|
||||||
"""
|
"""
|
||||||
|
@ -101,7 +101,7 @@ class DistributedServer(object):
|
||||||
os.unlink(temp.name)
|
os.unlink(temp.name)
|
||||||
|
|
||||||
|
|
||||||
class DistributedController(object):
|
class DistributedController:
|
||||||
"""
|
"""
|
||||||
Provides logic for dealing with remote tunnels and distributed servers.
|
Provides logic for dealing with remote tunnels and distributed servers.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -4,7 +4,7 @@ from core.nodes.ipaddress import Ipv4Prefix, Ipv6Prefix, MacAddress
|
||||||
from core.nodes.physical import PhysicalNode
|
from core.nodes.physical import PhysicalNode
|
||||||
|
|
||||||
|
|
||||||
class IdGen(object):
|
class IdGen:
|
||||||
def __init__(self, _id=0):
|
def __init__(self, _id=0):
|
||||||
self.id = _id
|
self.id = _id
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ def link_config(network, interface, link_options, devname=None, interface_two=No
|
||||||
network.linkconfig(**config)
|
network.linkconfig(**config)
|
||||||
|
|
||||||
|
|
||||||
class NodeOptions(object):
|
class NodeOptions:
|
||||||
"""
|
"""
|
||||||
Options for creating and updating nodes within core.
|
Options for creating and updating nodes within core.
|
||||||
"""
|
"""
|
||||||
|
@ -115,7 +115,7 @@ class NodeOptions(object):
|
||||||
self.alt = alt
|
self.alt = alt
|
||||||
|
|
||||||
|
|
||||||
class LinkOptions(object):
|
class LinkOptions:
|
||||||
"""
|
"""
|
||||||
Options for creating and updating links within core.
|
Options for creating and updating links within core.
|
||||||
"""
|
"""
|
||||||
|
@ -145,7 +145,7 @@ class LinkOptions(object):
|
||||||
self.opaque = None
|
self.opaque = None
|
||||||
|
|
||||||
|
|
||||||
class IpPrefixes(object):
|
class IpPrefixes:
|
||||||
"""
|
"""
|
||||||
Convenience class to help generate IP4 and IP6 addresses for nodes within CORE.
|
Convenience class to help generate IP4 and IP6 addresses for nodes within CORE.
|
||||||
"""
|
"""
|
||||||
|
@ -236,7 +236,7 @@ class IpPrefixes(object):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class InterfaceData(object):
|
class InterfaceData:
|
||||||
"""
|
"""
|
||||||
Convenience class for storing interface data.
|
Convenience class for storing interface data.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -71,7 +71,7 @@ NODES_TYPE = {NODES[x]: x for x in NODES}
|
||||||
CTRL_NET_ID = 9001
|
CTRL_NET_ID = 9001
|
||||||
|
|
||||||
|
|
||||||
class Session(object):
|
class Session:
|
||||||
"""
|
"""
|
||||||
CORE session manager.
|
CORE session manager.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -11,7 +11,7 @@ from core.emulator.enumerations import RegisterTlvs
|
||||||
from core.location import utm
|
from core.location import utm
|
||||||
|
|
||||||
|
|
||||||
class CoreLocation(object):
|
class CoreLocation:
|
||||||
"""
|
"""
|
||||||
Member of session class for handling global location data. This keeps
|
Member of session class for handling global location data. This keeps
|
||||||
track of a latitude/longitude/altitude reference point and scale in
|
track of a latitude/longitude/altitude reference point and scale in
|
||||||
|
|
|
@ -70,7 +70,7 @@ class Timer(threading.Thread):
|
||||||
|
|
||||||
|
|
||||||
@total_ordering
|
@total_ordering
|
||||||
class Event(object):
|
class Event:
|
||||||
"""
|
"""
|
||||||
Provides event objects that can be used within the EventLoop class.
|
Provides event objects that can be used within the EventLoop class.
|
||||||
"""
|
"""
|
||||||
|
@ -118,7 +118,7 @@ class Event(object):
|
||||||
self.canceled = True
|
self.canceled = True
|
||||||
|
|
||||||
|
|
||||||
class EventLoop(object):
|
class EventLoop:
|
||||||
"""
|
"""
|
||||||
Provides an event loop for running events.
|
Provides an event loop for running events.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -535,7 +535,7 @@ class BasicRangeModel(WirelessModel):
|
||||||
|
|
||||||
|
|
||||||
@total_ordering
|
@total_ordering
|
||||||
class WayPoint(object):
|
class WayPoint:
|
||||||
"""
|
"""
|
||||||
Maintains information regarding waypoints.
|
Maintains information regarding waypoints.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -21,7 +21,7 @@ from core.nodes.netclient import get_net_client
|
||||||
_DEFAULT_MTU = 1500
|
_DEFAULT_MTU = 1500
|
||||||
|
|
||||||
|
|
||||||
class NodeBase(object):
|
class NodeBase:
|
||||||
"""
|
"""
|
||||||
Base class for CORE nodes (nodes and networks)
|
Base class for CORE nodes (nodes and networks)
|
||||||
"""
|
"""
|
||||||
|
@ -1067,7 +1067,7 @@ class CoreNetworkBase(NodeBase):
|
||||||
return all_links
|
return all_links
|
||||||
|
|
||||||
|
|
||||||
class Position(object):
|
class Position:
|
||||||
"""
|
"""
|
||||||
Helper class for Cartesian coordinate position
|
Helper class for Cartesian coordinate position
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -8,7 +8,7 @@ from core import utils
|
||||||
from core.constants import VCMD_BIN
|
from core.constants import VCMD_BIN
|
||||||
|
|
||||||
|
|
||||||
class VnodeClient(object):
|
class VnodeClient:
|
||||||
"""
|
"""
|
||||||
Provides client functionality for interacting with a virtual node.
|
Provides client functionality for interacting with a virtual node.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -10,7 +10,7 @@ from core.nodes.base import CoreNode
|
||||||
from core.nodes.netclient import get_net_client
|
from core.nodes.netclient import get_net_client
|
||||||
|
|
||||||
|
|
||||||
class DockerClient(object):
|
class DockerClient:
|
||||||
def __init__(self, name, image, run):
|
def __init__(self, name, image, run):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.image = image
|
self.image = image
|
||||||
|
|
|
@ -10,7 +10,7 @@ from core.errors import CoreCommandError
|
||||||
from core.nodes.netclient import get_net_client
|
from core.nodes.netclient import get_net_client
|
||||||
|
|
||||||
|
|
||||||
class CoreInterface(object):
|
class CoreInterface:
|
||||||
"""
|
"""
|
||||||
Base class for network interfaces.
|
Base class for network interfaces.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -9,7 +9,7 @@ import struct
|
||||||
from socket import AF_INET, AF_INET6
|
from socket import AF_INET, AF_INET6
|
||||||
|
|
||||||
|
|
||||||
class MacAddress(object):
|
class MacAddress:
|
||||||
"""
|
"""
|
||||||
Provides mac address utilities for use within core.
|
Provides mac address utilities for use within core.
|
||||||
"""
|
"""
|
||||||
|
@ -77,7 +77,7 @@ class MacAddress(object):
|
||||||
return cls(tmpbytes[2:])
|
return cls(tmpbytes[2:])
|
||||||
|
|
||||||
|
|
||||||
class IpAddress(object):
|
class IpAddress:
|
||||||
"""
|
"""
|
||||||
Provides ip utilities and functionality for use within core.
|
Provides ip utilities and functionality for use within core.
|
||||||
"""
|
"""
|
||||||
|
@ -202,7 +202,7 @@ class IpAddress(object):
|
||||||
return struct.unpack("!I", value)[0]
|
return struct.unpack("!I", value)[0]
|
||||||
|
|
||||||
|
|
||||||
class IpPrefix(object):
|
class IpPrefix:
|
||||||
"""
|
"""
|
||||||
Provides ip address generation and prefix utilities.
|
Provides ip address generation and prefix utilities.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -10,7 +10,7 @@ from core.errors import CoreCommandError
|
||||||
from core.nodes.base import CoreNode
|
from core.nodes.base import CoreNode
|
||||||
|
|
||||||
|
|
||||||
class LxdClient(object):
|
class LxdClient:
|
||||||
def __init__(self, name, image, run):
|
def __init__(self, name, image, run):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.image = image
|
self.image = image
|
||||||
|
|
|
@ -19,7 +19,7 @@ def get_net_client(use_ovs, run):
|
||||||
return LinuxNetClient(run)
|
return LinuxNetClient(run)
|
||||||
|
|
||||||
|
|
||||||
class LinuxNetClient(object):
|
class LinuxNetClient:
|
||||||
"""
|
"""
|
||||||
Client for creating Linux bridges and ip interfaces for nodes.
|
Client for creating Linux bridges and ip interfaces for nodes.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -21,7 +21,7 @@ from core.nodes.netclient import get_net_client
|
||||||
ebtables_lock = threading.Lock()
|
ebtables_lock = threading.Lock()
|
||||||
|
|
||||||
|
|
||||||
class EbtablesQueue(object):
|
class EbtablesQueue:
|
||||||
"""
|
"""
|
||||||
Helper class for queuing up ebtables commands into rate-limited
|
Helper class for queuing up ebtables commands into rate-limited
|
||||||
atomic commits. This improves performance and reliability when there are
|
atomic commits. This improves performance and reliability when there are
|
||||||
|
|
|
@ -24,7 +24,7 @@ from core.nodes.network import WlanNode
|
||||||
|
|
||||||
|
|
||||||
# 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
|
||||||
class Bunch(object):
|
class Bunch:
|
||||||
"""
|
"""
|
||||||
Helper class for recording a collection of attributes.
|
Helper class for recording a collection of attributes.
|
||||||
"""
|
"""
|
||||||
|
@ -38,7 +38,7 @@ class Bunch(object):
|
||||||
self.__dict__.update(kwargs)
|
self.__dict__.update(kwargs)
|
||||||
|
|
||||||
|
|
||||||
class Sdt(object):
|
class Sdt:
|
||||||
"""
|
"""
|
||||||
Helper class for exporting session objects to NRL"s SDT3D.
|
Helper class for exporting session objects to NRL"s SDT3D.
|
||||||
The connect() method initializes the display, and can be invoked
|
The connect() method initializes the display, and can be invoked
|
||||||
|
|
|
@ -29,7 +29,7 @@ class ServiceMode(enum.Enum):
|
||||||
TIMER = 2
|
TIMER = 2
|
||||||
|
|
||||||
|
|
||||||
class ServiceDependencies(object):
|
class ServiceDependencies:
|
||||||
"""
|
"""
|
||||||
Can generate boot paths for services, based on their dependencies. Will validate
|
Can generate boot paths for services, based on their dependencies. Will validate
|
||||||
that all services will be booted and that all dependencies exist within the services provided.
|
that all services will be booted and that all dependencies exist within the services provided.
|
||||||
|
@ -127,7 +127,7 @@ class ServiceDependencies(object):
|
||||||
return self.path
|
return self.path
|
||||||
|
|
||||||
|
|
||||||
class ServiceShim(object):
|
class ServiceShim:
|
||||||
keys = [
|
keys = [
|
||||||
"dirs",
|
"dirs",
|
||||||
"files",
|
"files",
|
||||||
|
@ -235,7 +235,7 @@ class ServiceShim(object):
|
||||||
return servicesstring[1].split(",")
|
return servicesstring[1].split(",")
|
||||||
|
|
||||||
|
|
||||||
class ServiceManager(object):
|
class ServiceManager:
|
||||||
"""
|
"""
|
||||||
Manages services available for CORE nodes to use.
|
Manages services available for CORE nodes to use.
|
||||||
"""
|
"""
|
||||||
|
@ -306,7 +306,7 @@ class ServiceManager(object):
|
||||||
return service_errors
|
return service_errors
|
||||||
|
|
||||||
|
|
||||||
class CoreServices(object):
|
class CoreServices:
|
||||||
"""
|
"""
|
||||||
Class for interacting with a list of available startup services for
|
Class for interacting with a list of available startup services for
|
||||||
nodes. Mostly used to convert a CoreService into a Config API
|
nodes. Mostly used to convert a CoreService into a Config API
|
||||||
|
@ -791,7 +791,7 @@ class CoreServices(object):
|
||||||
node.nodefile(file_name, cfg)
|
node.nodefile(file_name, cfg)
|
||||||
|
|
||||||
|
|
||||||
class CoreService(object):
|
class CoreService:
|
||||||
"""
|
"""
|
||||||
Parent class used for defining services.
|
Parent class used for defining services.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -104,7 +104,7 @@ def add_configuration(parent, name, value):
|
||||||
add_attribute(config_element, "value", value)
|
add_attribute(config_element, "value", value)
|
||||||
|
|
||||||
|
|
||||||
class NodeElement(object):
|
class NodeElement:
|
||||||
def __init__(self, session, node, element_name):
|
def __init__(self, session, node, element_name):
|
||||||
self.session = session
|
self.session = session
|
||||||
self.node = node
|
self.node = node
|
||||||
|
@ -131,7 +131,7 @@ class NodeElement(object):
|
||||||
add_attribute(position, "alt", alt)
|
add_attribute(position, "alt", alt)
|
||||||
|
|
||||||
|
|
||||||
class ServiceElement(object):
|
class ServiceElement:
|
||||||
def __init__(self, service):
|
def __init__(self, service):
|
||||||
self.service = service
|
self.service = service
|
||||||
self.element = etree.Element("service")
|
self.element = etree.Element("service")
|
||||||
|
@ -232,7 +232,7 @@ class NetworkElement(NodeElement):
|
||||||
add_attribute(self.element, "type", node_type)
|
add_attribute(self.element, "type", node_type)
|
||||||
|
|
||||||
|
|
||||||
class CoreXmlWriter(object):
|
class CoreXmlWriter:
|
||||||
def __init__(self, session):
|
def __init__(self, session):
|
||||||
self.session = session
|
self.session = session
|
||||||
self.scenario = etree.Element("scenario")
|
self.scenario = etree.Element("scenario")
|
||||||
|
@ -527,7 +527,7 @@ class CoreXmlWriter(object):
|
||||||
return link_element
|
return link_element
|
||||||
|
|
||||||
|
|
||||||
class CoreXmlReader(object):
|
class CoreXmlReader:
|
||||||
def __init__(self, session):
|
def __init__(self, session):
|
||||||
self.session = session
|
self.session = session
|
||||||
self.scenario = None
|
self.scenario = None
|
||||||
|
|
|
@ -84,7 +84,7 @@ def get_ipv4_addresses(hostname):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|
||||||
class CoreXmlDeployment(object):
|
class CoreXmlDeployment:
|
||||||
def __init__(self, session, scenario):
|
def __init__(self, session, scenario):
|
||||||
self.session = session
|
self.session = session
|
||||||
self.scenario = scenario
|
self.scenario = scenario
|
||||||
|
|
|
@ -14,7 +14,7 @@ from core import services
|
||||||
from core.constants import CORE_CONF_DIR
|
from core.constants import CORE_CONF_DIR
|
||||||
|
|
||||||
|
|
||||||
class FileUpdater(object):
|
class FileUpdater:
|
||||||
"""
|
"""
|
||||||
Helper class for changing configuration files.
|
Helper class for changing configuration files.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -23,7 +23,7 @@ from core.services.coreservices import ServiceManager
|
||||||
EMANE_SERVICES = "zebra|OSPFv3MDR|IPForward"
|
EMANE_SERVICES = "zebra|OSPFv3MDR|IPForward"
|
||||||
|
|
||||||
|
|
||||||
class CoreServerTest(object):
|
class CoreServerTest:
|
||||||
def __init__(self, port=CORE_API_PORT):
|
def __init__(self, port=CORE_API_PORT):
|
||||||
self.host = "localhost"
|
self.host = "localhost"
|
||||||
self.port = port
|
self.port = port
|
||||||
|
|
Loading…
Reference in a new issue