enable automatic node stack
[nepi.git] / src / nepi / resources / ns3 / ns3node.py
index a6cf19e..8598979 100644 (file)
@@ -97,9 +97,13 @@ class NS3BaseNode(NS3Base):
         return rms
 
     def _configure_object(self):
-        ### node.AggregateObject(PacketSocketFactory())
-        uuid_packet_socket_factory = self.simulation.create("PacketSocketFactory")
-        self.simulation.invoke(self.uuid, "AggregateObject", uuid_packet_socket_factory)
+        if self.get("enableStack"):
+            uuid_stack_helper = self.simulation.create("InternetStackHelper")
+            self.simulation.invoke(uuid_stack_helper, "Install", self.uuid)
+        else:
+            ### node.AggregateObject(PacketSocketFactory())
+            uuid_packet_socket_factory = self.simulation.create("PacketSocketFactory")
+            self.simulation.invoke(self.uuid, "AggregateObject", uuid_packet_socket_factory)
 
         dceapplications = self.dceapplications
         if dceapplications:
@@ -110,10 +114,6 @@ class NS3BaseNode(NS3Base):
         if ipv4:
             self.simulation.invoke(self.uuid, "AggregateObject", ipv4.uuid)
 
-        if self.get("enableStack"):
-            uuid_stack_helper = self.simulation.create("InternetStackHelper")
-            self.simulation.invoke(uuid_stack_helper, "Install", self.uuid)
-
         mobility = self.mobility
         if mobility:
             self.simulation.invoke(self.uuid, "AggregateObject", mobility.uuid)