From cfd557e95c4b4f4ecfe78cefb5eca8e0166034fb Mon Sep 17 00:00:00 2001 From: Erik Reid <erik.reid@geant.org> Date: Sun, 24 Jan 2021 13:54:06 +0100 Subject: [PATCH] added peer-info, juniper-link-info schemas to docs --- docs/source/protocol/classifier.rst | 5 ++++- inventory_provider/routes/classifier.py | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/docs/source/protocol/classifier.rst b/docs/source/protocol/classifier.rst index 70db45d1..f57083f1 100644 --- a/docs/source/protocol/classifier.rst +++ b/docs/source/protocol/classifier.rst @@ -5,4 +5,7 @@ Classifier Endpoints ========================= -todo +.. autofunction:: inventory_provider.routes.classifier.peer_info + +.. autofunction:: inventory_provider.routes.classifier.get_juniper_link_info + diff --git a/inventory_provider/routes/classifier.py b/inventory_provider/routes/classifier.py index ba79aa3f..877ae863 100644 --- a/inventory_provider/routes/classifier.py +++ b/inventory_provider/routes/classifier.py @@ -183,6 +183,20 @@ def _link_interface_info(r, hostname, interface): methods=['GET', 'POST']) @common.require_accepts_json def get_juniper_link_info(source_equipment, interface): + """ + Handler for /classifier/juniper-link-info that + returns metadata about an IP interface. + + The response will be formatted according to the following schema: + + .. asjson:: + inventory_provider.routes.classifier_schema.JUNIPER_LINK_RESPONSE_SCHEMA + + :param source_equipment: router hostname + :param interface: link interface name + :return: + """ + r = common.get_current_redis() cache_key = 'classifier-cache:juniper:%s:%s' % ( @@ -473,7 +487,17 @@ def find_interfaces_and_services(address_str): @routes.route("/peer-info/<address>", methods=['GET', 'POST']) @common.require_accepts_json def peer_info(address): + """ + Handler for /classifier/peer-info that returns bgp peering metadata. + + The response will be formatted according to the following schema: + .. asjson:: + inventory_provider.routes.classifier_schema.PEER_INFO_RESPONSE_SCHEMA + + :param address: string representation of a bgp peer address + :return: + """ # canonicalize the input address first ... try: obj = ipaddress.ip_address(address) -- GitLab