diff --git a/sa/profiles/Cisco/IOS/get_cdp_neighbors.py b/sa/profiles/Cisco/IOS/get_cdp_neighbors.py index d26281186e850af630c912abec7fffe276c00836..176c272a1331c3013b54948aa2024c67d67fe6b9 100644 --- a/sa/profiles/Cisco/IOS/get_cdp_neighbors.py +++ b/sa/profiles/Cisco/IOS/get_cdp_neighbors.py @@ -1,7 +1,7 @@ # --------------------------------------------------------------------- # Cisco.IOS.get_cdp_neighbors # --------------------------------------------------------------------- -# Copyright (C) 2007-2018 The NOC Project +# Copyright (C) 2007-2022 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -47,10 +47,15 @@ class Script(BaseScript): # check if "()" in device_id and platform starts with "N", then clear out if self.rx_serial_check.match(r_device_id) and res[ii]["8"].startswith("N"): r_device_id = self.rx_serial_check.match(r_device_id).group(1) + ifname = self.profile.convert_interface_name(ii[0]) + # Convert `Se 0/0/0:0` to `Se 0/0/0` + name, *sub = ifname.rsplit(":", 1) + if sub: + ifname = name neighbors += [ { "device_id": r_device_id, - "local_interface": self.profile.convert_interface_name(ii[0]), + "local_interface": ifname, "remote_interface": res[ii]["7"], "platform": res[ii]["8"], } diff --git a/sa/profiles/Cisco/IOS/get_inventory.py b/sa/profiles/Cisco/IOS/get_inventory.py index 1c6ad93e87dd992bb9d2900d1dbade8b800e48dd..a3673d066e9e02f01cda82c6ac57dd2522835fcd 100644 --- a/sa/profiles/Cisco/IOS/get_inventory.py +++ b/sa/profiles/Cisco/IOS/get_inventory.py @@ -1,7 +1,7 @@ # --------------------------------------------------------------------- # Cisco.IOS.get_inventory # --------------------------------------------------------------------- -# Copyright (C) 2007-2021 The NOC Project +# Copyright (C) 2007-2022 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -463,6 +463,10 @@ class Script(BaseScript): match = self.rx_psu1.search(name) if match: self.slot_id = int(match.group("number")) + else: + match = self.rx_psu2.search(name) + if match: + self.slot_id = int(match.group("number")) return "PSU", self.slot_id, pid elif "FRU Power Supply" in descr: match = self.rx_psu2.search(name) @@ -545,6 +549,8 @@ class Script(BaseScript): return None, None, None def get_transceiver_pid(self, descr): + if descr == "10/100/1000BaseTX SFP": + return "NoName | Transceiver | 1G | SFP T" match = self.rx_trans.search(descr.upper().replace("-", "")) if match: return "Unknown | Transceiver | %s" % match.group(1).upper() diff --git a/sa/profiles/Cisco/IOS/profile.py b/sa/profiles/Cisco/IOS/profile.py index 818e0abf042cfbf660d5248092fc7965368d926a..4878e99512c646361be76b8c6c7dc2d264c0ae60 100644 --- a/sa/profiles/Cisco/IOS/profile.py +++ b/sa/profiles/Cisco/IOS/profile.py @@ -1,7 +1,7 @@ # --------------------------------------------------------------------- # Cisco.IOS profile # --------------------------------------------------------------------- -# Copyright (C) 2007-2020 The NOC Project +# Copyright (C) 2007-2022 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -249,7 +249,10 @@ class Profile(BaseProfile): CDP neighbor interface send like: Fa0/1.1 """ n = self.convert_interface_name(name) - name, *sub = n.rsplit(".", 1) + name, *sub = n.rsplit(":", 1) # Convert `Se 0/0/0:0` to `Se 0/0/0` + if sub: + return [name] + name, *sub = n.rsplit(".", 1) # Convert `Gi 1/1.10` to `Gi 1/1` if sub: return [name] return []