NIPAP XML-RPC

This module contains the actual functions presented over the XML-RPC API. All functions are quite thin and mostly wrap around the functionality provided by the backend module.

class nipap.xmlrpc.NipapXMLRPC

NIPAP XML-RPC API

add_asn(*args, **kwargs)

Add a new ASN.

Valid keys in the args-struct:

  • auth [struct]

    Authentication options passed to the AuthFactory.

  • attr [struct]

    ASN attributes.

Returns the ASN.

add_pool(*args, **kwargs)

Add a pool.

Valid keys in the args-struct:

  • auth [struct]

    Authentication options passed to the AuthFactory.

  • attr [struct]

    Attributes which will be set on the new pool.

Returns ID of created pool.

add_prefix(*args, **kwargs)

Add a prefix.

Valid keys in the args-struct:

  • auth [struct]

    Authentication options passed to the AuthFactory.

  • attr [struct]

    Attributes to set on the new prefix.

  • args [srgs]

    Arguments for addition of prefix, such as what pool or prefix it should be allocated from.

Returns ID of created prefix.

add_vrf(*args, **kwargs)

Add a new VRF.

Valid keys in the args-struct:

  • auth [struct]

    Authentication options passed to the AuthFactory.

  • attr [struct]

    VRF attributes.

Returns the internal database ID for the VRF.

db_version(*args, **kwargs)

Returns schema version of nipap psql db

Returns a string.

echo(*args, **kwargs)

An echo function

An API test function which simply echoes what is is passed in the ‘message’ element in the args-dict..

Valid keys in the args-struct:

  • auth [struct]

    Authentication options passed to the AuthFactory.

  • message [string]

    String to echo.

  • sleep [integer]

    Number of seconds to sleep before echoing.

Returns a string.

edit_asn(*args, **kwargs)

Edit an ASN.

Valid keys in the args-struct:

  • auth [struct]

    Authentication options passed to the AuthFactory.

  • asn [integer]

    An integer specifying which ASN to edit.

  • attr [struct]

    ASN attributes.

edit_pool(*args, **kwargs)

Edit pool.

Valid keys in the args-struct:

  • auth [struct]

    Authentication options passed to the AuthFactory.

  • pool [struct]

    Specifies pool attributes to match.

  • attr [struct]

    Pool attributes to set.

edit_prefix(*args, **kwargs)

Edit prefix.

Valid keys in the args-struct:

  • auth [struct]

    Authentication options passed to the AuthFactory.

  • prefix [struct]

    Prefix attributes which describes what prefix(es) to edit.

  • attr [struct]

    Attribuets to set on the new prefix.

edit_vrf(*args, **kwargs)

Edit a VRF.

Valid keys in the args-struct:

  • auth [struct]

    Authentication options passed to the AuthFactory.

  • vrf [struct]

    A VRF spec specifying which VRF(s) to edit.

  • attr [struct]

    VRF attributes.

find_free_prefix(*args, **kwargs)

Find a free prefix.

Valid keys in the args-struct:

  • auth [struct]

    Authentication options passed to the AuthFactory.

  • args [struct]

    Arguments for the find_free_prefix-function such as what prefix or pool to allocate from.

list_asn(*args, **kwargs)

List ASNs.

Valid keys in the args-struct:

  • auth [struct]

    Authentication options passed to the AuthFactory.

  • asn [struct]

    Specifies ASN attributes to match (optional).

Returns a list of ASNs matching the ASN spec as a list of structs.

list_pool(*args, **kwargs)

List pools.

Valid keys in the args-struct:

  • auth [struct]

    Authentication options passed to the AuthFactory.

  • pool [struct]

    Specifies pool attributes which will be matched.

Returns a list of structs describing the matching pools.

list_prefix(*args, **kwargs)

List prefixes.

Valid keys in the args-struct:

  • auth [struct]

    Authentication options passed to the AuthFactory.

  • prefix [struct]

    Prefix attributes to match.

Returns a list of structs describing the matching prefixes.

Certain values are casted from numbers to strings because XML-RPC simply cannot handle anything bigger than an integer.

list_vrf(*args, **kwargs)

List VRFs.

Valid keys in the args-struct:

  • auth [struct]

    Authentication options passed to the AuthFactory.

  • vrf [struct]

    Specifies VRF attributes to match (optional).

