From b49b6ea58ed91c3a94b01ebd307c12f068151ce6 Mon Sep 17 00:00:00 2001 From: thatmattlove Date: Wed, 8 Dec 2021 12:00:02 -0700 Subject: [PATCH] Allow customization of driver (Netmiko) configuration on a per-device basis --- hyperglass/constants.py | 2 -- hyperglass/execution/drivers/ssh_netmiko.py | 1 + hyperglass/models/config/devices.py | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hyperglass/constants.py b/hyperglass/constants.py index 72576d95..04c3368d 100644 --- a/hyperglass/constants.py +++ b/hyperglass/constants.py @@ -76,8 +76,6 @@ } DRIVER_MAP = { - "frr_legacy": "hyperglass_agent", - "bird_legacy": "hyperglass_agent", "bird": "netmiko", "frr": "netmiko", "http": "hyperglass_http_client", diff --git a/hyperglass/execution/drivers/ssh_netmiko.py b/hyperglass/execution/drivers/ssh_netmiko.py index 6e6a1614..572758bb 100644 --- a/hyperglass/execution/drivers/ssh_netmiko.py +++ b/hyperglass/execution/drivers/ssh_netmiko.py @@ -70,6 +70,7 @@ async def collect(self, host: str = None, port: int = None) -> Iterable: "timeout": math.floor(params.request_timeout * 1.25), "session_timeout": math.ceil(params.request_timeout - 1), **global_args, + **self.device.driver_config, } if "_telnet" in self.device.platform: diff --git a/hyperglass/models/config/devices.py b/hyperglass/models/config/devices.py index 819fcaf3..c5c091a7 100644 --- a/hyperglass/models/config/devices.py +++ b/hyperglass/models/config/devices.py @@ -54,6 +54,7 @@ class Device(HyperglassModelWithId, extra="allow"): structured_output: Optional[StrictBool] directives: Directives = Directives() driver: Optional[SupportedDriver] + driver_config: Dict[str, Any] = {} attrs: Dict[str, str] = {} def __init__(self, **kw) -> None: