From: Claudio-Daniel Freire Date: Tue, 26 Jul 2011 15:17:07 +0000 (+0200) Subject: SchedulerType attribute for ns3 testbed X-Git-Tag: nepi-3.0.0~344^2~1^2 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=9b79440f968545bcd676103add08dbfeae8c5022;p=nepi.git SchedulerType attribute for ns3 testbed Defaulted to ns3::ThreadsafeMapScheduler, since nepi requires thread-safe scheduling. --- diff --git a/src/nepi/testbeds/ns3/attributes_metadata.py b/src/nepi/testbeds/ns3/attributes_metadata.py index b544e7aa..90339988 100644 --- a/src/nepi/testbeds/ns3/attributes_metadata.py +++ b/src/nepi/testbeds/ns3/attributes_metadata.py @@ -11,9 +11,28 @@ testbed_attributes = dict({ "simu_impl_type": dict({ "name": "SimulatorImplementationType", "help": "The object class to use as the simulator implementation", - "type": Attribute.STRING, + "value": "ns3::DefaultSimulatorImpl", + "type": Attribute.ENUM, "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable, - "validation_function": validation.is_string + "allowed": [ + "ns3::DefaultSimulatorImpl", + "ns3::RealtimeSimulatorImpl", + ], + "validation_function": validation.is_enum + }), + "sched_impl_type": dict({ + "name": "SchedulerType", + "help": "The object class to use as the scheduler implementation. Make sure to pick a thread-safe variant.", + "value": "ns3::ThreadsafeMapScheduler", + "type": Attribute.ENUM, + "flags": Attribute.ExecReadOnly | Attribute.ExecImmutable, + "allowed": [ + "ns3::ThreadsafeMapScheduler", + "ns3::ThreadsafeHeapScheduler", + "ns3::ThreadsafeListScheduler", + "ns3::ThreadsafeCalendarScheduler", + ], + "validation_function": validation.is_enum }), "checksum": dict({ "name": "ChecksumEnabled", diff --git a/src/nepi/testbeds/ns3/execute.py b/src/nepi/testbeds/ns3/execute.py index 5c3045b4..1a76576c 100644 --- a/src/nepi/testbeds/ns3/execute.py +++ b/src/nepi/testbeds/ns3/execute.py @@ -283,6 +283,8 @@ class TestbedController(testbed_impl.TestbedController): def _configure_ns3_module(self): simu_impl_type = self._attributes.get_attribute_value( "SimulatorImplementationType") + sched_impl_type = self._attributes.get_attribute_value( + "SchedulerType") checksum = self._attributes.get_attribute_value("ChecksumEnabled") stop_time = self._attributes.get_attribute_value("StopTime") @@ -293,6 +295,9 @@ class TestbedController(testbed_impl.TestbedController): if simu_impl_type: value = mod.StringValue(simu_impl_type) mod.GlobalValue.Bind ("SimulatorImplementationType", value) + if sched_impl_type: + value = mod.StringValue(sched_impl_type) + mod.GlobalValue.Bind ("SchedulerType", value) if checksum: value = mod.BooleanValue(checksum) mod.GlobalValue.Bind ("ChecksumEnabled", value)