refactored configuration managers and options into a single class, now the models that can be configured will deal with and handle configurations for nodes themselves

This commit is contained in:
Blake J. Harnden 2018-06-11 12:26:12 -07:00
parent 1b843e2868
commit 52230bc026
22 changed files with 284 additions and 422 deletions

View file

@ -210,9 +210,12 @@ class CoreDocumentParser1(object):
raise NotImplementedError
logger.info("setting wireless link params: node(%s) model(%s) mobility_model(%s)",
nodenum, model_name, mobility_model_name)
mgr.setconfig_keyvalues(nodenum, model_name, link_params.items())
model_class = mgr.get_model_class(model_name)
model_class.set_configs(link_params, node_id=nodenum)
if mobility_model_name and mobility_params:
mgr.setconfig_keyvalues(nodenum, mobility_model_name, mobility_params.items())
model_class = mgr.get_model_class(mobility_model_name)
model_class.set_configs(mobility_params, node_id=nodenum)
def link_layer2_devices(self, device1, ifname1, device2, ifname2):
"""
@ -843,7 +846,7 @@ class CoreDocumentParser1(object):
params = self.parse_parameter_children(metadata)
for name, value in params.iteritems():
if name and value:
self.session.metadata.add_item(str(name), str(value))
self.session.metadata.set_config(str(name), str(value))
def parse_session_config(self):
session_config = xmlutils.get_first_child_by_tag_name(self.scenario, 'CORE:sessionconfig')

View file

@ -194,8 +194,7 @@ class CoreDocumentWriter0(Document):
self.addaddresses(i, ifc)
# per-interface models
if netmodel and netmodel._name[:6] == "emane_":
cfg = self.session.emane.getifcconfig(node.objid, netmodel._name,
None, ifc)
cfg = netmodel.getifcconfig(node.objid, ifc)
if cfg:
self.addmodels(i, ((netmodel, cfg),))

View file

@ -654,8 +654,7 @@ class DeviceElement(NamedXmlElement):
# per-interface models
# XXX Remove???
if netmodel and netmodel.name[:6] == "emane_":
cfg = self.coreSession.emane.getifcconfig(device_object.objid, netmodel.name,
None, interface_object)
cfg = netmodel.getifcconfig(device_object.objid, interface_object)
if cfg:
interface_element.addModels(((netmodel, cfg),))