X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=PLC%2FMethods%2FGetRoutes.py;fp=PLC%2FMethods%2FGetRoutes.py;h=a0037730d337eb8855af413ae2d7f8f8ac51b3d3;hb=f1b4415be5ba4be9941d25b531c46696b377fa3a;hp=0000000000000000000000000000000000000000;hpb=cb77137d884be296fe1e0b15eabe69d18ba443ae;p=plcapi.git diff --git a/PLC/Methods/GetRoutes.py b/PLC/Methods/GetRoutes.py new file mode 100644 index 0000000..a003773 --- /dev/null +++ b/PLC/Methods/GetRoutes.py @@ -0,0 +1,34 @@ +# $Id$ +# $URL$ +from PLC.Faults import * +from PLC.Method import Method +from PLC.Parameter import Parameter, Mixed +from PLC.Filter import Filter +from PLC.Routes import Route, Routes +from PLC.Auth import Auth + +class GetRoutes(Method): + """ + Returns an array of structs containing details about routes. + If interfaces_filter is specified and is an array of + interface identifiers, or a struct of interface fields and + values, only interfaces matching the filter will be + returned. + + If return_fields is given, only the specified details will be returned. + """ + + roles = ['admin', 'pi', 'user', 'tech', 'node', 'anonymous'] + + accepts = [ + Auth(), + Mixed([Mixed(Route.fields['route_id'])], + Parameter (int, "route id"), + Filter(Route.fields)), + Parameter([str], "List of fields to return", nullok = True) + ] + + returns = [Route.fields] + + def call(self, auth, route_filter = None, return_fields = None): + return Routes(self.api, route_filter, return_fields)