Changes to dumped command in src/nepi/resources/ns3/ns3wrapper.py
authorAlina Quereilhac <alina.quereilhac@inria.fr>
Tue, 2 Sep 2014 13:08:02 +0000 (15:08 +0200)
committerAlina Quereilhac <alina.quereilhac@inria.fr>
Tue, 2 Sep 2014 13:08:02 +0000 (15:08 +0200)
src/nepi/resources/ns3/ns3wrapper.py

index eea32d0..ebd0d67 100644 (file)
@@ -199,8 +199,8 @@ class NS3Wrapper(object):
         ### DEBUG
         self.logger.debug("FACTORY %s( %s )" % (type_name, str(kwargs)))
         
+        ### DUMP
         self.debuger.dump_factory(uuid, type_name, kwargs)
-        ########
 
         factory = self.ns3.ObjectFactory()
         factory.SetTypeId(type_name)
@@ -216,7 +216,6 @@ class NS3Wrapper(object):
         ### DEBUG
         self.logger.debug("RET FACTORY ( uuid %s ) %s = %s( %s )" % (
             str(uuid), str(obj), type_name, str(kwargs)))
-        ########
  
         return uuid
 
@@ -233,8 +232,8 @@ class NS3Wrapper(object):
         ### DEBUG
         self.logger.debug("CREATE %s( %s )" % (clazzname, str(args)))
     
+        ### DUMP
         self.debuger.dump_create(uuid, clazzname, args)
-        ########
 
         clazz = getattr(self.ns3, clazzname)
  
@@ -249,7 +248,6 @@ class NS3Wrapper(object):
         ### DEBUG
         self.logger.debug("RET CREATE ( uuid %s ) %s = %s( %s )" % (str(uuid), 
             str(obj), clazzname, str(args)))
-        ########
 
         return uuid
 
@@ -269,19 +267,25 @@ class NS3Wrapper(object):
         elif operation == "isAppRunning":
             result = self._is_app_running(uuid)
         else:
-            newuuid = self.make_uuid()
-
-            ### DEBUG
-            self.debuger.dump_invoke(newuuid, uuid, operation, args, kwargs)
-            ########
 
             if operation == "addStaticRoute":
                 result = self._add_static_route(uuid, *args)
+                
+                ### DUMP
+                self.debuger.dump_invoke(result, uuid, operation, args, kwargs)
 
             elif operation == "retrieveObject":
                 result = self._retrieve_object(uuid, *args, **kwargs)
+                
+                ### DUMP
+                self.debuger.dump_invoke(result, uuid, operation, args, kwargs)
 
             else:
+                newuuid = self.make_uuid()
+
+                ### DUMP
+                self.debuger.dump_invoke(newuuid, uuid, operation, args, kwargs)
+
                 if uuid.startswith(SINGLETON):
                     obj = self._singleton(uuid)
                 else:
@@ -319,8 +323,8 @@ class NS3Wrapper(object):
         ### DEBUG
         self.logger.debug("SET %s %s %s" % (uuid, name, str(value)))
     
+        ### DUMP
         self.debuger.dump_set(uuid, name, value)
-        ########
 
         obj = self.get_object(uuid)
         type_name = obj.GetInstanceTypeId().GetName()
@@ -347,7 +351,6 @@ class NS3Wrapper(object):
         ### DEBUG
         self.logger.debug("RET SET %s = %s -> set(%s, %s)" % (str(value), uuid, name, 
             str(value)))
-        ########
 
         return value
 
@@ -358,8 +361,8 @@ class NS3Wrapper(object):
         ### DEBUG
         self.logger.debug("GET %s %s" % (uuid, name))
         
+        ### DUMP
         self.debuger.dump_get(uuid, name)
-        ########
 
         obj = self.get_object(uuid)
         type_name = obj.GetInstanceTypeId().GetName()
@@ -379,14 +382,12 @@ class NS3Wrapper(object):
 
         ### DEBUG
         self.logger.debug("RET GET %s = %s -> get(%s)" % (str(result), uuid, name))
-        ########
 
         return result
 
     def start(self):
-        ### DEBUG
+        ### DUMP
         self.debuger.dump_start()
-        ########
 
         # Launch the simulator thread and Start the
         # simulator in that thread
@@ -400,12 +401,10 @@ class NS3Wrapper(object):
 
         ### DEBUG
         self.logger.debug("START")
-        ########
 
     def stop(self, time = None):
-        ### DEBUG
+        ### DUMP
         self.debuger.dump_stop(time=time)
-        ########
         
         if time is None:
             self.ns3.Simulator.Stop()
@@ -414,12 +413,10 @@ class NS3Wrapper(object):
 
         ### DEBUG
         self.logger.debug("STOP time=%s" % str(time))
-        ########
 
     def shutdown(self):
-        ### DEBUG
+        ### DUMP
         self.debuger.dump_shutdown()
-        ########
 
         while not self.ns3.Simulator.IsFinished():
             #self.logger.debug("Waiting for simulation to finish")
@@ -438,7 +435,6 @@ class NS3Wrapper(object):
 
         ### DEBUG
         self.logger.debug("SHUTDOWN")
-        ########
 
     def _simulator_run(self, condition):
         # Run simulation