diff --git a/docs/source/protocol/classifier.rst b/docs/source/protocol/classifier.rst index 70db45d164653591a43d5543b20750e91afb3d16..f57083f1513263144a2c67f5efd834fbf75b3b90 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 ba79aa3f56bd0dee8b3baf1659710b30fb8e034b..877ae86348670cb80076356911c78311b9e61310 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)