updates to support external transport configuration and an emane transport service to generate and run emanetransport for a configured external transport model

This commit is contained in:
Blake J. Harnden 2018-07-11 09:19:06 -07:00
parent bf222cd5b4
commit bfbee35a53
10 changed files with 108 additions and 16 deletions

View file

@ -41,8 +41,9 @@ class EmaneCommEffectModel(emanemodel.EmaneModel):
shim_defaults = {}
config_shim = emanemanifest.parse(shim_xml, shim_defaults)
# comm effect does not need the default phy configuration
# comm effect does not need the default phy and external configurations
phy_config = ()
external_config = ()
@classmethod
def configurations(cls):

View file

@ -128,7 +128,9 @@ class EmaneManager(ModelManager):
if not config and self.has_configs(interface.node.objid):
config = self.get_configs(node_id=interface.node.objid, config_type=model_name)
if not config and interface.transport_type == "raw":
# get non interface config, when none found
# if not config and interface.transport_type == "raw":
if not config and self.has_configs(node_id):
# with EMANE 0.9.2+, we need an extra NEM XML from
# model.buildnemxmlfiles(), so defaults are returned here
config = self.get_configs(node_id=node_id, config_type=model_name)
@ -561,11 +563,12 @@ class EmaneManager(ModelManager):
Build a platform.xml file now that all nodes are configured.
"""
nemid = int(self.get_config("nem_id_start"))
platform_xmls = {}
# assume self._objslock is already held here
for key in sorted(self._emane_nodes.keys()):
emane_node = self._emane_nodes[key]
nemid = emanexml.build_node_platform_xml(self, ctrlnet, emane_node, nemid)
nemid = emanexml.build_node_platform_xml(self, ctrlnet, emane_node, nemid, platform_xmls)
def buildnemxml(self):
"""

View file

@ -5,7 +5,9 @@ import os
from core import logger
from core.conf import ConfigGroup
from core.conf import Configuration
from core.emane import emanemanifest
from core.enumerations import ConfigDataTypes
from core.mobility import WirelessModel
from core.xml import emanexml
@ -32,19 +34,28 @@ class EmaneModel(WirelessModel):
}
phy_config = emanemanifest.parse(phy_xml, phy_defaults)
# support for external configurations
external_config = [
Configuration("external", ConfigDataTypes.BOOL, default="0"),
Configuration("platformendpoint", ConfigDataTypes.STRING, default="127.0.0.1:40001"),
Configuration("transportendpoint", ConfigDataTypes.STRING, default="127.0.0.1:50002")
]
config_ignore = set()
@classmethod
def configurations(cls):
return cls.mac_config + cls.phy_config
return cls.mac_config + cls.phy_config + cls.external_config
@classmethod
def config_groups(cls):
mac_len = len(cls.mac_config)
phy_len = len(cls.phy_config) + mac_len
config_len = len(cls.configurations())
return [
ConfigGroup("MAC Parameters", 1, mac_len),
ConfigGroup("PHY Parameters", mac_len + 1, config_len)
ConfigGroup("PHY Parameters", mac_len + 1, phy_len),
ConfigGroup("External Parameters", phy_len + 1, config_len)
]
def build_xml_files(self, config, interface=None):
@ -60,6 +71,7 @@ class EmaneModel(WirelessModel):
mac_name = emanexml.mac_file_name(self, interface)
phy_name = emanexml.phy_file_name(self, interface)
# check if this is external
transport_type = "virtual"
if interface and interface.transport_type == "raw":
transport_type = "raw"
@ -67,7 +79,7 @@ class EmaneModel(WirelessModel):
# create nem xml file
nem_file = os.path.join(self.session.session_dir, nem_name)
emanexml.create_nem_xml(self, nem_file, transport_name, mac_name, phy_name)
emanexml.create_nem_xml(self, config, nem_file, transport_name, mac_name, phy_name)
# create mac xml file
mac_file = os.path.join(self.session.session_dir, mac_name)

View file

@ -131,7 +131,7 @@ class EmaneNode(EmaneNet):
for netif in self.netifs():
if do_netns and "virtual" in netif.transport_type.lower():
netif.install()
netif.setaddrs()
# netif.setaddrs()
if not self.session.emane.genlocationevents():
netif.poshook = None
continue