daemon: adjustments to emane model post startup to accept an interface, since settings may be unique per interface, updated tdma to use this information for trying to initialize its tdma schedule properly
This commit is contained in:
parent
8d5c3bd212
commit
820539191d
3 changed files with 18 additions and 16 deletions
|
@ -446,17 +446,17 @@ class EmaneManager:
|
||||||
"""
|
"""
|
||||||
Retransmit location events now that all NEMs are active.
|
Retransmit location events now that all NEMs are active.
|
||||||
"""
|
"""
|
||||||
if not self.genlocationevents():
|
events_enabled = self.genlocationevents()
|
||||||
return
|
|
||||||
with self._emane_node_lock:
|
with self._emane_node_lock:
|
||||||
for node_id in sorted(self._emane_nets):
|
for node_id in sorted(self._emane_nets):
|
||||||
emane_net = self._emane_nets[node_id]
|
emane_net = self._emane_nets[node_id]
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"post startup for emane node: %s - %s", emane_net.id, emane_net.name
|
"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():
|
for iface in emane_net.get_ifaces():
|
||||||
iface.setposition()
|
emane_net.model.post_startup(iface)
|
||||||
|
if events_enabled:
|
||||||
|
iface.setposition()
|
||||||
|
|
||||||
def reset(self) -> None:
|
def reset(self) -> None:
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -134,10 +134,11 @@ class EmaneModel(WirelessModel):
|
||||||
emanexml.create_phy_xml(self, iface, config)
|
emanexml.create_phy_xml(self, iface, config)
|
||||||
emanexml.create_transport_xml(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.
|
Logic to execute after the emane manager is finished with startup.
|
||||||
|
|
||||||
|
:param iface: interface for post startup
|
||||||
:return: nothing
|
:return: nothing
|
||||||
"""
|
"""
|
||||||
logger.debug("emane model(%s) has no post setup tasks", self.name)
|
logger.debug("emane model(%s) has no post setup tasks", self.name)
|
||||||
|
|
|
@ -9,7 +9,9 @@ from typing import Set
|
||||||
from core import constants, utils
|
from core import constants, utils
|
||||||
from core.config import Configuration
|
from core.config import Configuration
|
||||||
from core.emane import emanemodel
|
from core.emane import emanemodel
|
||||||
|
from core.emane.nodes import EmaneNet
|
||||||
from core.emulator.enumerations import ConfigDataTypes
|
from core.emulator.enumerations import ConfigDataTypes
|
||||||
|
from core.nodes.interface import CoreInterface
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -44,22 +46,21 @@ class EmaneTdmaModel(emanemodel.EmaneModel):
|
||||||
)
|
)
|
||||||
cls.mac_config.insert(0, config_item)
|
cls.mac_config.insert(0, config_item)
|
||||||
|
|
||||||
def post_startup(self) -> None:
|
def post_startup(self, iface: CoreInterface) -> None:
|
||||||
"""
|
|
||||||
Logic to execute after the emane manager is finished with startup.
|
|
||||||
|
|
||||||
:return: nothing
|
|
||||||
"""
|
|
||||||
# get configured schedule
|
# get configured schedule
|
||||||
config = self.session.emane.get_config(self.id, self.name)
|
emane_net = self.session.get_node(self.id, EmaneNet)
|
||||||
if not config:
|
config = self.session.emane.get_iface_config(emane_net, iface)
|
||||||
return
|
|
||||||
schedule = Path(config[self.schedule_name])
|
schedule = Path(config[self.schedule_name])
|
||||||
if not schedule.is_file():
|
if not schedule.is_file():
|
||||||
logger.warning("ignoring invalid tdma schedule: %s", schedule)
|
logger.error("ignoring invalid tdma schedule: %s", schedule)
|
||||||
return
|
return
|
||||||
# initiate tdma schedule
|
# 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
|
device = service.device
|
||||||
logger.info(
|
logger.info(
|
||||||
"setting up tdma schedule: schedule(%s) device(%s)", schedule, device
|
"setting up tdma schedule: schedule(%s) device(%s)", schedule, device
|
||||||
|
|
Loading…
Reference in a new issue