Skip to content

Commit

Permalink
Merge branch 'develop' into pr-749
Browse files Browse the repository at this point in the history
  • Loading branch information
mirceaulinic committed Apr 16, 2020
2 parents 381d3c8 + 7ffb3fc commit c33b060
Show file tree
Hide file tree
Showing 16 changed files with 2,071 additions and 15 deletions.
1 change: 1 addition & 0 deletions docs/support/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,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
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
4 changes: 3 additions & 1 deletion napalm/eos/eos.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,9 @@ def get_lldp_neighbors_detail(self, interface=""):
lldp_neighbors_out[interface].append(
{
"parent_interface": interface, # no parent interfaces
"remote_port": neighbor_interface_info.get("interfaceId", ""),
"remote_port": neighbor_interface_info.get(
"interfaceId", ""
).replace('"', ""),
"remote_port_description": neighbor_interface_info.get(
"interfaceDescription", ""
),
Expand Down
9 changes: 4 additions & 5 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 Expand Up @@ -2439,9 +2440,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 Expand Up @@ -3193,8 +3192,8 @@ def traceroute(
if source:
command += " source {}".format(source)
if ttl:
if isinstance(ttl, int) and 0 <= timeout <= 255:
command += " ttl 0 {}".format(str(ttl))
if isinstance(ttl, int) and 0 <= ttl <= 255:
command += " ttl {}".format(str(ttl))
if timeout:
# Timeout should be an integer between 1 and 3600
if isinstance(timeout, int) and 1 <= timeout <= 3600:
Expand Down
5 changes: 4 additions & 1 deletion napalm/nxos/nxos.py
Original file line number Diff line number Diff line change
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 @@ -1485,6 +1486,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
Original file line number Diff line number Diff line change
Expand Up @@ -1521,6 +1521,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
8 changes: 4 additions & 4 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
black==19.10b0
coveralls==2.0.0
ddt==1.3.0
ddt==1.3.1
flake8-import-order==0.18.1
pytest==5.4.0
pytest==5.4.1
pytest-cov==2.8.1
pytest-json==0.4.0
pytest-pythonpath==0.7.3
pylama==7.7.1
mock==4.0.1
tox==3.14.5
mock==4.0.2
tox==3.14.6
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"Ethernet1/1": [
{
"parent_interface": "Ethernet1/1",
"remote_port": "1ce7.1003.5413",
"remote_port_description": "eth0",
"remote_system_name": "some-server",
"remote_system_description": "Ubuntu 18.04.3 LTS Linux 5.0.0-36-generic #39~18.04.1-Ubuntu SMP Tue Nov 12 11:09:50 UTC 2019 x86_64",
"remote_chassis_id": "1C:E7:10:03:54:13",
"remote_system_capab": [
"bridge",
"router",
"station",
"wlan-access-point"
],
"remote_system_enable_capab": [
"bridge",
"router"
]
}
],
"Ethernet26/1": [
{
"parent_interface": "Ethernet26/1",
"remote_port": "et-0/0/20",
"remote_port_description": "et-0/0/20",
"remote_system_name": "some-other-switch",
"remote_system_description": "boom boom",
"remote_chassis_id": "04:43:10:03:54:13",
"remote_system_capab": [
"bridge",
"router"
],
"remote_system_enable_capab": [
"bridge",
"router"
]
}
],
"Ethernet27/1": [
{
"parent_interface": "Ethernet27/1",
"remote_port": "et-0/0/20",
"remote_port_description": "et-0/0/20",
"remote_system_name": "some-switch",
"remote_system_description": "blah blih bleh",
"remote_chassis_id": "FC:66:10:03:54:13",
"remote_system_capab": [
"bridge",
"router"
],
"remote_system_enable_capab": [
"bridge",
"router"
]
}
]
}
Loading

0 comments on commit c33b060

Please sign in to comment.