Skip to content

Commit

Permalink
Add optional arguments force_no_enable for disable use enable mode. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
User-Man authored Apr 14, 2020
1 parent 6860683 commit 638af2d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions napalm/base/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ def _netmiko_open(self, device_type, netmiko_optional_args=None):
except NetMikoTimeoutException:
raise ConnectionException("Cannot connect to {}".format(self.hostname))

# ensure in enable mode
self._netmiko_device.enable()
# ensure in enable mode if not force disable
if not self.force_no_enable:
self._netmiko_device.enable()
return self._netmiko_device

def _netmiko_close(self):
Expand Down
1 change: 1 addition & 0 deletions napalm/ios/ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ def __init__(self, hostname, username, password, timeout=60, optional_args=None)
self.platform = "ios"
self.profile = [self.platform]
self.use_canonical_interface = optional_args.get("canonical_int", False)
self.force_no_enable = optional_args.get("force_no_enable", False)

def open(self):
"""Open a connection to the device."""
Expand Down

0 comments on commit 638af2d

Please sign in to comment.