updated all classes to be created without using (object), in python3 all classes are new style classes

This commit is contained in:
bharnden 2019-10-23 09:31:07 -07:00
parent 39c40d2a8c
commit 6a0a9e7698
24 changed files with 48 additions and 48 deletions

View file

@ -14,7 +14,7 @@ from core.api.grpc import core_pb2, core_pb2_grpc
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.
"""
@ -133,7 +133,7 @@ def start_streamer(stream, handler):
thread.start()
class CoreGrpcClient(object):
class CoreGrpcClient:
"""
Provides convenience methods for interfacing with the CORE grpc server.
"""

View file

@ -27,7 +27,7 @@ from core.emulator.enumerations import (
from core.nodes.ipaddress import IpAddress, MacAddress
class CoreTlvData(object):
class CoreTlvData:
"""
Helper base class used for packing and unpacking values using struct.
"""
@ -348,7 +348,7 @@ class CoreTlvDataMacAddr(CoreTlvDataObj):
return MacAddress(address=value[2:])
class CoreTlv(object):
class CoreTlv:
"""
Base class for representing CORE TLVs.
"""
@ -670,7 +670,7 @@ class CoreExceptionTlv(CoreTlv):
}
class CoreMessage(object):
class CoreMessage:
"""
Base class for representing CORE messages.
"""

View file

@ -8,7 +8,7 @@ from collections import OrderedDict
from core.emulator.data import ConfigData
class ConfigShim(object):
class ConfigShim:
"""
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.
"""
@ -131,7 +131,7 @@ class Configuration(object):
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.
"""
@ -240,7 +240,7 @@ class ConfigurableManager(object):
return self.node_configurations.get(node_id)
class ConfigGroup(object):
class ConfigGroup:
"""
Defines configuration group tabs used for display by ConfigurationOptions.
"""
@ -258,7 +258,7 @@ class ConfigGroup(object):
self.stop = stop
class ConfigurableOptions(object):
class ConfigurableOptions:
"""
Provides a base for defining configuration options within CORE.
"""

View file

