Added support for Cisco stacks in ios_facts.py (#33714)

This commit is contained in:
kalimsshar 2017-12-20 18:33:47 +01:00 committed by Nathaniel Case
parent 2e76c89910
commit 4086cb4b25

View file

@ -194,9 +194,13 @@ class Default(FactsBase):
return match.group(1) return match.group(1)
def parse_model(self, data): def parse_model(self, data):
match = re.search(r'^Cisco (.+) \(revision', data, re.M) match = re.findall(r'^Model number\s+: (\S+)', data, re.M)
if match: if match:
return match.group(1) return match
else:
match = re.search(r'^[Cc]isco (\S+).+bytes of memory', data, re.M)
if match:
return [match.group(1)]
def parse_image(self, data): def parse_image(self, data):
match = re.search(r'image file is "(.+)"', data) match = re.search(r'image file is "(.+)"', data)
@ -204,9 +208,13 @@ class Default(FactsBase):
return match.group(1) return match.group(1)
def parse_serialnum(self, data): def parse_serialnum(self, data):
match = re.search(r'board ID (\S+)', data) match = re.findall(r'^System serial number\s+: (\S+)', data, re.M)
if match: if match:
return match.group(1) return match
else:
match = re.search(r'board ID (\S+)', data)
if match:
return [match.group(1)]
class Hardware(FactsBase): class Hardware(FactsBase):