model is PID and not marketing descriptio
This commit is contained in:
1 parent
cfcb69a7ca
commit
fd19da1966
9 files changed
+250
-11
No files matched your search
+30
-9
@@ -239,19 +239,14 @@ class S350Driver(NetworkDriver):
|
|||||||
_, hostname = line.split('System Name:')
|
_, hostname = line.split('System Name:')
|
||||||
hostname = hostname.strip()
|
hostname = hostname.strip()
|
||||||
continue
|
continue
|
||||||
elif line.startswith('System Description:'):
|
|
||||||
_, model = line.split('System Description:')
|
|
||||||
model = model.strip()
|
|
||||||
continue
|
|
||||||
elif line.startswith('System Up Time (days,hour:min:sec):'):
|
elif line.startswith('System Up Time (days,hour:min:sec):'):
|
||||||
_, uptime_str = line.split('System Up Time (days,hour:min:sec):')
|
_, uptime_str = line.split('System Up Time (days,hour:min:sec):')
|
||||||
uptime = self._parse_uptime(uptime_str)
|
uptime = self._parse_uptime(uptime_str)
|
||||||
|
|
||||||
# serial_number
|
# serial_number and model
|
||||||
for line in show_inv.splitlines():
|
inventory = self._get_facts_parse_inventory(show_inv)['1']
|
||||||
if 'SN:' in line:
|
serial_number = inventory['sn']
|
||||||
serial_number = line.split('SN: ')[-1]
|
model = inventory['pid']
|
||||||
break
|
|
||||||
|
|
||||||
# fqdn
|
# fqdn
|
||||||
domainname = napalm.base.helpers.textfsm_extractor(self, 'hosts',
|
domainname = napalm.base.helpers.textfsm_extractor(self, 'hosts',
|
||||||
@@ -286,6 +281,32 @@ class S350Driver(NetworkDriver):
|
|||||||
'vendor': u'Cisco',
|
'vendor': u'Cisco',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def _get_facts_parse_inventory(self, show_inventory):
|
||||||
|
""" inventory can list more modules/devices """
|
||||||
|
# make 1 module 1 line
|
||||||
|
show_inventory = re.sub(r'\nPID', ' PID', show_inventory, re.M)
|
||||||
|
# delete empty lines
|
||||||
|
show_inventory = re.sub(r'^\n', '', show_inventory, re.M)
|
||||||
|
show_inventory = re.sub(r'\n\n', '', show_inventory, re.M)
|
||||||
|
show_inventory = re.sub(r'\n\s*\n', r'\n', show_inventory, re.M)
|
||||||
|
lines = show_inventory.splitlines()
|
||||||
|
|
||||||
|
modules = {}
|
||||||
|
for line in lines:
|
||||||
|
match = re.search(r"""
|
||||||
|
^
|
||||||
|
NAME:\s"(?P<name>\S+)"\s*
|
||||||
|
DESCR:\s"(?P<descr>[^"]+)"\s*
|
||||||
|
PID:\s(?P<pid>\S+)\s*
|
||||||
|
VID:\s(?P<vid>.+\S)\s*
|
||||||
|
SN:\s(?P<sn>\S+)\s*
|
||||||
|
""", line, re.X)
|
||||||
|
module = match.groupdict()
|
||||||
|
modules[module['name']] = module
|
||||||
|
|
||||||
|
if modules:
|
||||||
|
return modules
|
||||||
|
|
||||||
def _get_facts_parse_os_version(self, show_ver):
|
def _get_facts_parse_os_version(self, show_ver):
|
||||||
# os_version
|
# os_version
|
||||||
# detect os ver > 2
|
# detect os ver > 2
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
"Po7",
|
"Po7",
|
||||||
"Po8"
|
"Po8"
|
||||||
],
|
],
|
||||||
"model": "SG300-10 10-Port Gigabit Managed Switch",
|
"model": "SRW2008-K9",
|
||||||
"os_version": "1.4.11.5",
|
"os_version": "1.4.11.5",
|
||||||
"serial_number": "AAAABBBBCCC",
|
"serial_number": "AAAABBBBCCC",
|
||||||
"uptime": 607990,
|
"uptime": 607990,
|
||||||
|
|||||||
+71
@@ -0,0 +1,71 @@
|
|||||||
|
{
|
||||||
|
"fqdn" : "switch1.",
|
||||||
|
"hostname" : "switch1",
|
||||||
|
"interface_list" : [
|
||||||
|
"gi1/0/1",
|
||||||
|
"gi1/0/2",
|
||||||
|
"gi1/0/3",
|
||||||
|
"gi1/0/4",
|
||||||
|
"gi1/0/5",
|
||||||
|
"gi1/0/6",
|
||||||
|
"gi1/0/7",
|
||||||
|
"gi1/0/8",
|
||||||
|
"gi1/0/9",
|
||||||
|
"gi1/0/10",
|
||||||
|
"gi1/0/11",
|
||||||
|
"gi1/0/12",
|
||||||
|
"gi1/0/13",
|
||||||
|
"gi1/0/14",
|
||||||
|
"gi1/0/15",
|
||||||
|
"gi1/0/16",
|
||||||
|
"gi1/0/17",
|
||||||
|
"gi1/0/18",
|
||||||
|
"gi1/0/19",
|
||||||
|
"gi1/0/20",
|
||||||
|
"gi1/0/21",
|
||||||
|
"gi1/0/22",
|
||||||
|
"gi1/0/23",
|
||||||
|
"gi1/0/24",
|
||||||
|
"gi1/0/25",
|
||||||
|
"gi1/0/26",
|
||||||
|
"gi1/0/27",
|
||||||
|
"gi1/0/28",
|
||||||
|
"gi1/0/29",
|
||||||
|
"gi1/0/30",
|
||||||
|
"gi1/0/31",
|
||||||
|
"gi1/0/32",
|
||||||
|
"gi1/0/33",
|
||||||
|
"gi1/0/34",
|
||||||
|
"gi1/0/35",
|
||||||
|
"gi1/0/36",
|
||||||
|
"gi1/0/37",
|
||||||
|
"gi1/0/38",
|
||||||
|
"gi1/0/39",
|
||||||
|
"gi1/0/40",
|
||||||
|
"gi1/0/41",
|
||||||
|
"gi1/0/42",
|
||||||
|
"gi1/0/43",
|
||||||
|
"gi1/0/44",
|
||||||
|
"gi1/0/45",
|
||||||
|
"gi1/0/46",
|
||||||
|
"gi1/0/47",
|
||||||
|
"gi1/0/48",
|
||||||
|
"te1/0/1",
|
||||||
|
"te1/0/2",
|
||||||
|
"te1/0/3",
|
||||||
|
"te1/0/4",
|
||||||
|
"Po1",
|
||||||
|
"Po2",
|
||||||
|
"Po3",
|
||||||
|
"Po4",
|
||||||
|
"Po5",
|
||||||
|
"Po6",
|
||||||
|
"Po7",
|
||||||
|
"Po8"
|
||||||
|
],
|
||||||
|
"model" : "SG350X-48P-K9",
|
||||||
|
"os_version" : "2.4.5.71",
|
||||||
|
"serial_number" : "AAA00000BBB",
|
||||||
|
"uptime" : 1232968,
|
||||||
|
"vendor" : "Cisco"
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
|
||||||
|
Name/address lookup is enabled
|
||||||
|
Domain Timeout: 2 seconds
|
||||||
|
Domain Retry: 1 times
|
||||||
|
Domain Polling Interval: 8 seconds
|
||||||
|
|
||||||
|
|
||||||
|
Default Domain Table
|
||||||
|
|
||||||
|
Domain Source Interface Preference
|
||||||
|
-------------------------------------------- ------- --------- ----------
|
||||||
|
Domain name is not configured
|
||||||
|
|
||||||
|
|
||||||
|
Name Server Table
|
||||||
|
|
||||||
|
IP Address Source Interface Preference
|
||||||
|
-------------------------------------------- ------- --------- ----------
|
||||||
|
Name server is not configured
|
||||||
|
|
||||||
|
|
||||||
|
Cache Table
|
||||||
|
Flags: (STA/DYN, OK/NE/??)
|
||||||
|
STA - Static, DYN - Dynamic
|
||||||
|
OK - Okay, NE - Negative Cache, ?? - No Response
|
||||||
|
|
||||||
|
Remaining
|
||||||
|
Host Addresses Type State TTL
|
||||||
|
------------------------- ------------------------ ---- ------ ----------
|
||||||
|
No hostname is mapped to an IP address
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+67
@@ -0,0 +1,67 @@
|
|||||||
|
Flow Link Back Mdix
|
||||||
|
Port Type Duplex Speed Neg ctrl State Pressure Mode
|
||||||
|
-------- ------------ ------ ----- -------- ---- ----------- -------- -------
|
||||||
|
gi1/0/1 1G-Copper Full 1000 Enabled Off Up Disabled Off
|
||||||
|
gi1/0/2 1G-Copper Full 1000 Enabled Off Up Disabled Off
|
||||||
|
gi1/0/3 1G-Copper Full 1000 Enabled Off Up Disabled On
|
||||||
|
gi1/0/4 1G-Copper Full 1000 Enabled Off Up Disabled On
|
||||||
|
gi1/0/5 1G-Copper Full 1000 Enabled Off Up Disabled On
|
||||||
|
gi1/0/6 1G-Copper Full 1000 Enabled Off Up Disabled Off
|
||||||
|
gi1/0/7 1G-Copper -- -- -- -- Down -- --
|
||||||
|
gi1/0/8 1G-Copper -- -- -- -- Down -- --
|
||||||
|
gi1/0/9 1G-Copper -- -- -- -- Down -- --
|
||||||
|
gi1/0/10 1G-Copper -- -- -- -- Down -- --
|
||||||
|
gi1/0/11 1G-Copper -- -- -- -- Down -- --
|
||||||
|
gi1/0/12 1G-Copper -- -- -- -- Down -- --
|
||||||
|
gi1/0/13 1G-Copper -- -- -- -- Down -- --
|
||||||
|
gi1/0/14 1G-Copper -- -- -- -- Down -- --
|
||||||
|
gi1/0/15 1G-Copper Full 1000 Enabled Off Up Disabled Off
|
||||||
|
gi1/0/16 1G-Copper Full 100 Enabled Off Up Disabled On
|
||||||
|
gi1/0/17 1G-Copper -- -- -- -- Down -- --
|
||||||
|
gi1/0/18 1G-Copper -- -- -- -- Down -- --
|
||||||
|
gi1/0/19 1G-Copper -- -- -- -- Down -- --
|
||||||
|
gi1/0/20 1G-Copper -- -- -- -- Down -- --
|
||||||
|
gi1/0/21 1G-Copper -- -- -- -- Down -- --
|
||||||
|
gi1/0/22 1G-Copper -- -- -- -- Down -- --
|
||||||
|
gi1/0/23 1G-Copper -- -- -- -- Down -- --
|
||||||
|
gi1/0/24 1G-Copper -- -- -- -- Down -- --
|
||||||
|
gi1/0/25 1G-Copper Full 1000 Enabled Off Up Disabled Off
|
||||||
|
gi1/0/26 1G-Copper Full 1000 Enabled Off Up Disabled On
|
||||||
|
gi1/0/27 1G-Copper Full 1000 Enabled Off Up Disabled On
|
||||||
|
gi1/0/28 1G-Copper -- -- -- -- Down -- --
|
||||||
|
gi1/0/29 1G-Copper -- -- -- -- Down -- --
|
||||||
|
gi1/0/30 1G-Copper -- -- -- -- Down -- --
|
||||||
|
gi1/0/31 1G-Copper -- -- -- -- Down -- --
|
||||||
|
gi1/0/32 1G-Copper -- -- -- -- Down -- --
|
||||||
|
gi1/0/33 1G-Copper -- -- -- -- Down -- --
|
||||||
|
gi1/0/34 1G-Copper -- -- -- -- Down -- --
|
||||||
|
gi1/0/35 1G-Copper Full 1000 Enabled Off Up Disabled Off
|
||||||
|
gi1/0/36 1G-Copper Full 100 Enabled Off Up Disabled Off
|
||||||
|
gi1/0/37 1G-Copper Full 1000 Enabled Off Up Disabled Off
|
||||||
|
gi1/0/38 1G-Copper -- -- -- -- Down -- --
|
||||||
|
gi1/0/39 1G-Copper Full 100 Enabled Off Up Disabled On
|
||||||
|
gi1/0/40 1G-Copper -- -- -- -- Down -- --
|
||||||
|
gi1/0/41 1G-Copper -- -- -- -- Down -- --
|
||||||
|
gi1/0/42 1G-Copper -- -- -- -- Down -- --
|
||||||
|
gi1/0/43 1G-Copper -- -- -- -- Down -- --
|
||||||
|
gi1/0/44 1G-Copper -- -- -- -- Down -- --
|
||||||
|
gi1/0/45 1G-Copper Full 1000 Enabled Off Up Disabled Off
|
||||||
|
gi1/0/46 1G-Copper Full 100 Enabled Off Up Disabled Off
|
||||||
|
gi1/0/47 1G-Copper -- -- -- -- Down -- --
|
||||||
|
gi1/0/48 1G-Copper -- -- -- -- Down -- --
|
||||||
|
te1/0/1 10G-Combo-F Full 1000 Disabled Off Up Disabled Off
|
||||||
|
te1/0/2 10G-Combo-C -- -- -- -- Down -- --
|
||||||
|
te1/0/3 10G-Fiber Full 1000 Disabled Off Up Disabled Off
|
||||||
|
te1/0/4 10G-Fiber Full 10000 Disabled Off Up Disabled Off
|
||||||
|
|
||||||
|
Flow Link
|
||||||
|
Ch Type Duplex Speed Neg control State
|
||||||
|
-------- ------- ------ ----- -------- ------- -----------
|
||||||
|
Po1 -- -- -- -- -- Not Present
|
||||||
|
Po2 -- -- -- -- -- Not Present
|
||||||
|
Po3 -- -- -- -- -- Not Present
|
||||||
|
Po4 -- -- -- -- -- Not Present
|
||||||
|
Po5 -- -- -- -- -- Not Present
|
||||||
|
Po6 -- -- -- -- -- Not Present
|
||||||
|
Po7 -- -- -- -- -- Not Present
|
||||||
|
Po8 -- -- -- -- -- Not Present
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
NAME: "TengigabitEthernet1/0/1" DESCR: "SFP-1000Base-LX"
|
||||||
|
PID: GLC-LH-SMD VID: V01 SN: IAB8888888
|
||||||
|
|
||||||
|
|
||||||
|
NAME: "1" DESCR: "SG350X-48P 48-Port Gigabit PoE Stackable Managed Switch"
|
||||||
|
PID: SG350X-48P-K9 VID: V04 SN: AAA00000BBB
|
||||||
|
|
||||||
|
|
||||||
|
NAME: "TengigabitEthernet1/0/3" DESCR: "SFP-1000Base-SX"
|
||||||
|
PID: SFP-1000-SX VID: Information Unavailable SN: A888666
|
||||||
|
|
||||||
|
|
||||||
|
NAME: "TengigabitEthernet1/0/4" DESCR: "SFP-10Gbase-CX1"
|
||||||
|
PID: SFP-H10G-CU1M VID: Information Unavailable SN: AB0B000B0AB000B
|
||||||
|
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
System Description: SG350X-48P 48-Port Gigabit PoE Stackable Managed Switch
|
||||||
|
System Up Time (days,hour:min:sec): 14,06:29:28
|
||||||
|
System Contact:
|
||||||
|
System Name: switch1
|
||||||
|
System Location: SW location
|
||||||
|
System MAC Address: 04:eb:40:e3:91:7f
|
||||||
|
System Object ID: 1.3.6.1.4.1.9.6.1.94.48.5
|
||||||
|
|
||||||
|
Unit Type
|
||||||
|
---- ----------------------
|
||||||
|
1 SG350X-48P
|
||||||
|
|
||||||
|
|
||||||
|
Unit Fans Status
|
||||||
|
---- -------------------------------------
|
||||||
|
1 FANs OK
|
||||||
|
|
||||||
|
Unit Temperature (Celsius) Status
|
||||||
|
---- --------------------- ----------
|
||||||
|
1 30 OK
|
||||||
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
Active-image: flash://system/images/image_tesla_hybrid_2.4.5.71_release_cisco_signed.bin
|
||||||
|
Version: 2.4.5.71
|
||||||
|
MD5 Digest: 2dff89efdb2a0ec2f9a2c414ff7d401c
|
||||||
|
Date: 04-Nov-2018
|
||||||
|
Time: 19:46:16
|
||||||
|
Inactive-image: flash://system/images/image1.bin
|
||||||
|
Version: 2.4.0.94
|
||||||
|
MD5 Digest: 6f5be217100f34929986f2e93dd2d5e9
|
||||||
|
Date: 31-May-2018
|
||||||
|
Time: 02:39:58
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
"Po7",
|
"Po7",
|
||||||
"Po8"
|
"Po8"
|
||||||
],
|
],
|
||||||
"model" : "SG350X-48P 48-Port Gigabit PoE Stackable Managed Switch",
|
"model" : "SG350X-48P-K9",
|
||||||
"os_version" : "2.4.5.71",
|
"os_version" : "2.4.5.71",
|
||||||
"serial_number" : "AAA00000BBB",
|
"serial_number" : "AAA00000BBB",
|
||||||
"uptime" : 1232968,
|
"uptime" : 1232968,
|
||||||
|
|||||||
Reference in new issue
Block a user