1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00

fix juniper AS_PATH parsing problem

This commit is contained in:
checktheroads
2020-06-06 01:23:51 -07:00
parent 97d1be3ae3
commit 308840b315

View File

@@ -83,13 +83,19 @@ class Construct:
):
query = str(self.query_data.query_target)
asns = re.findall(r"\d+", query)
was_modified = False
if bool(re.match(r"^\_", query)):
# Replace `_65000` with `.* 65000`
asns.insert(0, r".*")
was_modified = True
if bool(re.match(r".*(\_)$", query)):
# Replace `65000_` with `65000 .*`
asns.append(r".*")
self.target = " ".join(asns)
was_modified = True
if was_modified:
self.target = " ".join(asns)
else:
self.target = query
def json(self, afi):
"""Return JSON version of validated query for REST devices.