diff --git a/lg.py b/lg.py index 728503c..3a0a1fc 100755 --- a/lg.py +++ b/lg.py @@ -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():