use print() - import print_function - should be fine for both py2 and py3
[nepi.git] / examples / planetlab / ping.py
index e36ba61..f35ea70 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
@@ -25,6 +24,7 @@
 # $ cd <path-to-nepi>
 # python examples/planetlab/ping.py -s <pl-slice> -u <pl-user> -p <pl-password> -k <pl-ssh-key>  
 
+from __future__ import print_function
 
 from nepi.execution.ec import ExperimentController
 
@@ -56,7 +56,7 @@ pl_password = options.pl_password
 ec = ExperimentController(exp_id = "pl_ping")
 
 # Register a Planetlab Node with no restrictions, it can be any node
-node = ec.register_resource("PlanetlabNode")
+node = ec.register_resource("planetlab::Node")
 
 # The username in this case is the slice name, the one to use for login in 
 # via ssh into PlanetLab nodes. Replace with your own slice name.
@@ -69,11 +69,11 @@ ec.set(node, "pluser", pl_user)
 ec.set(node, "plpassword", pl_password)
 
 # Remove previous results
-ec.set(node, "cleanHome", True)
+ec.set(node, "cleanExperiment", True)
 ec.set(node, "cleanProcesses", True)
 
 # Define a ping application
-app = ec.register_resource("LinuxApplication")
+app = ec.register_resource("linux::Application")
 ec.set(app, "command", "ping -c3 nepi.inria.fr")
 
 # Connect the application to the node
@@ -87,9 +87,9 @@ ec.wait_finished(app)
 
 trace = ec.trace(app, "stdout")
 
-print "PING outout ", trace
+print("PING outout ", trace)
 
-# Do the experiment controller shutdown:
+# Do the experiment controller shutdown
 ec.shutdown()
 
 # END