@ -29,7 +29,7 @@ signal.signal(signal.SIGUSR1, 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.
"""

View file

@ -21,7 +21,7 @@ LOCK = threading.Lock()
CMD_HIDE = True
class DistributedServer(object):
class DistributedServer:
"""
Provides distributed server interactions.
"""
@ -101,7 +101,7 @@ class DistributedServer(object):
os.unlink(temp.name)
class DistributedController(object):
class DistributedController:
"""
Provides logic for dealing with remote tunnels and distributed servers.
"""

View file

@ -4,7 +4,7 @@ from core.nodes.ipaddress import Ipv4Prefix, Ipv6Prefix, MacAddress
from core.nodes.physical import PhysicalNode
class IdGen(object):
class IdGen:
def __init__(self, _id=0):
self.id = _id
@ -61,7 +61,7 @@ def link_config(network, interface, link_options, devname=None, interface_two=No
network.linkconfig(**config)
class NodeOptions(object):
class NodeOptions:
"""
Options for creating and updating nodes within core.
"""
@ -115,7 +115,7 @@ class NodeOptions(object):
self.alt = alt
class LinkOptions(object):
class LinkOptions:
"""
Options for creating and updating links within core.
"""
@ -145,7 +145,7 @@ class LinkOptions(object):
self.opaque = None
class IpPrefixes(object):
class IpPrefixes:
"""
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.
"""

View file

@ -71,7 +71,7 @@ NODES_TYPE = {NODES[x]: x for x in NODES}
CTRL_NET_ID = 9001
class Session(object):
class Session:
"""
CORE session manager.
"""

View file

@ -11,7 +11,7 @@ from core.emulator.enumerations import RegisterTlvs
from core.location import utm
class CoreLocation(object):
class CoreLocation:
"""
Member of session class for handling global location data. This keeps
track of a latitude/longitude/altitude reference point and scale in

View file

@ -70,7 +70,7 @@ class Timer(threading.Thread):
@total_ordering
class Event(object):
class Event:
"""
Provides event objects that can be used within the EventLoop class.
"""
@ -118,7 +118,7 @@ class Event(object):
self.canceled = True
class EventLoop(object):
class EventLoop:
"""
Provides an event loop for running events.
"""

View file

@ -535,7 +535,7 @@ class BasicRangeModel(WirelessModel):
@total_ordering
class WayPoint(object):
class WayPoint:
"""
Maintains information regarding waypoints.
"""

View file

@ -21,7 +21,7 @@ from core.nodes.netclient import get_net_client
_DEFAULT_MTU = 1500
class NodeBase(object):
class NodeBase:
"""
Base class for CORE nodes (nodes and networks)
"""
@ -1067,7 +1067,7 @@ class CoreNetworkBase(NodeBase):
return all_links
class Position(object):
class Position:
"""
Helper class for Cartesian coordinate position
"""

View file

@ -8,7 +8,7 @@ from core import utils
from core.constants import VCMD_BIN
class VnodeClient(object):
class VnodeClient:
"""
Provides client functionality for interacting with a virtual node.
"""

View file

@ -10,7 +10,7 @@ from core.nodes.base import CoreNode
from core.nodes.netclient import get_net_client
class DockerClient(object):
class DockerClient:
def __init__(self, name, image, run):
self.name = name
self.image = image

View file

@ -10,7 +10,7 @@ from core.errors import CoreCommandError
from core.nodes.netclient import get_net_client
class CoreInterface(object):
class CoreInterface:
"""
Base class for network interfaces.
"""

View file

@ -9,7 +9,7 @@ import struct
from socket import AF_INET, AF_INET6
class MacAddress(object):
class MacAddress:
"""
Provides mac address utilities for use within core.
"""
@ -77,7 +77,7 @@ class MacAddress(object):
return cls(tmpbytes[2:])
class IpAddress(object):
class IpAddress:
"""
Provides ip utilities and functionality for use within core.
"""
@ -202,7 +202,7 @@ class IpAddress(object):
return struct.unpack("!I", value)[0]
class IpPrefix(object):
class IpPrefix:
"""
Provides ip address generation and prefix utilities.
"""

View file

@ -10,7 +10,7 @@ from core.errors import CoreCommandError
from core.nodes.base import CoreNode
class LxdClient(object):
class LxdClient:
def __init__(self, name, image, run):
self.name = name
self.image = image

View file

@ -19,7 +19,7 @@ def get_net_client(use_ovs, run):
return LinuxNetClient(run)
class LinuxNetClient(object):
class LinuxNetClient:
"""
Client for creating Linux bridges and ip interfaces for nodes.
"""

View file

@ -21,7 +21,7 @@ from core.nodes.netclient import get_net_client
ebtables_lock = threading.Lock()
class EbtablesQueue(object):
class EbtablesQueue:
"""
Helper class for queuing up ebtables commands into rate-limited
atomic commits. This improves performance and reliability when there are

View file

@ -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
class Bunch(object):
class Bunch:
"""
Helper class for recording a collection of attributes.
"""
@ -38,7 +38,7 @@ class Bunch(object):
self.__dict__.update(kwargs)
class Sdt(object):
class Sdt:
"""
Helper class for exporting session objects to NRL"s SDT3D.
The connect() method initializes the display, and can be invoked

View file

@ -29,7 +29,7 @@ class ServiceMode(enum.Enum):
TIMER = 2
class ServiceDependencies(object):
class ServiceDependencies:
"""
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.
@ -127,7 +127,7 @@ class ServiceDependencies(object):
return self.path
class ServiceShim(object):
class ServiceShim:
keys = [
"dirs",
"files",
@ -235,7 +235,7 @@ class ServiceShim(object):
return servicesstring[1].split(",")
class ServiceManager(object):
class ServiceManager:
"""
Manages services available for CORE nodes to use.
"""
@ -306,7 +306,7 @@ class ServiceManager(object):
return service_errors
class CoreServices(object):
class CoreServices:
"""
Class for interacting with a list of available startup services for
nodes. Mostly used to convert a CoreService into a Config API
@ -791,7 +791,7 @@ class CoreServices(object):
node.nodefile(file_name, cfg)
class CoreService(object):
class CoreService:
"""
Parent class used for defining services.
"""

View file

@ -104,7 +104,7 @@ def add_configuration(parent, name, value):
add_attribute(config_element, "value", value)
class NodeElement(object):
class NodeElement:
def __init__(self, session, node, element_name):
self.session = session
self.node = node
@ -131,7 +131,7 @@ class NodeElement(object):
add_attribute(position, "alt", alt)
class ServiceElement(object):
class ServiceElement:
def __init__(self, service):
self.service = service
self.element = etree.Element("service")
@ -232,7 +232,7 @@ class NetworkElement(NodeElement):
add_attribute(self.element, "type", node_type)
class CoreXmlWriter(object):
class CoreXmlWriter:
def __init__(self, session):
self.session = session
self.scenario = etree.Element("scenario")
@ -527,7 +527,7 @@ class CoreXmlWriter(object):
return link_element
class CoreXmlReader(object):
class CoreXmlReader:
def __init__(self, session):
self.session = session
self.scenario = None

View file

@ -84,7 +84,7 @@ def get_ipv4_addresses(hostname):
raise NotImplementedError
class CoreXmlDeployment(object):
class CoreXmlDeployment:
def __init__(self, session, scenario):
self.session = session
self.scenario = scenario

View file

@ -14,7 +14,7 @@ from core import services
from core.constants import CORE_CONF_DIR
class FileUpdater(object):
class FileUpdater:
"""
Helper class for changing configuration files.
"""

View file

@ -23,7 +23,7 @@ from core.services.coreservices import ServiceManager
EMANE_SERVICES = "zebra|OSPFv3MDR|IPForward"
class CoreServerTest(object):
class CoreServerTest:
def __init__(self, port=CORE_API_PORT):
self.host = "localhost"
self.port = port