diff --git a/napalm/base/base.py b/napalm/base/base.py index b1b56040d..10448debd 100644 --- a/napalm/base/base.py +++ b/napalm/base/base.py @@ -1599,7 +1599,11 @@ def get_optics(self) -> Dict[str, models.OpticsDict]: raise NotImplementedError def get_config( - self, retrieve: str = "all", full: bool = False, sanitized: bool = False + self, + retrieve: str = "all", + full: bool = False, + sanitized: bool = False, + format: str = "text", ) -> models.ConfigDict: """ Return the configuration of a device. @@ -1609,6 +1613,7 @@ def get_config( The rest will be set to "". full(bool): Retrieve all the configuration. For instance, on ios, "sh run all". sanitized(bool): Remove secret data. Default: ``False``. + format(string): The configuration format style to be retrieved. Returns: The object returned is a dictionary with a key for each configuration store: diff --git a/napalm/eos/eos.py b/napalm/eos/eos.py index 52db5463b..a31e91a71 100644 --- a/napalm/eos/eos.py +++ b/napalm/eos/eos.py @@ -2063,7 +2063,7 @@ def get_optics(self): return optics_detail - def get_config(self, retrieve="all", full=False, sanitized=False): + def get_config(self, retrieve="all", full=False, sanitized=False, format="text"): """get_config implementation for EOS.""" get_startup = retrieve == "all" or retrieve == "startup" get_running = retrieve == "all" or retrieve == "running" diff --git a/napalm/ios/ios.py b/napalm/ios/ios.py index df7a78400..b10b22fe3 100644 --- a/napalm/ios/ios.py +++ b/napalm/ios/ios.py @@ -3613,7 +3613,7 @@ def get_network_instances(self, name=""): except AttributeError: raise ValueError("The vrf %s does not exist" % name) - def get_config(self, retrieve="all", full=False, sanitized=False): + def get_config(self, retrieve="all", full=False, sanitized=False, format="text"): """Implementation of get_config for IOS. Returns the startup or/and running configuration as dictionary. diff --git a/napalm/iosxr/iosxr.py b/napalm/iosxr/iosxr.py index 475ad3484..71f5c31ba 100644 --- a/napalm/iosxr/iosxr.py +++ b/napalm/iosxr/iosxr.py @@ -2318,7 +2318,7 @@ def get_users(self): return users - def get_config(self, retrieve="all", full=False, sanitized=False): + def get_config(self, retrieve="all", full=False, sanitized=False, format="text"): config = {"startup": "", "running": "", "candidate": ""} # default values # IOS-XR only supports "all" on "show run" diff --git a/napalm/iosxr_netconf/iosxr_netconf.py b/napalm/iosxr_netconf/iosxr_netconf.py index 6f224e46a..f8b0a7a0e 100644 --- a/napalm/iosxr_netconf/iosxr_netconf.py +++ b/napalm/iosxr_netconf/iosxr_netconf.py @@ -3111,7 +3111,7 @@ def get_users(self): return users - def get_config(self, retrieve="all", full=False, sanitized=False): + def get_config(self, retrieve="all", full=False, sanitized=False, format="text"): """Return device configuration.""" encoding = self.config_encoding diff --git a/napalm/junos/junos.py b/napalm/junos/junos.py index b12d09774..413b39a17 100644 --- a/napalm/junos/junos.py +++ b/napalm/junos/junos.py @@ -2435,10 +2435,11 @@ def get_optics(self): return optics_detail - def get_config(self, retrieve="all", full=False, sanitized=False): + def get_config(self, retrieve="all", full=False, sanitized=False, format="text"): rv = {"startup": "", "running": "", "candidate": ""} - options = {"format": "text", "database": "candidate"} + self.format = format + options = {"format": self.format, "database": "candidate"} sanitize_strings = { r"^(\s+community\s+)\w+(;.*|\s+{.*)$": r"\1\2", r'^(.*)"\$\d\$\S+"(;.*)$': r"\1\2", diff --git a/napalm/nxos/nxos.py b/napalm/nxos/nxos.py index 09170074d..ef293b77a 100644 --- a/napalm/nxos/nxos.py +++ b/napalm/nxos/nxos.py @@ -583,7 +583,7 @@ def _disable_confirmation(self) -> None: self._send_command_list(["terminal dont-ask"]) def get_config( - self, retrieve: str = "all", full: bool = False, sanitized: bool = False + self, retrieve: str = "all", full: bool = False, sanitized: bool = False, format: str = "text" ) -> models.ConfigDict: # NX-OS adds some extra, unneeded lines that should be filtered. filter_strings = [