Returns a list of structs matching the VRF spec.

remove_asn(*args, **kwargs)

Removes an ASN.

Valid keys in the args-struct:

  • auth [struct]

    Authentication options passed to the AuthFactory.

  • asn [integer]

    An ASN.

remove_pool(*args, **kwargs)

Remove a pool.

Valid keys in the args-struct:

  • auth [struct]

    Authentication options passed to the AuthFactory.

  • pool [struct]

    Specifies what pool(s) to remove.

remove_prefix(*args, **kwargs)

Remove a prefix.

Valid keys in the args-struct:

  • auth [struct]

    Authentication options passed to the AuthFactory.

  • prefix [struct]

    Attributes used to select what prefix to remove.

  • recursive [boolean]

    When set to 1, also remove child prefixes.

remove_vrf(*args, **kwargs)

Removes a VRF.

Valid keys in the args-struct:

  • auth [struct]

    Authentication options passed to the AuthFactory.

  • vrf [struct]

    A VRF spec.

search_asn(*args, **kwargs)

Search ASNs.

Valid keys in the args-struct:

  • auth [struct]

    Authentication options passed to the AuthFactory.

  • query [struct]

    A struct specifying the search query.

  • search_options [struct]

    Options for the search query, such as limiting the number of results returned.

Returns a struct containing search result and the search options used.

search_pool(*args, **kwargs)

Search for pools.

Valid keys in the args-struct:

  • auth [struct]

    Authentication options passed to the AuthFactory.

  • query [struct]

    A struct specifying the search query.

  • search_options [struct]

    Options for the search query, such as limiting the number of results returned.

Returns a struct containing search result and the search options used.

search_prefix(*args, **kwargs)

Search for prefixes.

Valid keys in the args-struct:

  • auth [struct]

    Authentication options passed to the AuthFactory.

  • query [struct]

    A struct specifying the search query.

  • search_options [struct]

    Options for the search query, such as limiting the number of results returned.

Returns a struct containing the search result together with the search options used.

Certain values are casted from numbers to strings because XML-RPC simply cannot handle anything bigger than an integer.

search_vrf(*args, **kwargs)

Search for VRFs.

Valid keys in the args-struct:

  • auth [struct]

    Authentication options passed to the AuthFactory.

  • query [struct]

    A struct specifying the search query.

  • search_options [struct]

    Options for the search query, such as limiting the number of results returned.

Returns a struct containing search result and the search options used.

smart_search_asn(*args, **kwargs)

Perform a smart search among ASNs.

Valid keys in the args-struct:

  • auth [struct]

    Authentication options passed to the AuthFactory.

  • query_string [string]

    The search string.

  • search_options [struct]

    Options for the search query, such as limiting the number of results returned.

Returns a struct containing search result, interpretation of the search string and the search options used.

smart_search_pool(*args, **kwargs)

Perform a smart search.

Valid keys in the args-struct:

  • auth [struct]

    Authentication options passed to the AuthFactory.

  • query [string]

    The search string.

  • search_options [struct]

    Options for the search query, such as limiting the number of results returned.

Returns a struct containing search result, interpretation of the query string and the search options used.

smart_search_prefix(*args, **kwargs)

Perform a smart search.

Valid keys in the args-struct:

  • auth [struct]

    Authentication options passed to the AuthFactory.

  • query_string [string]

    The search string.

  • search_options [struct]

    Options for the search query, such as limiting the number of results returned.

  • extra_query [struct]

    Extra search terms, will be AND:ed together with what is extracted from the query string.

Returns a struct containing search result, interpretation of the query string and the search options used.

Certain values are casted from numbers to strings because XML-RPC simply cannot handle anything bigger than an integer.

smart_search_vrf(*args, **kwargs)

Perform a smart search.

Valid keys in the args-struct:

  • auth [struct]

    Authentication options passed to the AuthFactory.

  • query_string [string]

    The search string.

  • search_options [struct]

    Options for the search query, such as limiting the number of results returned.

Returns a struct containing search result, interpretation of the search string and the search options used.

version(*args, **kwargs)

Returns nipapd version

Returns a string.

nipap.xmlrpc.authenticate()

Sends a 401 response that enables basic auth

nipap.xmlrpc.requires_auth(f)

Class decorator for XML-RPC functions that requires auth