From 7d22dc272efb4cb13ee5a733330fdedff7b470dd Mon Sep 17 00:00:00 2001 From: Erik Reid <erik.reid@geant.org> Date: Wed, 2 Jun 2021 10:54:14 +0200 Subject: [PATCH] added /poller/gws/direct doc, started restructuring a bit --- docs/source/protocol/index.rst | 5 +-- docs/source/protocol/poller.rst | 26 --------------- inventory_provider/routes/poller.py | 49 +++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 28 deletions(-) delete mode 100644 docs/source/protocol/poller.rst diff --git a/docs/source/protocol/index.rst b/docs/source/protocol/index.rst index 0ec3dbb5..370ec063 100644 --- a/docs/source/protocol/index.rst +++ b/docs/source/protocol/index.rst @@ -29,9 +29,10 @@ API modules :caption: Contents: classifier - poller lg data jobs msr - lnetd \ No newline at end of file + lnetd + +.. automodule:: inventory_provider.routes.poller diff --git a/docs/source/protocol/poller.rst b/docs/source/protocol/poller.rst deleted file mode 100644 index 7b9040ad..00000000 --- a/docs/source/protocol/poller.rst +++ /dev/null @@ -1,26 +0,0 @@ -.. poller endpoint docs - - -BRIAN support Endpoints -========================= - -These endpoints are intended for use by BRIAN. - -.. contents:: :local: - -/poller/interfaces</hostname> ---------------------------------- - -.. autofunction:: inventory_provider.routes.poller.interfaces - - -/poller/speeds</hostname> ---------------------------------- - -.. autofunction:: inventory_provider.routes.poller.interface_speeds - - -/poller/eumetsat-multicast ---------------------------------- - -.. autofunction:: inventory_provider.routes.poller.eumetsat_multicast diff --git a/inventory_provider/routes/poller.py b/inventory_provider/routes/poller.py index 18275d9f..5fa9bf17 100644 --- a/inventory_provider/routes/poller.py +++ b/inventory_provider/routes/poller.py @@ -1,3 +1,35 @@ +""" +BRIAN support Endpoints +========================= + +These endpoints are intended for use by BRIAN. + +.. contents:: :local: + +/poller/interfaces</hostname> +--------------------------------- + +.. autofunction:: inventory_provider.routes.poller.interfaces + + +/poller/speeds</hostname> +--------------------------------- + +.. autofunction:: inventory_provider.routes.poller.interface_speeds + + +/poller/eumetsat-multicast +--------------------------------- + +.. autofunction:: inventory_provider.routes.poller.eumetsat_multicast + + +/poller/gws/direct +--------------------------------- + +.. autofunction:: inventory_provider.routes.poller.gws_direct + +""" import json import logging import re @@ -577,6 +609,23 @@ def eumetsat_multicast(hostname=None): @routes.route("/gws/direct", methods=['GET', 'POST']) @common.require_accepts_json def gws_direct(): + """ + Handler for `/poller/gws/direct` which returns required for polling + customer equipment counters for ISP connetions. + + The response is a list of nren/isp/counter structures that must be + polled. + + .. asjson:: + inventory_provider.routes.poller.GWS_DIRECT_DATA_SCHEMA + + This method returns essentially hard-coded data, + based on the information in POL1-422. + + TODO: this hard-coded data should be in the config file + + :return: + """ data = [ { "nren": "ARNES", -- GitLab