SchedulerType attribute for ns3 testbed
authorClaudio-Daniel Freire <claudio-daniel.freire@inria.fr>
Tue, 26 Jul 2011 15:17:07 +0000 (17:17 +0200)
committerClaudio-Daniel Freire <claudio-daniel.freire@inria.fr>
Tue, 26 Jul 2011 15:17:07 +0000 (17:17 +0200)
Defaulted to ns3::ThreadsafeMapScheduler, since nepi requires thread-safe scheduling.

src/nepi/testbeds/ns3/attributes_metadata.py
src/nepi/testbeds/ns3/execute.py

index b544e7a..9033998 100644 (file)
@@ -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",
index 5c3045b..1a76576 100644 (file)
@@ -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)