Skip to content

Commit

Permalink
Merge branch 'develop' into py313_support
Browse files Browse the repository at this point in the history
  • Loading branch information
ktbyers authored Nov 13, 2024
2 parents 8b99f08 + 17e0aeb commit b3ba502
Show file tree
Hide file tree
Showing 9 changed files with 261 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ docs/_static/
.venv
.vscode
.devcontainer
.python-version

env
*.swp
Expand Down
7 changes: 3 additions & 4 deletions napalm/nxos_ssh/nxos_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@ def parse_intf_section(interface):
mtu = int(speed_data["mtu"])
speed_unit = speed_data["speed_unit"]
speed_unit = speed_unit.rstrip(",")
# This was alway in Kbit (in the data I saw)
if speed_unit != "Kbit":
if speed_unit not in ["Kbit", "Kbit/sec"]:
msg = "Unexpected speed unit in show interfaces parsing:\n\n{}".format(
interface
)
Expand Down Expand Up @@ -484,7 +483,7 @@ def parse_uptime(uptime_str):
Return the uptime in seconds as an integer
"""
# Initialize to zero
(years, weeks, days, hours, minutes) = (0, 0, 0, 0, 0)
(years, weeks, days, hours, minutes, seconds) = (0, 0, 0, 0, 0, 0)

uptime_str = uptime_str.strip()
time_list = uptime_str.split(",")
Expand Down Expand Up @@ -622,7 +621,7 @@ def get_facts(self):
_, uptime_str = line.split(" uptime is ")
uptime = self.parse_uptime(uptime_str)

if "system: " in line or "NXOS: " in line:
if "system: " in line or line.strip().startswith("NXOS: version"):
line = line.strip()
os_version = line.split()[2]
os_version = os_version.strip()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"os_version": "10.3(5)",
"uptime": 4338547,
"interface_list": [
"Management0",
"Ethernet1/1",
"Ethernet1/2",
"Ethernet1/3",
"Ethernet1/4",
"Ethernet1/5",
"Ethernet1/6",
"Ethernet1/7",
"Ethernet1/8",
"Ethernet1/9",
"Ethernet1/10",
"Ethernet1/11",
"Ethernet1/12",
"Ethernet1/13",
"Ethernet1/14",
"Ethernet1/15",
"Ethernet1/16",
"Ethernet1/17",
"Ethernet1/18",
"Ethernet1/19",
"Ethernet1/20",
"Ethernet1/21",
"Ethernet1/22",
"Ethernet1/23",
"Ethernet1/24",
"Ethernet1/25",
"Ethernet1/26",
"Ethernet1/27",
"Ethernet1/28",
"Ethernet1/29",
"Ethernet1/30",
"Ethernet1/31",
"Ethernet1/32",
"Ethernet1/33",
"Ethernet1/34",
"Ethernet1/35",
"Ethernet1/36",
"Ethernet1/37",
"Ethernet1/38",
"Ethernet1/39",
"Ethernet1/40",
"Ethernet1/41",
"Ethernet1/42",
"Ethernet1/43",
"Ethernet1/44",
"Ethernet1/45",
"Ethernet1/46",
"Ethernet1/47",
"Ethernet1/48",
"Ethernet1/49",
"Ethernet1/50",
"Ethernet1/51",
"Ethernet1/52",
"Port-channel1",
"Port-channel16",
"Port-channel17",
"Port-channel32",
"Port-channel33",
"Port-channel34",
"Port-channel35",
"Port-channel50",
"Port-channel51",
"Port-channel360",
"Vlan1",
"Vlan351"
],
"vendor": "Cisco",
"serial_number": "TM6012EC74B",
"model": "Nexus 3048 Chassis",
"hostname": "SWITCH_NXOSv",
"fqdn": "SWITCH_NXOSv.y.z.a.com"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SWITCH_NXOSv.y.z.a.com
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
DNS lookup enabled
Vrf Name: default Default domain is y.z.a.com
Name servers are 8.8.8.4 8.8.8.8



Host Address
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@

--------------------------------------------------------------------------------
Port Name Status Vlan Duplex Speed Type
--------------------------------------------------------------------------------
mgmt0 -- connected routed full 1000 --
Eth1/1 -- connected 353 full 100 10/100/1g
Eth1/2 -- notconnec 353 auto auto 10/100/1g
Eth1/3 -- disabled 366 auto auto 10/100/1g
Eth1/4 -- connected 351 full 1000 10/100/1g
Eth1/5 -- connected 351 full 1000 10/100/1g
Eth1/6 -- connected 351 full 1000 10/100/1g
Eth1/7 -- connected 351 full 1000 10/100/1g
Eth1/8 -- connected 351 full 1000 10/100/1g
Eth1/9 -- connected 351 full 1000 10/100/1g
Eth1/10 -- connected 351 full 1000 10/100/1g
Eth1/11 -- connected 351 full 1000 10/100/1g
Eth1/12 -- connected 351 full 1000 10/100/1g
Eth1/13 -- connected 351 full 1000 10/100/1g
Eth1/14 -- connected 351 full 1000 10/100/1g
Eth1/15 -- connected 351 full 1000 10/100/1g
Eth1/16 -- connected trunk full 1000 10/100/1g
Eth1/17 -- connected trunk full 1000 10/100/1g
Eth1/18 -- connected 369 full 1000 10/100/1g
Eth1/19 -- notconnec 351 auto auto 10/100/1g
Eth1/20 -- connected 351 full 100 10/100/1g
Eth1/21 -- connected 351 half 100 10/100/1g
Eth1/22 -- connected 351 half 100 10/100/1g
Eth1/23 -- disabled 366 auto auto 10/100/1g
Eth1/24 -- connected 352 full 1000 10/100/1g
Eth1/25 -- connected 352 half 100 10/100/1g
Eth1/26 -- connected 352 full 1000 10/100/1g
Eth1/27 -- connected 352 half 100 10/100/1g
Eth1/28 -- connected 352 full 100 10/100/1g
Eth1/29 -- connected 352 full 100 10/100/1g
Eth1/30 -- connected 352 full 100 10/100/1g
Eth1/31 -- disabled 366 auto auto 10/100/1g
Eth1/32 -- connected trunk full 1000 10/100/1g
Eth1/33 -- connected trunk full 1000 10/100/1g
Eth1/34 -- connected trunk full 1000 10/100/1g
Eth1/35 -- connected trunk full 1000 10/100/1g
Eth1/36 -- connected 351 full 1000 10/100/1g
Eth1/37 -- connected 351 full 1000 10/100/1g
Eth1/38 -- connected 351 full 1000 10/100/1g
Eth1/39 -- connected 351 full 1000 10/100/1g
Eth1/40 -- connected 351 full 1000 10/100/1g
Eth1/41 -- disabled 350 auto auto 10/100/1g
Eth1/42 -- connected 351 full 1000 10/100/1g
Eth1/43 -- connected 351 full 1000 10/100/1g
Eth1/44 -- connected 351 full 1000 10/100/1g
Eth1/45 -- connected 351 full 1000 10/100/1g
Eth1/46 -- disabled 366 auto auto 10/100/1g
Eth1/47 -- connected trunk full 1000 10/100/1g
Eth1/48 -- connected trunk full 1000 10/100/1g
Eth1/49 -- xcvrAbsen 366 full 10G --
Eth1/50 -- connected trunk full 1000 1000base-SX
Eth1/51 -- connected trunk full 1000 1000base-SX
Eth1/52 -- connected trunk full 1000 1000base-SX
Po1 -- connected trunk full 1000 --
Po16 -- connected trunk full 1000 --
Po17 -- connected trunk full 1000 --
Po32 -- connected trunk full 1000 --
Po33 -- connected trunk full 1000 --
Po34 -- connected trunk full 1000 --
Po35 -- connected trunk full 1000 --
Po50 -- connected trunk full 1000 --
Po51 -- connected trunk full 1000 --
Po360 -- connected trunk full 1000 --
Vlan1 -- down routed auto auto --
Vlan351 -- connected routed auto auto --
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"TABLE_inv": {
"ROW_inv": [
{
"name": "Chassis",
"desc": "Nexus 6001 Chassis",
"productid": "N6K-C6001-64P",
"vendorid": "V01",
"serialnum": "TM6012EC74B"
},
{
"name": "Module 1",
"desc": "Nexus 64 Supervisor",
"productid": "N6K-C6001-64P",
"vendorid": "V01",
"serialnum": "FOC11111111"
},
{
"name": "Module 2",
"desc": "Nexus 4xQSFP Ethernet Module",
"productid": "N6K-C6001-M4Q",
"vendorid": "V01",
"serialnum": "FOC11111111"
},
{
"name": "Fan 1",
"desc": "Chassis fan module",
"productid": "N6K-C6001-FAN-B",
"vendorid": "N/A",
"serialnum": "N/A"
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
Cisco Nexus Operating System (NX-OS) Software
TAC support: http://www.cisco.com/tac
Copyright (C) 2002-2017, Cisco and/or its affiliates.
All rights reserved.
The copyrights to certain works contained in this software are
owned by other third parties and used and distributed under their own
licenses, such as open source. This software is provided "as is," and unless
otherwise stated, there is no warranty, express or implied, including but not
limited to warranties of merchantability and fitness for a particular purpose.
Certain components of this software are licensed under
the GNU General Public License (GPL) version 2.0 or
GNU General Public License (GPL) version 3.0 or the GNU
Lesser General Public License (LGPL) Version 2.1 or
Lesser General Public License (LGPL) Version 2.0.
A copy of each such license is available at
http://www.opensource.org/licenses/gpl-2.0.php and
http://opensource.org/licenses/gpl-3.0.html and
http://www.opensource.org/licenses/lgpl-2.1.php and
http://www.gnu.org/licenses/old-licenses/library.txt.

Software
BIOS: version 01.09
NXOS: version 10.3(5) [Maintenance Release]
Host NXOS: version 10.3(5)
BIOS compile time: 10/08/2023
NXOS image file is: bootflash:///nxos64-cs.10.3.5.M.bin
NXOS compile time: 4/30/2024 12:00:00 [05/08/2024 05:39:13]
NXOS boot mode: LXC

Hardware
cisco Nexus 3048 Chassis
Intel(R) Celeron(R) CPU P4505 @ 1.87GHz with 3903332 kB of memory.
Processor Board ID TM6012EC74B

Device name: SWITCH_NXOSv
bootflash: 1848240 kB
usb1: 0 kB (expansion flash)

Kernel uptime is 50 day(s), 5 hour(s), 9 minute(s), 7 second(s)

Last reset at 829281 usecs after Thu Oct 26 20:25:34 2017

Reason: Reset Requested by CLI command reload
System version: 7.0(3)I4(7)
Service:

plugin
Core Plugin, Ethernet Plugin

Active Package(s):
20 changes: 20 additions & 0 deletions test/nxos_ssh/test_static_methods.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""Tests for uptime utils"""

from napalm.nxos_ssh import NXOSSSHDriver


def test_parse_uptime():
"""
Test uptime parsing
"""
assert (
NXOSSSHDriver.parse_uptime("0 day(s), 0 hour(s), 0 minute(s), 1 second(s)") == 1
)
assert (
NXOSSSHDriver.parse_uptime("1 day(s), 0 hour(s), 0 minute(s), 0 second(s)")
== 86400
)
assert (
NXOSSSHDriver.parse_uptime("4 day(s), 15 hour(s), 48 minute(s), 52 second(s)")
== 402532
)

0 comments on commit b3ba502

Please sign in to comment.