1
0
Fork 0
mirror of https://github.com/sileht/bird-lg.git synced 2024-11-22 06:54:43 +01:00

Add adv show route

This commit is contained in:
Mehdi Abaakouk 2012-01-27 00:15:46 +01:00
parent d83d3e4777
commit cf59cd673d
2 changed files with 10 additions and 3 deletions

12
lg.py
View file

@ -5,7 +5,7 @@ import os
import subprocess
import re
from urllib2 import urlopen
from urllib import quote
from urllib import quote, unquote
from toolbox import mask_is_valid, ipv6_is_valid, ipv4_is_valid, resolve
@ -159,6 +159,10 @@ def traceroute(hosts, proto):
infos[host] = add_links(resultat)
return render_template('traceroute.html', infos=infos)
@app.route("/adv/<hosts>/<proto>")
def show_route_filter(hosts, proto):
return show_route("", hosts, proto)
@app.route("/where/<hosts>/<proto>")
def show_route_where(hosts, proto):
return show_route("where", hosts, proto)
@ -176,12 +180,14 @@ def show_route_for_detail(hosts, proto):
return show_route("prefix_detail", hosts, proto)
def show_route(req_type, hosts, proto):
expression = request.args.get('q', '')
expression = unquote(request.args.get('q', ''))
set_session(req_type, hosts, proto, expression)
all = (req_type.endswith("detail") and " all" or "" )
if req_type.startswith("where"):
if not req_type:
command = "show route " + expression
elif req_type.startswith("where"):
command = "show route where net ~ [ " + expression + " ]" + all
else:
mask = ""

View file

@ -140,6 +140,7 @@ $( function() {
<li id="prefix_detail">show route for ... all</li>
<li id="where">show route where net ~ [ ... ]</li>
<li id="where_detail">show route where net ~ [ ... ] all</li>
<li id="adv">show route ...</li>
</ul>
{% if session.request_args %}
<p>... = {{session.request_args}}</p>