From 0aed47390b9a7d7cc0d9aa5e7272cf83f021edee Mon Sep 17 00:00:00 2001 From: Claudio-Daniel Freire Date: Tue, 17 May 2011 15:11:36 +0200 Subject: [PATCH] Fix invisible attribute implementation: they should be both queriable and settable. --- src/nepi/testbeds/ns3/execute.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/nepi/testbeds/ns3/execute.py b/src/nepi/testbeds/ns3/execute.py index d3b3307c..47eba7d5 100644 --- a/src/nepi/testbeds/ns3/execute.py +++ b/src/nepi/testbeds/ns3/execute.py @@ -61,12 +61,13 @@ class TestbedController(testbed_impl.TestbedController): # TODO: take on account schedule time for the task factory_id = self._create[guid] factory = self._factories[factory_id] - if factory.box_attributes.is_attribute_design_only(name) or \ - factory.box_attributes.is_attribute_invisible(name): + if factory.box_attributes.is_attribute_design_only(name): return element = self._elements[guid] if factory_id in self.LOCAL_FACTORIES: setattr(element, name, value) + elif factory.box_attributes.is_attribute_invisible(name): + return else: ns3_value = self._to_ns3_value(guid, name, value) element.SetAttribute(name, ns3_value) @@ -76,11 +77,15 @@ class TestbedController(testbed_impl.TestbedController): # TODO: take on account schedule time for the task factory_id = self._create[guid] factory = self._factories[factory_id] + element = self._elements[guid] + if factory_id in self.LOCAL_FACTORIES: + if hasattr(element, name): + return getattr(element, name) + else: + return value if factory.box_attributes.is_attribute_design_only(name) or \ factory.box_attributes.is_attribute_invisible(name): return value - if factory_id in self.LOCAL_FACTORIES: - return getattr(element, name) TypeId = self.ns3.TypeId() typeid = TypeId.LookupByName(factory_id) info = TypeId.AttributeInfo() @@ -89,7 +94,6 @@ class TestbedController(testbed_impl.TestbedController): (name, guid)) checker = info.checker ns3_value = checker.Create() - element = self._elements[guid] element.GetAttribute(name, ns3_value) value = ns3_value.SerializeToString(checker) attr_type = factory.box_attributes.get_attribute_type(name) -- 2.43.0