lots of changes to support inter-node vpn links

This commit is contained in:
Nils Schneider 2012-06-11 23:53:45 +02:00
parent c539ab0168
commit b1eaf86d30
9 changed files with 179 additions and 102 deletions

View file

@ -17,6 +17,9 @@ parser.add_argument('-a', '--aliases',
help='read aliases from FILE',
metavar='FILE')
parser.add_argument('-g', '--gateway', action='append',
help='MAC of a gateway')
parser.add_argument('batmanjson', help='output of batman vd json')
args = parser.parse_args()
@ -30,9 +33,10 @@ db.import_batman(list(fileinput.input(options['batmanjson'])))
if options['aliases']:
db.import_aliases(json.load(open(options['aliases'])))
db.import_wikigps("http://freifunk.metameute.de/Knoten")
if options['gateway']:
db.mark_gateways(options['gateway'])
#db.wilder_scheiss()
db.import_wikigps("http://freifunk.metameute.de/Knoten")
m = GeoMapBuilder(db)

View file

@ -1,92 +1,112 @@
{ "router" : "56:e6:fc:af:43:81", "neighbor" : "56:e6:fc:98:58:f3", "label" : "6.375" }
{ "router" : "56:e6:fc:b0:43:80", "neighbor" : "52:54:00:f3:62:d9", "label" : "1.003" }
{ "router" : "56:e6:fc:b0:43:80", "gateway" : "54:e6:fc:af:43:80", "label" : "TT" }
{ "router" : "56:e6:fc:b0:43:80", "gateway" : "de:4e:9a:b3:b7:8f", "label" : "TT" }
{ "router" : "56:e6:fc:af:43:81", "neighbor" : "56:e6:fc:98:58:f3", "label" : "1.000" }
{ "router" : "56:e6:fc:b0:43:80", "neighbor" : "8e:3d:c2:10:10:28", "label" : "1.015" }
{ "router" : "56:e6:fc:b0:43:80", "neighbor" : "52:54:00:f3:62:d9", "label" : "1.000" }
{ "router" : "56:e6:fc:b0:43:80", "gateway" : "3a:21:2d:d1:ed:14", "label" : "TT" }
{ "router" : "56:e6:fc:b0:43:80", "gateway" : "a0:0b:ba:cb:cb:e3", "label" : "TT" }
{ "secondary" : "56:e6:fc:af:43:81", "of" : "56:e6:fc:b0:43:80" }
{ "primary" : "56:e6:fc:b0:43:80" }
{ "router" : "56:e6:fc:af:43:bb", "neighbor" : "56:e6:fc:98:58:ab", "label" : "1.000" }
{ "router" : "56:e6:fc:b0:43:ba", "neighbor" : "8e:3d:c2:10:10:28", "label" : "1.000" }
{ "router" : "56:e6:fc:b0:43:ba", "neighbor" : "52:54:00:f3:62:d9", "label" : "1.015" }
{ "router" : "56:e6:fc:b0:43:ba", "gateway" : "90:c1:15:b2:9f:b7", "label" : "TT" }
{ "router" : "56:e6:fc:af:43:bb", "neighbor" : "56:e6:fc:98:58:ab", "label" : "1.424" }
{ "router" : "56:e6:fc:b0:43:ba", "neighbor" : "8e:3d:c2:10:10:28", "label" : "1.015" }
{ "router" : "56:e6:fc:b0:43:ba", "neighbor" : "52:54:00:f3:62:d9", "label" : "1.000" }
{ "router" : "56:e6:fc:b0:43:ba", "gateway" : "54:e6:fc:af:43:ba", "label" : "TT" }
{ "router" : "56:e6:fc:b0:43:ba", "gateway" : "96:d6:5f:bd:7a:63", "label" : "TT" }
{ "router" : "56:e6:fc:b0:43:ba", "gateway" : "90:c1:15:89:1c:ce", "label" : "TT" }
{ "router" : "56:e6:fc:b0:43:ba", "gateway" : "ca:9f:87:99:0d:13", "label" : "TT" }
{ "router" : "56:e6:fc:b0:43:ba", "gateway" : "00:c0:ca:57:d6:b4", "label" : "TT" }
{ "router" : "56:e6:fc:b0:43:ba", "gateway" : "38:e7:d8:ee:19:7a", "label" : "TT" }
{ "secondary" : "56:e6:fc:af:43:bb", "of" : "56:e6:fc:b0:43:ba" }
{ "primary" : "56:e6:fc:b0:43:ba" }
{ "router" : "56:e6:fc:98:58:f3", "neighbor" : "56:e6:fc:af:43:81", "label" : "2.318" }
{ "router" : "56:e6:fc:99:58:f2", "gateway" : "e2:c0:bd:3e:6c:72", "label" : "TT" }
{ "router" : "56:e6:fc:98:58:f3", "neighbor" : "56:e6:fc:af:43:81", "label" : "1.000" }
{ "router" : "56:e6:fc:99:58:f2", "gateway" : "d4:20:6d:4e:fd:58", "label" : "TT" }
{ "router" : "56:e6:fc:99:58:f2", "gateway" : "7c:61:93:a9:86:14", "label" : "TT" }
{ "router" : "56:e6:fc:99:58:f2", "gateway" : "ea:40:68:d6:3f:3e", "label" : "TT" }
{ "router" : "56:e6:fc:99:58:f2", "gateway" : "00:0c:f1:57:93:6b", "label" : "TT" }
{ "router" : "56:e6:fc:99:58:f2", "gateway" : "54:e6:fc:98:58:f2", "label" : "TT" }
{ "router" : "56:e6:fc:99:58:f2", "gateway" : "3c:d0:f8:65:bc:f5", "label" : "TT" }
{ "router" : "56:e6:fc:99:58:f2", "gateway" : "2c:81:58:fc:4e:1b", "label" : "TT" }
{ "secondary" : "56:e6:fc:98:58:f3", "of" : "56:e6:fc:99:58:f2" }
{ "primary" : "56:e6:fc:99:58:f2" }
{ "router" : "b0:48:7a:e7:d3:64", "neighbor" : "00:25:86:e6:f1:bf", "label" : "1.000" }
{ "router" : "b0:48:7a:e7:d3:64", "neighbor" : "00:e0:29:39:34:d7", "label" : "1.000" }
{ "router" : "b2:48:7a:e7:d3:65", "neighbor" : "fa:d1:11:37:fc:39", "label" : "1.015" }
{ "router" : "b2:48:7a:e7:d3:65", "gateway" : "00:04:13:29:20:76", "label" : "TT" }
{ "router" : "b2:48:7a:e7:d3:65", "gateway" : "bc:ae:c5:5a:e8:85", "label" : "TT" }
{ "router" : "b2:48:7a:e7:d3:65", "gateway" : "1c:4b:d6:97:86:0f", "label" : "TT" }
{ "router" : "b2:48:7a:e7:d3:65", "gateway" : "00:08:9b:be:1b:14", "label" : "TT" }
{ "router" : "b2:48:7a:e7:d3:65", "gateway" : "82:43:a4:6d:bc:12", "label" : "TT" }
{ "router" : "b2:48:7a:e7:d3:65", "gateway" : "92:8d:df:24:d7:a0", "label" : "TT" }
{ "router" : "b2:48:7a:e7:d3:65", "gateway" : "f0:de:f1:53:5b:9f", "label" : "TT" }
{ "secondary" : "b0:48:7a:e7:d3:64", "of" : "b2:48:7a:e7:d3:65" }
{ "primary" : "b2:48:7a:e7:d3:65" }
{ "router" : "b2:48:7a:cb:30:49", "neighbor" : "76:ea:3a:be:22:40", "label" : "1.094" }
{ "router" : "b2:48:7a:cc:30:48", "gateway" : "b0:48:7a:cb:30:47", "label" : "TT" }
{ "router" : "b2:48:7a:cc:30:48", "gateway" : "0e:5d:f2:e9:4f:9a", "label" : "TT" }
{ "secondary" : "b2:48:7a:cb:30:49", "of" : "b2:48:7a:cc:30:48" }
{ "primary" : "b2:48:7a:cc:30:48" }
{ "router" : "92:f6:52:3f:b9:26", "neighbor" : "8e:3d:c2:10:10:28", "label" : "1.000" }
{ "router" : "92:f6:52:3f:b9:26", "neighbor" : "52:54:00:f3:62:d9", "label" : "1.000" }
{ "router" : "92:f6:52:3e:b9:28", "gateway" : "90:f6:52:3e:b9:26", "label" : "TT" }
{ "router" : "92:f6:52:3e:b9:28", "gateway" : "9e:e7:5c:8e:b4:52", "label" : "TT" }
{ "secondary" : "92:f6:52:3f:b9:26", "of" : "92:f6:52:3e:b9:28" }
{ "primary" : "92:f6:52:3e:b9:28" }
{ "router" : "92:f6:52:3f:b9:26", "gateway" : "8a:1b:98:8a:13:ec", "label" : "TT" }
{ "primary" : "92:f6:52:3f:b9:26" }
{ "router" : "fa:d1:11:25:9d:a2", "neighbor" : "8e:3d:c2:10:10:28", "label" : "1.015" }
{ "router" : "fa:d1:11:25:9d:a2", "neighbor" : "fa:d1:11:80:41:d4", "label" : "1.045" }
{ "router" : "fa:d1:11:25:9d:a2", "neighbor" : "52:54:00:f3:62:d9", "label" : "1.000" }
{ "router" : "fa:d1:11:25:9d:a2", "neighbor" : "00:25:86:e6:f1:c0", "label" : "1.000" }
{ "router" : "fa:d1:11:24:9d:a3", "gateway" : "da:91:8e:4c:4f:49", "label" : "TT" }
{ "router" : "fa:d1:11:24:9d:a3", "gateway" : "8c:64:22:59:9d:ce", "label" : "TT" }
{ "secondary" : "fa:d1:11:25:9d:a2", "of" : "fa:d1:11:24:9d:a3" }
{ "primary" : "fa:d1:11:24:9d:a3" }
{ "router" : "b2:48:7a:9a:d8:ce", "neighbor" : "8e:3d:c2:10:10:28", "label" : "1.000" }
{ "router" : "b2:48:7a:9a:d8:ce", "neighbor" : "52:54:00:f3:62:d9", "label" : "1.000" }
{ "router" : "b2:48:7a:9a:d8:ce", "gateway" : "1e:2b:ac:f5:4e:13", "label" : "TT" }
{ "router" : "b2:48:7a:9a:d8:ce", "gateway" : "38:e7:d8:03:11:7a", "label" : "TT" }
{ "router" : "b2:48:7a:9a:d8:ce", "gateway" : "92:7d:36:3f:43:cd", "label" : "TT" }
{ "primary" : "b2:48:7a:9a:d8:ce" }
{ "router" : "fa:d1:11:24:be:44", "neighbor" : "b2:48:7a:cb:26:8e", "label" : "1.231" }
{ "router" : "fa:d1:11:24:be:44", "neighbor" : "b2:48:7a:cb:26:8e", "label" : "1.191" }
{ "router" : "fa:d1:11:25:be:42", "neighbor" : "8e:3d:c2:10:10:28", "label" : "1.000" }
{ "router" : "fa:d1:11:25:be:42", "neighbor" : "52:54:00:f3:62:d9", "label" : "1.000" }
{ "router" : "fa:d1:11:25:be:42", "gateway" : "22:e7:3e:10:6b:8e", "label" : "TT" }
{ "secondary" : "fa:d1:11:24:be:44", "of" : "fa:d1:11:25:be:42" }
{ "primary" : "fa:d1:11:25:be:42" }
{ "router" : "56:e6:fc:98:58:ab", "neighbor" : "56:e6:fc:af:43:bb", "label" : "1.071" }
{ "router" : "fa:d1:11:30:1b:e3", "neighbor" : "fa:d1:11:7f:41:d5", "label" : "1.032" }
{ "router" : "fa:d1:11:30:1b:e3", "gateway" : "3e:6a:13:62:a5:5b", "label" : "TT" }
{ "router" : "fa:d1:11:30:1b:e3", "gateway" : "f8:d1:11:30:1b:e1", "label" : "TT" }
{ "primary" : "fa:d1:11:30:1b:e3" }
{ "router" : "56:e6:fc:98:58:ab", "neighbor" : "56:e6:fc:af:43:bb", "label" : "1.062" }
{ "router" : "56:e6:fc:99:58:aa", "gateway" : "ea:13:b6:5c:41:ae", "label" : "TT" }
{ "router" : "56:e6:fc:99:58:aa", "gateway" : "54:e6:fc:98:58:aa", "label" : "TT" }
{ "secondary" : "56:e6:fc:98:58:ab", "of" : "56:e6:fc:99:58:aa" }
{ "primary" : "56:e6:fc:99:58:aa" }
{ "router" : "fa:d1:11:80:41:d4", "neighbor" : "8e:3d:c2:10:10:28", "label" : "1.000" }
{ "router" : "fa:d1:11:80:41:d4", "neighbor" : "8e:3d:c2:10:10:28", "label" : "1.007" }
{ "router" : "fa:d1:11:80:41:d4", "neighbor" : "52:54:00:f3:62:d9", "label" : "1.000" }
{ "router" : "fa:d1:11:80:41:d4", "neighbor" : "fa:d1:11:25:9d:a2", "label" : "1.036" }
{ "router" : "fa:d1:11:7f:41:d5", "neighbor" : "fa:d1:11:30:1b:e3", "label" : "1.020" }
{ "router" : "fa:d1:11:7f:41:d5", "gateway" : "f8:d1:11:7f:41:d4", "label" : "TT" }
{ "router" : "fa:d1:11:7f:41:d5", "gateway" : "fe:7f:f7:83:c0:e5", "label" : "TT" }
{ "secondary" : "fa:d1:11:80:41:d4", "of" : "fa:d1:11:7f:41:d5" }
{ "primary" : "fa:d1:11:7f:41:d5" }
{ "router" : "56:e6:fc:99:64:9c", "neighbor" : "8e:3d:c2:10:10:28", "label" : "1.000" }
{ "router" : "56:e6:fc:99:64:9c", "neighbor" : "8e:3d:c2:10:10:28", "label" : "1.003" }
{ "router" : "56:e6:fc:99:64:9c", "neighbor" : "52:54:00:f3:62:d9", "label" : "1.000" }
{ "router" : "56:e6:fc:99:64:9c", "gateway" : "54:e6:fc:98:64:9c", "label" : "TT" }
{ "router" : "56:e6:fc:99:64:9c", "gateway" : "56:54:c2:34:54:0a", "label" : "TT" }
{ "primary" : "56:e6:fc:99:64:9c" }
{ "router" : "b2:48:7a:a1:16:de", "neighbor" : "8e:3d:c2:10:10:28", "label" : "1.000" }
{ "router" : "b2:48:7a:a1:16:de", "neighbor" : "52:54:00:f3:62:d9", "label" : "1.000" }
{ "router" : "b2:48:7a:a1:16:de", "gateway" : "4a:d5:8a:4d:d3:2c", "label" : "TT" }
{ "primary" : "b2:48:7a:a1:16:de" }
{ "router" : "00:25:86:e6:f1:c0", "neighbor" : "8e:3d:c2:10:10:28", "label" : "1.000" }
{ "router" : "00:25:86:e6:f1:c0", "neighbor" : "52:54:00:f3:62:d9", "label" : "1.000" }
{ "router" : "00:25:86:e6:f1:c0", "neighbor" : "fa:d1:11:25:9d:a2", "label" : "1.000" }
{ "router" : "00:25:86:e6:f1:bf", "neighbor" : "b0:48:7a:e7:d3:64", "label" : "1.000" }
{ "router" : "00:25:86:e6:f1:bf", "neighbor" : "00:e0:29:39:34:d7", "label" : "1.000" }
{ "router" : "00:25:86:e6:f1:bf", "gateway" : "66:44:30:0f:15:e5", "label" : "TT" }
{ "secondary" : "00:25:86:e6:f1:c0", "of" : "00:25:86:e6:f1:bf" }
{ "primary" : "00:25:86:e6:f1:bf" }
{ "router" : "52:54:00:f3:62:d9", "neighbor" : "76:ea:3a:bf:22:3e", "label" : "1.000" }
{ "router" : "52:54:00:f3:62:d9", "neighbor" : "76:ea:3a:bf:22:3e", "label" : "1.015" }
{ "router" : "52:54:00:f3:62:d9", "neighbor" : "8e:3d:c2:10:10:28", "label" : "1.000" }
{ "router" : "52:54:00:f3:62:d9", "neighbor" : "fa:d1:11:80:41:d4", "label" : "1.000" }
{ "router" : "52:54:00:f3:62:d9", "neighbor" : "56:e6:fc:b0:43:80", "label" : "1.015" }
{ "router" : "52:54:00:f3:62:d9", "neighbor" : "fa:d1:11:80:41:d4", "label" : "1.032" }
{ "router" : "52:54:00:f3:62:d9", "neighbor" : "56:e6:fc:b0:43:80", "label" : "1.000" }
{ "router" : "52:54:00:f3:62:d9", "neighbor" : "b2:48:7a:9a:d8:ce", "label" : "1.000" }
{ "router" : "52:54:00:f3:62:d9", "neighbor" : "02:22:b0:45:94:af", "label" : "1.000" }
{ "router" : "52:54:00:f3:62:d9", "neighbor" : "56:e6:fc:99:64:9c", "label" : "1.000" }
{ "router" : "52:54:00:f3:62:d9", "neighbor" : "56:e6:fc:b1:1a:7e", "label" : "1.000" }
{ "router" : "52:54:00:f3:62:d9", "neighbor" : "02:22:b0:45:94:af", "label" : "1.015" }
{ "router" : "52:54:00:f3:62:d9", "neighbor" : "56:e6:fc:99:64:9c", "label" : "1.032" }
{ "router" : "52:54:00:f3:62:d9", "neighbor" : "fa:d1:11:25:9d:a2", "label" : "1.000" }
{ "router" : "52:54:00:f3:62:d9", "neighbor" : "fa:d1:11:25:95:58", "label" : "1.015" }
{ "router" : "52:54:00:f3:62:d9", "neighbor" : "fa:d1:11:25:95:58", "label" : "1.000" }
{ "router" : "52:54:00:f3:62:d9", "neighbor" : "92:f6:52:3f:b9:26", "label" : "1.000" }
{ "router" : "52:54:00:f3:62:d9", "neighbor" : "00:25:86:e6:f1:c0", "label" : "1.000" }
{ "router" : "52:54:00:f3:62:d9", "neighbor" : "fa:d1:11:25:be:42", "label" : "1.000" }
{ "router" : "52:54:00:f3:62:d9", "neighbor" : "b2:48:7a:a1:16:de", "label" : "1.000" }
{ "router" : "52:54:00:f3:62:d9", "neighbor" : "b2:48:7a:bc:50:54", "label" : "1.000" }
{ "router" : "52:54:00:f3:62:d9", "neighbor" : "56:e6:fc:b0:43:ba", "label" : "1.003" }
{ "router" : "52:54:00:f3:62:d9", "neighbor" : "56:e6:fc:b0:43:ba", "label" : "1.000" }
{ "router" : "52:54:00:f3:62:d9", "neighbor" : "b2:48:7a:cc:26:8c", "label" : "1.000" }
{ "router" : "52:54:00:f3:62:d9", "gateway" : "de:66:21:dc:a9:c8", "label" : "TT" }
{ "router" : "52:54:00:f3:62:d9", "gateway" : "52:54:00:eb:bb:15", "label" : "TT" }
@ -96,16 +116,11 @@
{ "router" : "52:54:00:f3:62:d9", "gateway" : "52:54:00:b3:2d:41", "label" : "TT" }
{ "primary" : "52:54:00:f3:62:d9" }
{ "router" : "b2:48:7a:bc:50:54", "neighbor" : "8e:3d:c2:10:10:28", "label" : "1.000" }
{ "router" : "b2:48:7a:bc:50:54", "neighbor" : "52:54:00:f3:62:d9", "label" : "1.000" }
{ "router" : "b2:48:7a:bc:50:54", "neighbor" : "52:54:00:f3:62:d9", "label" : "1.003" }
{ "router" : "b2:48:7a:bc:50:54", "gateway" : "4a:32:c8:a8:3f:4d", "label" : "TT" }
{ "primary" : "b2:48:7a:bc:50:54" }
{ "router" : "56:e6:fc:b1:1a:7e", "neighbor" : "8e:3d:c2:10:10:28", "label" : "1.000" }
{ "router" : "56:e6:fc:b1:1a:7e", "neighbor" : "52:54:00:f3:62:d9", "label" : "1.000" }
{ "router" : "56:e6:fc:b1:1a:7e", "gateway" : "54:e6:fc:b0:1a:7e", "label" : "TT" }
{ "router" : "56:e6:fc:b1:1a:7e", "gateway" : "aa:56:e7:36:97:35", "label" : "TT" }
{ "primary" : "56:e6:fc:b1:1a:7e" }
{ "router" : "b2:48:7a:cb:26:8e", "neighbor" : "fa:d1:11:24:be:44", "label" : "1.003" }
{ "router" : "b2:48:7a:cc:26:8c", "neighbor" : "8e:3d:c2:10:10:28", "label" : "1.000" }
{ "router" : "b2:48:7a:cb:26:8e", "neighbor" : "fa:d1:11:24:be:44", "label" : "1.036" }
{ "router" : "b2:48:7a:cc:26:8c", "neighbor" : "8e:3d:c2:10:10:28", "label" : "1.015" }
{ "router" : "b2:48:7a:cc:26:8c", "neighbor" : "52:54:00:f3:62:d9", "label" : "1.000" }
{ "router" : "b2:48:7a:cc:26:8c", "gateway" : "b0:48:7a:cb:26:8c", "label" : "TT" }
{ "router" : "b2:48:7a:cc:26:8c", "gateway" : "d2:b7:58:56:f6:41", "label" : "TT" }
@ -117,45 +132,46 @@
{ "router" : "02:22:b0:44:94:b0", "gateway" : "00:22:b0:44:94:af", "label" : "TT" }
{ "secondary" : "02:22:b0:45:94:af", "of" : "02:22:b0:44:94:b0" }
{ "primary" : "02:22:b0:44:94:b0" }
{ "router" : "8e:3d:c2:10:10:28", "neighbor" : "fa:d1:11:80:41:d4", "label" : "1.000" }
{ "router" : "8e:3d:c2:10:10:28", "neighbor" : "fa:d1:11:80:41:d4", "label" : "1.032" }
{ "router" : "8e:3d:c2:10:10:28", "neighbor" : "56:e6:fc:b0:43:80", "label" : "1.015" }
{ "router" : "8e:3d:c2:10:10:28", "neighbor" : "52:54:00:f3:62:d9", "label" : "1.000" }
{ "router" : "8e:3d:c2:10:10:28", "neighbor" : "b2:48:7a:9a:d8:ce", "label" : "1.000" }
{ "router" : "8e:3d:c2:10:10:28", "neighbor" : "02:22:b0:45:94:af", "label" : "1.000" }
{ "router" : "8e:3d:c2:10:10:28", "neighbor" : "56:e6:fc:99:64:9c", "label" : "1.000" }
{ "router" : "8e:3d:c2:10:10:28", "neighbor" : "56:e6:fc:b1:1a:7e", "label" : "1.000" }
{ "router" : "8e:3d:c2:10:10:28", "neighbor" : "fa:d1:11:25:9d:a2", "label" : "1.000" }
{ "router" : "8e:3d:c2:10:10:28", "neighbor" : "02:22:b0:45:94:af", "label" : "1.015" }
{ "router" : "8e:3d:c2:10:10:28", "neighbor" : "56:e6:fc:99:64:9c", "label" : "1.015" }
{ "router" : "8e:3d:c2:10:10:28", "neighbor" : "fa:d1:11:25:9d:a2", "label" : "1.007" }
{ "router" : "8e:3d:c2:10:10:28", "neighbor" : "fa:d1:11:25:95:58", "label" : "1.000" }
{ "router" : "8e:3d:c2:10:10:28", "neighbor" : "92:f6:52:3f:b9:26", "label" : "1.000" }
{ "router" : "8e:3d:c2:10:10:28", "neighbor" : "00:25:86:e6:f1:c0", "label" : "1.000" }
{ "router" : "8e:3d:c2:10:10:28", "neighbor" : "fa:d1:11:25:be:42", "label" : "1.000" }
{ "router" : "8e:3d:c2:10:10:28", "neighbor" : "b2:48:7a:a1:16:de", "label" : "1.000" }
{ "router" : "8e:3d:c2:10:10:28", "neighbor" : "b2:48:7a:bc:50:54", "label" : "1.000" }
{ "router" : "8e:3d:c2:10:10:28", "neighbor" : "56:e6:fc:b0:43:ba", "label" : "1.000" }
{ "router" : "8e:3d:c2:10:10:28", "neighbor" : "56:e6:fc:b0:43:ba", "label" : "1.015" }
{ "router" : "8e:3d:c2:10:10:28", "neighbor" : "b2:48:7a:cc:26:8c", "label" : "1.000" }
{ "router" : "8e:3d:c2:10:10:28", "gateway" : "56:47:05:ac:00:2c", "label" : "TT" }
{ "router" : "8e:3d:c2:10:10:28", "gateway" : "f8:d1:11:24:76:12", "label" : "TT" }
{ "router" : "8e:3d:c2:10:10:28", "gateway" : "00:18:84:d0:34:20", "label" : "TT" }
{ "router" : "8e:3d:c2:10:10:28", "gateway" : "04:a8:2a:8a:81:2b", "label" : "TT" }
{ "router" : "8e:3d:c2:10:10:28", "gateway" : "52:54:00:0c:bb:eb", "label" : "TT" }
{ "router" : "8e:3d:c2:10:10:28", "gateway" : "50:cc:f8:1b:0e:87", "label" : "TT" }
{ "router" : "8e:3d:c2:10:10:28", "gateway" : "9e:1f:3c:eb:f2:ae", "label" : "TT" }
{ "router" : "8e:3d:c2:10:10:28", "gateway" : "56:47:05:ab:00:2c", "label" : "TT" }
{ "router" : "8e:3d:c2:10:10:28", "gateway" : "f4:ec:38:eb:f1:f2", "label" : "TT" }
{ "primary" : "8e:3d:c2:10:10:28" }
{ "router" : "fa:d1:11:25:9d:a2", "neighbor" : "8e:3d:c2:10:10:28", "label" : "1.000" }
{ "router" : "fa:d1:11:25:9d:a2", "neighbor" : "52:54:00:f3:62:d9", "label" : "1.000" }
{ "router" : "fa:d1:11:25:9d:a2", "gateway" : "da:91:8e:4c:4f:49", "label" : "TT" }
{ "primary" : "fa:d1:11:25:9d:a2" }
{ "router" : "76:ea:3a:bf:22:3e", "neighbor" : "52:54:00:f3:62:d9", "label" : "1.000" }
{ "router" : "76:ea:3a:be:22:40", "neighbor" : "b2:48:7a:cb:30:49", "label" : "1.099" }
{ "router" : "76:ea:3a:be:22:40", "gateway" : "ee:a9:d0:a1:20:d5", "label" : "TT" }
{ "router" : "76:ea:3a:be:22:40", "gateway" : "76:ea:3a:be:22:3f", "label" : "TT" }
{ "router" : "76:ea:3a:be:22:40", "gateway" : "b2:da:f9:9f:6e:a9", "label" : "TT" }
{ "secondary" : "76:ea:3a:bf:22:3e", "of" : "76:ea:3a:be:22:40" }
{ "primary" : "76:ea:3a:be:22:40" }
{ "router" : "fa:d1:11:37:fc:39", "neighbor" : "b2:48:7a:e7:d3:65", "label" : "1.000" }
{ "router" : "fa:d1:11:37:fc:39", "gateway" : "00:27:10:74:e6:88", "label" : "TT" }
{ "router" : "fa:d1:11:37:fc:39", "gateway" : "b6:9d:b0:42:a0:29", "label" : "TT" }
{ "router" : "fa:d1:11:37:fc:39", "gateway" : "00:26:b6:ac:30:22", "label" : "TT" }
{ "router" : "fa:d1:11:37:fc:39", "gateway" : "00:24:d7:ae:b0:b8", "label" : "TT" }
{ "router" : "fa:d1:11:37:fc:39", "gateway" : "00:24:d7:4f:67:c8", "label" : "TT" }
{ "primary" : "fa:d1:11:37:fc:39" }
{ "router" : "00:e0:29:39:34:d7", "neighbor" : "b0:48:7a:e7:d3:64", "label" : "1.000" }
{ "router" : "00:e0:29:39:34:d7", "neighbor" : "00:25:86:e6:f1:bf", "label" : "1.000" }
{ "router" : "00:e0:29:39:34:d7", "gateway" : "0a:3a:e5:45:f1:bb", "label" : "TT" }
{ "primary" : "00:e0:29:39:34:d7" }
{ "router" : "fa:d1:11:25:95:58", "neighbor" : "8e:3d:c2:10:10:28", "label" : "1.000" }
{ "router" : "fa:d1:11:25:95:58", "neighbor" : "52:54:00:f3:62:d9", "label" : "1.015" }
{ "router" : "fa:d1:11:25:95:58", "neighbor" : "52:54:00:f3:62:d9", "label" : "1.000" }
{ "router" : "fa:d1:11:25:95:58", "gateway" : "16:44:d8:37:99:cf", "label" : "TT" }
{ "primary" : "fa:d1:11:25:95:58" }

