mirror of
https://github.com/FreifunkFranken/fff-monitoring.git
synced 2024-06-19 23:28:43 +02:00
helpers: Enable search for gateways
Introduces two new query parameters: gw:<mac> looks for routers being aware of the specified gateway selected:<mac> looks for routers CONNECTED to the specified gw Both variants support regex. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
parent
386384212e
commit
d7bdca4797
|
@ -27,6 +27,8 @@ allowed_filters = (
|
|||
'community',
|
||||
'neighbor',
|
||||
'neighbour',
|
||||
'gw',
|
||||
'selected',
|
||||
)
|
||||
|
||||
def parse_router_list_search_query(args):
|
||||
|
@ -66,6 +68,14 @@ def parse_router_list_search_query(args):
|
|||
j += " INNER JOIN ( SELECT router, mac FROM router_netif GROUP BY router, mac) AS j ON router.id = j.router "
|
||||
k = "mac {} REGEXP %s".format(no)
|
||||
t.append(value.lower())
|
||||
elif (key == 'gw'):
|
||||
j += " INNER JOIN router_gw ON router.id = router_gw.router "
|
||||
k = "router_gw.mac {} REGEXP %s".format(no)
|
||||
t.append(value.lower())
|
||||
elif (key == 'selected'):
|
||||
j += " INNER JOIN router_gw ON router.id = router_gw.router "
|
||||
k = "router_gw.mac {} REGEXP %s AND router_gw.selected = TRUE".format(no)
|
||||
t.append(value.lower())
|
||||
elif (key == 'neighbor') or (key == 'neighbour'):
|
||||
j += " INNER JOIN ( SELECT router, mac FROM router_neighbor GROUP BY router, mac) AS j ON router.id = j.router "
|
||||
k = "mac {} REGEXP %s".format(no)
|
||||
|
|
Loading…
Reference in New Issue
Block a user