Fixing validation of error in the state query for ns3 application
[nepi.git] / src / nepi / resources / ns3 / ns3application.py
index 64bacf7..6e46e7f 100644 (file)
@@ -73,10 +73,19 @@ class NS3BaseApplication(NS3Base):
     @property
     def state(self):
         if self._state == ResourceState.STARTED:
-            is_running = self.simulation.invoke(self.uuid, "isAppRunning")
-            
-            if not is_running:
-                self.set_stopped()
+            try:
+                is_running = self.simulation.invoke(self.uuid, "isAppRunning")
+                
+                if not is_running:
+                    self.set_stopped()
+            except:
+                msg = "Application failed. Can not retrieve state"
+                out = ""
+
+                import traceback
+                err = traceback.format_exc()
+                self.error(msg, out, err)
+                self.do_fail()
 
         return self._state