diff --git a/lg.py b/lg.py index 6a9f4e7..40caa95 100644 --- a/lg.py +++ b/lg.py @@ -575,7 +575,11 @@ def build_as_tree_from_raw_bird_ouput(host, proto, text): net_dest = expr2.group(1).strip() if line.startswith("BGP.as_path:"): - path.extend(line.replace("BGP.as_path:", "").strip().split(" ")) + ASes = line.replace("BGP.as_path:", "").strip().split(" ") + if path: + path.extend(ASes) + else: + path = ASes if path: path.append(net_dest)