OMF examples
[nepi.git] / examples / omf / nitos_omf6_ping.py
index 0fcb288..1f6d871 100644 (file)
@@ -112,7 +112,6 @@ ec.set(iface2, "essid", "ping")
 ec.set(iface2, "ip", "192.168.0.%s/24" % nodez[-2:]) 
 ec.register_connection(node2, iface2)
 
-
 # Create and Configure the Channel
 channel = ec.register_resource("OMFChannel")
 ec.set(channel, "channel", chan)
@@ -129,22 +128,18 @@ ec.set(app1, "appid", "Ping#1")
 ec.set(app1, "command", "/bin/ping -c3 192.168.0.%s" % nodez[-2:])
 ec.register_connection(app1, node1)
 
-app2 = ec.register_resource("OMFApplication")
-ec.set(app2, "appid", "Kill#1")
-ec.set(app2, "command", "/usr/bin/killall ping")
-ec.register_connection(app2, node1)
-
-# User Behaviour
-ec.register_condition(app1, ResourceAction.STOP, app1, ResourceState.STARTED , "10s")
-ec.register_condition(app2, ResourceAction.START, app1, ResourceState.STARTED , "12s")
-ec.register_condition(app2, ResourceAction.STOP, app2, ResourceState.STARTED , "1s")
+## Make sure the ping stops after 30 seconds
+ec.register_condition(app1, ResourceAction.STOP, app1, 
+        ResourceState.STARTED , "30s")
 
 # Deploy
 ec.deploy()
 
-ec.wait_finished([app1, app2])
+ec.wait_finished([app1])
 
-print ec.trace(app1, "stdout")
+# Retrieve the output of the ping command
+ping_output = ec.trace(app1, "stdout")
+print "\n PING OUTPUT\n", ping_output, "\n"
 
 # Stop Experiment
 ec.shutdown()