Fix regression on HW discovery for Cisco Catalyst chassis (#10877)

* Catalyst fix for HW

* Try to avoid issue with stacks, chassis or standalone boxes

* formatCiscoHardware iosxe for humans

* codeclimate
This commit is contained in:
PipoCanaja
2019-11-24 02:17:00 +01:00
committed by Tony Murray
parent ef562f607e
commit 1ab645c75c
3 changed files with 17 additions and 7 deletions

View File

@@ -193,6 +193,18 @@ class Rewrite
}
}
if ($device['os'] == "iosxe") {
if ($device['hardware']) {
if (preg_match('/CAT9K/', $device['sysDescr'], $matches) && preg_match("/^C(9[A-Za-z0-9]+)/", $device['hardware'], $matches2)) {
if (!$short) {
$device['hardware'] = "Catalyst " . $matches2[1] . " (" . $device['hardware'] . ")";
} else {
$device['hardware'] = "Catalyst " . $matches2[1];
}
}
}
}
return $device['hardware'];
}