fixed formatting in docs due

This commit is contained in:
Blake Harnden 2020-01-16 16:12:01 -08:00
parent 5490f961a6
commit b8ded52a66
23 changed files with 106 additions and 109 deletions

View file

@ -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

View file

@ -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:

View file

@ -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:

View file

@ -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 []

View file

@ -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:

View file

@ -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:

View file

@ -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))

View file

@ -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