Improved unified IPv4/6 support, also allows setting default
This commit is contained in:
parent
3c76d1679f
commit
1b68bf7a18
36
lg.py
36
lg.py
@ -123,7 +123,7 @@ def whois_command(query):
|
|||||||
def bird_command(host, proto, query):
|
def bird_command(host, proto, query):
|
||||||
"""Alias to bird_proxy for bird service"""
|
"""Alias to bird_proxy for bird service"""
|
||||||
if app.config.get("UNIFIED_DAEMON", False):
|
if app.config.get("UNIFIED_DAEMON", False):
|
||||||
return bird_proxy(host, "ipv4", "bird", query)
|
return bird_proxy(host, app.config.get("PROTO_DEFAULT", "ipv4"), "bird", query)
|
||||||
else:
|
else:
|
||||||
return bird_proxy(host, proto, "bird", query)
|
return bird_proxy(host, proto, "bird", query)
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ def hello():
|
|||||||
if app.config.get("UNIFIED_DAEMON", False):
|
if app.config.get("UNIFIED_DAEMON", False):
|
||||||
return redirect("/summary/all")
|
return redirect("/summary/all")
|
||||||
else:
|
else:
|
||||||
return redirect("/summary/all/ipv4")
|
return redirect("/summary/all/%s" % app.config.get("PROTO_DEFAULT", "ipv4"))
|
||||||
|
|
||||||
|
|
||||||
def error_page(text):
|
def error_page(text):
|
||||||
@ -234,7 +234,7 @@ SUMMARY_UNWANTED_PROTOS = ["Kernel", "Static", "Device", "BFD"]
|
|||||||
|
|
||||||
@app.route("/summary/<hosts>")
|
@app.route("/summary/<hosts>")
|
||||||
@app.route("/summary/<hosts>/<proto>")
|
@app.route("/summary/<hosts>/<proto>")
|
||||||
def summary(hosts, proto="ipv4"):
|
def summary(hosts, proto=app.config.get("PROTO_DEFAULT", "ipv4")):
|
||||||
set_session("summary", hosts, proto, "")
|
set_session("summary", hosts, proto, "")
|
||||||
command = "show protocols"
|
command = "show protocols"
|
||||||
|
|
||||||
@ -286,8 +286,9 @@ def summary(hosts, proto="ipv4"):
|
|||||||
return render_template('summary.html', summary=summary, command=command, errors=errors)
|
return render_template('summary.html', summary=summary, command=command, errors=errors)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/detail/<hosts>")
|
||||||
@app.route("/detail/<hosts>/<proto>")
|
@app.route("/detail/<hosts>/<proto>")
|
||||||
def detail(hosts, proto):
|
def detail(hosts, proto=app.config.get("PROTO_DEFAULT", "ipv4")):
|
||||||
name = get_query()
|
name = get_query()
|
||||||
|
|
||||||
if not name:
|
if not name:
|
||||||
@ -318,8 +319,9 @@ def detail(hosts, proto):
|
|||||||
return render_template('detail.html', detail=detail, command=command, errors=errors)
|
return render_template('detail.html', detail=detail, command=command, errors=errors)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/traceroute/<hosts>")
|
||||||
@app.route("/traceroute/<hosts>/<proto>")
|
@app.route("/traceroute/<hosts>/<proto>")
|
||||||
def traceroute(hosts, proto):
|
def traceroute(hosts, proto=app.config.get("PROTO_DEFAULT", "ipv4")):
|
||||||
q = get_query()
|
q = get_query()
|
||||||
|
|
||||||
if not q:
|
if not q:
|
||||||
@ -361,43 +363,51 @@ def traceroute(hosts, proto):
|
|||||||
return render_template('traceroute.html', infos=infos, errors=errors)
|
return render_template('traceroute.html', infos=infos, errors=errors)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/adv/<hosts>")
|
||||||
@app.route("/adv/<hosts>/<proto>")
|
@app.route("/adv/<hosts>/<proto>")
|
||||||
def show_route_filter(hosts, proto):
|
def show_route_filter(hosts, proto=app.config.get("PROTO_DEFAULT", "ipv4")):
|
||||||
return show_route("adv", hosts, proto)
|
return show_route("adv", hosts, proto)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/adv_bgpmap/<hosts>")
|
||||||
@app.route("/adv_bgpmap/<hosts>/<proto>")
|
@app.route("/adv_bgpmap/<hosts>/<proto>")
|
||||||
def show_route_filter_bgpmap(hosts, proto):
|
def show_route_filter_bgpmap(hosts, proto=app.config.get("PROTO_DEFAULT", "ipv4")):
|
||||||
return show_route("adv_bgpmap", hosts, proto)
|
return show_route("adv_bgpmap", hosts, proto)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/where/<hosts>")
|
||||||
@app.route("/where/<hosts>/<proto>")
|
@app.route("/where/<hosts>/<proto>")
|
||||||
def show_route_where(hosts, proto):
|
def show_route_where(hosts, proto=app.config.get("PROTO_DEFAULT", "ipv4")):
|
||||||
return show_route("where", hosts, proto)
|
return show_route("where", hosts, proto)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/where_detail/<hosts>")
|
||||||
@app.route("/where_detail/<hosts>/<proto>")
|
@app.route("/where_detail/<hosts>/<proto>")
|
||||||
def show_route_where_detail(hosts, proto):
|
def show_route_where_detail(hosts, proto=app.config.get("PROTO_DEFAULT", "ipv4")):
|
||||||
return show_route("where_detail", hosts, proto)
|
return show_route("where_detail", hosts, proto)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/where_bgpmap/<hosts>")
|
||||||
@app.route("/where_bgpmap/<hosts>/<proto>")
|
@app.route("/where_bgpmap/<hosts>/<proto>")
|
||||||
def show_route_where_bgpmap(hosts, proto):
|
def show_route_where_bgpmap(hosts, proto=app.config.get("PROTO_DEFAULT", "ipv4")):
|
||||||
return show_route("where_bgpmap", hosts, proto)
|
return show_route("where_bgpmap", hosts, proto)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/prefix/<hosts>")
|
||||||
@app.route("/prefix/<hosts>/<proto>")
|
@app.route("/prefix/<hosts>/<proto>")
|
||||||
def show_route_for(hosts, proto):
|
def show_route_for(hosts, proto=app.config.get("PROTO_DEFAULT", "ipv4")):
|
||||||
return show_route("prefix", hosts, proto)
|
return show_route("prefix", hosts, proto)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/prefix_detail/<hosts>")
|
||||||
@app.route("/prefix_detail/<hosts>/<proto>")
|
@app.route("/prefix_detail/<hosts>/<proto>")
|
||||||
def show_route_for_detail(hosts, proto):
|
def show_route_for_detail(hosts, proto=app.config.get("PROTO_DEFAULT", "ipv4")):
|
||||||
return show_route("prefix_detail", hosts, proto)
|
return show_route("prefix_detail", hosts, proto)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/prefix_bgpmap/<hosts>")
|
||||||
@app.route("/prefix_bgpmap/<hosts>/<proto>")
|
@app.route("/prefix_bgpmap/<hosts>/<proto>")
|
||||||
def show_route_for_bgpmap(hosts, proto):
|
def show_route_for_bgpmap(hosts, proto=app.config.get("PROTO_DEFAULT", "ipv4")):
|
||||||
return show_route("prefix_bgpmap", hosts, proto)
|
return show_route("prefix_bgpmap", hosts, proto)
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@
|
|||||||
<div class="list-group history">
|
<div class="list-group history">
|
||||||
{% for hosts, proto, request_type, request_args in session.history %}
|
{% for hosts, proto, request_type, request_args in session.history %}
|
||||||
<a class="list-group-item list-group-item-action {% if loop.first %}active{% endif %}"
|
<a class="list-group-item list-group-item-action {% if loop.first %}active{% endif %}"
|
||||||
href="/{{ [request_type, hosts, proto]|join("/") }}{% if request_args %}?q={{request_args}}{% endif %}">
|
href="/{{ [request_type, hosts]|join("/") }}{% if not config.UNIFIED_DAEMON %}/{{proto}}{% endif %}{% if request_args %}?q={{request_args}}{% endif %}">
|
||||||
{{hosts}}{% if not config.UNIFIED_DAEMON %}/{{proto}}{% endif %}: {{ commands_dict[request_type]|replace("...", request_args) }}
|
{{hosts}}{% if not config.UNIFIED_DAEMON %}/{{proto}}{% endif %}: {{ commands_dict[request_type]|replace("...", request_args) }}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user