X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=trunk%2FPLC%2FMethods%2FAdmGetAllNodeNetworks.py;fp=trunk%2FPLC%2FMethods%2FAdmGetAllNodeNetworks.py;h=c00bdec437d13bb217f0f1b53016e7fa553ea50c;hb=5a4c1b1278ffa01e630fde47f7c54888ed20a576;hp=0000000000000000000000000000000000000000;hpb=cee5ab52df1c9f38b6eaff2dd354cb22f59028c7;p=plcapi.git diff --git a/trunk/PLC/Methods/AdmGetAllNodeNetworks.py b/trunk/PLC/Methods/AdmGetAllNodeNetworks.py new file mode 100644 index 0000000..c00bdec --- /dev/null +++ b/trunk/PLC/Methods/AdmGetAllNodeNetworks.py @@ -0,0 +1,37 @@ +from PLC.Faults import * +from PLC.Method import Method +from PLC.Parameter import Parameter, Mixed +from PLC.Nodes import Node, Nodes +from PLC.NodeNetworks import NodeNetwork, NodeNetworks +from PLC.Auth import Auth +from PLC.Methods.GetNodeNetworks import GetNodeNetworks + +class AdmGetAllNodeNetworks(GetNodeNetworks): + """ + Deprecated. Functionality can be implemented with GetNodes and + GetNodeNetworks. + """ + + status = "deprecated" + + roles = ['admin', 'pi', 'user', 'tech'] + + accepts = [ + Auth(), + Mixed(Node.fields['node_id'], + Node.fields['hostname']) + ] + + returns = [NodeNetwork.fields] + + def call(self, auth, node_id_or_hostname): + # Get node information + nodes = Nodes(self.api, [node_id_or_hostname]) + if not nodes: + raise PLCInvalidArgument, "No such node" + node = nodes[0] + + if not node['nodenetwork_ids']: + return [] + + return GetNodeNetworks.call(self, auth, node['nodenetwork_ids'])