routertools: Use float for neighbor and gateway quality
This enables support for BATMAN V. This requires changes to the MySQL database! Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
parent
eb8822d79f
commit
89ad846375
|
@ -135,7 +135,7 @@ mysql.execute("""
|
|||
CREATE TABLE router_gw (
|
||||
`router` mediumint(8) UNSIGNED NOT NULL,
|
||||
`mac` char(17) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`quality` smallint(6) NOT NULL,
|
||||
`quality` float NOT NULL,
|
||||
`nexthop` char(17) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||
`netif` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||
`gw_class` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||
|
@ -166,7 +166,7 @@ mysql.execute("""
|
|||
`router` mediumint(8) UNSIGNED NOT NULL,
|
||||
`mac` char(17) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`netif` varchar(15) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`quality` smallint(6) NOT NULL,
|
||||
`quality` float NOT NULL,
|
||||
`type` varchar(10) COLLATE utf8_unicode_ci DEFAULT 'l2'
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
|
||||
""")
|
||||
|
@ -232,7 +232,7 @@ mysql.execute("""
|
|||
`time` int(11) NOT NULL,
|
||||
`router` mediumint(8) UNSIGNED NOT NULL,
|
||||
`mac` char(17) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`quality` smallint(6) NOT NULL
|
||||
`quality` float NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
|
||||
""")
|
||||
|
||||
|
@ -247,7 +247,7 @@ mysql.execute("""
|
|||
`time` int(11) NOT NULL,
|
||||
`router` mediumint(8) UNSIGNED NOT NULL,
|
||||
`mac` char(17) COLLATE utf8_unicode_ci NOT NULL,
|
||||
`quality` smallint(6) NOT NULL
|
||||
`quality` float NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
|
||||
""")
|
||||
|
||||
|
|
|
@ -780,7 +780,6 @@ def parse_nodewatcher_xml(xml):
|
|||
o_nexthop = evalxpath(originator,"nexthop/text()")
|
||||
# mac is the mac of the neighbour w2/5mesh if
|
||||
# (which might also be called wlan0-1)
|
||||
o_link_quality = evalxpath(originator,"link_quality/text()")
|
||||
o_out_if = evalxpath(originator,"outgoing_interface/text()")
|
||||
if o_mac.upper() == o_nexthop.upper():
|
||||
# skip vpn server
|
||||
|
@ -793,7 +792,7 @@ def parse_nodewatcher_xml(xml):
|
|||
neighbour = {
|
||||
"mac": o_mac.lower(),
|
||||
"netif": o_out_if,
|
||||
"quality": int(o_link_quality),
|
||||
"quality": evalxpathfloat(originator,"link_quality/text()"),
|
||||
"type": "l2"
|
||||
}
|
||||
router_update["neighbours"].append(neighbour)
|
||||
|
@ -817,7 +816,7 @@ def parse_nodewatcher_xml(xml):
|
|||
if gw["quality"].startswith("false"):
|
||||
gw["quality"] = gw["quality"][5:]
|
||||
if gw["quality"]:
|
||||
gw["quality"] = int(gw["quality"])
|
||||
gw["quality"] = float(gw["quality"])
|
||||
else:
|
||||
gw["quality"] = 0
|
||||
if gw["netif"]=="false":
|
||||
|
|
Loading…
Reference in New Issue