napalm-automation / napalm-ios

Apache License 2.0
31 stars 40 forks source link

get_facts returns the whole string from "show version" not just the software version #184

Closed bdlamprecht closed 6 years ago

bdlamprecht commented 7 years ago

Description of Issue/Question

When using the generic NAPALM function get_facts against an ios device, the whole string from the command "show version" is returned, not just the software version (like a junos device does).

Did you follow the steps from https://github.com/napalm-automation/napalm#faq

Setup

napalm-ios version

(Paste verbatim output from pip freeze | grep napalm-ios between quotes below)

$ pip freeze | grep napalm-ios
napalm-ios==0.7.0

IOS version

(Paste verbatim output from show version between quotes below)

#sh ver
Cisco IOS Software, s72033_rp Software (s72033_rp-ADVIPSERVICESK9-M), Version 15.1(2)SY9, RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2016 by Cisco Systems, Inc.
Compiled Thu 29-Sep-16 04:07 by prod_rel_team

ROM: System Bootstrap, Version 12.2(17r)SX5, RELEASE SOFTWARE (fc1)
BOOTLDR: Cisco IOS Software, s72033_rp Software (s72033_rp-ADVIPSERVICESK9-M), Version 15.1(2)SY9, RELEASE SOFTWARE (fc1)

 bld-vsc-a uptime is 20 weeks, 3 days, 6 hours, 43 minutes
Uptime for this control processor is 20 weeks, 3 days, 6 hours, 43 minutes
System returned to ROM by reload at 15:17:00 UTC Fri Mar 17 2017 (SP by reload)
System restarted at 15:20:16 UTC Fri Mar 17 2017
System image file is "sup-bootdisk:s72033-advipservicesk9-mz.151-2.SY9.bin"
Last reload reason: Reload Command

This product contains cryptographic features and is subject to United
States and local country laws governing import, export, transfer and
use. Delivery of Cisco cryptographic products does not imply
third-party authority to import, export, distribute or use encryption.
Importers, exporters, distributors and users are responsible for
compliance with U.S. and local country laws. By using this product you
agree to comply with applicable laws and regulations. If you are unable
to comply with U.S. and local laws, return this product immediately.

A summary of U.S. laws governing Cisco cryptographic products may be found at:
http://www.cisco.com/wwl/export/crypto/tool/stqrg.html

If you require further assistance please contact us by sending email to
export@cisco.com.

cisco WS-C6509-E (R7000) processor (revision 1.2) with 983008K/65536K bytes of memory.
Processor board ID SMG1027NQ4V
SR71000 CPU at 600Mhz, Implementation 0x504, Rev 1.2, 512KB L2 Cache
Last reset from s/w reset
27 Virtual Ethernet interfaces
51 Gigabit Ethernet interfaces
18 Ten Gigabit Ethernet interfaces
1917K bytes of non-volatile configuration memory.

65536K bytes of Flash internal SIMM (Sector size 512K).
Configuration register is 0x2102

Steps to Reproduce the Issue

When executing the get_facts function against the device above, the os_version variable that is returned contains the string s72033_rp Software (s72033_rp-ADVIPSERVICESK9-M), Version 15.1(2)SY9, RELEASE SOFTWARE (fc1)" and not just 15.1(2)SY9 (similar to the way a junos device returns something like 12.3R7.7).

Error Traceback

N/A

FYI, @ktbyers requested this bug to be opened.

ktbyers commented 7 years ago

Also for IOS-XE

Cisco IOS XE Software, Version 03.13.06a.S - Extended Support Release Cisco IOS Software, ASR1000 Software (X86_64_LINUX_IOSD-UNIVERSALK9_NOLI-M), Version 15.4(3)S6a, RELEASE SOFTWARE (fc2)


[4:51] 
it shows both the XE version `03.13.06a.S` and the wrapped IOS version `X86_64_LINUX_IOSD-UNIVERSALK9_NOLI-M), Version 15.4(3)S6a`

[4:51] 
the XE version is what you want to return i think

[4:51] 
that is on an asr1001
ktbyers commented 7 years ago

Also want to retain the:

advipservicesk9-m
dbarrosop commented 7 years ago

I think this is dangerous. I would suggest returning the filename: s72033-advipservicesk9-mz.151-2.SY9 without the extension. Cisco encodes a lot of information there and they are anything but consistent so the only way to play it safe is probably by removing the extension of the filename. Also, due to the lack of consistency it's easier to reason about this if we just say "the version on IOS is just the filename with the extension stripped".

mirceaulinic commented 6 years ago

Hi @bdlamprecht - we are currently in the process of reunification, please check https://napalm-automation.net/reunification/. For the time being, we have moved this issue to https://github.com/napalm-automation/napalm/issues/469 so we can discuss further. Going forward, we'd like to ask you to submit Pull Requests and Issues to the main repository: https://github.com/napalm-automation/napalm

Thanks for understanding!