forked from mirrors/thatmattlove-hyperglass
fix juniper AS_PATH parsing problem
This commit is contained in:
parent
97d1be3ae3
commit
308840b315
1 changed files with 7 additions and 1 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue