+def parse_args():
+ pl_slice = os.environ.get("PL_SLICE")
+ pl_user = os.environ.get("PL_USER")
+ pl_pass = os.environ.get("PL_PASS")
+ identity = os.environ.get("PL_SSHKEY")
+
+ usage = ("usage: %prog -a <host1> -b <host2> -c <host3> "
+ "-d <switch1> -e <switch2> -f <switch3> "
+ "-n <vsys_vnet> -C <controller> -s <slicename> -u <pl-user> "
+ "-p <pl-password> -i <ssh-key> ")
+
+ switch1 = "planetlab2.virtues.fi"
+ switch2 = "planetlab2.upc.es"
+ switch3 = "inriarennes1.irisa.fr"
+ host1 = "planetlab2.ionio.gr"
+ host2 = "iraplab2.iralab.uni-karlsruhe.de"
+ host3 = "planetlab2.diku.dk"
+
+ parser = OptionParser(usage = usage)
+ parser.add_option("-a", "--host1", dest="host1",
+ help="Hostname for PlanetLab host 1", default=host1)
+ parser.add_option("-b", "--host2", dest="host2",
+ help="Hostname for PlanetLab host 2", default=host2)
+ parser.add_option("-c", "--host3", dest="host3",
+ help="Hostname for PlanetLab host 3", default=host3)
+ parser.add_option("-d", "--switch1", dest="switch1",
+ help="Hostname for PlanetLab switch 1", default=switch1)
+ parser.add_option("-e", "--switch2", dest="switch2",
+ help="Hostname for PlanetLab switch 2", default=switch2)
+ parser.add_option("-f", "--switch3", dest="switch3",
+ help="Hostname for PlanetLab switch 3", default=switch3)
+ parser.add_option("-n", "--vsys_vnet", dest="vsys_vnet",
+ help="Overlay network address of the form x.x.x.x/yy. "
+ "Must correspond to the vsys_vnet tag on the PlanetLab slice")
+ parser.add_option("-C", "--controller", dest="controller",
+ help="IP address for the OpenFlow controller, if one has been deployed",
+ default="1.1.1.1")
+ parser.add_option("-s", "--slicename", dest="slicename",
+ help="Name of PlanetLab slice",
+ default=pl_slice)
+ parser.add_option("-u", "--pl_user", dest="pl_user",
+ help="PlanetLab user (email address)",
+ default=pl_user)
+ parser.add_option("-p", "--pl_pass", dest="pl_pass",
+ help="PlanetLab password",
+ default=pl_pass)
+ parser.add_option("-i", "--identity", dest="identity",
+ help="Path to SSH key",
+ default=identity)
+
+ (options, args) = parser.parse_args()
+
+ return (options.host1, options.host2, options.host3, options.switch1,
+ options.switch2, options.switch3, options.vsys_vnet,
+ options.controller, options.slicename, options.pl_user,
+ options.pl_pass, identity)
+
+(host1, host2, host3, switch1, switch2, switch3, vsys_vnet, controller,
+ slicename, pl_user, pl_pass, identity) = parse_args()