mirror of
https://github.com/checktheroads/hyperglass
synced 2024-05-11 05:55:08 +00:00
remove device.location field
This commit is contained in:
@@ -255,7 +255,6 @@ def _build_frontend_networks():
|
||||
{
|
||||
"device.network.display_name": {
|
||||
"device.name": {
|
||||
"location": "device.location",
|
||||
"display_name": "device.display_name",
|
||||
"vrfs": [
|
||||
"Global",
|
||||
@@ -277,7 +276,6 @@ def _build_frontend_networks():
|
||||
frontend_dict[device.network.display_name].update(
|
||||
{
|
||||
device.name: {
|
||||
"location": device.location,
|
||||
"display_name": device.network.display_name,
|
||||
"vrfs": [vrf.display_name for vrf in device.vrfs],
|
||||
}
|
||||
@@ -286,7 +284,6 @@ def _build_frontend_networks():
|
||||
elif device.network.display_name not in frontend_dict:
|
||||
frontend_dict[device.network.display_name] = {
|
||||
device.name: {
|
||||
"location": device.location,
|
||||
"display_name": device.network.display_name,
|
||||
"vrfs": [vrf.display_name for vrf in device.vrfs],
|
||||
}
|
||||
@@ -303,7 +300,6 @@ def _build_frontend_devices():
|
||||
Schema:
|
||||
{
|
||||
"device.name": {
|
||||
"location": "device.location",
|
||||
"display_name": "device.display_name",
|
||||
"vrfs": [
|
||||
"Global",
|
||||
@@ -323,7 +319,6 @@ def _build_frontend_devices():
|
||||
if device.name in frontend_dict:
|
||||
frontend_dict[device.name].update(
|
||||
{
|
||||
"location": device.location,
|
||||
"network": device.network.display_name,
|
||||
"display_name": device.display_name,
|
||||
"vrfs": [
|
||||
@@ -334,7 +329,6 @@ def _build_frontend_devices():
|
||||
)
|
||||
elif device.name not in frontend_dict:
|
||||
frontend_dict[device.name] = {
|
||||
"location": device.location,
|
||||
"network": device.network.display_name,
|
||||
"display_name": device.display_name,
|
||||
"vrfs": [
|
||||
@@ -366,7 +360,6 @@ def _build_networks():
|
||||
network_def["locations"].append(
|
||||
{
|
||||
"name": device.name,
|
||||
"location": device.location,
|
||||
"display_name": device.display_name,
|
||||
"network": device.network.display_name,
|
||||
"vrfs": [
|
||||
|
@@ -48,7 +48,6 @@ class Router(HyperglassModel):
|
||||
network: Network
|
||||
credential: Credential
|
||||
proxy: Optional[Proxy]
|
||||
location: StrictStr
|
||||
display_name: StrictStr
|
||||
port: StrictInt
|
||||
ssl: Optional[Ssl]
|
||||
@@ -72,7 +71,7 @@ class Router(HyperglassModel):
|
||||
raise UnsupportedDevice(f'"{value}" device type is not supported.')
|
||||
return value
|
||||
|
||||
@validator("name", "location")
|
||||
@validator("name")
|
||||
def clean_name(cls, value):
|
||||
"""Remove or replace unsupported characters from field values.
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
Accepts input from front end application, validates the input and
|
||||
returns errors if input is invalid. Passes validated parameters to
|
||||
construct.py, which is used to build & run the Netmiko connectoins or
|
||||
construct.py, which is used to build & run the Netmiko connections or
|
||||
hyperglass-frr API calls, returns the output back to the front end.
|
||||
"""
|
||||
|
||||
@@ -81,7 +81,7 @@ class Connect:
|
||||
)
|
||||
except sshtunnel.BaseSSHTunnelForwarderError as scrape_proxy_error:
|
||||
log.error(
|
||||
f"Error connecting to device {self.device.location} via "
|
||||
f"Error connecting to device {self.device.name} via "
|
||||
f"proxy {self.device.proxy.name}"
|
||||
)
|
||||
raise ScrapeError(
|
||||
@@ -120,7 +120,7 @@ class Connect:
|
||||
}
|
||||
|
||||
try:
|
||||
log.debug("Connecting to {loc}...", loc=self.device.location)
|
||||
log.debug("Connecting to {loc}...", loc=self.device.name)
|
||||
|
||||
nm_connect_direct = ConnectHandler(**scrape_host)
|
||||
|
||||
@@ -138,7 +138,7 @@ class Connect:
|
||||
except (NetMikoTimeoutException, NetmikoTimeoutError) as scrape_error:
|
||||
log.error(
|
||||
"Timeout connecting to device {loc}: {e}",
|
||||
loc=self.device.location,
|
||||
loc=self.device.name,
|
||||
e=str(scrape_error),
|
||||
)
|
||||
raise DeviceTimeout(
|
||||
@@ -150,7 +150,7 @@ class Connect:
|
||||
except (NetMikoAuthenticationException, NetmikoAuthError) as auth_error:
|
||||
log.error(
|
||||
"Error authenticating to device {loc}: {e}",
|
||||
loc=self.device.location,
|
||||
loc=self.device.name,
|
||||
e=str(auth_error),
|
||||
)
|
||||
raise AuthError(
|
||||
@@ -182,7 +182,7 @@ class Connect:
|
||||
Directly connects to the router via Netmiko library, returns the
|
||||
command output.
|
||||
"""
|
||||
log.debug(f"Connecting directly to {self.device.location}...")
|
||||
log.debug(f"Connecting directly to {self.device.name}...")
|
||||
|
||||
scrape_host = {
|
||||
"host": self.device.address,
|
||||
@@ -230,7 +230,7 @@ class Connect:
|
||||
except (NetMikoAuthenticationException, NetmikoAuthError) as auth_error:
|
||||
log.error(
|
||||
"Error authenticating to device {loc}: {e}",
|
||||
loc=self.device.location,
|
||||
loc=self.device.name,
|
||||
e=str(auth_error),
|
||||
)
|
||||
|
||||
@@ -335,7 +335,7 @@ class Connect:
|
||||
)
|
||||
|
||||
if not response:
|
||||
log.error(f"No response from device {self.device.location}")
|
||||
log.error(f"No response from device {self.device.name}")
|
||||
raise RestError(
|
||||
params.messages.connection_error,
|
||||
device_name=self.device.display_name,
|
||||
@@ -349,7 +349,7 @@ class Execute:
|
||||
"""Perform query execution on device.
|
||||
|
||||
Ingests raw user input, performs validation of target input, pulls
|
||||
all configuraiton variables for the input router and connects to the
|
||||
all configuration variables for the input router and connects to the
|
||||
selected device to execute the query.
|
||||
"""
|
||||
|
||||
|
Reference in New Issue
Block a user