X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=examples%2Flinux%2Fping.py;h=3e9f03a8082308956c46bd1b65312d1b544d42e1;hb=327c0ed98930e561cf240a2e4d0b2ddd2d4c1c84;hp=eaee0dee751f73949d39975c489efc34bf8d4bcc;hpb=8142962e1ddc0e587b32832cec0b726e6307a332;p=nepi.git diff --git a/examples/linux/ping.py b/examples/linux/ping.py index eaee0dee..3e9f03a8 100644 --- a/examples/linux/ping.py +++ b/examples/linux/ping.py @@ -18,18 +18,44 @@ # # Author: Alina Quereilhac +# Example of how to run this experiment (replace with your information): +# +# $ cd +# python examples/linux/ping.py -a -u -i + + from nepi.execution.ec import ExperimentController +from optparse import OptionParser, SUPPRESS_HELP +import os + +usage = ("usage: %prog -a -u -i ") + +parser = OptionParser(usage = usage) +parser.add_option("-a", "--hostname", dest="hostname", + help="Remote host", type="str") +parser.add_option("-u", "--username", dest="username", + help="Username to SSH to remote host", type="str") +parser.add_option("-i", "--ssh-key", dest="ssh_key", + help="Path to private SSH key to be used for connection", + type="str") +(options, args) = parser.parse_args() + +hostname = options.hostname +username = options.username +ssh_key = options.ssh_key + ec = ExperimentController(exp_id = "ping-exp") node = ec.register_resource("LinuxNode") -ec.set(node, "hostname", host) +ec.set(node, "hostname", hostname) ec.set(node, "username", username) +ec.set(node, "identity", ssh_key) ec.set(node, "cleanHome", True) ec.set(node, "cleanProcesses", True) app = ec.register_resource("LinuxApplication") -ec.set(app, "command", "ping -c3 www.google.com") +ec.set(app, "command", "ping -c3 nepi.inria.fr") ec.register_connection(app, node) ec.deploy() @@ -38,5 +64,5 @@ ec.wait_finished(app) print ec.trace(app, "stdout") - ec.shutdown() +