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

add VRF support

This commit is contained in:
checktheroads
2019-10-02 01:18:01 -07:00
parent 7df02dc3b4
commit 12d9a7f7cd
2 changed files with 10 additions and 2 deletions

View File

@@ -36,6 +36,8 @@ class Construct:
"""Formats query target based on NOS requirement"""
if self.device.nos in target_format_space:
_target = re.sub(r"\/", r" ", target)
else:
_target = target
log.debug(f"Formatted target: {_target}")
return _target

View File

@@ -184,7 +184,13 @@ class Connect:
f"Connecting to {self.device_config.location} via Netmiko library"
)
nm_connect_direct = ConnectHandler(**scrape_host)
response = nm_connect_direct.send_command(self.query)
responses = []
for query in self.query:
raw = nm_connect_direct.send_command(query)
responses.append(raw)
log.debug(f'Raw response for command "{query}":\n{raw}')
response = "\n\n".join(responses)
log.debug(f"Response type:\n{type(response)}")
except (NetMikoTimeoutException, NetmikoTimeoutError) as scrape_error:
log.error(f"{params.general.request_timeout - 1} second timeout expired.")
log.error(scrape_error)
@@ -204,7 +210,7 @@ class Connect:
proxy=None,
error=params.messages.authentication_error,
)
if not response:
if response is None:
log.error(f"No response from device {self.device_config.location}")
raise ScrapeError(
params.messages.connection_error,