1
0
Fork 0
mirror of https://github.com/sileht/bird-lg.git synced 2024-11-22 06:54:43 +01:00

Remove duplicate label on a edge

This commit is contained in:
Mehdi Abaakouk 2012-07-19 17:28:32 +02:00
parent 63a6f32d5f
commit 3905d7d0ac

9
lg.py
View file

@ -379,7 +379,14 @@ def show_bgpmap():
edges[edge_tuple] = edge
elif "label" in kwargs and kwargs["label"]:
e = edges[edge_tuple]
e.set_label(e.get_label() + "\r" + kwargs["label"])
label_without_star = kwargs["label"].replace("*", "")
labels = e.get_label().split("\r")
if "%s*" % pl not in labels:
labels = [ kwargs["label"] ] + [ l for l in labels if not l.startswith(label_without_star) ]
labels = sorted(labels, cmp=lambda x,y: x.endswith("*") and -1 or 1)
e.set_label("\r".join(labels))
return edges[edge_tuple]
for host, asmaps in data.iteritems():