use print() - import print_function - should be fine for both py2 and py3
[nepi.git] / examples / omf / testing / nitos_omf5_ping.py
index ee0c316..44d0ae9 100644 (file)
@@ -4,9 +4,8 @@
 #    Copyright (C) 2013 INRIA
 #
 #    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU General Public License as published by
-#    the Free Software Foundation, either version 3 of the License, or
-#    (at your option) any later version.
+#    it under the terms of the GNU General Public License version 2 as
+#    published by the Free Software Foundation;
 #
 #    This program is distributed in the hope that it will be useful,
 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -43,6 +42,8 @@
 #
 #
 
+from __future__ import print_function
+
 from nepi.execution.ec import ExperimentController
 from nepi.execution.resource import ResourceAction, ResourceState
 
@@ -76,7 +77,7 @@ chan = options.channel
 ec = ExperimentController(exp_id="nitos_omf5_ping")
 
 # Create and Configure the Nodes
-node1 = ec.register_resource("OMFNode")
+node1 = ec.register_resource("omf::Node")
 ec.set(node1, "hostname", nodex)
 ec.set(node1, "xmppUser", slicename)
 ec.set(node1, "xmppServer", "nitlab.inf.uth.gr")
@@ -85,7 +86,7 @@ ec.set(node1, "xmppPassword", "1234")
 ec.set(node1, "version", "5")
 
 # Create and Configure the Interfaces
-iface1 = ec.register_resource("OMFWifiInterface")
+iface1 = ec.register_resource("omf::WifiInterface")
 ec.set(iface1, "name", "wlan0")
 ec.set(iface1, "mode", "adhoc")
 ec.set(iface1, "hw_mode", "g")
@@ -95,7 +96,7 @@ ec.set(iface1, "version", "5")
 ec.register_connection(node1, iface1)
 
 # Create and Configure the Channel
-channel = ec.register_resource("OMFChannel")
+channel = ec.register_resource("omf::Channel")
 ec.set(channel, "channel", chan)
 ec.set(channel, "xmppUser", slicename)
 ec.set(channel, "xmppServer", "nitlab.inf.uth.gr")
@@ -105,13 +106,13 @@ ec.set(channel, "version", "5")
 ec.register_connection(iface1, channel)
 
 # Create and Configure the PING Application
-app1 = ec.register_resource("OMFApplication")
+app1 = ec.register_resource("omf::Application")
 ec.set(app1, "appid", "Ping#1")
 ec.set(app1, "command", "/bin/ping -c3 192.168.0.%s" % nodex[-2:])
 ec.set(app1, "version", "5")
 ec.register_connection(app1, node1)
 
-app2 = ec.register_resource("OMFApplication")
+app2 = ec.register_resource("omf::Application")
 ec.set(app2, "appid", "Kill#1")
 ec.set(app2, "command", "/usr/bin/killall ping")
 ec.set(app2, "version", "5")
@@ -127,7 +128,7 @@ ec.deploy()
 
 ec.wait_finished([app1, app2])
 
-print ec.trace(app1, "stdout")
+print(ec.trace(app1, "stdout"))
 
 # Stop Experiment
 ec.shutdown()