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

fix huawei slash conversion issue

This commit is contained in:
checktheroads
2020-03-24 18:36:04 -07:00
parent 62e2e7eca8
commit d0451fd7af
4 changed files with 13 additions and 16 deletions

View File

@@ -4,7 +4,7 @@ import sys
from datetime import datetime
__name__ = "hyperglass"
__version__ = "1.0.0-beta.11"
__version__ = "1.0.0-beta.12"
__author__ = "Matt Love"
__copyright__ = f"Copyright {datetime.now().year} Matthew Love"
__license__ = "BSD 3-Clause Clear License"

View File

@@ -35,6 +35,7 @@ class Construct:
)
self.device = device
self.query_data = query_data
self.target = self.query_data.query_target
# Set transport method based on NOS type
self.transport = "scrape"
@@ -43,16 +44,13 @@ class Construct:
# Remove slashes from target for required platforms
if self.device.nos in TARGET_FORMAT_SPACE:
self.query_data.query_target = re.sub(
r"\/", r" ", str(self.query_data.query_target)
)
self.target = re.sub(r"\/", r" ", str(self.query_data.query_target))
# Set AFIs for based on query type
if self.query_data.query_type in ("bgp_route", "ping", "traceroute"):
"""
For IP queries, AFIs are enabled (not null/None) VRF -> AFI definitions
where the IP version matches the IP version of the target.
"""
# For IP queries, AFIs are enabled (not null/None) VRF -> AFI definitions
# where the IP version matches the IP version of the target.
self.afis = [
v
for v in (
@@ -62,10 +60,9 @@ class Construct:
if v is not None and self.query_data.query_target.version == v.version
]
elif self.query_data.query_type in ("bgp_aspath", "bgp_community"):
"""
For AS Path/Community queries, AFIs are just enabled VRF -> AFI definitions,
no IP version checking is performed (since there is no IP).
"""
# For AS Path/Community queries, AFIs are just enabled VRF -> AFI
# definitions, no IP version checking is performed (since there is no IP).
self.afis = [
v
for v in (
@@ -91,7 +88,7 @@ class Construct:
"vrf": self.query_data.query_vrf.name,
"afi": afi.protocol,
"source": str(afi.source_address),
"target": str(self.query_data.query_target),
"target": str(self.target),
}
)
@@ -108,7 +105,7 @@ class Construct:
f"{self.device.nos}.{afi.protocol}.{self.query_data.query_type}"
)(commands)
return command.format(
target=self.query_data.query_target,
target=self.target,
source=str(afi.source_address),
vrf=self.query_data.query_vrf.name,
)

View File

@@ -2,7 +2,7 @@
set -e
HYPERGLASS_VERSION="1.0.0b11"
HYPERGLASS_VERSION="1.0.0b12"
MIN_PYTHON_MAJOR="3"
MIN_PYTHON_MINOR="6"

View File

@@ -4,7 +4,7 @@ build-backend = "poetry.masonry.api"
[tool.poetry]
name = "hyperglass"
version = "1.0.0-beta.11"
version = "1.0.0-beta.12"
description = "hyperglass is the modern network looking glass that tries to make the internet better."
authors = ["Matt Love <matt@hyperglass.io>"]
readme = "README.md"