def _get_if_entry(self, if_name): if_table = "" # Once PORT_TABLE will be moved to CONFIG DB # we will get entry from CONFIG_DB for all cases db = mibs.APPL_DB if if_name in self.if_name_map: if_table = mibs.if_entry_table(if_name) elif if_name in self.mgmt_oid_name_map.values(): if_table = mibs.mgmt_if_entry_table(if_name) db = mibs.CONFIG_DB else: return None return self.db_conn.get_all(db, if_table, blocking=True)
def _get_if_entry(self, sub_id): """ :param oid: The 1-based sub-identifier query. :return: the DB entry for the respective sub_id. """ oid = self.get_oid(sub_id) if not oid: return if_table = "" # Once PORT_TABLE will be moved to CONFIG DB # we will get entry from CONFIG_DB for all cases db = mibs.APPL_DB if oid in self.oid_lag_name_map: if_table = mibs.lag_entry_table(self.oid_lag_name_map[oid]) elif oid in self.mgmt_oid_name_map: if_table = mibs.mgmt_if_entry_table(self.mgmt_oid_name_map[oid]) db = mibs.CONFIG_DB elif oid in self.oid_name_map: if_table = mibs.if_entry_table(self.oid_name_map[oid]) else: return None return self.db_conn.get_all(db, if_table, blocking=True)