Commit 0a686447 authored by Leigh Stoller's avatar Leigh Stoller

Add a second vlans function, which will eventually replace the

original, but for now the second version is to develop my changes;
instead of processing the arguments and sending things through on
the command line, take the blob of xml and send it through to the
proxy (via a file) and let it convert the xml to a data structure
(the same data structure that the client inside the elabinelab sent).
Much easier and less error prone.
parent 5e1e0895
#! /usr/bin/env python
#
# EMULAB-COPYRIGHT
# Copyright (c) 2004-2007 University of Utah and the Flux Group.
# Copyright (c) 2004-2008 University of Utah and the Flux Group.
# All rights reserved.
#
import sys
......@@ -4350,6 +4350,42 @@ class elabinelab:
return EmulabResponse(RESPONSE_SUCCESS, output=output)
def vlansnew(self, version, argdict):
if version != self.VERSION:
return EmulabResponse(RESPONSE_BADVERSION,
output="Client version mismatch!")
try:
checknologins()
pass
except NoLoginsError, e:
return EmulabResponse(RESPONSE_REFUSED, output=str(e))
argerror = CheckRequiredArgs(argdict, ("xmldoc",))
if (argerror):
return argerror
verifyerror = self.verifystuff();
if (verifyerror):
return verifyerror
#
# We get an xmldoc as the argument, which we give to the proxy
# to decode on its own. Easier then trying to decode a bunch
# of stuff to pass on the commandline.
#
(xmlfp, xmlfilename) = writensfile(argdict["xmldoc"]);
if not xmlfilename:
return EmulabResponse(RESPONSE_SERVERERROR, output="Server Error")
argstr = "-p " + self.pid + " -e " + self.eid + " " + xmlfilename;
(exitval, output) = runcommand(TBDIR + "/sbin/snmpit.proxy2 " + argstr)
if exitval:
return EmulabResponse(RESPONSE_ERROR, exitval >> 8, output=output)
return EmulabResponse(RESPONSE_SUCCESS, output=output)
#
# Fire up a frisbeed for an image,
#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment