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 # SFA on a different machine than PLC.
12 def __init__(self,logger):
16 def call(self, name, pl_auth, *args):
18 key = pl_auth["Url"] + "#" + pl_auth["Username"]
20 if not (key in self.servers):
21 self.logger.info("Connecting to PLCAPI at url %s"%pl_auth['Url'])
22 server = xmlrpclib.Server(pl_auth["Url"], verbose = 0, allow_none=True)
23 #server.AdmAuthCheck(pl_auth)
24 server.AuthCheck(pl_auth)
25 self.servers[key] = server
27 server = self.servers[key]
31 arglist.append(repr(arg))
33 str = "server." + name + "(" + ",".join(arglist) + ")"
38 # TODO: there's probably an automatic way to import all these stubs
40 def AddInitScript(self, pl_auth, *args):
41 return self.call("AddInitScript", pl_auth, *args)
43 def AddNode(self, pl_auth, *args):
44 return self.call("AddNode", pl_auth, *args)
46 def AddPerson(self, pl_auth, *args):
47 return self.call("AddPerson", pl_auth, *args)
49 def AddPersonToSlice(self, pl_auth, *args):
50 return self.call("AddPersonToSlice", pl_auth, *args)
52 def AddSite(self, pl_auth, *args):
53 return self.call("AddSite", pl_auth, *args)
55 def AddSlice(self, pl_auth, *args):
56 return self.call("AddSlice", pl_auth, *args)
58 def DeleteNode(self, pl_auth, *args):
59 return self.call("DeleteNode", pl_auth, *args)
61 def DeletePerson(self, pl_auth, *args):
62 return self.call("DeletePerson", pl_auth, *args)
64 def DeletePersonFromSlice(self, pl_auth, *args):
65 return self.call("DeletePersonFromSlice", pl_auth, *args)
67 def DeleteSite(self, pl_auth, *args):
68 return self.call("DeleteSite", pl_auth, *args)
70 def DeleteSlice(self, pl_auth, *args):
71 return self.call("DeleteSlice", pl_auth, *args)
73 def GetInitScripts(self, pl_auth, *args):
74 return self.call("GetInitScripts", pl_auth, *args)
76 def GetKeys(self, pl_auth, *args):
77 return self.call("GetKeys", pl_auth, *args)
79 def GetNodes(self, pl_auth, *args):
80 return self.call("GetNodes", pl_auth, *args)
82 def GetPersons(self, pl_auth, *args):
83 return self.call("GetPersons", pl_auth, *args)
85 def GetSites(self, pl_auth, *args):
86 return self.call("GetSites", pl_auth, *args)
88 def GetSliceAttributes(self, pl_auth, *args):
89 return self.call("GetSliceAttributes", pl_auth, *args)
91 def GetSlices(self, pl_auth, *args):
92 return self.call("GetSlices", pl_auth, *args)
94 def UpdateNode(self, pl_auth, *args):
95 return self.call("UpdateNode", pl_auth, *args)
97 def UpdatePerson(self, pl_auth, *args):
98 return self.call("UpdatePerson", pl_auth, *args)
100 def UpdateSite(self, pl_auth, *args):
101 return self.call("UpdateSite", pl_auth, *args)
103 def UpdateSlice(self, pl_auth, *args):
104 return self.call("UpdateSlice", pl_auth, *args)