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:
@@ -83,13 +83,19 @@ class Construct:
|
|||||||
):
|
):
|
||||||
query = str(self.query_data.query_target)
|
query = str(self.query_data.query_target)
|
||||||
asns = re.findall(r"\d+", query)
|
asns = re.findall(r"\d+", query)
|
||||||
|
was_modified = False
|
||||||
if bool(re.match(r"^\_", query)):
|
if bool(re.match(r"^\_", query)):
|
||||||
# Replace `_65000` with `.* 65000`
|
# Replace `_65000` with `.* 65000`
|
||||||
asns.insert(0, r".*")
|
asns.insert(0, r".*")
|
||||||
|
was_modified = True
|
||||||
if bool(re.match(r".*(\_)$", query)):
|
if bool(re.match(r".*(\_)$", query)):
|
||||||
# Replace `65000_` with `65000 .*`
|
# Replace `65000_` with `65000 .*`
|
||||||
asns.append(r".*")
|
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):
|
def json(self, afi):
|
||||||
"""Return JSON version of validated query for REST devices.
|
"""Return JSON version of validated query for REST devices.
|
||||||
|
Reference in New Issue
Block a user