Skip to content

Commit

Permalink
BugFix: XR - show version - account for CRS output (networktocode#519)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcgill298 authored and thomasblass committed Oct 25, 2020
1 parent 823ec49 commit b232ec7
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 34 deletions.
41 changes: 25 additions & 16 deletions templates/cisco_xr_show_version.template
Original file line number Diff line number Diff line change
@@ -1,28 +1,37 @@
Value VERSION (\S+)
Value UPTIME (.+)
Value VERSION (\S[^\[]+)
Value UPTIME (.+?)
Value LOCATION (\S+)
Value HARDWARE (\S+)
Value HARDWARE (.+)
Value BUILD_HOST (\S+)

Start
^.+UTC
^Cisco.+Software.+Version.+
^Copyright\s\(c\).+
^Cisco.+Software.+Version\s+${VERSION}
^Build\s+Information: -> Build_Info
^[Cc]isco\s${HARDWARE}\s.+
^System\suptime\sis\s${UPTIME} -> Record
^\s+$$
^$$
^.* -> Error "Line not found"
^.+uptime\s+is\s+${UPTIME}\s*$$
^(?:\s*[Cc]isco\s+)?${HARDWARE}\s\(.*\) processor
^\S{3}\s+\S{3}\s+\d{1,2}\s+\d+:\d+:\d+
^Copyright
^ROM:
^[Ss]ystem\s+[Ii]mage
^\d+\s+processor
^\d+\s+.*(?:[Ee]th|[Gg]ig[Ee]|[Ss][Oo][Nn][Ee][Tt]|[Ww][Aa][Nn][Pp][Hh][Yy])
^\d+\w\s+bytes
^Boot\s+device
^Package\s+active
^hfr-doc -> CRS
^\s*$$
^. -> Error

# A VARIATION OF THE OUTPUT, EX. NCS PLATFORM
Build_Info
^\s+Built\sBy.+
^\s+Built\sOn.+
^\s+Buil[dt]\sHost\s+:\s+${BUILD_HOST}
^\s+Workspace\s+:\s\S+
^\s+Version\s+:\s${VERSION}
^\s+Version\s+:
^\s+Location\s+:\s${LOCATION}
^$$ -> Start
^\s+$$
^$$
^.* -> Error "Line not found"
^\s*$$ -> Start
^.* -> Error

CRS
^.
14 changes: 5 additions & 9 deletions tests/cisco_xr/show_version/cisco_xr_show_version.parsed
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
---

parsed_sample:


- hardware : 'NCS-5500'
uptime : '4 weeks, 6 days, 1 hour, 42 minutes'
version : '6.1.4'
location : '/opt/cisco/XR/packages/'
build_host : 'iox-lnx-032'

- version : '6.1.4'
uptime : '4 weeks, 6 days, 1 hour, 42 minutes'
location : '/opt/cisco/XR/packages/'
hardware : 'NCS-5500'
build_host : 'iox-lnx-032'
14 changes: 5 additions & 9 deletions tests/cisco_xr/show_version/cisco_xr_show_version2.parsed
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
---

parsed_sample:


- hardware : 'IOS-XRv'
uptime : '1 minute'
version : '6.5.1'
location : '/opt/cisco/XR/packages/'
build_host : 'iox-ucs-019'

- version : '6.5.1'
uptime : '1 minute'
location : '/opt/cisco/XR/packages/'
hardware : 'IOS-XRv 9000'
build_host : 'iox-ucs-019'
7 changes: 7 additions & 0 deletions tests/cisco_xr/show_version/cisco_xr_show_version_crs.parsed
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
parsed_sample:
- version : '4.1.0'
uptime : '1 week, 6 days, 4 hours, 22 minutes'
location : ''
hardware : 'CRS-8/S'
build_host : ''
37 changes: 37 additions & 0 deletions tests/cisco_xr/show_version/cisco_xr_show_version_crs.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Cisco IOS XR Software, Version 4.1.0[Default]
Copyright (c) 2010 by Cisco Systems, Inc.


ROM: System Bootstrap, Version 2.100(20100129:213223) [CRS-1 ROMMON],


router uptime is 1 week, 6 days, 4 hours, 22 minutes
System image file is "bootflash:disk0/hfr-os-mbi-4.1.0/mbihfr-rp.vm"


cisco CRS-8/S (7457) processor with 4194304K bytes of memory.
7457 processor at 1197Mhz, Revision 1.2


2 Management Ethernet
8 GigabitEthernet
12 SONET/SDH
12 Packet over SONET/SDH
1 WANPHY controller(s)
1 TenGigE
1019k bytes of non-volatile configuration memory.
38079M bytes of hard disk.
3607592k bytes of disk0: (Sector size 512 bytes).
3607592k bytes of disk1: (Sector size 512 bytes).


Boot device on node 0/1/SP is bootflash:
Package active on node 0/1/SP:
hfr-doc, V 4.1.0[Default], Cisco Systems, at disk0:hfr-doc-4.1.0
Built on Thu May 6 17:28:51 DST 2010
By sjc-lds-364 in /auto/ioxbuild6/production/4.1.0.DT_IMAGE/hfr/workspace for pie


iosxr-infra, V 4.1.0[Default], Cisco Systems, at disk0:iosxr-infra-4.1.0
Built on Thu May 6 15:09:12 DST 2010
By sjc-lds-364 in /auto/ioxbuild6/production/4.1.0.DT_IMAGE/hfr/workspace for pie

0 comments on commit b232ec7

Please sign in to comment.