From 9549a53ed7a5616f3cbd61ef3f0d685e3d6b78f5 Mon Sep 17 00:00:00 2001 From: Alina Quereilhac Date: Tue, 3 Jun 2014 09:05:41 +0200 Subject: [PATCH] enable dce in simulation is now automatic --- src/nepi/resources/ns3/ns3node.py | 15 +++++++++++++++ src/nepi/resources/ns3/ns3wrapper.py | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/nepi/resources/ns3/ns3node.py b/src/nepi/resources/ns3/ns3node.py index 0c0d8766..a6cf19ea 100644 --- a/src/nepi/resources/ns3/ns3node.py +++ b/src/nepi/resources/ns3/ns3node.py @@ -25,6 +25,17 @@ from nepi.resources.ns3.ns3base import NS3Base class NS3BaseNode(NS3Base): _rtype = "abstract::ns3::Node" + @classmethod + def _register_attributes(cls): + enablestack = Attribute("enableStack", + "Install network stack in Node, including: ARP, " + "IP4, ICMP, UDP and TCP ", + type = Types.Bool, + default = False, + flags = Flags.Design) + + cls._register_attribute(enablestack) + @property def simulation(self): from nepi.resources.ns3.ns3simulation import NS3Simulation @@ -99,6 +110,10 @@ 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) diff --git a/src/nepi/resources/ns3/ns3wrapper.py b/src/nepi/resources/ns3/ns3wrapper.py index a7dff070..e5f4a890 100644 --- a/src/nepi/resources/ns3/ns3wrapper.py +++ b/src/nepi/resources/ns3/ns3wrapper.py @@ -213,7 +213,7 @@ class NS3Wrapper(object): def invoke(self, uuid, operation, *args, **kwargs): if operation == "isRunning": - return self.is_running() + return self.is_running if operation == "isAppRunning": return self._is_app_running(uuid) if operation == "addStaticRoute": -- 2.43.0