added support for emane manifest parsing into core compatible information, refactoring of emane code to align with its usage

This commit is contained in:
Blake J. Harnden 2018-03-30 12:08:33 -07:00
parent 8963ef51e3
commit fd32e1cf78
7 changed files with 271 additions and 259 deletions

View file

@ -6,6 +6,7 @@ import os
from core import constants
from core import logger
from core.emane import emanemanifest
from core.emane import emanemodel
from core.enumerations import ConfigDataTypes
from core.misc import utils
@ -14,40 +15,26 @@ from core.misc import utils
class EmaneTdmaModel(emanemodel.EmaneModel):
# model name
name = "emane_tdma"
library = "tdmaeventschedulerradiomodel"
# mac configuration
xml_path = "/usr/share/emane/xml/models/mac/tdmaeventscheduler"
mac_library = "tdmaeventschedulerradiomodel"
mac_xml = "/usr/share/emane/manifest/tdmaeventschedulerradiomodel.xml"
mac_defaults = {
"pcrcurveuri": "/usr/share/emane/xml/models/mac/tdmaeventscheduler/tdmabasemodelpcr.xml",
}
config_mac = emanemanifest.parse(mac_xml, mac_defaults)
# add custom schedule options and ignore it when writing emane xml
schedule_name = "schedule"
default_schedule = os.path.join(constants.CORE_DATA_DIR, "examples", "tdma", "schedule.xml")
config_mac.insert(0, (schedule_name, ConfigDataTypes.STRING.value, default_schedule, "", "TDMA schedule file"))
config_ignore = {schedule_name}
_config_mac = [
(schedule_name, ConfigDataTypes.STRING.value, default_schedule, "", "TDMA schedule file"),
("enablepromiscuousmode", ConfigDataTypes.BOOL.value, "0", "True,False", "enable promiscuous mode"),
("flowcontrolenable", ConfigDataTypes.BOOL.value, "0", "On,Off", "enable traffic flow control"),
("flowcontroltokens", ConfigDataTypes.UINT16.value, "10", "", "number of flow control tokens"),
("fragmentcheckthreshold", ConfigDataTypes.UINT16.value, "2", "",
"rate in seconds for check if fragment reassembly efforts should be abandoned"),
("fragmenttimeoutthreshold", ConfigDataTypes.UINT16.value, "5", "",
"threshold in seconds to wait for another packet fragment for reassembly"),
("neighbormetricdeletetime", ConfigDataTypes.FLOAT.value, "60.0", "",
"neighbor RF reception timeout for removal from neighbor table (sec)"),
("neighbormetricupdateinterval", ConfigDataTypes.FLOAT.value, "1.0", "",
"neighbor table update interval (sec)"),
("pcrcurveuri", ConfigDataTypes.STRING.value, "%s/tdmabasemodelpcr.xml" % xml_path, "", "SINR/PCR curve file"),
("queue.aggregationenable", ConfigDataTypes.BOOL.value, "1", "On,Off", "enable transmit packet aggregation"),
("queue.aggregationslotthreshold", ConfigDataTypes.FLOAT.value, "90.0", "",
"percentage of a slot that must be filled in order to conclude aggregation"),
("queue.depth", ConfigDataTypes.UINT16.value, "256", "",
"size of the per service class downstream packet queues (packets)"),
("queue.fragmentationenable", ConfigDataTypes.BOOL.value, "1", "On,Off",
"enable packet fragmentation (over multiple slots)"),
("queue.strictdequeueenable", ConfigDataTypes.BOOL.value, "0", "On,Off",
"enable strict dequeueing to specified queues only"),
]
config_matrix = _config_mac + emanemodel.EmaneModel._config_phy
config_groups = emanemodel.create_config_groups(_config_mac, config_matrix)
# defines overall config
config_matrix = config_mac + emanemodel.EmaneModel.config_phy
# gui display tabs
config_groups = emanemodel.create_config_groups(config_mac, config_matrix)
def post_startup(self, emane_manager):
"""