1 from PLC.Faults import *
2 from PLC.Method import Method
3 from PLC.Parameter import Parameter, Mixed
4 from PLC.Nodes import Node, Nodes
5 from PLC.PCUs import PCU, PCUs
6 from PLC.Auth import Auth
7 from PLC.Methods.DeleteNodeFromPCU import DeleteNodeFromPCU
9 class AdmDisassociatePowerControlUnitPort(DeleteNodeFromPCU):
11 Deprecated. See DeleteNodeFromPCU.
16 roles = ['admin', 'pi', 'tech']
21 Parameter(int, 'PCU port number'),
24 returns = Parameter(int, '1 if successful')
26 def call(self, auth, pcu_id, port):
27 pcus = PCUs(self.api, [pcu_id])
29 raise PLCInvalidArgument, "No such PCU"
33 ports = dict(zip(pcu['ports'], pcu['node_ids']))
35 raise PLCInvalidArgument, "No node on that port or no such port"
37 return DeleteNodeFromPCU(self, auth, ports[port], pcu_id)