View file

@ -14,11 +14,14 @@ class D3MapBuilder:
'geo': x.gps.split(" ") if x.gps else None,
'flags': x.flags
} for x in nodes if x.flags['online']]
output['links'] = [{'source': x.pair[0], 'target': x.pair[1],
links = self._db.get_links()
output['links'] = [{'source': x.source.id, 'target': x.target.id,
'quality': x.quality,
'type': x.type,
'id': "-".join(nodes[i].id for i in x.pair)
} for x in self._db.get_links()]
'id': x.id
} for x in links]
return json.dumps(output)

View file

@ -57,6 +57,10 @@ class GeoMapBuilder:
continue
for link in self._db.get_links():
print(link.type)
if link.type == "vpn":
continue
try:
text.append(GeoEdge(nodes, link).render())
except:
@ -101,7 +105,7 @@ class GeoEdge:
def __init__(self, nodes, link):
self._link = link
self.pair = [nodes[k] for k in link.pair]
self.pair = [nodes[k.id] for k in (link.source, link.target)]
def render(self):
if not (self.pair[0].gps and self.pair[1].gps):

View file

@ -275,20 +275,20 @@ function reload() {
var node, other
if (d.source.flags.vpn) {
node = d.target;
other = d.source;
node = d.target
other = d.source
}
if (d.target.flags.vpn) {
node = d.source;
other = d.target;
node = d.source
other = d.target
}
if (node) {
if (node.uplinks === undefined)
node.uplinks = new Array();
node.uplinks = 0
node.uplinks.push(other);
node.uplinks++
}
})
@ -307,9 +307,13 @@ var linkcolor = d3.scale.linear()
function update() {
var links = data.links
.filter(function (d) {
if (!visible.vpn && d.type == "vpn")
return false
if (!visible.clients && (d.source.flags.client || d.target.flags.client))
return false
// hides links to clients
if (!visible.vpn && (d.source.flags.vpn || d.target.flags.vpn))
return false
@ -343,7 +347,7 @@ function update() {
return d.type != 'client'
})
.style("stroke", function(d) {
return linkcolor(d.quality)
return linkcolor(Math.max.apply(null, d.quality.split(",")))
})
link.selectAll("title")
@ -429,7 +433,7 @@ function update() {
if (!visible.vpn) {
var uplink_info = node.filter(function (d) {
if (d.uplinks !== undefined)
return d.uplinks.length > 0
return d.uplinks > 0
else
return false
})
@ -445,7 +449,7 @@ function update() {
uplink_info.append("text")
.attr("text-anchor", "middle")
.attr("y", 3 - 20)
.text(function (d) {return d.uplinks.length})
.text(function (d) {return d.uplinks})
}
node.exit().remove()

11
link.py
View file

@ -1,6 +1,15 @@
class Link():
def __init__(self):
self.pair = None
self.id = None
self.source = None
self.target = None
self.quality = None
self.type = None
class LinkConnector():
def __init__(self):
self.id = None
self.interface = None
def __repr__(self):
return "LinkConnector(%d, %s)" % (self.id, self.interface)

View file

@ -18,7 +18,7 @@ if [ `cat /sys/class/net/bat0/mesh/gw_mode` = server ]; then
fi
batctl vd json | "$(dirname "$0")"/bat2nodes.py -a "$(dirname "$0")"/aliases.json $GWS - > $DEST/nodes.json.new
batctl vd json | "$(dirname "$0")"/bat2geomap.py -a "$(dirname "$0")"/aliases.json - > $DEST/geomap.kml.new
batctl vd json | "$(dirname "$0")"/bat2geomap.py -a "$(dirname "$0")"/aliases.json $GWS - > $DEST/geomap.kml.new
mv $DEST/nodes.json.new $DEST/nodes.json
mv $DEST/geomap.kml.new $DEST/geomap.kml

View file

@ -3,6 +3,7 @@ class Node():
self.name = ""
self.id = ""
self.macs = set()
self.interfaces = dict()
self.flags = dict({
"online": False,
"vpn": False,
@ -18,7 +19,12 @@ class Node():
self.macs.add(mac)
self.interfaces[mac] = Interface()
def __repr__(self):
return self.macs.__repr__()
class Interface():
def __init__(self):
self.vpn = False

View file

@ -1,6 +1,8 @@
import json
from node import Node
from link import Link
from functools import reduce
from collections import defaultdict
from node import Node, Interface
from link import Link, LinkConnector
from itertools import zip_longest
from bs4 import BeautifulSoup
@ -13,21 +15,12 @@ class NodeDB:
# fetch list of links
def get_links(self):
return [self.map_link(x) for x in self._links]
return self.reduce_links()
# fetch list of nodes
def get_nodes(self):
return self._nodes
def add_link(self, a, b, q):
l = tuple(sorted((a,b)))
for link in self._links:
if l == link[0]:
if link[1] != str(q):
link[1] = max(float(link[1]), float(q))
return
self._links.append([l,str(q)])
def maybe_node_by_mac(self, macs):
for node in self._nodes:
for mac in macs:
@ -117,11 +110,20 @@ class NodeDB:
except:
continue
a = self._nodes.index(router)
b = self._nodes.index(neighbor)
link = Link()
link.source = LinkConnector()
link.source.interface = x['router']
link.source.id = self._nodes.index(router)
link.target = LinkConnector()
link.target.interface = x['neighbor']
link.target.id = self._nodes.index(neighbor)
link.quality = x['label']
link.id = "-".join(sorted((link.source.interface, link.target.interface)))
if a != b:
self.add_link(a, b, x['label'])
if x['label'] == "TT":
link.type = "client"
self._links.append(link)
for line in lines:
x = json.loads(line)
@ -134,6 +136,29 @@ class NodeDB:
node.id = x['primary']
def reduce_links(self):
tmp_links = defaultdict(list)
for link in self._links:
tmp_links[link.id].append(link)
links = []
def reduce_link(a, b):
a.id = b.id
a.source = b.source
a.target = b.target
a.type = b.type
a.quality = ", ".join([x for x in (a.quality, b.quality) if x])
return a
for k, v in tmp_links.items():
new_link = reduce(reduce_link, v, Link())
links.append(new_link)
return links
def import_aliases(self, aliases):
for mac, alias in aliases.items():
try:
@ -156,19 +181,25 @@ class NodeDB:
node.flags['gateway'] = True
node.flags['vpn'] = True
def map_link(self, pair):
type = None
if any(filter(lambda x: self._nodes[x].flags['vpn'], pair[0])):
type = "vpn"
for k, v in node.interfaces.items():
node.interfaces[k].vpn = "vpn"
if any(filter(lambda x: self._nodes[x].flags['client'], pair[0])):
type = "client"
changes = 1
while changes > 0:
changes = 0
for link in self._links:
if link.type == "client":
continue
link = Link()
link.pair = pair[0]
link.type = type
link.quality = pair[1]
return link
source_interface = self._nodes[link.source.id].interfaces[link.source.interface]
target_interface = self._nodes[link.target.id].interfaces[link.target.interface]
if source_interface.vpn or target_interface.vpn:
source_interface.vpn = True
target_interface.vpn = True
if link.type != "vpn":
changes += 1
link.type = "vpn"
def import_wikigps(self, url):
def fetch_wikitable(url):