def __init__(self): super().__init__() self.statedb = Namespace.init_namespace_dbs() Namespace.connect_all_dbs(self.statedb, mibs.STATE_DB) # List of available sub OIDs. self.physical_entities = [] # Map sub ID to its data. self.physical_classes_map = {} self.physical_description_map = {} self.physical_name_map = {} self.physical_hw_version_map = {} self.physical_serial_number_map = {} self.physical_mfg_name_map = {} self.physical_model_name_map = {} self.physical_contained_in_map = {} self.physical_parent_relative_pos_map = {} self.physical_fru_map = {} # Map physical entity name and oid. According to RFC2737, entPhysicalContainedIn is indicates the value of # entPhysicalIndex for the physical entity which 'contains' this physical entity. However, there is # only parent entity name in database, so need a way to get physical entity oid by name. self.physical_name_to_oid_map = {} # Map physical entity name that need resolve. The key is the entity name, value is a list of Callback objects # that will be called when the entity name is added to self.physical_name_to_oid_map. # It's possible the parent name and parent oid are still not in self.physical_name_to_oid_map when child entity # update cache. In that case, the child entity might not be able to calculate its sub id and cannot update its # cache or do future operation. So this dictionary provides a way to store such operations for future executes. self.pending_resolve_parent_name_map = {} # physical entity updaters self.physical_entity_updaters = self.create_physical_entity_updaters()
def __init__(self): super().__init__() self.db_conn = Namespace.init_namespace_dbs() # establish connection to application database. Namespace.connect_all_dbs(self.db_conn, mibs.APPL_DB) self.if_range = [] self.oid_name_map = {} self.mgmt_oid_name_map = {} self.pubsub = [None] * len(self.db_conn)
def reinit_data(self): """ Subclass update data routine. """ # establish connection to application database. Namespace.connect_all_dbs(self.db_conn, mibs.APPL_DB) self.loc_chassis_data = Namespace.dbs_get_all(self.db_conn, mibs.APPL_DB, mibs.LOC_CHASSIS_TABLE) self.loc_chassis_data[ b'lldp_loc_sys_cap_supported'] = parse_sys_capability( self.loc_chassis_data[b'lldp_loc_sys_cap_supported']) self.loc_chassis_data[ b'lldp_loc_sys_cap_enabled'] = parse_sys_capability( self.loc_chassis_data[b'lldp_loc_sys_cap_enabled'])
def reinit_data(self): """ Subclass reinit data routine. """ _, _, _, self.oid_name_map = Namespace.get_sync_d_from_all_namespace( mibs.init_sync_d_interface_tables, self.db_conn) self.mgmt_oid_name_map, _ = mibs.init_mgmt_interface_tables( self.db_conn[0]) self.oid_name_map.update(self.mgmt_oid_name_map) # establish connection to application database. Namespace.connect_all_dbs(self.db_conn, mibs.APPL_DB) self.if_range = [] for if_oid, if_name in self.oid_name_map.items(): self.update_rem_if_mgmt(if_oid, if_name)
def __init__(self): super().__init__() self.statedb = Namespace.init_namespace_dbs() Namespace.connect_all_dbs(self.statedb, mibs.STATE_DB) self.if_alias_map = {} # List of available sub OIDs. self.physical_entities = [] # Map sub ID to its data. self.physical_classes_map = {} self.physical_description_map = {} self.physical_hw_version_map = {} self.physical_serial_number_map = {} self.physical_mfg_name_map = {} self.physical_model_name_map = {} self.pubsub = [None] * len(self.statedb)
def __init__(self): super().__init__() self.db_conn = Namespace.init_namespace_dbs() # establish connection to application database. Namespace.connect_all_dbs(self.db_conn, mibs.APPL_DB) self.if_name_map = {} self.if_alias_map = {} self.if_id_map = {} self.oid_name_map = {} self.mgmt_oid_name_map = {} self.mgmt_alias_map = {} self.if_range = [] # cache of port data # { if_name -> { 'key': 'value' } } self.loc_port_data = {} self.pubsub = [None] * len(self.db_conn)
def __init__(self): """ ctor """ super().__init__() self.statedb = Namespace.init_namespace_dbs() Namespace.connect_all_dbs(self.statedb, mibs.STATE_DB) # list of available sub OIDs self.sub_ids = [] # sensor MIB requiered values self.ent_phy_sensor_type_map = {} self.ent_phy_sensor_scale_map = {} self.ent_phy_sensor_precision_map = {} self.ent_phy_sensor_value_map = {} self.ent_phy_sensor_oper_state_map = {} self.transceiver_dom = []
def reinit_data(self): Namespace.connect_all_dbs(self.db_conn, mibs.APPL_DB) self.neigh_key_list = Namespace.dbs_keys_namespace( self.db_conn, mibs.APPL_DB, "NEIGH_TABLE:*")
def reinit_data(self): Namespace.connect_all_dbs(self.db_conn, mibs.STATE_DB) self.neigh_state_map = Namespace.dbs_keys_namespace( self.db_conn, mibs.STATE_DB, "NEIGH_STATE_TABLE|*")