def get_netbox_vlan_tags(self): if self.available_vlans is None: self.available_vlans = [ OID(oid)[-1] for oid, status in self._bulkwalk(self.VLAN_ROW_STATUS) if status == 1 ] return self.available_vlans
def _get_if_stats(self, stats): """Make a list with tuples. Each tuple contain interface-index and corresponding status-value""" available_stats = [] for (if_index, stat) in stats: if_index = OID(if_index)[-1] if isinstance(if_index, int): available_stats.append((if_index, stat)) return available_stats
def _get_all_interfaces_vlan(self): """Retrieves the untagged VLAN value for every interface. :returns: A dict describing {ifIndex: VLAN_TAG} """ return { OID(index)[-1]: value for index, value in self._bulkwalk(self.VlAN_OID) }
def _get_all_ifaliases(self): """Get all aliases for all interfaces. :returns: A dict describing {ifIndex: ifAlias} """ return { OID(oid)[-1]: safestring(value) for oid, value in self._bulkwalk(self.IF_ALIAS_OID) }
def _get_interface_names(self) -> Dict[int, str]: """Returns a mapping of interface indexes to ifName values""" return { OID(index)[-1]: safestring(value) for index, value in self._bulkwalk(self.IF_NAME_OID) }
def get_all_vlans(self): return { OID(index)[-1]: value for index, value in self._bulkwalk(self.VlAN_OID) }
def get_all_if_alias(self): return { OID(oid)[-1]: safestring(value) for oid, value in self._bulkwalk(self.IF_ALIAS_OID) }