X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=src%2Fnepi%2Futil%2Fproxy.py;h=b075efa2ad192fc5734e2d20b9fae0863d2e18f5;hb=6d97b42c5f59a054bbf75df3758ac4c19ba9f0f8;hp=574ef6bfed71dc841d96c922a31d9a47f2a75dbf;hpb=3d91807a47a7e434c162f2264868afa75ef5eb61;p=nepi.git diff --git a/src/nepi/util/proxy.py b/src/nepi/util/proxy.py index 574ef6bf..b075efa2 100644 --- a/src/nepi/util/proxy.py +++ b/src/nepi/util/proxy.py @@ -45,6 +45,7 @@ GUIDS = 27 GET_ROUTE = 28 GET_ADDRESS = 29 RECOVER = 30 +DO_PRECONFIGURE = 31 # PARAMETER TYPE STRING = 100 @@ -83,6 +84,7 @@ testbed_messages = dict({ DO_CREATE: "%d" % DO_CREATE, DO_CONNECT: "%d" % DO_CONNECT, DO_CONFIGURE: "%d" % DO_CONFIGURE, + DO_PRECONFIGURE: "%d" % DO_PRECONFIGURE, DO_CROSS_CONNECT: "%d" % DO_CROSS_CONNECT, GET: "%d|%s" % (GET, "%s|%d|%s"), SET: "%d|%s" % (SET, "%s|%d|%s|%s|%d"), @@ -117,6 +119,7 @@ instruction_text = dict({ DO_CREATE: "DO_CREATE", DO_CONNECT: "DO_CONNECT", DO_CONFIGURE: "DO_CONFIGURE", + DO_PRECONFIGURE: "DO_PRECONFIGURE", DO_CROSS_CONNECT: "DO_CROSS_CONNECT", GET: "GET", SET: "SET", @@ -365,6 +368,8 @@ class TestbedControllerServer(server.Server): reply = self.do_connect(params) elif instruction == DO_CONFIGURE: reply = self.do_configure(params) + elif instruction == DO_PRECONFIGURE: + reply = self.do_preconfigure(params) elif instruction == DO_CROSS_CONNECT: reply = self.do_cross_connect(params) elif instruction == GET: @@ -511,6 +516,10 @@ class TestbedControllerServer(server.Server): self._testbed.do_configure() return "%d|%s" % (OK, "") + def do_preconfigure(self, params): + self._testbed.do_preconfigure() + return "%d|%s" % (OK, "") + def do_cross_connect(self, params): self._testbed.do_cross_connect() return "%d|%s" % (OK, "") @@ -867,6 +876,16 @@ class TestbedControllerProxy(object): if code == ERROR: raise RuntimeError(text) + def do_preconfigure(self): + msg = testbed_messages[DO_PRECONFIGURE] + self._client.send_msg(msg) + reply = self._client.read_reply() + result = reply.split("|") + code = int(result[0]) + text = base64.b64decode(result[1]) + if code == ERROR: + raise RuntimeError(text) + def do_cross_connect(self): msg = testbed_messages[DO_CROSS_CONNECT] self._client.send_msg(msg)