mirror of
https://github.com/sileht/bird-lg.git
synced 2024-11-25 16:24:43 +01:00
Remove duplicate label on a edge
This commit is contained in:
parent
63a6f32d5f
commit
3905d7d0ac
9
lg.py
9
lg.py
|
@ -379,7 +379,14 @@ def show_bgpmap():
|
||||||
edges[edge_tuple] = edge
|
edges[edge_tuple] = edge
|
||||||
elif "label" in kwargs and kwargs["label"]:
|
elif "label" in kwargs and kwargs["label"]:
|
||||||
e = edges[edge_tuple]
|
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]
|
return edges[edge_tuple]
|
||||||
|
|
||||||
for host, asmaps in data.iteritems():
|
for host, asmaps in data.iteritems():
|
||||||
|
|
Loading…
Reference in a new issue