From 38f5d02e5d699f145566f6770e68ab35de8abdb9 Mon Sep 17 00:00:00 2001 From: Andrey Vertiprahov Date: Thu, 18 Aug 2022 17:26:48 +0000 Subject: [PATCH] Merge branch 'noc-fix-generic' into 'master' Generic.get_interfaces. Add method check a subinterface See merge request noc/noc!6587 (cherry picked from commit 114c7e2efbbab6c49e6d020cfef8847d00dccd92) b7780ff5 Fix Generic. Add method check a subinterface --- sa/profiles/Ericsson/SEOS/get_interfaces.py | 5 ++++- sa/profiles/Generic/get_interfaces.py | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/sa/profiles/Ericsson/SEOS/get_interfaces.py b/sa/profiles/Ericsson/SEOS/get_interfaces.py index 766253feef..f988cfab8c 100644 --- a/sa/profiles/Ericsson/SEOS/get_interfaces.py +++ b/sa/profiles/Ericsson/SEOS/get_interfaces.py @@ -1,7 +1,7 @@ # --------------------------------------------------------------------- # Ericsson.SEOS.get_interfaces # --------------------------------------------------------------------- -# Copyright (C) 2007-2020 The NOC Project +# Copyright (C) 2007-2022 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -40,3 +40,6 @@ class Script(BaseScript): for oid, iftype in self.snmp.getnext(mib["IF-MIB::ifType"]) } return self.INTERFACE_TYPES.get(self._iftype_map[ifindex], "other") + + def is_subinterface(self, iface): + return False diff --git a/sa/profiles/Generic/get_interfaces.py b/sa/profiles/Generic/get_interfaces.py index 698551a433..f92014be36 100644 --- a/sa/profiles/Generic/get_interfaces.py +++ b/sa/profiles/Generic/get_interfaces.py @@ -1,7 +1,7 @@ # --------------------------------------------------------------------- # Generic.get_interfaces # --------------------------------------------------------------------- -# Copyright (C) 2007-2020 The NOC Project +# Copyright (C) 2007-2022 The NOC Project # See LICENSE for details # --------------------------------------------------------------------- @@ -187,6 +187,10 @@ class Script(BaseScript): """ return True + def is_subinterface(self, iface): + if "." in iface: + return True + def execute_snmp(self, **kwargs): ifaces = {} # For interfaces subifaces = {} # For subinterfaces like Fa 0/1.XXX @@ -202,7 +206,7 @@ class Script(BaseScript): iface["ifindex"], iface["interface"], iface.get("oper_status") ): continue - if "." in iface["interface"]: + if self.is_subinterface(iface["interface"]): subifaces[iface["ifindex"]] = { "name": iface["interface"], "snmp_ifindex": iface["ifindex"], -- GitLab