+ return newuuid
+
+ def set(self, uuid, name, value):
+ obj = self.get_object(uuid)
+ ns3_value = self._to_ns3_value(uuid, name, value)
+
+ def set_attr(obj, name, ns3_value):
+ obj.SetAttribute(name, ns3_value)
+
+ # If the Simulation thread is not running,
+ # then there will be no thread-safety problems
+ # in changing the value of an attribute directly.
+ # However, if the simulation is running we need
+ # to set the value by scheduling an event, else
+ # we risk to corrupt the state of the
+ # simulation.
+ if self._is_running:
+ # schedule the event in the Simulator
+ self._schedule_event(self._condition, set_attr, obj,
+ name, ns3_value)
+ else:
+ set_attr(obj, name, ns3_value)
+
+ def get(self, uuid, name):
+ obj = self.get_object(uuid)
+ ns3_value = self._create_ns3_value(uuid, name)
+
+ def get_attr(obj, name, ns3_value):
+ obj.GetAttribute(name, ns3_value)
+
+ if self._is_running:
+ # schedule the event in the Simulator
+ self._schedule_event(self._condition, get_attr, obj,
+ name, ns3_value)
+ else:
+ get_attr(obj, name, ns3_value)
+
+ return self._from_ns3_value(uuid, name, ns3_value)