Merge branch 'rel/5.2' into core-rest-flask
This commit is contained in:
commit
1ddea3ed54
3 changed files with 27 additions and 5 deletions
|
@ -1697,16 +1697,16 @@ class CoreHandler(SocketServer.BaseRequestHandler):
|
||||||
|
|
||||||
# send mobility model info
|
# send mobility model info
|
||||||
for node_id in self.session.mobility.nodes():
|
for node_id in self.session.mobility.nodes():
|
||||||
node = self.session.get_object(node_id)
|
for model_name, config in self.session.mobility.get_all_configs(node_id).iteritems():
|
||||||
for model_class, config in self.session.mobility.get_models(node):
|
model_class = self.session.mobility.models[model_name]
|
||||||
logger.debug("mobility config: node(%s) class(%s) values(%s)", node_id, model_class, config)
|
logger.debug("mobility config: node(%s) class(%s) values(%s)", node_id, model_class, config)
|
||||||
config_data = ConfigShim.config_data(0, node_id, ConfigFlags.UPDATE.value, model_class, config)
|
config_data = ConfigShim.config_data(0, node_id, ConfigFlags.UPDATE.value, model_class, config)
|
||||||
self.session.broadcast_config(config_data)
|
self.session.broadcast_config(config_data)
|
||||||
|
|
||||||
# send emane model info
|
# send emane model info
|
||||||
for node_id in self.session.emane.nodes():
|
for node_id in self.session.emane.nodes():
|
||||||
node = self.session.get_object(node_id)
|
for model_name, config in self.session.emane.get_all_configs(node_id).iteritems():
|
||||||
for model_class, config in self.session.emane.get_models(node):
|
model_class = self.session.emane.models[model_name]
|
||||||
logger.debug("emane config: node(%s) class(%s) values(%s)", node_id, model_class, config)
|
logger.debug("emane config: node(%s) class(%s) values(%s)", node_id, model_class, config)
|
||||||
config_data = ConfigShim.config_data(0, node_id, ConfigFlags.UPDATE.value, model_class, config)
|
config_data = ConfigShim.config_data(0, node_id, ConfigFlags.UPDATE.value, model_class, config)
|
||||||
self.session.broadcast_config(config_data)
|
self.session.broadcast_config(config_data)
|
||||||
|
|
|
@ -126,7 +126,7 @@ def make_tuple_fromstr(s, value_type):
|
||||||
"""
|
"""
|
||||||
Create a tuple from a string.
|
Create a tuple from a string.
|
||||||
|
|
||||||
:param str s: string to convert to a tuple
|
:param str|unicode s: string to convert to a tuple
|
||||||
:param value_type: type of values to be contained within tuple
|
:param value_type: type of values to be contained within tuple
|
||||||
:return: tuple from string
|
:return: tuple from string
|
||||||
:rtype: tuple
|
:rtype: tuple
|
||||||
|
|
22
daemon/tests/test_utils.py
Normal file
22
daemon/tests/test_utils.py
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
from core.misc import utils
|
||||||
|
|
||||||
|
|
||||||
|
class TestUtils:
|
||||||
|
def test_make_tuple_fromstr(self):
|
||||||
|
# given
|
||||||
|
no_args = "()"
|
||||||
|
one_arg = "('one',)"
|
||||||
|
two_args = "('one', 'two')"
|
||||||
|
unicode_args = u"('one', 'two', 'three')"
|
||||||
|
|
||||||
|
# when
|
||||||
|
no_args = utils.make_tuple_fromstr(no_args, str)
|
||||||
|
one_arg = utils.make_tuple_fromstr(one_arg, str)
|
||||||
|
two_args = utils.make_tuple_fromstr(two_args, str)
|
||||||
|
unicode_args = utils.make_tuple_fromstr(unicode_args, str)
|
||||||
|
|
||||||
|
# then
|
||||||
|
assert no_args == ()
|
||||||
|
assert len(one_arg) == 1
|
||||||
|
assert len(two_args) == 2
|
||||||
|
assert len(unicode_args) == 3
|
Loading…
Add table
Reference in a new issue