Skip to content
Snippets Groups Projects
Commit bd77619c authored by Erik Reid's avatar Erik Reid
Browse files

use junosspace for router list

parent 411bb772
No related branches found
No related tags found
No related merge requests found
import json
import re
from flask import Blueprint, Response, current_app, jsonify
......@@ -26,11 +27,15 @@ def coriant_addresses():
@routes.route("/juniper-server-addresses", methods=['GET', 'POST'])
@common.require_accepts_json
def juniper_addresses():
# TODO: definitive way of returning these addresses
# TODO: probably this (and corant, infinera routes) can be removed
routers = current_app.config[
"INVENTORY_PROVIDER_CONFIG"]["routers"]
return jsonify([r['hostname'] for r in routers])
# TODO: this route (and corant, infinera routes) can be removed
r = common.get_redis()
routers = []
for k in r.keys('junosspace:*'):
info = r.get(k.decode('utf-8'))
assert info # sanity: value shouldn't be empty
info = json.loads(info.decode('utf-8'))
routers.append(info['address'])
return jsonify(routers)
@routes.route("/trap-metadata/<source_equipment>/<path:interface>",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment