daemon: fixed issue with using the wrong emane network for a given emane connected interface
This commit is contained in:
parent
371ca72900
commit
0177b07f03
2 changed files with 15 additions and 10 deletions
|
@ -71,7 +71,6 @@ class EmaneState(Enum):
|
|||
|
||||
@dataclass
|
||||
class StartData:
|
||||
emane_net: EmaneNet
|
||||
node: CoreNodeBase
|
||||
ifaces: List[CoreInterface] = field(default_factory=list)
|
||||
|
||||
|
@ -370,9 +369,7 @@ class EmaneManager(ModelManager):
|
|||
iface.name,
|
||||
)
|
||||
continue
|
||||
start_node = node_map.setdefault(
|
||||
iface.node, StartData(emane_net, iface.node)
|
||||
)
|
||||
start_node = node_map.setdefault(iface.node, StartData(iface.node))
|
||||
start_node.ifaces.append(iface)
|
||||
start_nodes = sorted(node_map.values(), key=lambda x: x.node.id)
|
||||
for start_node in start_nodes:
|
||||
|
@ -386,7 +383,7 @@ class EmaneManager(ModelManager):
|
|||
emanexml.build_platform_xml(self, control_net, data)
|
||||
self.start_daemon(data.node)
|
||||
for iface in data.ifaces:
|
||||
self.install_iface(data.emane_net, iface)
|
||||
self.install_iface(iface)
|
||||
|
||||
def set_nem(self, nem_id: int, iface: CoreInterface) -> None:
|
||||
if nem_id in self.nems_to_ifaces:
|
||||
|
@ -606,7 +603,12 @@ class EmaneManager(ModelManager):
|
|||
node.host_cmd(emanecmd, cwd=path)
|
||||
logging.info("node(%s) host emane daemon running: %s", node.name, emanecmd)
|
||||
|
||||
def install_iface(self, emane_net: EmaneNet, iface: CoreInterface) -> None:
|
||||
def install_iface(self, iface: CoreInterface) -> None:
|
||||
emane_net = iface.net
|
||||
if not isinstance(emane_net, EmaneNet):
|
||||
raise CoreError(
|
||||
f"emane interface not connected to emane net: {emane_net.name}"
|
||||
)
|
||||
config = self.get_iface_config(emane_net, iface)
|
||||
external = config.get("external", "0")
|
||||
if isinstance(iface, TunTap) and external == "0":
|
||||
|
|
|
@ -7,6 +7,7 @@ from lxml import etree
|
|||
|
||||
from core import utils
|
||||
from core.config import Configuration
|
||||
from core.emane.nodes import EmaneNet
|
||||
from core.emulator.distributed import DistributedServer
|
||||
from core.errors import CoreError
|
||||
from core.nodes.base import CoreNode, CoreNodeBase
|
||||
|
@ -166,8 +167,12 @@ def build_platform_xml(
|
|||
add_param(platform_element, name, value)
|
||||
|
||||
# create nem xml entries for all interfaces
|
||||
emane_net = data.emane_net
|
||||
for iface in data.ifaces:
|
||||
emane_net = iface.net
|
||||
if not isinstance(emane_net, EmaneNet):
|
||||
raise CoreError(
|
||||
f"emane interface not connected to emane net: {emane_net.name}"
|
||||
)
|
||||
nem_id = emane_manager.next_nem_id()
|
||||
emane_manager.set_nem(nem_id, iface)
|
||||
emane_manager.write_nem(iface, nem_id)
|
||||
|
@ -180,9 +185,7 @@ def build_platform_xml(
|
|||
"nem", id=str(nem_id), name=iface.localname, definition=nem_definition
|
||||
)
|
||||
|
||||
# check if this is an external transport, get default config if an interface
|
||||
# specific one does not exist
|
||||
config = emane_manager.get_iface_config(emane_net, iface)
|
||||
# check if this is an external transport
|
||||
if is_external(config):
|
||||
nem_element.set("transport", "external")
|
||||
platform_endpoint = "platformendpoint"
|
||||
|
|
Loading…
Reference in a new issue