diff --git a/daemon/core/emane/emanemanager.py b/daemon/core/emane/emanemanager.py index 5a403c20..60f25023 100644 --- a/daemon/core/emane/emanemanager.py +++ b/daemon/core/emane/emanemanager.py @@ -446,17 +446,17 @@ class EmaneManager: """ Retransmit location events now that all NEMs are active. """ - if not self.genlocationevents(): - return + events_enabled = self.genlocationevents() with self._emane_node_lock: for node_id in sorted(self._emane_nets): emane_net = self._emane_nets[node_id] logger.debug( "post startup for emane node: %s - %s", emane_net.id, emane_net.name ) - emane_net.model.post_startup() for iface in emane_net.get_ifaces(): - iface.setposition() + emane_net.model.post_startup(iface) + if events_enabled: + iface.setposition() def reset(self) -> None: """ diff --git a/daemon/core/emane/emanemodel.py b/daemon/core/emane/emanemodel.py index 54f8c72d..62e9fb0d 100644 --- a/daemon/core/emane/emanemodel.py +++ b/daemon/core/emane/emanemodel.py @@ -134,10 +134,11 @@ class EmaneModel(WirelessModel): emanexml.create_phy_xml(self, iface, config) emanexml.create_transport_xml(iface, config) - def post_startup(self) -> None: + def post_startup(self, iface: CoreInterface) -> None: """ Logic to execute after the emane manager is finished with startup. + :param iface: interface for post startup :return: nothing """ logger.debug("emane model(%s) has no post setup tasks", self.name) diff --git a/daemon/core/emane/models/tdma.py b/daemon/core/emane/models/tdma.py index 62843ec1..c23e3d73 100644 --- a/daemon/core/emane/models/tdma.py +++ b/daemon/core/emane/models/tdma.py @@ -9,7 +9,9 @@ from typing import Set from core import constants, utils from core.config import Configuration from core.emane import emanemodel +from core.emane.nodes import EmaneNet from core.emulator.enumerations import ConfigDataTypes +from core.nodes.interface import CoreInterface logger = logging.getLogger(__name__) @@ -44,22 +46,21 @@ class EmaneTdmaModel(emanemodel.EmaneModel): ) cls.mac_config.insert(0, config_item) - def post_startup(self) -> None: - """ - Logic to execute after the emane manager is finished with startup. - - :return: nothing - """ + def post_startup(self, iface: CoreInterface) -> None: # get configured schedule - config = self.session.emane.get_config(self.id, self.name) - if not config: - return + emane_net = self.session.get_node(self.id, EmaneNet) + config = self.session.emane.get_iface_config(emane_net, iface) schedule = Path(config[self.schedule_name]) if not schedule.is_file(): - logger.warning("ignoring invalid tdma schedule: %s", schedule) + logger.error("ignoring invalid tdma schedule: %s", schedule) return # initiate tdma schedule - for service in self.session.emane.services.values(): + nem_id = self.session.emane.get_nem_id(iface) + if not nem_id: + logger.error("could not find nem for interface") + return + service = self.session.emane.nem_service.get(nem_id) + if service: device = service.device logger.info( "setting up tdma schedule: schedule(%s) device(%s)", schedule, device