mirror of
https://github.com/sileht/bird-lg.git
synced 2024-11-22 06:54:43 +01:00
Merge pull request #53 from tamihiro/new-pr-batch-5
Correct AS path prepend count in bgpmap.
This commit is contained in:
commit
d8c20f4cbd
11
lg.py
11
lg.py
|
@ -477,7 +477,13 @@ def show_bgpmap():
|
||||||
hop_label = ""
|
hop_label = ""
|
||||||
for _as in asmap:
|
for _as in asmap:
|
||||||
if _as == previous_as:
|
if _as == previous_as:
|
||||||
prepend_as[_as] = prepend_as.get(_as, 1) + 1
|
if not prepend_as.get(_as, None):
|
||||||
|
prepend_as[_as] = {}
|
||||||
|
if not prepend_as[_as].get(host, None):
|
||||||
|
prepend_as[_as][host] = {}
|
||||||
|
if not prepend_as[_as][host].get(asmap[0], None):
|
||||||
|
prepend_as[_as][host][asmap[0]] = 1
|
||||||
|
prepend_as[_as][host][asmap[0]] += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not hop:
|
if not hop:
|
||||||
|
@ -513,7 +519,8 @@ def show_bgpmap():
|
||||||
first = False
|
first = False
|
||||||
|
|
||||||
for _as in prepend_as:
|
for _as in prepend_as:
|
||||||
graph.add_edge(pydot.Edge(*(_as, _as), label=" %dx" % prepend_as[_as], color="grey", fontcolor="grey"))
|
for n in set([ n for h, d in prepend_as[_as].iteritems() for p, n in d.iteritems() ]):
|
||||||
|
graph.add_edge(pydot.Edge(*(_as, _as), label=" %dx" % n, color="grey", fontcolor="grey"))
|
||||||
|
|
||||||
fmt = request.args.get('fmt', 'png')
|
fmt = request.args.get('fmt', 'png')
|
||||||
#response = Response("<pre>" + graph.create_dot() + "</pre>")
|
#response = Response("<pre>" + graph.create_dot() + "</pre>")
|
||||||
|
|
Loading…
Reference in a new issue