show version brief does not work on iosxr virtual (#39847)

* show version brief does not work on iosxr virtual (#37609)

* show version brief does not work on iosxr virtual

* ci failures fix

(cherry picked from commit 66b389a00d)

* changelog entry
pull/39852/head
Deepak Agrawal 7 years ago committed by GitHub
parent 079b7cb1fe
commit c23aa1c9ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- iosxr_* modules do not work with iosxr version >= 6.3.2 as cisco has deprecated 'show version brief'

@ -136,12 +136,12 @@ class FactsBase(object):
class Default(FactsBase): class Default(FactsBase):
def commands(self): def commands(self):
return(['show version brief']) return(['show version | utility head -n 20'])
def populate(self, results): def populate(self, results):
self.facts['version'] = self.parse_version(results['show version brief']) self.facts['version'] = self.parse_version(results['show version | utility head -n 20'])
self.facts['image'] = self.parse_image(results['show version brief']) self.facts['image'] = self.parse_image(results['show version | utility head -n 20'])
self.facts['hostname'] = self.parse_hostname(results['show version brief']) self.facts['hostname'] = self.parse_hostname(results['show version | utility head -n 20'])
def parse_version(self, data): def parse_version(self, data):
match = re.search(r'Version (\S+)$', data, re.M) match = re.search(r'Version (\S+)$', data, re.M)

@ -35,7 +35,7 @@ class Cliconf(CliconfBase):
device_info = {} device_info = {}
device_info['network_os'] = 'iosxr' device_info['network_os'] = 'iosxr'
reply = self.get(b'show version brief') reply = self.get(b'show version | utility head -n 20')
data = to_text(reply, errors='surrogate_or_strict').strip() data = to_text(reply, errors='surrogate_or_strict').strip()
match = re.search(r'Version (\S+)$', data, re.M) match = re.search(r'Version (\S+)$', data, re.M)

@ -0,0 +1,18 @@
Cisco IOS XR Software, Version 6.0.0[Default]
Copyright (c) 2015 by Cisco Systems, Inc.
ROM: GRUB, Version 1.99(0), DEV RELEASE
iosxr01 uptime is 11 weeks, 6 days, 2 hours, 2 minutes
System image file is "bootflash:disk0/xrvr-os-mbi-6.0.0/mbixrvr-rp.vm"
cisco IOS XRv Series (Pentium Celeron Stepping 3) processor with 3169911K bytes
of memory.
Pentium Celeron Stepping 3 processor at 3836MHz, Revision 2.174
IOS XRv Chassis
1 Management Ethernet
6 GigabitEthernet
97070k bytes of non-volatile configuration memory.
866M bytes of hard disk.
2321392k bytes of disk0: (Sector size 512 bytes).

@ -57,6 +57,7 @@ class TestIosxrFacts(TestIosxrModule):
command = item command = item
filename = str(command).replace(' ', '_') filename = str(command).replace(' ', '_')
filename = filename.replace('/', '7') filename = filename.replace('/', '7')
filename = filename.replace('|', '_')
output.append(load_fixture(filename)) output.append(load_fixture(filename))
return output return output

Loading…
Cancel
Save