3 # interface to the PLC api via xmlrpc
5 # RemoteShell() exports an API that looks identical to that exported by
6 # PLC.Shell.Shell(). It's meant to be a drop in replacement for running
7 # geniwrapper on a different machine than PLC.
15 def call(self, name, pl_auth, *args):
17 key = pl_auth["Url"] + "#" + pl_auth["Username"]
19 if not (key in self.servers):
20 server = xmlrpclib.Server(pl_auth["Url"], verbose = 0, allow_none=True)
21 #server.AdmAuthCheck(pl_auth)
22 server.AuthCheck(pl_auth)
23 self.servers[key] = server
25 server = self.servers[key]
29 arglist.append(repr(arg))
31 str = "server." + name + "(" + ",".join(arglist) + ")"
36 # TODO: there's probably an automatic way to import all these stubs
38 def AddInitScript(self, pl_auth, *args):
39 return self.call("AddInitScript", pl_auth, *args)
41 def AddNode(self, pl_auth, *args):
42 return self.call("AddNode", pl_auth, *args)
44 def AddPerson(self, pl_auth, *args):
45 return self.call("AddPerson", pl_auth, *args)
47 def AddSite(self, pl_auth, *args):
48 return self.call("AddSite", pl_auth, *args)
50 def AddSlice(self, pl_auth, *args):
51 return self.call("AddSlice", pl_auth, *args)
53 def DeleteNode(self, pl_auth, *args):
54 return self.call("DeleteNode", pl_auth, *args)
56 def DeletePerson(self, pl_auth, *args):
57 return self.call("DeletePerson", pl_auth, *args)
59 def DeleteSite(self, pl_auth, *args):
60 return self.call("DeleteSite", pl_auth, *args)
62 def DeleteSlice(self, pl_auth, *args):
63 return self.call("DeleteSlice", pl_auth, *args)
65 def GetInitScripts(self, pl_auth, *args):
66 return self.call("GetInitScripts", pl_auth, *args)
68 def GetKeys(self, pl_auth, *args):
69 return self.call("GetKeys", pl_auth, *args)
71 def GetNodes(self, pl_auth, *args):
72 return self.call("GetNodes", pl_auth, *args)
74 def GetPersons(self, pl_auth, *args):
75 return self.call("GetPersons", pl_auth, *args)
77 def GetSites(self, pl_auth, *args):
78 return self.call("GetSites", pl_auth, *args)
80 def GetSliceAttributes(self, pl_auth, *args):
81 return self.call("GetSliceAttributes", pl_auth, *args)
83 def GetSlices(self, pl_auth, *args):
84 return self.call("GetSlices", pl_auth, *args)
86 def UpdateNode(self, pl_auth, *args):
87 return self.call("UpdateNode", pl_auth, *args)
89 def UpdatePerson(self, pl_auth, *args):
90 return self.call("UpdatePerson", pl_auth, *args)
92 def UpdateSite(self, pl_auth, *args):
93 return self.call("UpdateSite", pl_auth, *args)
95 def UpdateSlice(self, pl_auth, *args):
96 return self.call("UpdateSlice", pl_auth, *args)