updated emane manager to parse config options from manifest, updates to denote core specific configurations within emane models, update to account for manifest parsing of INETADDR

This commit is contained in:
Blake J. Harnden 2018-04-02 14:00:28 -07:00
parent ac44603205
commit b6d891f124
3 changed files with 26 additions and 38 deletions

View file

@ -11,6 +11,7 @@ from core import constants
from core import logger from core import logger
from core.api import coreapi from core.api import coreapi
from core.conf import ConfigurableManager from core.conf import ConfigurableManager
from core.emane import emanemanifest
from core.emane.bypass import EmaneBypassModel from core.emane.bypass import EmaneBypassModel
from core.emane.commeffect import EmaneCommEffectModel from core.emane.commeffect import EmaneCommEffectModel
from core.emane.emanemodel import EmaneModel from core.emane.emanemodel import EmaneModel
@ -607,7 +608,7 @@ class EmaneManager(ConfigurableManager):
doc = self.xmldoc("platform") doc = self.xmldoc("platform")
plat = doc.getElementsByTagName("platform").pop() plat = doc.getElementsByTagName("platform").pop()
names = list(self.emane_config.getnames()) names = list(self.emane_config.getnames())
platform_names = names[:len(self.emane_config._confmatrix_platform)] platform_names = names[:len(self.emane_config.emulator_config)]
platform_names.remove("platform_id_start") platform_names.remove("platform_id_start")
platform_values = list(values) platform_values = list(values)
if otadev: if otadev:
@ -1010,48 +1011,30 @@ class EmaneGlobalModel(EmaneModel):
""" """
Global EMANE configuration options. Global EMANE configuration options.
""" """
# Over-The-Air channel required for EMANE 0.9.2
_DEFAULT_OTA = "1"
_DEFAULT_DEV = "ctrl0" _DEFAULT_DEV = "ctrl0"
name = "emane" name = "emane"
_confmatrix_platform = [ emulator_xml = "/usr/share/emane/manifest/nemmanager.xml"
("antennaprofilemanifesturi", ConfigDataTypes.STRING.value, "", "", "antenna profile manifest URI"), emulator_defaults = {
("controlportendpoint", ConfigDataTypes.STRING.value, "0.0.0.0:47000", "", "Control port address"), "eventservicedevice": _DEFAULT_DEV,
("eventservicedevice", ConfigDataTypes.STRING.value, _DEFAULT_DEV, "", "Event Service device"), "eventservicegroup": "224.1.2.8:45703",
("eventservicegroup", ConfigDataTypes.STRING.value, "224.1.2.8:45703", "", "Event Service group"), "otamanagerdevice": _DEFAULT_DEV,
("eventservicettl", ConfigDataTypes.UINT8.value, "1", "", "Event Service TTL"), "otamanagergroup": "224.1.2.8:45702"
("otamanagerchannelenable", ConfigDataTypes.BOOL.value, _DEFAULT_OTA, "on,off", "enable OTA Manager channel"), }
("otamanagerdevice", ConfigDataTypes.STRING.value, _DEFAULT_DEV, "", "OTA Manager device"), emulator_config = emanemanifest.parse(emulator_xml, emulator_defaults)
("otamanagergroup", ConfigDataTypes.STRING.value, "224.1.2.8:45702", "", "OTA Manager group"), emulator_config.insert(
("otamanagerloopback", ConfigDataTypes.BOOL.value, "0", "on,off", "Enable OTA multicast loopback"), 0,
("otamanagermtu", ConfigDataTypes.UINT32.value, "0", "", "OTA channel MTU in bytes, 0 to disable"), ("platform_id_start", ConfigDataTypes.INT32.value, "1", "", "Starting Platform ID (core)")
("otamanagerpartcheckthreshold", ConfigDataTypes.UINT16.value, "2", "", )
"Rate in seconds a check is performed to see if any OTA packet part reassembly efforts should be abandoned"),
("otamanagerparttimeoutthreshold", ConfigDataTypes.UINT16.value, "5", "", nem_config = [
"Threshold in seconds to wait for another OTA packet part for an existing reassembly effort before " ("nem_id_start", ConfigDataTypes.INT32.value, "1", "", "Starting NEM ID (core)"),
"abandoning the effort"),
("otamanagerttl", ConfigDataTypes.UINT8.value, "1", "", "OTA channel multicast message TTL"),
("stats.event.maxeventcountrows", ConfigDataTypes.UINT32.value, "0", "",
"Event channel max event count table rows"),
("stats.ota.maxeventcountrows", ConfigDataTypes.UINT32.value, "0", "",
"OTA channel max event count table rows"),
("stats.ota.maxpacketcountrows", ConfigDataTypes.UINT32.value, "0", "",
"OTA channel max packet count table rows"),
("platform_id_start", ConfigDataTypes.INT32.value, "1", "", "starting Platform ID"),
] ]
# defined from 0.9.2 config_matrix_override = emulator_config + nem_config
_confmatrix_nem = [ config_groups_override = "Platform Attributes:1-%d|NEM Parameters:%d-%d" % (
("nem_id_start", ConfigDataTypes.INT32.value, "1", "", "starting NEM ID"), len(emulator_config), len(emulator_config) + 1, len(config_matrix_override))
]
config_matrix_override = _confmatrix_platform + _confmatrix_nem
config_groups_override = "Platform Attributes:1-%d|NEM Parameters:%d-%d" % \
(len(_confmatrix_platform), len(_confmatrix_platform) + 1,
len(config_matrix_override))
def __init__(self, session, object_id=None): def __init__(self, session, object_id=None):
EmaneModel.__init__(self, session, object_id) EmaneModel.__init__(self, session, object_id)

View file

@ -17,6 +17,8 @@ def _type_value(config_type):
config_type = config_type.upper() config_type = config_type.upper()
if config_type == "DOUBLE": if config_type == "DOUBLE":
config_type = "FLOAT" config_type = "FLOAT"
elif config_type == "INETADDR":
config_type = "STRING"
return ConfigDataTypes[config_type].value return ConfigDataTypes[config_type].value

View file

@ -27,7 +27,10 @@ class EmaneTdmaModel(emanemodel.EmaneModel):
# add custom schedule options and ignore it when writing emane xml # add custom schedule options and ignore it when writing emane xml
schedule_name = "schedule" schedule_name = "schedule"
default_schedule = os.path.join(constants.CORE_DATA_DIR, "examples", "tdma", "schedule.xml") default_schedule = os.path.join(constants.CORE_DATA_DIR, "examples", "tdma", "schedule.xml")
mac_config.insert(0, (schedule_name, ConfigDataTypes.STRING.value, default_schedule, "", "TDMA schedule file")) mac_config.insert(
0,
(schedule_name, ConfigDataTypes.STRING.value, default_schedule, "", "TDMA schedule file (core)")
)
config_ignore = {schedule_name} config_ignore = {schedule_name}
def post_startup(self, emane_manager): def post_startup(self, emane_manager):