map/router.html: Indicate ethernet mesh connections by color
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
parent
3034fd9e2c
commit
166cad518a
|
@ -23,6 +23,10 @@
|
|||
</Rule>
|
||||
</Style>
|
||||
<Style name="color" filter-mode="first">
|
||||
<Rule>
|
||||
<Filter>([quality] < 1)</Filter>
|
||||
<LineSymbolizer stroke-width="3" stroke="#008c00" stroke-linecap="butt" clip="false" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>([quality] < 105)</Filter>
|
||||
<LineSymbolizer stroke-width="3" stroke="#ff1e1e" stroke-linecap="butt" clip="false" />
|
||||
|
|
|
@ -23,6 +23,10 @@
|
|||
</Rule>
|
||||
</Style>
|
||||
<Style name="color" filter-mode="first">
|
||||
<Rule>
|
||||
<Filter>([quality] < 1)</Filter>
|
||||
<LineSymbolizer stroke-width="3" stroke="#008c00" stroke-linecap="butt" clip="false" />
|
||||
</Rule>
|
||||
<Rule>
|
||||
<Filter>([quality] < 105)</Filter>
|
||||
<LineSymbolizer stroke-width="3" stroke="#ff1e1e" stroke-linecap="butt" clip="false" />
|
||||
|
|
|
@ -137,14 +137,23 @@ def update_mapnik_csv(mysql):
|
|||
else:
|
||||
# Check for duplicate
|
||||
if row["nid"] in dictl2.keys() and row["rid"] in dictl2[row["nid"]].keys():
|
||||
# Check for ethernet (ethernet always wins)
|
||||
if dictl2[row["nid"]][row["rid"]]["data"][4] == 0:
|
||||
continue
|
||||
row["quality"] = int(0.5 * (dictl2[row["nid"]][row["rid"]]["data"][4] + row["quality"]))
|
||||
del dictl2[row["nid"]][row["rid"]] # Delete old entry, as we create a new one with averaged quality
|
||||
if row["rid"] in dictl2.keys() and row["nid"] in dictl2[row["rid"]].keys():
|
||||
# Check for ethernet (ethernet always wins)
|
||||
if dictl2[row["rid"]][row["nid"]]["data"][4] == 0:
|
||||
continue
|
||||
row["quality"] = int(0.5 * (dictl2[row["rid"]][row["nid"]]["data"][4] + row["quality"]))
|
||||
# No need to delete, since we overwrite later
|
||||
# Write current set to dict
|
||||
if not row["rid"] in dictl2.keys():
|
||||
dictl2[row["rid"]] = {}
|
||||
# Check for ethernet
|
||||
if row["netif"].startswith("eth"):
|
||||
row["quality"] = 0
|
||||
|
||||
tmp = (
|
||||
row["rlng"],
|
||||
|
|
|
@ -16,12 +16,10 @@ def writefulllog(content):
|
|||
with open(CONFIG["debug_dir"] + "/fulllog.log", "a") as csv:
|
||||
csv.write(time.strftime('{%Y-%m-%d %H:%M:%S}') + " - " + content + "\n")
|
||||
|
||||
def neighbor_color(quality,rt_protocol):
|
||||
def neighbor_color(quality,netif,rt_protocol):
|
||||
color = "#04ff0a"
|
||||
if rt_protocol=="BATMAN_V":
|
||||
color = "#04ff0a"
|
||||
if quality < 0:
|
||||
color = "#06a4f4"
|
||||
elif quality < 10:
|
||||
if quality < 10:
|
||||
color = "#ff1e1e"
|
||||
elif quality < 20:
|
||||
color = "#ff4949"
|
||||
|
@ -32,10 +30,7 @@ def neighbor_color(quality,rt_protocol):
|
|||
elif quality < 1000:
|
||||
color = "#ffeb79"
|
||||
else:
|
||||
color = "#04ff0a"
|
||||
if quality < 0:
|
||||
color = "#06a4f4"
|
||||
elif quality < 105:
|
||||
if quality < 105:
|
||||
color = "#ff1e1e"
|
||||
elif quality < 130:
|
||||
color = "#ff4949"
|
||||
|
@ -47,6 +42,11 @@ def neighbor_color(quality,rt_protocol):
|
|||
color = "#ffeb79"
|
||||
elif quality < 230:
|
||||
color = "#79ff7c"
|
||||
if netif.startswith("eth"):
|
||||
#color = "#999999"
|
||||
color = "#008c00"
|
||||
if quality < 0:
|
||||
color = "#06a4f4"
|
||||
return color
|
||||
|
||||
def defrag_table(mysql,table,sleep):
|
||||
|
|
|
@ -105,7 +105,7 @@ def get_nearest_router():
|
|||
WHERE nb.router = %s""",(router["id"],))
|
||||
mysql.close()
|
||||
for n in router["neighbours"]:
|
||||
n["color"] = neighbor_color(n["quality"],router["routing_protocol"])
|
||||
n["color"] = neighbor_color(n["quality"],n["netif"],router["routing_protocol"])
|
||||
|
||||
r = make_response(bson2json(router))
|
||||
r.mimetype = 'application/json'
|
||||
|
|
|
@ -226,7 +226,7 @@ def router_info(dbid):
|
|||
|
||||
## Set color for neighbors AFTER json if clause
|
||||
for n in router["neighbours"]:
|
||||
n["color"] = neighbor_color(n["quality"],router["routing_protocol"])
|
||||
n["color"] = neighbor_color(n["quality"],n["netif"],router["routing_protocol"])
|
||||
|
||||
router["stats"] = mysql.fetchall("""SELECT * FROM router_stats WHERE router = %s""",(dbid,))
|
||||
for s in router["stats"]:
|
||||
|
|
Loading…
Reference in New Issue