updates to make how core_handlers handles model config messages a bit simpler
This commit is contained in:
parent
4b9cf996d1
commit
b696cf16e9
1 changed files with 10 additions and 12 deletions
|
@ -1207,14 +1207,13 @@ class CoreHandler(SocketServer.BaseRequestHandler):
|
||||||
logger.warn("model class does not exist: %s", object_name)
|
logger.warn("model class does not exist: %s", object_name)
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
config = model_class.default_values()
|
||||||
if values_str:
|
if values_str:
|
||||||
config = ConfigShim.str_to_dict(values_str)
|
parsed_config = ConfigShim.str_to_dict(values_str)
|
||||||
else:
|
for name, value in parsed_config.iteritems():
|
||||||
config = self.session.mobility.get_configs(node_id, object_name)
|
|
||||||
|
|
||||||
for name, value in model_class.default_values().iteritems():
|
|
||||||
if name not in config:
|
|
||||||
config[name] = value
|
config[name] = value
|
||||||
|
else:
|
||||||
|
config = self.session.mobility.get_configs(node_id, object_name) or config
|
||||||
|
|
||||||
self.session.mobility.set_configs(config, node_id, object_name)
|
self.session.mobility.set_configs(config, node_id, object_name)
|
||||||
|
|
||||||
|
@ -1303,14 +1302,13 @@ class CoreHandler(SocketServer.BaseRequestHandler):
|
||||||
logger.warn("model class does not exist: %s", object_name)
|
logger.warn("model class does not exist: %s", object_name)
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
config = model_class.default_values()
|
||||||
if values_str:
|
if values_str:
|
||||||
config = ConfigShim.str_to_dict(values_str)
|
parsed_config = ConfigShim.str_to_dict(values_str)
|
||||||
else:
|
for name, value in parsed_config.iteritems():
|
||||||
config = self.session.emane.get_configs(node_id, object_name)
|
|
||||||
|
|
||||||
for name, value in model_class.default_values().iteritems():
|
|
||||||
if name not in config:
|
|
||||||
config[name] = value
|
config[name] = value
|
||||||
|
else:
|
||||||
|
config = self.session.emane.get_configs(node_id, object_name) or config
|
||||||
|
|
||||||
self.session.emane.set_configs(config, node_id, object_name)
|
self.session.emane.set_configs(config, node_id, object_name)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue