daemon: fixed issues when emane generated platform.xml for raw interfaces
This commit is contained in:
parent
ddcb0205f3
commit
ac1c27b1c8
2 changed files with 21 additions and 24 deletions
|
@ -31,7 +31,6 @@ from core.emulator.enumerations import (
|
||||||
from core.errors import CoreCommandError, CoreError
|
from core.errors import CoreCommandError, CoreError
|
||||||
from core.nodes.base import CoreNode, NodeBase
|
from core.nodes.base import CoreNode, NodeBase
|
||||||
from core.nodes.interface import CoreInterface, TunTap
|
from core.nodes.interface import CoreInterface, TunTap
|
||||||
from core.nodes.physical import Rj45Node
|
|
||||||
from core.xml import emanexml
|
from core.xml import emanexml
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
@ -531,19 +530,21 @@ class EmaneManager(ModelManager):
|
||||||
cfgloglevel = self.session.options.get_config_int("emane_log_level")
|
cfgloglevel = self.session.options.get_config_int("emane_log_level")
|
||||||
realtime = self.session.options.get_config_bool("emane_realtime", default=True)
|
realtime = self.session.options.get_config_bool("emane_realtime", default=True)
|
||||||
if cfgloglevel:
|
if cfgloglevel:
|
||||||
logging.info("setting user-defined EMANE log level: %d", cfgloglevel)
|
logging.info("setting user-defined emane log level: %d", cfgloglevel)
|
||||||
loglevel = str(cfgloglevel)
|
loglevel = str(cfgloglevel)
|
||||||
emanecmd = f"emane -d -l {loglevel}"
|
emanecmd = f"emane -d -l {loglevel}"
|
||||||
if realtime:
|
if realtime:
|
||||||
emanecmd += " -r"
|
emanecmd += " -r"
|
||||||
otagroup, _otaport = self.get_config("otamanagergroup").split(":")
|
|
||||||
otadev = self.get_config("otamanagerdevice")
|
|
||||||
otanetidx = self.session.get_control_net_index(otadev)
|
|
||||||
eventgroup, _eventport = self.get_config("eventservicegroup").split(":")
|
|
||||||
eventdev = self.get_config("eventservicedevice")
|
|
||||||
eventservicenetidx = self.session.get_control_net_index(eventdev)
|
|
||||||
node = iface.node
|
node = iface.node
|
||||||
if not isinstance(node, Rj45Node):
|
transport_type = emanexml.get_transport_type(iface)
|
||||||
|
if not transport_type == TransportType.RAW:
|
||||||
|
otagroup, _otaport = self.get_config("otamanagergroup").split(":")
|
||||||
|
otadev = self.get_config("otamanagerdevice")
|
||||||
|
otanetidx = self.session.get_control_net_index(otadev)
|
||||||
|
eventgroup, _eventport = self.get_config("eventservicegroup").split(":")
|
||||||
|
eventdev = self.get_config("eventservicedevice")
|
||||||
|
eventservicenetidx = self.session.get_control_net_index(eventdev)
|
||||||
|
|
||||||
# control network not yet started here
|
# control network not yet started here
|
||||||
self.session.add_remove_control_iface(
|
self.session.add_remove_control_iface(
|
||||||
node, 0, remove=False, conf_required=False
|
node, 0, remove=False, conf_required=False
|
||||||
|
@ -559,6 +560,7 @@ class EmaneManager(ModelManager):
|
||||||
node, eventservicenetidx, remove=False, conf_required=False
|
node, eventservicenetidx, remove=False, conf_required=False
|
||||||
)
|
)
|
||||||
# multicast route is needed for OTA data
|
# multicast route is needed for OTA data
|
||||||
|
logging.info("OTA GROUP(%s) OTA DEV(%s)", otagroup, otadev)
|
||||||
node.node_net_client.create_route(otagroup, otadev)
|
node.node_net_client.create_route(otagroup, otadev)
|
||||||
# multicast route is also needed for event data if on control network
|
# multicast route is also needed for event data if on control network
|
||||||
if eventservicenetidx >= 0 and eventgroup != otagroup:
|
if eventservicenetidx >= 0 and eventgroup != otagroup:
|
||||||
|
@ -588,7 +590,8 @@ class EmaneManager(ModelManager):
|
||||||
node = iface.node
|
node = iface.node
|
||||||
if not node.up:
|
if not node.up:
|
||||||
continue
|
continue
|
||||||
if isinstance(node, Rj45Node):
|
transport_type = emanexml.get_transport_type(iface)
|
||||||
|
if transport_type == TransportType.RAW:
|
||||||
node.host_cmd(kill_emaned, wait=False)
|
node.host_cmd(kill_emaned, wait=False)
|
||||||
else:
|
else:
|
||||||
node.cmd(kill_emaned, wait=False)
|
node.cmd(kill_emaned, wait=False)
|
||||||
|
|
|
@ -13,7 +13,6 @@ from core.emulator.enumerations import TransportType
|
||||||
from core.errors import CoreError
|
from core.errors import CoreError
|
||||||
from core.nodes.interface import CoreInterface
|
from core.nodes.interface import CoreInterface
|
||||||
from core.nodes.network import CtrlNet
|
from core.nodes.network import CtrlNet
|
||||||
from core.nodes.physical import Rj45Node
|
|
||||||
from core.xml import corexml
|
from core.xml import corexml
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
@ -93,7 +92,8 @@ def create_iface_file(
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
node = iface.node
|
node = iface.node
|
||||||
if isinstance(node, Rj45Node):
|
transport_type = get_transport_type(iface)
|
||||||
|
if transport_type == TransportType.RAW:
|
||||||
file_path = os.path.join(node.session.session_dir, file_name)
|
file_path = os.path.join(node.session.session_dir, file_name)
|
||||||
else:
|
else:
|
||||||
file_path = os.path.join(node.nodedir, file_name)
|
file_path = os.path.join(node.nodedir, file_name)
|
||||||
|
@ -185,21 +185,15 @@ def build_platform_xml(
|
||||||
)
|
)
|
||||||
add_param(transport_element, "device", iface.name)
|
add_param(transport_element, "device", iface.name)
|
||||||
|
|
||||||
# determine platform element to add xml to
|
transport_type = get_transport_type(iface)
|
||||||
if iface.transport_type == TransportType.RAW:
|
transport_configs = {"otamanagerdevice", "eventservicedevice"}
|
||||||
otadev = control_net.brname
|
|
||||||
eventdev = control_net.brname
|
|
||||||
else:
|
|
||||||
otadev = None
|
|
||||||
eventdev = None
|
|
||||||
platform_element = etree.Element("platform")
|
platform_element = etree.Element("platform")
|
||||||
if otadev:
|
|
||||||
emane_manager.set_config("otamanagerdevice", otadev)
|
|
||||||
if eventdev:
|
|
||||||
emane_manager.set_config("eventservicedevice", eventdev)
|
|
||||||
for configuration in emane_manager.emane_config.emulator_config:
|
for configuration in emane_manager.emane_config.emulator_config:
|
||||||
name = configuration.id
|
name = configuration.id
|
||||||
value = emane_manager.get_config(name)
|
if transport_type == TransportType.RAW and name in transport_configs:
|
||||||
|
value = control_net.brname
|
||||||
|
else:
|
||||||
|
value = emane_manager.get_config(name)
|
||||||
add_param(platform_element, name, value)
|
add_param(platform_element, name, value)
|
||||||
platform_element.append(nem_element)
|
platform_element.append(nem_element)
|
||||||
emane_net.setnemid(iface, nem_id)
|
emane_net.setnemid(iface, nem_id)
|
||||||
|
|
Loading…
Add table
Reference in a new issue