From fd64d9521889d53f132cfafec505fcf053d9aec1 Mon Sep 17 00:00:00 2001 From: Robert Latta <robert.latta@geant.org> Date: Wed, 27 Jan 2021 16:25:01 +0000 Subject: [PATCH] added route for getting routers list locally --- inventory_provider/routes/testing.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/inventory_provider/routes/testing.py b/inventory_provider/routes/testing.py index 7405a52e..6c4d655a 100644 --- a/inventory_provider/routes/testing.py +++ b/inventory_provider/routes/testing.py @@ -1,5 +1,6 @@ import collections import json +import os import re from flask import Blueprint, Response, jsonify, current_app @@ -219,6 +220,12 @@ def get_netconf(hostname): return msg +@routes.route("routers-list", methods=['GET', 'POST']) +def routers_from_config_dir(): + with open(os.environ['FAKE_ROUTERS_FILE']) as f: + return Response(f.read(), mimetype="text.plain") + + @routes.route("latchdb", methods=['GET', 'POST']) def latch_db(): config = current_app.config["INVENTORY_PROVIDER_CONFIG"] -- GitLab