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