diff --git a/daemon/core/api/tlv/broker.py b/daemon/core/api/tlv/broker.py index d94195ab..d63a8ca2 100644 --- a/daemon/core/api/tlv/broker.py +++ b/daemon/core/api/tlv/broker.py @@ -96,7 +96,7 @@ class CoreBroker(object): """ Creates a CoreBroker instance. - :param core.session.Session session: session this manager is tied to + :param core.emulator.session.Session session: session this manager is tied to :return: nothing """ @@ -901,7 +901,7 @@ class CoreBroker(object): opaque data in the link message, otherwise use the IP of the message sender (the master server). - :param coreapi.CoreLinkMessage msg: + :param core.api.tlv.coreapi.CoreLinkMessage msg: link message :param bool first_is_local: is first local :return: host address :rtype: str diff --git a/daemon/core/api/tlv/coreapi.py b/daemon/core/api/tlv/coreapi.py index e5b09f27..e0cd938d 100644 --- a/daemon/core/api/tlv/coreapi.py +++ b/daemon/core/api/tlv/coreapi.py @@ -243,7 +243,7 @@ class CoreTlvDataUint16List(CoreTlvData): Retrieves a unint 16 list from a string :param str value: string representation of a uint 16 list - :return: unint 16 list + :return: uint 16 list :rtype: list """ return tuple(int(x) for x in value.split()) @@ -274,7 +274,7 @@ class CoreTlvDataIpv4Addr(CoreTlvDataObj): :param str value: value to get Ipv4 address from :return: Ipv4 address - :rtype: core.misc.ipaddress.IpAddress + :rtype: core.nodes.ipaddress.IpAddress """ return IpAddress(af=socket.AF_INET, address=value) @@ -292,7 +292,7 @@ class CoreTlvDataIPv6Addr(CoreTlvDataObj): """ Retrieve Ipv6 address value from object. - :param core.misc.ipaddress.IpAddress obj: ip address to get value from + :param core.nodes.ipaddress.IpAddress obj: ip address to get value from :return: """ return obj.addr @@ -304,7 +304,7 @@ class CoreTlvDataIPv6Addr(CoreTlvDataObj): :param str value: value to get Ipv4 address from :return: Ipv4 address - :rtype: core.misc.ipaddress.IpAddress + :rtype: core.nodes.ipaddress.IpAddress """ return IpAddress(af=socket.AF_INET6, address=value) @@ -322,7 +322,7 @@ class CoreTlvDataMacAddr(CoreTlvDataObj): """ Retrieve Ipv6 address value from object. - :param core.misc.ipaddress.MacAddress obj: mac address to get value from + :param core.nodes.ipaddress.MacAddress obj: mac address to get value from :return: """ # extend to 64 bits @@ -335,7 +335,7 @@ class CoreTlvDataMacAddr(CoreTlvDataObj): :param str value: value to get Ipv4 address from :return: Ipv4 address - :rtype: core.misc.ipaddress.MacAddress + :rtype: core.nodes.ipaddress.MacAddress """ # only use 48 bits return MacAddress(address=value[2:]) diff --git a/daemon/core/api/tlv/corehandlers.py b/daemon/core/api/tlv/corehandlers.py index 50a62e1c..e57ec54e 100644 --- a/daemon/core/api/tlv/corehandlers.py +++ b/daemon/core/api/tlv/corehandlers.py @@ -213,7 +213,7 @@ class CoreHandler(socketserver.BaseRequestHandler): """ Callback to handle an event broadcast out from a session. - :param core.data.EventData event_data: event data to handle + :param core.emulator.data.EventData event_data: event data to handle :return: nothing """ logging.debug("handling broadcast event: %s", event_data) @@ -237,7 +237,7 @@ class CoreHandler(socketserver.BaseRequestHandler): """ Callback to handle a file broadcast out from a session. - :param core.data.FileData file_data: file data to handle + :param core.emulator.data.FileData file_data: file data to handle :return: nothing """ logging.debug("handling broadcast file: %s", file_data) @@ -264,7 +264,7 @@ class CoreHandler(socketserver.BaseRequestHandler): """ Callback to handle a config broadcast out from a session. - :param core.data.ConfigData config_data: config data to handle + :param core.emulator.data.ConfigData config_data: config data to handle :return: nothing """ logging.debug("handling broadcast config: %s", config_data) @@ -278,7 +278,7 @@ class CoreHandler(socketserver.BaseRequestHandler): """ Callback to handle an exception broadcast out from a session. - :param core.data.ExceptionData exception_data: exception data to handle + :param core.emulator.data.ExceptionData exception_data: exception data to handle :return: nothing """ logging.debug("handling broadcast exception: %s", exception_data) @@ -301,7 +301,7 @@ class CoreHandler(socketserver.BaseRequestHandler): """ Callback to handle an node broadcast out from a session. - :param core.data.NodeData node_data: node data to handle + :param core.emulator.data.NodeData node_data: node data to handle :return: nothing """ logging.debug("handling broadcast node: %s", node_data) @@ -315,7 +315,7 @@ class CoreHandler(socketserver.BaseRequestHandler): """ Callback to handle an link broadcast out from a session. - :param core.data.LinkData link_data: link data to handle + :param core.emulator.data.LinkData link_data: link data to handle :return: nothing """ logging.debug("handling broadcast link: %s", link_data) @@ -407,7 +407,7 @@ class CoreHandler(socketserver.BaseRequestHandler): Receive data and return a CORE API message object. :return: received message - :rtype: coreapi.CoreMessage + :rtype: core.api.tlv.coreapi.CoreMessage """ try: header = self.request.recv(coreapi.CoreMessage.header_len) @@ -586,7 +586,7 @@ class CoreHandler(socketserver.BaseRequestHandler): """ Sends an exception for display within the GUI. - :param core.enumerations.ExceptionLevel level: level for exception + :param core.emulator.enumerations.ExceptionLevel level: level for exception :param str source: source where exception came from :param str text: details about exception :param int node: node id, if related to a specific node @@ -624,7 +624,7 @@ class CoreHandler(socketserver.BaseRequestHandler): """ Node Message handler - :param coreapi.CoreNodeMessage message: node message + :param core.api.coreapi.CoreNodeMessage message: node message :return: replies to node message """ replies = [] @@ -696,7 +696,7 @@ class CoreHandler(socketserver.BaseRequestHandler): """ Link Message handler - :param coreapi.CoreLinkMessage message: link message to handle + :param core.api.tlv.coreapi.CoreLinkMessage message: link message to handle :return: link message replies """ node_one_id = message.get_tlv(LinkTlvs.N1_NUMBER.value) @@ -756,7 +756,7 @@ class CoreHandler(socketserver.BaseRequestHandler): """ Execute Message handler - :param coreapi.CoreExecMessage message: execute message to handle + :param core.api.tlv.coreapi.CoreExecMessage message: execute message to handle :return: reply messages """ node_num = message.get_tlv(ExecuteTlvs.NODE.value) @@ -831,7 +831,7 @@ class CoreHandler(socketserver.BaseRequestHandler): """ Register Message Handler - :param coreapi.CoreRegMessage message: register message to handle + :param core.api.tlv.coreapi.CoreRegMessage message: register message to handle :return: reply messages """ replies = [] @@ -923,7 +923,7 @@ class CoreHandler(socketserver.BaseRequestHandler): """ Configuration Message handler - :param coreapi.CoreConfMessage message: configuration message to handle + :param core.api.tlv.coreapi.CoreConfMessage message: configuration message to handle :return: reply messages """ # convert config message to standard config data object @@ -1341,7 +1341,7 @@ class CoreHandler(socketserver.BaseRequestHandler): """ File Message handler - :param coreapi.CoreFileMessage message: file message to handle + :param core.api.tlv.coreapi.CoreFileMessage message: file message to handle :return: reply messages """ if message.flags & MessageFlags.ADD.value: @@ -1405,7 +1405,7 @@ class CoreHandler(socketserver.BaseRequestHandler): """ Event Message handler - :param coreapi.CoreEventMessage message: event message to handle + :param core.api.tlv.coreapi.CoreEventMessage message: event message to handle :return: reply messages """ event_data = EventData( @@ -1508,7 +1508,7 @@ class CoreHandler(socketserver.BaseRequestHandler): Handle an Event Message used to start, stop, restart, or validate a service on a given node. - :param EventData event_data: event data to handle + :param core.emulator.enumerations.EventData event_data: event data to handle :return: nothing """ event_type = event_data.event_type @@ -1573,7 +1573,7 @@ class CoreHandler(socketserver.BaseRequestHandler): """ Session Message handler - :param coreapi.CoreSessionMessage message: session message to handle + :param core.api.tlv.coreapi.CoreSessionMessage message: session message to handle :return: reply messages """ session_id_str = message.get_tlv(SessionTlvs.NUMBER.value) diff --git a/daemon/core/api/tlv/dataconversion.py b/daemon/core/api/tlv/dataconversion.py index 781afbc2..b8808f42 100644 --- a/daemon/core/api/tlv/dataconversion.py +++ b/daemon/core/api/tlv/dataconversion.py @@ -11,7 +11,7 @@ def convert_node(node_data): """ Convenience method for converting NodeData to a packed TLV message. - :param core.data.NodeData node_data: node data to convert + :param core.emulator.data.NodeData node_data: node data to convert :return: packed node message """ tlv_data = structutils.pack_values(coreapi.CoreNodeTlv, [ @@ -43,7 +43,7 @@ def convert_config(config_data): """ Convenience method for converting ConfigData to a packed TLV message. - :param core.data.ConfigData config_data: config data to convert + :param core.emulator.data.ConfigData config_data: config data to convert :return: packed message """ tlv_data = structutils.pack_values(coreapi.CoreConfigTlv, [ diff --git a/daemon/core/emane/emanemodel.py b/daemon/core/emane/emanemodel.py index bfbfc119..3f00f921 100644 --- a/daemon/core/emane/emanemodel.py +++ b/daemon/core/emane/emanemodel.py @@ -147,7 +147,7 @@ class EmaneModel(WirelessModel): """ Invoked when a Link Message is received. Default is unimplemented. - :param core.netns.vif.Veth netif: interface one + :param core.nodes.interface.Veth netif: interface one :param bw: bandwidth to set to :param delay: packet delay to set to :param loss: packet loss to set to diff --git a/daemon/core/location/mobility.py b/daemon/core/location/mobility.py index 360dd305..8303813f 100644 --- a/daemon/core/location/mobility.py +++ b/daemon/core/location/mobility.py @@ -41,7 +41,7 @@ class MobilityManager(ModelManager): """ Creates a MobilityManager instance. - :param core.session.Session session: session this manager is tied to + :param core.emulator.session.Session session: session this manager is tied to """ super(MobilityManager, self).__init__() self.session = session @@ -468,8 +468,6 @@ class BasicRangeModel(WirelessModel): with self.wlan._linked_lock: linked = self.wlan.linked(a, b) - logging.debug("checking range netif1(%s) netif2(%s): linked(%s) actual(%s) > config(%s)", - a.name, b.name, linked, d, self.range) if d > self.range: if linked: logging.debug("was linked, unlinking") @@ -533,8 +531,8 @@ class BasicRangeModel(WirelessModel): """ Send a wireless link/unlink API message to the GUI. - :param core.coreobj.PyCoreNetIf netif: interface one - :param core.coreobj.PyCoreNetIf netif2: interface two + :param core.nodes.interface.CoreInterface netif: interface one + :param core.nodes.interface.CoreInterface netif2: interface two :param bool unlink: unlink or not :return: nothing """ @@ -702,7 +700,7 @@ class WayPointMobility(WirelessModel): Calculate next node location and update its coordinates. Returns True if the node's position has changed. - :param core.netns.vnode.CoreNode node: node to move + :param core.nodes.base.CoreNode node: node to move :param dt: move factor :return: True if node was moved, False otherwise :rtype: bool @@ -929,9 +927,8 @@ class Ns2ScriptedMobility(WayPointMobility): """ Creates a Ns2ScriptedMobility instance. - :param core.session.Session session: CORE session instance + :param core.emulator.session.Session session: CORE session instance :param int _id: object id - :param config: values """ super(Ns2ScriptedMobility, self).__init__(session=session, _id=_id) self._netifs = {} diff --git a/daemon/core/nodes/base.py b/daemon/core/nodes/base.py index 219757d2..05b45b4c 100644 --- a/daemon/core/nodes/base.py +++ b/daemon/core/nodes/base.py @@ -1,5 +1,5 @@ """ -PyCoreNode and LxcNode classes that implement the network namespac virtual node. +Defines the base logic for nodes used within core. """ import errno @@ -11,9 +11,10 @@ import signal import socket import string import threading -from builtins import range from socket import AF_INET, AF_INET6 +from builtins import range + from core import CoreCommandError, utils from core import constants from core.emulator.data import NodeData, LinkData @@ -21,7 +22,6 @@ 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 -from core.nodes.ipaddress import MacAddress _DEFAULT_MTU = 1500 @@ -39,7 +39,7 @@ class NodeBase(object): """ Creates a PyCoreObj instance. - :param core.session.Session session: CORE session object + :param core.emulator.session.Session session: CORE session object :param int _id: id :param str name: object name :param bool start: start value @@ -226,7 +226,7 @@ class CoreNodeBase(NodeBase): """ Create a CoreNodeBase instance. - :param core.session.Session session: CORE session object + :param core.emulator.session.Session session: CORE session object :param int _id: object id :param str name: object name :param bool start: boolean for starting @@ -417,14 +417,6 @@ class CoreNodeBase(NodeBase): class CoreNode(CoreNodeBase): """ Provides standard core node logic. - - :var nodedir: str - :var ctrlchnlname: str - :var client: core.netns.vnodeclient.VnodeClient - :var pid: int - :var up: bool - :var lock: threading.RLock - :var _mounts: list[tuple[str, str]] """ apitype = NodeTypes.DEFAULT.value valid_address_types = {"inet", "inet6", "inet6link"} @@ -433,7 +425,7 @@ class CoreNode(CoreNodeBase): """ Create a CoreNode instance. - :param core.session.Session session: core session instance + :param core.emulator.session.Session session: core session instance :param int _id: object id :param str name: object name :param str nodedir: node directory @@ -646,7 +638,7 @@ class CoreNode(CoreNodeBase): :param int ifindex: index for the new interface :param str ifname: name for the new interface - :param net: network to associate interface with + :param core.nodes.base.CoreNetworkBase net: network to associate interface with :return: nothing """ with self.lock: @@ -736,7 +728,7 @@ class CoreNode(CoreNodeBase): Set hardware addres for an interface. :param int ifindex: index of interface to set hardware address for - :param core.misc.ipaddress.MacAddress addr: hardware address to set + :param core.nodes.ipaddress.MacAddress addr: hardware address to set :return: nothing :raises CoreCommandError: when a non-zero exit status occurs """ @@ -819,9 +811,9 @@ class CoreNode(CoreNodeBase): """ Create a new network interface. - :param net: network to associate with + :param core.nodes.base.CoreNetworkBase net: network to associate with :param list addrlist: addresses to add on the interface - :param core.misc.ipaddress.MacAddress hwaddr: hardware address to set for interface + :param core.nodes.ipaddress.MacAddress hwaddr: hardware address to set for interface :param int ifindex: index of interface to create :param str ifname: name for interface :return: interface index @@ -864,7 +856,7 @@ class CoreNode(CoreNodeBase): Connect a node. :param str ifname: name of interface to connect - :param core.netns.nodes.LxcNode othernode: node to connect to + :param core.nodes.CoreNodeBase othernode: node to connect to :param str otherifname: interface name to connect to :return: nothing """ @@ -970,9 +962,9 @@ class CoreNetworkBase(NodeBase): def __init__(self, session, _id, name, start=True): """ - Create a PyCoreNet instance. + Create a CoreNetworkBase instance. - :param core.session.Session session: CORE session object + :param core.emulator.session.Session session: CORE session object :param int _id: object id :param str name: object name :param bool start: should object start diff --git a/daemon/core/nodes/client.py b/daemon/core/nodes/client.py index 486a0c9f..8530804b 100644 --- a/daemon/core/nodes/client.py +++ b/daemon/core/nodes/client.py @@ -1,8 +1,7 @@ """ client.py: implementation of the VnodeClient class for issuing commands over a control channel to the vnoded process running in a network namespace. -The control channel can be accessed via calls to the vcmd Python module or -by invoking the vcmd shell command. +The control channel can be accessed via calls using the vcmd shell. """ import logging @@ -124,8 +123,6 @@ class VnodeClient(object): """ self._verify_connection() args = utils.split_args(args) - # if isinstance(args, list): - # args = " ".join(args) cmd = self._cmd_args() + args logging.info("popen: %s", cmd) p = Popen(cmd, stdout=PIPE, stderr=PIPE, stdin=PIPE) diff --git a/daemon/core/nodes/interface.py b/daemon/core/nodes/interface.py index 38b34ea1..3d8b6dc5 100644 --- a/daemon/core/nodes/interface.py +++ b/daemon/core/nodes/interface.py @@ -24,7 +24,7 @@ class CoreInterface(object): """ Creates a PyCoreNetIf instance. - :param core.coreobj.PyCoreNode node: node for interface + :param core.nodes.base.CoreNode node: node for interface :param str name: interface name :param mtu: mtu value """ @@ -67,7 +67,7 @@ class CoreInterface(object): """ Attach network. - :param core.coreobj.PyCoreNet net: network to attach + :param core.nodes.base.CoreNetworkBase net: network to attach :return: nothing """ if self.net: @@ -109,7 +109,7 @@ class CoreInterface(object): """ Set hardware address. - :param core.misc.ipaddress.MacAddress addr: hardware address to set to. + :param core.nodes.ipaddress.MacAddress addr: hardware address to set to. :return: nothing """ self.hwaddr = addr @@ -199,7 +199,7 @@ class Veth(CoreInterface): """ Creates a VEth instance. - :param core.netns.vnode.SimpleLxcNode node: related core node + :param core.nodes.base.CoreNode node: related core node :param str name: interface name :param str localname: interface local name :param mtu: interface mtu @@ -260,11 +260,11 @@ class TunTap(CoreInterface): """ Create a TunTap instance. - :param core.netns.vnode.SimpleLxcNode node: related core node + :param core.nodes.base.CoreNode node: related core node :param str name: interface name :param str localname: local interface name :param mtu: interface mtu - :param net: related network + :param core.nodes.base.CoreNetworkBase net: related network :param bool start: start flag """ CoreInterface.__init__(self, node=node, name=name, mtu=mtu) @@ -420,9 +420,9 @@ class GreTap(CoreInterface): """ Creates a GreTap instance. - :param core.netns.vnode.SimpleLxcNode node: related core node + :param core.nodes.base.CoreNode node: related core node :param str name: interface name - :param core.session.Session session: core session instance + :param core.emulator.session.Session session: core session instance :param mtu: interface mtu :param str remoteip: remote address :param int _id: object id @@ -493,6 +493,6 @@ class GreTap(CoreInterface): :param flags: link flags :return: link data - :rtype: list[core.data.LinkData] + :rtype: list[core.emulator.data.LinkData] """ return [] diff --git a/daemon/core/nodes/ipaddress.py b/daemon/core/nodes/ipaddress.py index 111bb38c..cf9eadeb 100644 --- a/daemon/core/nodes/ipaddress.py +++ b/daemon/core/nodes/ipaddress.py @@ -215,7 +215,7 @@ class IpPrefix(object): Create a IpPrefix instance. :param int af: address family for ip prefix - :param prefixstr: ip prefix string + :param str prefixstr: ip prefix string """ # prefixstr format: address/prefixlen tmp = prefixstr.split("/") diff --git a/daemon/core/nodes/network.py b/daemon/core/nodes/network.py index 899f636f..5520e375 100644 --- a/daemon/core/nodes/network.py +++ b/daemon/core/nodes/network.py @@ -1,6 +1,5 @@ """ -PyCoreNet and LxBrNet classes that implement virtual networks using -Linux Ethernet bridging and ebtables rules. +Defines network nodes used within core. """ import logging @@ -343,7 +342,7 @@ class CoreNetwork(CoreNetworkBase): """ Detach a network interface. - :param core.netns.vif.Veth netif: network interface to detach + :param core.nodes.interface.Veth netif: network interface to detach :return: nothing """ if self.up: @@ -355,8 +354,8 @@ class CoreNetwork(CoreNetworkBase): """ Determine if the provided network interfaces are linked. - :param core.netns.vif.Veth netif1: interface one - :param core.netns.vif.Veth netif2: interface two + :param core.nodes.interface.CoreInterface netif1: interface one + :param core.nodes.interface.CoreInterface netif2: interface two :return: True if interfaces are linked, False otherwise :rtype: bool """ @@ -385,8 +384,8 @@ class CoreNetwork(CoreNetworkBase): Unlink two PyCoreNetIfs, resulting in adding or removing ebtables filtering rules. - :param core.netns.vif.Veth netif1: interface one - :param core.netns.vif.Veth netif2: interface two + :param core.nodes.interface.CoreInterface netif1: interface one + :param core.nodes.interface.CoreInterface netif2: interface two :return: nothing """ with self._linked_lock: @@ -401,8 +400,8 @@ class CoreNetwork(CoreNetworkBase): Link two PyCoreNetIfs together, resulting in adding or removing ebtables filtering rules. - :param core.netns.vif.Veth netif1: interface one - :param core.netns.vif.Veth netif2: interface two + :param core.nodes.interface.CoreInterface netif1: interface one + :param core.nodes.interface.CoreInterface netif2: interface two :return: nothing """ with self._linked_lock: @@ -417,7 +416,7 @@ class CoreNetwork(CoreNetworkBase): """ Configure link parameters by applying tc queuing disciplines on the interface. - :param core.netns.vif.Veth netif: interface one + :param core.nodes.interface.Veth netif: interface one :param bw: bandwidth to set to :param delay: packet delay to set to :param loss: packet loss to set to @@ -549,9 +548,9 @@ class CoreNetwork(CoreNetworkBase): Return the interface of that links this net with another net (that were linked using linknet()). - :param core.netns.vnet.LxBrNet net: interface to get link for + :param core.nodes.base.CoreNetworkBase net: interface to get link for :return: interface the provided network is linked to - :rtype: core.netns.vnet.LxBrNet + :rtype: core.nodes.interface.CoreInterface """ for netif in self.netifs(): if hasattr(netif, "othernet") and netif.othernet == net: @@ -584,7 +583,7 @@ class GreTapBridge(CoreNetwork): """ Create a GreTapBridge instance. - :param core.session.Session session: core session instance + :param core.emulator.session.Session session: core session instance :param str remoteip: remote address :param int _id: object id :param str name: object name @@ -593,7 +592,6 @@ class GreTapBridge(CoreNetwork): :param ttl: ttl value :param key: gre tap key :param bool start: start flag - :return: """ CoreNetwork.__init__(self, session=session, _id=_id, name=name, policy=policy, start=False) self.grekey = key @@ -685,7 +683,7 @@ class CtrlNet(CoreNetwork): """ Creates a CtrlNet instance. - :param core.session.Session session: core session instance + :param core.emulator.session.Session session: core session instance :param int _id: node id :param str name: node namee :param prefix: control network ipv4 prefix @@ -740,7 +738,7 @@ class CtrlNet(CoreNetwork): def detectoldbridge(self): """ - Occassionally, control net bridges from previously closed sessions are not cleaned up. + Occasionally, control net bridges from previously closed sessions are not cleaned up. Check if there are old control net bridges and delete them :return: True if an old bridge was detected, False otherwise @@ -825,7 +823,7 @@ class PtpNet(CoreNetwork): :param float lon: longitude :param float alt: altitude :return: node data object - :rtype: core.data.NodeData + :rtype: core.emulator.data.NodeData """ return None @@ -836,7 +834,7 @@ class PtpNet(CoreNetwork): :param flags: message flags :return: list of link data - :rtype: list[core.data.LinkData] + :rtype: list[core.emulator.data.LinkData] """ all_links = [] @@ -997,7 +995,7 @@ class WlanNode(CoreNetwork): """ Attach a network interface. - :param core.netns.vif.VEth netif: network interface + :param core.nodes.interface.CoreInterface netif: network interface :return: nothing """ CoreNetwork.attach(self, netif) @@ -1013,7 +1011,7 @@ class WlanNode(CoreNetwork): """ Sets the mobility and wireless model. - :param core.mobility.WirelessModel.cls model: wireless model to set to + :param core.location.mobility.WirelessModel.cls model: wireless model to set to :param dict config: configuration for model being set :return: nothing """ @@ -1056,7 +1054,7 @@ class WlanNode(CoreNetwork): :param flags: message flags :return: list of link data - :rtype: list[core.data.LinkData] + :rtype: list[core.emulator.data.LinkData] """ all_links = CoreNetwork.all_link_data(self, flags) diff --git a/daemon/core/nodes/nodeutils.py b/daemon/core/nodes/nodeutils.py index 2aa88b8f..95c53165 100644 --- a/daemon/core/nodes/nodeutils.py +++ b/daemon/core/nodes/nodeutils.py @@ -23,7 +23,7 @@ def _convert_map(x, y): :param dict x: dictionary to reduce node items into :param tuple y: current node item - :return: + :return: human readable name mapping of the node map """ x[y[0].name] = y[1] return x @@ -33,7 +33,6 @@ def update_node_map(node_map): """ Update the current node map with the provided node map values. - :param dict node_map: node map to update with """ global _NODE_MAP @@ -70,7 +69,7 @@ def get_node_type(node_class): :param class node_class: node class to get type for :return: node type - :rtype: core.enumerations.NodeTypes + :rtype: core.emulator.enumerations.NodeTypes """ global _NODE_MAP node_type_map = {_NODE_MAP[x]: x for x in _NODE_MAP} diff --git a/daemon/core/nodes/openvswitch.py b/daemon/core/nodes/openvswitch.py index facff596..12923f4a 100644 --- a/daemon/core/nodes/openvswitch.py +++ b/daemon/core/nodes/openvswitch.py @@ -53,12 +53,11 @@ class OvsNet(CoreNetworkBase): """ Creates an OvsNet instance. - :param core.session.Session session: session this object is a part of - :param _id: - :param name: - :param start: - :param policy: - :return: + :param core.emulator.session.Session session: session this object is a part of + :param int _id: object id + :param str name: object name + :param bool start: start flag + :param policy: network policy """ CoreNetworkBase.__init__(self, session, _id, name, start) @@ -173,7 +172,7 @@ class OvsNet(CoreNetworkBase): def link(self, interface_one, interface_two): """ - Link two PyCoreNetIfs together, resulting in adding or removing + Link two interfaces together, resulting in adding or removing ebtables filtering rules. """ with self._linked_lock: @@ -299,19 +298,11 @@ class OvsNet(CoreNetworkBase): interface = Veth(node=None, name=name, localname=localname, mtu=1500, net=self, start=self.up) self.attach(interface) if network.up: - # this is similar to net.attach() but uses netif.name instead - # of localname + # this is similar to net.attach() but uses netif.name instead of localname utils.check_cmd([constants.OVS_BIN, "add-port", network.bridge_name, interface.name]) utils.check_cmd([constants.IP_BIN, "link", "set", interface.name, "up"]) - # TODO: is there a native method for this? see if this causes issues - # i = network.newifindex() - # network._netif[i] = interface - # with network._linked_lock: - # network._linked[interface] = {} - # this method call is equal to the above, with a interface.netifi = call network.attach(interface) - interface.net = self interface.othernet = network return interface diff --git a/daemon/core/nodes/physical.py b/daemon/core/nodes/physical.py index 388cddb6..9c57bcb1 100644 --- a/daemon/core/nodes/physical.py +++ b/daemon/core/nodes/physical.py @@ -99,7 +99,7 @@ class PhysicalNode(CoreNodeBase): def sethwaddr(self, ifindex, addr): """ - same as SimpleLxcNode.sethwaddr() + Set hardware address for an interface. """ self._netif[ifindex].sethwaddr(addr) ifname = self.ifname(ifindex) @@ -108,7 +108,7 @@ class PhysicalNode(CoreNodeBase): def addaddr(self, ifindex, addr): """ - same as SimpleLxcNode.addaddr() + Add an address to an interface. """ if self.up: self.check_cmd([constants.IP_BIN, "addr", "add", str(addr), "dev", self.ifname(ifindex)]) @@ -117,7 +117,7 @@ class PhysicalNode(CoreNodeBase): def deladdr(self, ifindex, addr): """ - same as SimpleLxcNode.deladdr() + Delete an address from an interface. """ try: self._netif[ifindex].deladdr(addr) @@ -258,7 +258,7 @@ class Rj45Node(CoreNodeBase, CoreInterface): """ Create an RJ45Node instance. - :param core.session.Session session: core session instance + :param core.emulator.session.Session session: core session instance :param int _id: node id :param str name: node name :param mtu: rj45 mtu @@ -336,7 +336,7 @@ class Rj45Node(CoreNodeBase, CoreInterface): represents an interface, we do not create another object here, but attach ourselves to the given network. - :param core.coreobj.PyCoreNet net: new network instance + :param core.nodes.base.CoreNetworkBase net: new network instance :param list[str] addrlist: address list :param str hwaddr: hardware address :param int ifindex: interface index @@ -392,7 +392,7 @@ class Rj45Node(CoreNodeBase, CoreInterface): :param int ifindex: interface index to retrieve :param net: network to retrieve :return: a network interface - :rtype: core.coreobj.PyCoreNetIf + :rtype: core.nodes.interface,CoreInterface """ if net is not None and net == self.net: return self @@ -409,7 +409,7 @@ class Rj45Node(CoreNodeBase, CoreInterface): """ Retrieve network interface index. - :param core.coreobj.PyCoreNetIf netif: network interface to retrieve index for + :param core.nodes.interface.CoreInterface netif: network interface to retrieve index for :return: interface index, None otherwise :rtype: int """ diff --git a/daemon/core/plugins/sdt.py b/daemon/core/plugins/sdt.py index 79d7597c..0b8e3e9e 100644 --- a/daemon/core/plugins/sdt.py +++ b/daemon/core/plugins/sdt.py @@ -61,7 +61,7 @@ class Sdt(object): """ Creates a Sdt instance. - :param core.session.Session session: session this manager is tied to + :param core.emulator.session.Session session: session this manager is tied to """ self.session = session self.sock = None @@ -83,7 +83,7 @@ class Sdt(object): """ Handler for node updates, specifically for updating their location. - :param core.data.NodeData node_data: node data being updated + :param core.emulator.data.NodeData node_data: node data being updated :return: nothing """ x = node_data.x_position @@ -103,7 +103,7 @@ class Sdt(object): """ Handler for link updates, checking for wireless link/unlink messages. - :param core.data.LinkData link_data: link data being updated + :param core.emulator.data.LinkData link_data: link data being updated :return: nothing """ if link_data.link_type == LinkTypes.WIRELESS.value: diff --git a/daemon/core/services/coreservices.py b/daemon/core/services/coreservices.py index 59448fd2..9b3c04b1 100644 --- a/daemon/core/services/coreservices.py +++ b/daemon/core/services/coreservices.py @@ -125,7 +125,7 @@ class ServiceShim(object): Convert service properties into a string list of key=value pairs, separated by "|". - :param core.netns.vnode.CoreNode node: node to get value list for + :param core.nodes.base.CoreNode node: node to get value list for :param CoreService service: service to get value list for :return: value list string :rtype: str @@ -441,7 +441,7 @@ class CoreServices(object): """ Start all service boot paths found, based on dependencies. - :param core.netns.vnode.LxcNode node: node to start services on + :param core.nodes.base.CoreNode node: node to start services on :param list[CoreService] boot_path: service to start in dependent order :return: nothing """ @@ -458,7 +458,7 @@ class CoreServices(object): Start a service on a node. Create private dirs, generate config files, and execute startup commands. - :param core.netns.vnode.LxcNode node: node to boot services on + :param core.nodes.base.CoreNode node: node to boot services on :param CoreService service: service to start :return: nothing """ @@ -511,7 +511,7 @@ class CoreServices(object): config references an existing file that should be copied. Returns True for local files, False for generated. - :param core.netns.vnode.LxcNode node: node to copy service for + :param core.nodes.base.CoreNode node: node to copy service for :param str filename: file name for a configured service :param str cfg: configuration string :return: True if successful, False otherwise @@ -530,7 +530,7 @@ class CoreServices(object): """ Run the validation command(s) for a service. - :param core.netns.vnode.LxcNode node: node to validate service for + :param core.nodes.base.CoreNode node: node to validate service for :param CoreService service: service to validate :return: service validation status :rtype: int @@ -567,7 +567,7 @@ class CoreServices(object): """ Stop a service on a node. - :param core.netns.vnode.LxcNode node: node to stop a service on + :param core.nodes.base.CoreNode node: node to stop a service on :param CoreService service: service to stop :return: status for stopping the services :rtype: str @@ -586,7 +586,7 @@ class CoreServices(object): Send a File Message when the GUI has requested a service file. The file data is either auto-generated or comes from an existing config. - :param core.netns.vnode.LxcNode node: node to get service file from + :param core.nodes.base.CoreNode node: node to get service file from :param str service_name: service to get file from :param str filename: file name to retrieve :return: file message for node @@ -655,7 +655,7 @@ class CoreServices(object): """ Startup a node service. - :param PyCoreNode node: node to reconfigure service for + :param core.nodes.base.CoreNode node: node to reconfigure service for :param CoreService service: service to reconfigure :param bool wait: determines if we should wait to validate startup :return: status of startup @@ -682,7 +682,7 @@ class CoreServices(object): """ Creates node service files. - :param PyCoreNode node: node to reconfigure service for + :param core.nodes.base.CoreNode node: node to reconfigure service for :param CoreService service: service to reconfigure :return: nothing """ @@ -715,7 +715,7 @@ class CoreServices(object): """ Reconfigure a node service. - :param PyCoreNode node: node to reconfigure service for + :param core.nodes.base.CoreNode node: node to reconfigure service for :param CoreService service: service to reconfigure :return: nothing """ @@ -805,7 +805,7 @@ class CoreService(object): returns the cls._configs tuple, but this method may be overriden to provide node-specific filenames that may be based on other services. - :param core.netns.vnode.LxcNode node: node to generate config for + :param core.nodes.base.CoreNode node: node to generate config for :return: configuration files :rtype: tuple """ @@ -819,7 +819,7 @@ class CoreService(object): Return the configuration string to be written to a file or sent to the GUI for customization. - :param core.netns.vnode.LxcNode node: node to generate config for + :param core.nodes.base.CoreNode node: node to generate config for :param str filename: file name to generate config for :return: nothing """ @@ -833,7 +833,7 @@ class CoreService(object): overridden to provide node-specific commands that may be based on other services. - :param core.netns.vnode.LxcNode node: node to get startup for + :param core.nodes.base.CoreNode node: node to get startup for :return: startup commands :rtype: tuple """ @@ -847,7 +847,7 @@ class CoreService(object): overridden to provide node-specific commands that may be based on other services. - :param core.netns.vnode.LxcNode node: node to validate + :param core.nodes.base.CoreNode node: node to validate :return: validation commands :rtype: tuple """ diff --git a/daemon/core/utils.py b/daemon/core/utils.py index 366c8b44..5b18f230 100644 --- a/daemon/core/utils.py +++ b/daemon/core/utils.py @@ -313,8 +313,8 @@ def expand_corepath(pathname, session=None, node=None): Expand a file path given session information. :param str pathname: file path to expand - :param core.session.Session session: core session object to expand path with - :param core.netns.LxcNode node: node to expand path with + :param core.emulator.session.Session session: core session object to expand path with + :param core.nodes.base.CoreNode node: node to expand path with :return: expanded path :rtype: str """