ns-3 simulator synchronizing start
[nepi.git] / src / nepi / resources / ns3 / ns3wrapper.py
index b617f33..f6075b0 100644 (file)
@@ -212,6 +212,8 @@ class NS3Wrapper(object):
         return uuid
 
     def invoke(self, uuid, operation, *args, **kwargs):
+        if operation == "isRunning":
+            return self._is_running()
         if operation == "isAppRunning":
             return self._is_app_running(uuid)
         if operation == "addStaticRoute":
@@ -447,6 +449,16 @@ class NS3Wrapper(object):
 
         return realkwargs
 
+    def _is_running(self): 
+        if self.ns3.Simulator.IsFinished():
+            return False
+
+        now = self.ns3.Simulator.Now()
+        if now.IsZero():
+            return False
+        
+        return True
+
     def _is_app_running(self, uuid): 
         now = self.ns3.Simulator.Now()
         if now.IsZero():