1 from PLC.Faults import *
2 from PLC.Method import Method
3 from PLC.Parameter import Parameter, Mixed
4 from PLC.PCUs import PCU, PCUs
5 from PLC.Auth import PasswordAuth
6 from PLC.Methods.GetPCUs import GetPCUs
8 class AdmGetPowerControlUnitNodes(GetPCUs):
10 Deprecated. See GetPCUs.
12 Returns a list of the nodes, and the ports they are assigned to,
15 Admin may query all PCUs. Non-admins may only query the PCUs at
19 roles = ['admin', 'pi', 'tech']
26 returns = [{'node_id': Parameter(int, "Node identifier"),
27 'port_number': Parameter(int, "Port number")}]
29 def call(self, auth, pcu_id):
30 pcus = GetPCUs.call(self, auth, [pcu_id])
32 raise PLCInvalidArgument, "No such PCU"
35 return [{'node_id': node_id, 'port_number': port} \
36 for (node_id, port) in zip(pcu['node_ids'], pcu['ports'])]