Fixing DCE application status, adding is_app_started function
[nepi.git] / src / nepi / resources / ns3 / ns3wrapper.py
index d8fa96f..4c9b9db 100644 (file)
@@ -281,6 +281,9 @@ class NS3Wrapper(object):
         elif operation == "isAppRunning":
             result = self._is_app_running(uuid)
 
+        elif operation == "isAppStarted":
+            result = self._is_app_started(uuid)
+
         elif operation == "recvFD":
             ### passFD operation binds to a different random socket 
             ### en every execution, so the socket name that could be
@@ -598,10 +601,14 @@ class NS3Wrapper(object):
         app.GetAttribute("StartTime", start_time_value)
         start_time = start_time_value.Get()
         
-        if now.Compare(start_time) >= 0 and now.Compare(stop_time) < 0:
-            return True
+        if now.Compare(start_time) >= 0:
+            if stop_time.IsZero() or now.Compare(stop_time) < 0:
+                return True
 
         return False
+    
+    def _is_app_started(self, uuid):
+        return self._is_app_running(uuid) or self.is_finished()
 
     def _add_static_route(self, ipv4_uuid, network, prefix, nexthop):
         ipv4 = self.get_object(ipv4_uuid)