X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=root-context%2Fexec%2Fconnectswitch;fp=root-context%2Fexec%2Fconnectswitch;h=b61e1860fc7c955a572f9e1fa4acd01ff0e819e4;hb=10503d985ac1acdac4ed653e608ccc492baa446a;hp=0000000000000000000000000000000000000000;hpb=46f46b3486d68231a875c7c21e5dd64282b3813a;p=vsys-scripts.git diff --git a/root-context/exec/connectswitch b/root-context/exec/connectswitch new file mode 100755 index 0000000..b61e186 --- /dev/null +++ b/root-context/exec/connectswitch @@ -0,0 +1,29 @@ +#!/usr/bin/python + +import sys +import pwd +import re +import socket +import struct +import os +import string + +vsys_config_dir = "/etc/planetlab/vsys-attributes" + +if len(sys.argv) != 2: sys.exit(1) + +slicename=sys.argv[1] +sliceid = pwd.getpwnam(slicename).pw_uid +dpname = "dp-%d"%sliceid + +### Read args from stdin +arglines = map(string.strip, sys.stdin.readlines()) +if len(arglines) != 1: sys.exit(1) +of_server = arglines[0] + +if re.match(r'^(tcp|udp):[\d\.]+$', of_server) is None: + print "Address '%s' is invalid; should look like 'tcp:10.0.5.6'" % of_server + exit(1) + +print "Requesting creation of data path %s."%dpname +os.system("ovs-openflowd %s %s" % (dpname, of_server))