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