routertools/filters: Implement babel cost by using negative quality

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
Adrian Schmutzler 2018-02-07 20:30:57 +01:00
parent 3cc07acf87
commit f4fab7e1c1
2 changed files with 4 additions and 6 deletions

View File

@ -832,12 +832,10 @@ def parse_nodewatcher_xml(xml):
def get_l3_neighbours(tree):
l3_neighbours = list()
for neighbour in tree.xpath("/data/babel_neighbours/*"):
v6_fe80 = neighbour.text
out_if = neighbour.xpath("outgoing_interface/text()")[0]
neighbour = {
"mac": get_mac_from_v6_link_local(v6_fe80).lower(),
"netif": out_if,
"quality": -1,
"mac": get_mac_from_v6_link_local(neighbour.text).lower(),
"netif": neighbour.xpath("outgoing_interface/text()")[0],
"quality": -1.0*evalxpathfloat(neighbour,"link_cost/text()",1),
"type": "l3"
}
l3_neighbours.append(neighbour)

View File

@ -18,7 +18,7 @@ filters = Blueprint("filters", __name__)
@filters.app_template_filter('neighbour_color')
def neighbour_color(quality):
color = "#04ff0a"
if quality == -1:
if quality < 0:
color = "#06a4f4"
elif quality < 105:
color = "#ff1e1e"