From b8ded52a66d372a19b3b00bd468dca800e653478 Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Thu, 16 Jan 2020 16:12:01 -0800 Subject: [PATCH] fixed formatting in docs due --- daemon/core/emane/emanemanager.py | 6 ++--- daemon/core/emane/emanemanifest.py | 7 +++-- daemon/core/emane/emanemodel.py | 4 +-- daemon/core/emulator/coreemu.py | 4 +-- daemon/core/emulator/distributed.py | 4 +-- daemon/core/emulator/emudata.py | 8 +++--- daemon/core/emulator/session.py | 16 +++++------ daemon/core/location/corelocation.py | 6 ++--- daemon/core/location/event.py | 4 +-- daemon/core/location/mobility.py | 14 +++++----- daemon/core/nodes/base.py | 40 ++++++++++++++-------------- daemon/core/nodes/client.py | 2 +- daemon/core/nodes/docker.py | 2 +- daemon/core/nodes/interface.py | 8 +++--- daemon/core/nodes/lxd.py | 2 +- daemon/core/nodes/netclient.py | 6 ++--- daemon/core/nodes/network.py | 19 +++++++------ daemon/core/nodes/physical.py | 6 ++--- daemon/core/plugins/sdt.py | 10 +++---- daemon/core/services/__init__.py | 2 +- daemon/core/services/coreservices.py | 29 ++++++++++---------- daemon/core/services/nrl.py | 2 +- daemon/core/xml/emanexml.py | 14 +++++----- 23 files changed, 106 insertions(+), 109 deletions(-) diff --git a/daemon/core/emane/emanemanager.py b/daemon/core/emane/emanemanager.py index 4acc512b..0c508284 100644 --- a/daemon/core/emane/emanemanager.py +++ b/daemon/core/emane/emanemanager.py @@ -104,7 +104,7 @@ class EmaneManager(ModelManager): :param interface: node interface :param model_name: model to get configuration for :return: node/interface model configuration -""" + """ # use the network-wide config values or interface(NEM)-specific values? if interface is None: return self.get_configs(node_id=node_id, config_type=model_name) @@ -258,7 +258,7 @@ class EmaneManager(ModelManager): :return: SUCCESS, NOT_NEEDED, NOT_READY in order to delay session instantiation -""" + """ logging.debug("emane setup") # TODO: drive this from the session object @@ -316,7 +316,7 @@ class EmaneManager(ModelManager): :return: SUCCESS, NOT_NEEDED, NOT_READY in order to delay session instantiation -""" + """ self.reset() r = self.setup() diff --git a/daemon/core/emane/emanemanifest.py b/daemon/core/emane/emanemanifest.py index 5a51dedb..914b4f83 100644 --- a/daemon/core/emane/emanemanifest.py +++ b/daemon/core/emane/emanemanifest.py @@ -36,7 +36,7 @@ def _get_possible(config_type: str, config_regex: str) -> List[str]: :param config_type: emane configuration type :param config_regex: emane configuration regex :return: a string listing comma delimited values, if needed, empty string otherwise -""" + """ if config_type == "bool": return ["On", "Off"] @@ -54,8 +54,7 @@ def _get_default(config_type_name: str, config_value: List[str]) -> str: :param config_type_name: emane configuration type name :param config_value: emane configuration value list :return: default core config value -""" - + """ config_default = "" if config_type_name == "bool": @@ -78,7 +77,7 @@ def parse(manifest_path: str, defaults: Dict[str, str]) -> List[Configuration]: :param manifest_path: absolute manifest file path :param defaults: used to override default values for configurations :return: list of core configuration values -""" + """ # no results when emane bindings are not present if not manifest: diff --git a/daemon/core/emane/emanemodel.py b/daemon/core/emane/emanemodel.py index 5ac85c9d..001ea8b0 100644 --- a/daemon/core/emane/emanemodel.py +++ b/daemon/core/emane/emanemodel.py @@ -70,7 +70,7 @@ class EmaneModel(WirelessModel): Returns the combination all all configurations (mac, phy, and external). :return: all configurations -""" + """ return cls.mac_config + cls.phy_config + cls.external_config @classmethod @@ -79,7 +79,7 @@ class EmaneModel(WirelessModel): Returns the defined configuration groups. :return: list of configuration groups. -""" + """ mac_len = len(cls.mac_config) phy_len = len(cls.phy_config) + mac_len config_len = len(cls.configurations()) diff --git a/daemon/core/emulator/coreemu.py b/daemon/core/emulator/coreemu.py index 23ef81da..3fe4a40f 100644 --- a/daemon/core/emulator/coreemu.py +++ b/daemon/core/emulator/coreemu.py @@ -91,7 +91,7 @@ class CoreEmu: :param _id: session id for new session :param _cls: Session class to use :return: created session -""" + """ if not _id: _id = 1 while _id in self.sessions: @@ -107,7 +107,7 @@ class CoreEmu: :param _id: session id to delete :return: True if deleted, False otherwise -""" + """ logging.info("deleting session: %s", _id) session = self.sessions.pop(_id, None) result = False diff --git a/daemon/core/emulator/distributed.py b/daemon/core/emulator/distributed.py index d332b170..60b83b82 100644 --- a/daemon/core/emulator/distributed.py +++ b/daemon/core/emulator/distributed.py @@ -200,7 +200,7 @@ class DistributedController: :param server: server to create tunnel for :return: local and remote gre taps created for tunnel -""" + """ host = server.host key = self.tunnel_key(node.id, netaddr.IPAddress(host).value) tunnel = self.tunnels.get(key) @@ -237,7 +237,7 @@ class DistributedController: :param n1_id: node one id :param n2_id: node two id :return: tunnel key for the node pair -""" + """ logging.debug("creating tunnel key for: %s, %s", n1_id, n2_id) key = ( (self.session.id << 16) ^ utils.hashkey(n1_id) ^ (utils.hashkey(n2_id) << 8) diff --git a/daemon/core/emulator/emudata.py b/daemon/core/emulator/emudata.py index f4e93940..96eab522 100644 --- a/daemon/core/emulator/emudata.py +++ b/daemon/core/emulator/emudata.py @@ -217,7 +217,7 @@ class InterfaceData: Returns a list of ip4 and ip6 address when present. :return: list of addresses -""" + """ ip4 = self.ip4_address() ip6 = self.ip6_address() return [i for i in [ip4, ip6] if i] @@ -252,7 +252,7 @@ class IpPrefixes: :param node: node to get IP4 address for :return: IP4 address or None -""" + """ if not self.ip4: raise ValueError("ip4 prefixes have not been set") return str(self.ip4[node.id]) @@ -263,7 +263,7 @@ class IpPrefixes: :param node: node to get IP6 address for :return: IP4 address or None -""" + """ if not self.ip6: raise ValueError("ip6 prefixes have not been set") return str(self.ip6[node.id]) @@ -280,7 +280,7 @@ class IpPrefixes: :param mac: mac address to use for this interface, default is random generation :return: new interface data for the provided node -""" + """ # interface id inteface_id = node.newifindex() diff --git a/daemon/core/emulator/session.py b/daemon/core/emulator/session.py index 3d03d73a..c3083e70 100644 --- a/daemon/core/emulator/session.py +++ b/daemon/core/emulator/session.py @@ -199,7 +199,7 @@ class Session: :param node_one_id: node one id :param node_two_id: node two id :return: nodes, network nodes if present, and tunnel if present -""" + """ logging.debug( "link message between node1(%s) and node2(%s)", node_one_id, node_two_id ) @@ -1254,7 +1254,7 @@ class Session: :param state: flag to determine if session state should be included :return: environment variables -""" + """ env = os.environ.copy() env["SESSION"] = str(self.id) env["SESSION_SHORT"] = self.short_session_id() @@ -1374,7 +1374,7 @@ class Session: :param _id: id of node to delete :return: True if node deleted, False otherwise -""" + """ # delete node and check for session shutdown if a node was removed logging.info("deleting node(%s)", _id) node = None @@ -1610,7 +1610,7 @@ class Session: request flag. :return: service boot exceptions -""" + """ with self._nodes_lock: funcs = [] start = time.monotonic() @@ -1631,7 +1631,7 @@ class Session: Retrieve control net prefixes. :return: control net prefix list -""" + """ p = self.options.get_config("controlnet") p0 = self.options.get_config("controlnet0") p1 = self.options.get_config("controlnet1") @@ -1646,7 +1646,7 @@ class Session: Retrieve control net server interfaces. :return: list of control net server interfaces -""" + """ d0 = self.options.get_config("controlnetif0") if d0: logging.error("controlnet0 cannot be assigned with a host interface") @@ -1661,7 +1661,7 @@ class Session: :param dev: device to get control net index for :return: control net index, -1 otherwise -""" + """ if dev[0:4] == "ctrl" and int(dev[4]) in [0, 1, 2, 3]: index = int(dev[4]) if index == 0: @@ -1696,7 +1696,7 @@ class Session: :param remove: flag to check if it should be removed :param conf_required: flag to check if conf is required :return: control net node -""" + """ logging.debug( "add/remove control net: index(%s) remove(%s) conf_required(%s)", net_index, diff --git a/daemon/core/location/corelocation.py b/daemon/core/location/corelocation.py index b744b935..6eb7d16d 100644 --- a/daemon/core/location/corelocation.py +++ b/daemon/core/location/corelocation.py @@ -100,7 +100,7 @@ class CoreLocation: :param y: y value :param z: z value :return: lat, lon, alt values for provided coordinates -""" + """ # shift (x,y,z) over to reference point (x,y,z) x -= self.refxyz[0] y = -(y - self.refxyz[1]) @@ -142,7 +142,7 @@ class CoreLocation: :param lon: longitude :param alt: altitude :return: converted x, y, z coordinates -""" + """ # convert lat/lon to UTM coordinates in meters e, n, zonen, zonel = utm.from_latlon(lat, lon) _rlat, _rlon, ralt = self.refgeo @@ -249,7 +249,7 @@ class CoreLocation: :param e: easting value :param n: northing value :return: modified easting, northing, and zone values -""" + """ zone = self.refutm[0] rlat, rlon, _ralt = self.refgeo if e > 834000 or e < 166000: diff --git a/daemon/core/location/event.py b/daemon/core/location/event.py index acba5e5a..8826c42b 100644 --- a/daemon/core/location/event.py +++ b/daemon/core/location/event.py @@ -51,7 +51,7 @@ class Timer(threading.Thread): the timer was already running. :return: True if canceled, False otherwise -""" + """ locked = self._running.acquire(False) if locked: self.finished.set() @@ -222,7 +222,7 @@ class EventLoop: :param args: event arguments :param kwds: event keyword arguments :return: created event -""" + """ with self.lock: eventnum = self.eventnum self.eventnum += 1 diff --git a/daemon/core/location/mobility.py b/daemon/core/location/mobility.py index 320b6f9e..703eaa9f 100644 --- a/daemon/core/location/mobility.py +++ b/daemon/core/location/mobility.py @@ -233,7 +233,7 @@ class WirelessModel(ConfigurableOptions): :param flags: link data flags :return: link data -""" + """ return [] def update(self, moved: bool, moved_netifs: List[CoreInterface]) -> None: @@ -473,7 +473,7 @@ class BasicRangeModel(WirelessModel): :param p1: point one :param p2: point two :return: distance petween the points -""" + """ a = p1[0] - p2[0] b = p1[1] - p2[1] c = 0 @@ -502,7 +502,7 @@ class BasicRangeModel(WirelessModel): :param interface2: interface two :param message_type: link message type :return: link data -""" + """ return LinkData( message_type=message_type, node1_id=interface1.node.id, @@ -536,7 +536,7 @@ class BasicRangeModel(WirelessModel): :param flags: link flags :return: all link data -""" + """ all_links = [] with self.wlan._linked_lock: for a in self.wlan._linked: @@ -690,7 +690,7 @@ class WayPointMobility(WirelessModel): :param node: node to move :param dt: move factor :return: True if node was moved, False otherwise -""" + """ if node.id not in self.points: return False x1, y1, z1 = node.getposition() @@ -1058,7 +1058,7 @@ class Ns2ScriptedMobility(WayPointMobility): :param file_name: file name to find :return: absolute path to the file -""" + """ if os.path.exists(file_name): return file_name @@ -1103,7 +1103,7 @@ class Ns2ScriptedMobility(WayPointMobility): :param nodenum: node id to map :return: mapped value or the node id itself -""" + """ nodenum = int(nodenum) return self.nodemap.get(nodenum, nodenum) diff --git a/daemon/core/nodes/base.py b/daemon/core/nodes/base.py index b1c5a227..d31701b8 100644 --- a/daemon/core/nodes/base.py +++ b/daemon/core/nodes/base.py @@ -123,7 +123,7 @@ class NodeBase: :param y: y position :param z: z position :return: True if position changed, False otherwise -""" + """ return self.position.set(x=x, y=y, z=z) def getposition(self) -> Tuple[float, float, float]: @@ -131,7 +131,7 @@ class NodeBase: Return an (x,y,z) tuple representing this object's position. :return: x,y,z position tuple -""" + """ return self.position.get() def ifname(self, ifindex: int) -> str: @@ -140,7 +140,7 @@ class NodeBase: :param ifindex: interface index :return: interface name -""" + """ return self._netif[ifindex].name def netifs(self, sort: bool = False) -> List[CoreInterface]: @@ -149,7 +149,7 @@ class NodeBase: :param sort: boolean used to determine if interfaces should be sorted :return: network interfaces -""" + """ if sort: return [self._netif[x] for x in sorted(self._netif)] else: @@ -160,7 +160,7 @@ class NodeBase: Return the attached interface count. :return: number of network interfaces -""" + """ return len(self._netif) def getifindex(self, netif: CoreInterface) -> int: @@ -169,7 +169,7 @@ class NodeBase: :param netif: interface to get index for :return: interface index if found, -1 otherwise -""" + """ for ifindex in self._netif: if self._netif[ifindex] is netif: return ifindex @@ -180,7 +180,7 @@ class NodeBase: Create a new interface index. :return: interface index -""" + """ while self.ifindex in self._netif: self.ifindex += 1 ifindex = self.ifindex @@ -204,7 +204,7 @@ class NodeBase: :param alt: altitude :param source: source of node data :return: node data object -""" + """ if self.apitype is None: return None @@ -248,7 +248,7 @@ class NodeBase: :param flags: message flags :return: list of link data -""" + """ return [] @@ -338,7 +338,7 @@ class CoreNodeBase(NodeBase): :param ifindex: index of interface to retrieve :return: network interface, or None if not found -""" + """ if ifindex in self._netif: return self._netif[ifindex] else: @@ -392,7 +392,7 @@ class CoreNodeBase(NodeBase): :param obj: object to get common network with :param want_ctrl: flag set to determine if control network are wanted :return: tuples of common networks -""" + """ common = [] for netif1 in self.netifs(): if not want_ctrl and hasattr(netif1, "control"): @@ -487,7 +487,7 @@ class CoreNode(CoreNodeBase): Check if the node is alive. :return: True if node is alive, False otherwise -""" + """ try: self.host_cmd(f"kill -0 {self.pid}") except CoreCommandError: @@ -647,7 +647,7 @@ class CoreNode(CoreNodeBase): Retrieve a new interface index. :return: new interface index -""" + """ with self.lock: return super().newifindex() @@ -715,7 +715,7 @@ class CoreNode(CoreNodeBase): :param ifindex: interface index :param ifname: interface name :return: interface index -""" + """ with self.lock: if ifindex is None: ifindex = self.newifindex() @@ -817,7 +817,7 @@ class CoreNode(CoreNodeBase): :param ifindex: index of interface to create :param ifname: name for interface :return: interface index -""" + """ if not addrlist: addrlist = [] @@ -984,7 +984,7 @@ class CoreNetworkBase(NodeBase): :param net: network to link with :return: created interface -""" + """ pass def getlinknetif(self, net: "CoreNetworkBase") -> CoreInterface: @@ -993,7 +993,7 @@ class CoreNetworkBase(NodeBase): :param net: interface to get link for :return: interface the provided network is linked to -""" + """ for netif in self.netifs(): if hasattr(netif, "othernet") and netif.othernet == net: return netif @@ -1031,7 +1031,7 @@ class CoreNetworkBase(NodeBase): :param flags: message type :return: list of link data -""" + """ all_links = [] # build a link message from this network node to each node having a @@ -1142,7 +1142,7 @@ class Position: :param y: y position :param z: z position :return: True if position changed, False otherwise -""" + """ if self.x == x and self.y == y and self.z == z: return False self.x = x @@ -1155,5 +1155,5 @@ class Position: Retrieve x,y,z position. :return: x,y,z position tuple -""" + """ return self.x, self.y, self.z diff --git a/daemon/core/nodes/client.py b/daemon/core/nodes/client.py index 989bee41..cd39eb37 100644 --- a/daemon/core/nodes/client.py +++ b/daemon/core/nodes/client.py @@ -38,7 +38,7 @@ class VnodeClient: Check if node is connected or not. :return: True if connected, False otherwise -""" + """ return True def close(self) -> None: diff --git a/daemon/core/nodes/docker.py b/daemon/core/nodes/docker.py index 7590dd32..4622f4f5 100644 --- a/daemon/core/nodes/docker.py +++ b/daemon/core/nodes/docker.py @@ -118,7 +118,7 @@ class DockerNode(CoreNode): Check if the node is alive. :return: True if node is alive, False otherwise -""" + """ return self.client.is_alive() def startup(self) -> None: diff --git a/daemon/core/nodes/interface.py b/daemon/core/nodes/interface.py index 9a8e4554..fe15ba95 100644 --- a/daemon/core/nodes/interface.py +++ b/daemon/core/nodes/interface.py @@ -226,7 +226,7 @@ class CoreInterface: :param other: other interface :return: true if less than, false otherwise -""" + """ return id(self) < id(other) @@ -374,7 +374,7 @@ class TunTap(CoreInterface): :param attempts: number of attempts to wait for a zero result :param maxretrydelay: maximum retry delay :return: True if wait succeeded, False otherwise -""" + """ delay = 0.01 result = False for i in range(1, attempts + 1): @@ -402,7 +402,7 @@ class TunTap(CoreInterface): appear right away waits :return: wait for device local response -""" + """ logging.debug("waiting for device local: %s", self.localname) def localdevexists(): @@ -560,5 +560,5 @@ class GreTap(CoreInterface): :param flags: link flags :return: link data -""" + """ return [] diff --git a/daemon/core/nodes/lxd.py b/daemon/core/nodes/lxd.py index 357c6b56..b64c0206 100644 --- a/daemon/core/nodes/lxd.py +++ b/daemon/core/nodes/lxd.py @@ -102,7 +102,7 @@ class LxcNode(CoreNode): Check if the node is alive. :return: True if node is alive, False otherwise -""" + """ return self.client.is_alive() def startup(self) -> None: diff --git a/daemon/core/nodes/netclient.py b/daemon/core/nodes/netclient.py index 9ad72d57..40d26f7f 100644 --- a/daemon/core/nodes/netclient.py +++ b/daemon/core/nodes/netclient.py @@ -73,7 +73,7 @@ class LinuxNetClient: :param device: device to get information for :return: device information -""" + """ return self.run(f"{IP_BIN} link show {device}") def get_mac(self, device: str) -> str: @@ -82,7 +82,7 @@ class LinuxNetClient: :param device: device to get mac for :return: MAC address -""" + """ return self.run(f"cat /sys/class/net/{device}/address") def get_ifindex(self, device: str) -> str: @@ -91,7 +91,7 @@ class LinuxNetClient: :param device: device to get ifindex for :return: ifindex -""" + """ return self.run(f"cat /sys/class/net/{device}/ifindex") def device_ns(self, device: str, namespace: str) -> None: diff --git a/daemon/core/nodes/network.py b/daemon/core/nodes/network.py index 20c1ad16..2d24b24f 100644 --- a/daemon/core/nodes/network.py +++ b/daemon/core/nodes/network.py @@ -102,7 +102,7 @@ class EbtablesQueue: :param cmd: ebtable command :return: ebtable atomic command -""" + """ return f"{EBTABLES_BIN} --atomic-file {self.atomic_file} {cmd}" def lastupdate(self, wlan: "CoreNetwork") -> float: @@ -111,7 +111,7 @@ class EbtablesQueue: :param wlan: wlan entity :return: elpased time -""" + """ try: elapsed = time.monotonic() - self.last_update_time[wlan] except KeyError: @@ -387,7 +387,7 @@ class CoreNetwork(CoreNetworkBase): :param netif1: interface one :param netif2: interface two :return: True if interfaces are linked, False otherwise -""" + """ # check if the network interfaces are attached to this network if self._netif[netif1.netifi] != netif1: raise ValueError(f"inconsistency for netif {netif1.name}") @@ -544,7 +544,7 @@ class CoreNetwork(CoreNetworkBase): :param net: network to link with :return: created interface -""" + """ sessionid = self.session.short_session_id() try: _id = f"{self.id:x}" @@ -584,7 +584,7 @@ class CoreNetwork(CoreNetworkBase): :param net: interface to get link for :return: interface the provided network is linked to -""" + """ for netif in self.netifs(): if hasattr(netif, "othernet") and netif.othernet == net: return netif @@ -855,7 +855,7 @@ class CtrlNet(CoreNetwork): :param flags: message flags :return: list of link data -""" + """ return [] @@ -897,7 +897,7 @@ class PtpNet(CoreNetwork): :param alt: altitude :param source: source of node data :return: node data object -""" + """ return None def all_link_data(self, flags: int) -> List[LinkData]: @@ -907,8 +907,7 @@ class PtpNet(CoreNetwork): :param flags: message flags :return: list of link data -""" - + """ all_links = [] if len(self._netif) != 2: @@ -1130,7 +1129,7 @@ class WlanNode(CoreNetwork): :param flags: message flags :return: list of link data -""" + """ all_links = super().all_link_data(flags) if self.model: all_links.extend(self.model.all_link_data(flags)) diff --git a/daemon/core/nodes/physical.py b/daemon/core/nodes/physical.py index c01d5057..fc3a7b00 100644 --- a/daemon/core/nodes/physical.py +++ b/daemon/core/nodes/physical.py @@ -424,7 +424,7 @@ class Rj45Node(CoreNodeBase, CoreInterface): :param ifindex: interface index to retrieve :param net: network to retrieve :return: a network interface -""" + """ if net is not None and net == self.net: return self @@ -443,7 +443,7 @@ class Rj45Node(CoreNodeBase, CoreInterface): :param netif: network interface to retrieve index for :return: interface index, None otherwise -""" + """ if netif != self: return None return self.ifindex @@ -526,7 +526,7 @@ class Rj45Node(CoreNodeBase, CoreInterface): :param y: y position :param z: z position :return: True if position changed, False otherwise -""" + """ result = CoreNodeBase.setposition(self, x, y, z) CoreInterface.setposition(self, x, y, z) return result diff --git a/daemon/core/plugins/sdt.py b/daemon/core/plugins/sdt.py index 1ce6bb8d..b6dcdd1b 100644 --- a/daemon/core/plugins/sdt.py +++ b/daemon/core/plugins/sdt.py @@ -134,7 +134,7 @@ class Sdt: the option is missing. :return: True if enabled, False otherwise -""" + """ return self.session.options.get_config("enablesdt") == "1" def seturl(self) -> None: @@ -156,7 +156,7 @@ class Sdt: Connect to the SDT address/port if enabled. :return: True if connected, False otherwise -""" + """ if not self.is_enabled(): return False if self.connected: @@ -194,7 +194,7 @@ class Sdt: the virtual globe. :return: initialize command status -""" + """ if not self.cmd(f'path "{CORE_DATA_DIR}/icons/normal"'): return False # send node type to icon mappings @@ -238,7 +238,7 @@ class Sdt: :param cmdstr: command to send :return: True if command was successful, False otherwise -""" + """ if self.sock is None: return False try: @@ -507,7 +507,7 @@ class Sdt: :param nodenum: node id to check :return: True if node is wlan or emane, False otherwise -""" + """ if nodenum in self.remotes: node_type = self.remotes[nodenum].type if node_type in ("wlan", "emane"): diff --git a/daemon/core/services/__init__.py b/daemon/core/services/__init__.py index 562b4bd7..94e1e9d1 100644 --- a/daemon/core/services/__init__.py +++ b/daemon/core/services/__init__.py @@ -16,5 +16,5 @@ def load(): Loads all services from the modules that reside under core.services. :return: list of services that failed to load -""" + """ return ServiceManager.add_services(_PATH) diff --git a/daemon/core/services/coreservices.py b/daemon/core/services/coreservices.py index 46cc6292..66214122 100644 --- a/daemon/core/services/coreservices.py +++ b/daemon/core/services/coreservices.py @@ -60,7 +60,7 @@ class ServiceDependencies: Generates the boot paths for the services provided to the class. :return: list of services to boot, in order -""" + """ paths = [] for name in self.node_services: service = self.node_services[name] @@ -151,7 +151,7 @@ class ServiceShim: :param node: node to get value list for :param service: service to get value list for :return: value list string -""" + """ start_time = 0 start_index = 0 valmap = [ @@ -229,7 +229,7 @@ class ServiceShim: :param opaque: opaque data string :return: services -""" + """ servicesstring = opaque.split(":") if servicesstring[0] != "service": return [] @@ -280,7 +280,7 @@ class ServiceManager: :param name: name of the service to retrieve :return: service if it exists, None otherwise -""" + """ return cls.services.get(name) @classmethod @@ -290,7 +290,7 @@ class ServiceManager: :param path: path to retrieve services from :return: list of core services that failed to load -""" + """ service_errors = [] services = utils.load_classes(path, CoreService) for service in services: @@ -342,7 +342,7 @@ class CoreServices: :param node_type: node type to get default services for :return: default services -""" + """ logging.debug("getting default services for type: %s", node_type) results = [] defaults = self.default_services.get(node_type, []) @@ -426,7 +426,7 @@ class CoreServices: to a session or opening XML. :return: list of tuples of node ids and services -""" + """ configs = [] for node_id in self.custom_services: custom_services = self.custom_services[node_id] @@ -442,7 +442,7 @@ class CoreServices: :param service: service to get files for :return: list of all custom service files -""" + """ files = [] if not service.custom: return files @@ -566,7 +566,7 @@ class CoreServices: :param filename: file name for a configured service :param cfg: configuration string :return: True if successful, False otherwise -""" + """ if cfg[:7] == "file://": src = cfg[7:] src = src.split("\n")[0] @@ -583,7 +583,7 @@ class CoreServices: :param node: node to validate service for :param service: service to validate :return: service validation status -""" + """ logging.debug("validating node(%s) service(%s)", node.name, service.name) cmds = service.validate if not service.custom: @@ -723,8 +723,7 @@ class CoreServices: :param service: service to reconfigure :param wait: determines if we should wait to validate startup :return: status of startup -""" - + """ cmds = service.startup if not service.custom: cmds = service.get_startup(node) @@ -869,7 +868,7 @@ class CoreService: :param node: node to generate config for :return: configuration files -""" + """ return cls.configs @classmethod @@ -896,7 +895,7 @@ class CoreService: :param node: node to get startup for :return: startup commands -""" + """ return cls.startup @classmethod @@ -909,5 +908,5 @@ class CoreService: :param node: node to validate :return: validation commands -""" + """ return cls.validate diff --git a/daemon/core/services/nrl.py b/daemon/core/services/nrl.py index ef75a08b..3c9f262d 100644 --- a/daemon/core/services/nrl.py +++ b/daemon/core/services/nrl.py @@ -12,7 +12,7 @@ class NrlService(CoreService): """ Parent class for NRL services. Defines properties and methods common to NRL's routing daemons. - """ "" + """ name = None group = "ProtoSvc" diff --git a/daemon/core/xml/emanexml.py b/daemon/core/xml/emanexml.py index 7d4ccd68..2c5cc9c0 100644 --- a/daemon/core/xml/emanexml.py +++ b/daemon/core/xml/emanexml.py @@ -26,7 +26,7 @@ def is_external(config: Dict[str, str]) -> bool: :param config: configuration to check :return: True if external, False otherwise -""" + """ return config.get("external") == "1" @@ -144,7 +144,7 @@ def build_node_platform_xml( :param nem_id: nem id to use for interfaces for this node :param platform_xmls: stores platform xml elements to append nem entries to :return: the next nem id that can be used for creating platform xml files -""" + """ logging.debug( "building emane platform xml for node(%s) nem_id(%s): %s", node, @@ -500,7 +500,7 @@ def _basename(emane_model: "EmaneModel", interface: CoreInterface = None) -> str :param emane_model: emane model to create name for :param interface: interface for this model :return: basename used for file creation -""" + """ name = f"n{emane_model.id}" if interface: @@ -518,7 +518,7 @@ def nem_file_name(emane_model: "EmaneModel", interface: CoreInterface = None) -> :param emane_model: emane model to create file :param interface: interface for this model :return: nem xml filename -""" + """ basename = _basename(emane_model, interface) append = "" if interface and interface.transport_type == "raw": @@ -533,7 +533,7 @@ def shim_file_name(emane_model: "EmaneModel", interface: CoreInterface = None) - :param emane_model: emane model to create file :param interface: interface for this model :return: shim xml filename -""" + """ name = _basename(emane_model, interface) return f"{name}shim.xml" @@ -545,7 +545,7 @@ def mac_file_name(emane_model: "EmaneModel", interface: CoreInterface = None) -> :param emane_model: emane model to create file :param interface: interface for this model :return: mac xml filename -""" + """ name = _basename(emane_model, interface) return f"{name}mac.xml" @@ -557,6 +557,6 @@ def phy_file_name(emane_model: "EmaneModel", interface: CoreInterface = None) -> :param emane_model: emane model to create file :param interface: interface for this model :return: phy xml filename -""" + """ name = _basename(emane_model, interface) return f"{name}phy.xml"