Skip to content

Commit

Permalink
Merge branch 'develop' into vrf_get_interface_ip
Browse files Browse the repository at this point in the history
  • Loading branch information
mirceaulinic committed Apr 15, 2020
2 parents 4c533fc + dd68b7f commit dcfbb83
Show file tree
Hide file tree
Showing 10 changed files with 1,738 additions and 7 deletions.
1 change: 1 addition & 0 deletions docs/support/index.rst
Expand Up @@ -119,6 +119,7 @@ ____________________________________
* :code:`canonical_int` (ios) - Convert operational interface's returned name to canonical name (fully expanded name) (default: ``False``).
* :code:`dest_file_system` (ios) - Destination file system for SCP transfers (default: ``flash:``).
* :code:`enable_password` (eos) - Password required to enter privileged exec (enable) (default: ``''``).
* :code:`force_no_enable` (ios, nxos_ssh) - Do not automatically enter enable-mode on connect (default: ``False``).
* :code:`global_delay_factor` (ios, nxos_ssh) - Allow for additional delay in command execution (default: ``1``).
* :code:`ignore_warning` (junos) - Allows to set `ignore_warning` when loading configuration to avoid exceptions via junos-pyez. (default: ``False``).
* :code:`keepalive` (iosxr, junos) - SSH keepalive interval, in seconds (default: ``30`` seconds).
Expand Down
5 changes: 3 additions & 2 deletions napalm/base/base.py
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
5 changes: 2 additions & 3 deletions napalm/ios/ios.py
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 Expand Up @@ -2443,9 +2444,7 @@ def get_mac_address_table(self):
) # 7 fields
RE_MACTABLE_6500_2 = r"^{}\s+{}\s+".format(VLAN_REGEX, MAC_REGEX) # 6 fields
RE_MACTABLE_6500_3 = r"^\s{51}\S+" # Fill down prior
RE_MACTABLE_6500_4 = r"^R\s+{}\s+.*Router".format(
VLAN_REGEX, MAC_REGEX
) # Router field
RE_MACTABLE_6500_4 = r"^R\s+{}\s+.*Router".format(VLAN_REGEX) # Router field
RE_MACTABLE_6500_5 = r"^R\s+N/A\s+{}.*Router".format(
MAC_REGEX
) # Router skipped
Expand Down
5 changes: 4 additions & 1 deletion napalm/nxos/nxos.py
Expand Up @@ -84,6 +84,7 @@ def __init__(self, hostname, username, password, timeout=60, optional_args=None)
self.candidate_cfg = "candidate_config.txt"
self.rollback_cfg = "rollback_config.txt"
self._dest_file_system = optional_args.pop("dest_file_system", "bootflash:")
self.force_no_enable = optional_args.get("force_no_enable", False)
self.netmiko_optional_args = netmiko_args(optional_args)
self.device = None

Expand Down Expand Up @@ -804,7 +805,7 @@ def get_facts(self):
facts["model"] = show_version.get("chassis_id", "")
facts["hostname"] = show_version.get("host_name", "")
facts["os_version"] = show_version.get(
"sys_ver_str", show_version.get("rr_sys_ver", "")
"sys_ver_str", show_version.get("kickstart_ver_str", "")
)

uptime_days = show_version.get("kern_uptm_days", 0)
Expand Down Expand Up @@ -1490,6 +1491,8 @@ def get_vlans(self):
vlan_table_raw = [vlan_table_raw]

for vlan in vlan_table_raw:
if "vlanshowplist-ifidx" not in vlan.keys():
vlan["vlanshowplist-ifidx"] = []
vlans[vlan["vlanshowbr-vlanid"]] = {
"name": vlan["vlanshowbr-vlanname"],
"interfaces": self._parse_vlan_ports(vlan["vlanshowplist-ifidx"]),
Expand Down
2 changes: 2 additions & 0 deletions napalm/nxos_ssh/nxos_ssh.py
Expand Up @@ -1525,6 +1525,8 @@ def get_vlans(self):
vlan_table_raw = [vlan_table_raw]

for vlan in vlan_table_raw:
if "vlanshowplist-ifidx" not in vlan.keys():
vlan["vlanshowplist-ifidx"] = []
vlans[vlan["vlanshowbr-vlanid"]] = {
"name": vlan["vlanshowbr-vlanname"],
"interfaces": self._parse_vlan_ports(vlan["vlanshowplist-ifidx"]),
Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Expand Up @@ -7,7 +7,7 @@ license_file = LICENSE
[pylama]
linters = mccabe,pep8,pyflakes
ignore = D203,C901,E203
skip = .tox/*
skip = .tox/*,.env/*,.venv/*

[pylama:pep8]
max_line_length = 100
Expand All @@ -17,6 +17,7 @@ norecursedirs =
.git
.tox
.env
.venv
dist
build
south_migraitons
Expand Down

0 comments on commit dcfbb83

Please sign in to comment.