def reinit_data(self): """ Subclass update interface information """ self.if_name_map, \ self.if_alias_map, \ self.if_id_map, \ 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, \ self.mgmt_alias_map = mibs.init_mgmt_interface_tables(self.db_conn[0]) # merge dataplane and mgmt ports self.oid_name_map.update(self.mgmt_oid_name_map) self.if_alias_map.update(self.mgmt_alias_map) self.if_range = [] # get local port kvs from APP_BD's PORT_TABLE self.loc_port_data = {} for if_oid, if_name in self.oid_name_map.items(): self.update_interface_data(if_name) self.if_range.append((if_oid, )) self.if_range.sort() if not self.loc_port_data: logger.warning( "0 - b'PORT_TABLE' is empty. No local port information could be retrieved." )
def update_rif_counters(self): rif_sai_ids = list(self.rif_port_map) + list(self.vlan_name_map) self.rif_counters = \ {sai_id: Namespace.dbs_get_all(self.db_conn, mibs.COUNTERS_DB, mibs.counter_table(mibs.split_sai_id_key(sai_id)[1]), blocking=False) for sai_id in rif_sai_ids}
def _update_entity_cache(self, fan_name): fan_info = Namespace.dbs_get_all(self.mib_updater.statedb, mibs.STATE_DB, mibs.fan_info_table(fan_name)) if not fan_info: return model, presence, serial, speed, replaceable = get_db_data( fan_info, FanInfoDB) if presence.lower() != 'true': self._remove_entity_cache(fan_name) return fan_relation_info = self.get_physical_relation_info(fan_name) fan_position, fan_parent_name = get_db_data(fan_relation_info, PhysicalRelationInfoDB) fan_position = int(fan_position) if fan_parent_name in self.mib_updater.physical_name_to_oid_map: self._update_fan_mib_info(fan_parent_name, fan_position, fan_name, serial, model, speed, replaceable) else: args = [ fan_parent_name, fan_position, fan_name, serial, model, speed, replaceable ] self.mib_updater.add_pending_entity_name_callback( fan_parent_name, self._update_fan_mib_info, args)
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) if self.loc_chassis_data: self.loc_chassis_data[ 'lldp_loc_sys_cap_supported'] = parse_sys_capability( self.loc_chassis_data['lldp_loc_sys_cap_supported']) self.loc_chassis_data[ 'lldp_loc_sys_cap_enabled'] = parse_sys_capability( self.loc_chassis_data['lldp_loc_sys_cap_enabled'])
def _update_entity_cache(self, interface): """ Update data for single transceiver :param: interface: Interface name associated with transceiver """ # get interface from interface name ifindex = port_util.get_index_from_str(interface) if ifindex is None: # interface name invalid, skip this entry mibs.logger.warning("Invalid interface name in {} \ in STATE_DB, skipping".format(interface)) return # get transceiver information from transceiver info entry in STATE DB transceiver_info = Namespace.dbs_get_all( self.mib_updater.statedb, mibs.STATE_DB, mibs.transceiver_info_table(interface)) if not transceiver_info: return # update xcvr info from DB # use port's name as key for transceiver info entries sub_id = get_transceiver_sub_id(ifindex) # add interface to available OID list self.mib_updater.add_sub_id(sub_id) self._add_entity_related_oid(interface, sub_id) # physical class - network port self.mib_updater.set_phy_class(sub_id, PhysicalClass.PORT) # save values into cache sfp_type, hw_version, serial_number, mfg_name, model_name, replaceable = get_db_data( transceiver_info, XcvrInfoDB) self.mib_updater.set_phy_hw_ver(sub_id, hw_version) self.mib_updater.set_phy_serial_num(sub_id, serial_number) self.mib_updater.set_phy_mfg_name(sub_id, mfg_name) self.mib_updater.set_phy_model_name(sub_id, model_name) self.mib_updater.set_phy_contained_in(sub_id, CHASSIS_SUB_ID) self.mib_updater.set_phy_fru(sub_id, replaceable) # Relative position of SFP can be changed at run time. For example, plug out a normal cable SFP3 and plug in # a 1 split 4 SFP, the relative position of SFPs after SPF3 will change. In this case, it is hard to determine # the relative position for other SFP. According to RFC 2737, 'If the agent cannot determine the parent-relative position # for some reason, or if the associated value of entPhysicalContainedIn is '0', then the value '-1' is returned'. # See https://tools.ietf.org/html/rfc2737. self.mib_updater.set_phy_parent_relative_pos(sub_id, -1) ifalias = self.if_alias_map.get(interface, "") # generate a description for this transceiver self.mib_updater.set_phy_descr( sub_id, get_transceiver_description(sfp_type, ifalias)) self.mib_updater.set_phy_name(sub_id, interface) # update transceiver sensor cache self._update_transceiver_sensor_cache(interface, sub_id)
def _update_transceiver_sensor_cache(self, interface): """ Update sensor data for single transceiver :param: interface: Interface name associated with transceiver """ ifalias = self.if_alias_map.get(interface, "") ifindex = port_util.get_index_from_str(interface) # get transceiver sensors from transceiver dom entry in STATE DB transceiver_dom_entry = Namespace.dbs_get_all( self.statedb, mibs.STATE_DB, mibs.transceiver_dom_table(interface)) if not transceiver_dom_entry: return # go over transceiver sensors for sensor in transceiver_dom_entry: if sensor not in SENSOR_NAME_MAP: continue sensor_sub_id = mibs.get_transceiver_sensor_sub_id(ifindex, sensor) sensor_description = get_transceiver_sensor_description( sensor, ifalias) self.physical_classes_map[sensor_sub_id] = PhysicalClass.SENSOR self.physical_description_map[sensor_sub_id] = sensor_description # add to available OIDs list insort_right(self.physical_entities, sensor_sub_id)
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.vlan_oid_name_map: if_table = mibs.vlan_entry_table(self.vlan_oid_name_map[oid]) elif oid in self.oid_name_map: if_table = mibs.if_entry_table(self.oid_name_map[oid]) else: return None return Namespace.dbs_get_all(self.db_conn, db, if_table, blocking=True)
def update_data(self): """ Subclass update data routine. Updates available LLDP counters. """ # establish connection to application database. self.if_range = [] self.lldp_counters = {} for if_oid, if_name in self.oid_name_map.items(): lldp_kvs = Namespace.dbs_get_all(self.db_conn, mibs.APPL_DB, mibs.lldp_entry_table(if_name)) if not lldp_kvs: continue try: # OID index for this MIB consists of remote time mark, if_oid, remote_index. # For multi-asic platform, it can happen that same interface index result # is seen in SNMP walk, with a different remote time mark. # To avoid repeating the data of same interface index with different remote # time mark, remote time mark is made as 0 in the OID indexing. time_mark = 0 remote_index = int(lldp_kvs['lldp_rem_index']) self.if_range.append((time_mark, if_oid, remote_index)) lldp_kvs['lldp_rem_sys_cap_supported'] = parse_sys_capability( lldp_kvs['lldp_rem_sys_cap_supported']) lldp_kvs['lldp_rem_sys_cap_enabled'] = parse_sys_capability( lldp_kvs['lldp_rem_sys_cap_enabled']) self.lldp_counters.update({if_name: lldp_kvs}) except (KeyError, AttributeError) as e: logger.warning( "Exception when updating lldpRemTable: {}".format(e)) continue self.if_range.sort()
def update_data(self): """ Update sensors cache. """ self.sub_ids = [] if not self.transceiver_dom: return # update transceiver sensors cache for transceiver_dom_entry in self.transceiver_dom: # extract interface name interface = transceiver_dom_entry.split( mibs.TABLE_NAME_SEPARATOR_VBAR)[-1] ifindex = port_util.get_index_from_str(interface) if ifindex is None: mibs.logger.warning("Invalid interface name in {} \ in STATE_DB, skipping".format(transceiver_dom_entry)) continue # get transceiver sensors from transceiver dom entry in STATE DB transceiver_dom_entry_data = Namespace.dbs_get_all( self.statedb, mibs.STATE_DB, transceiver_dom_entry) if not transceiver_dom_entry_data: continue for sensor_key in map(bytes.decode, transceiver_dom_entry_data): if sensor_key not in TRANSCEIVER_SENSOR_MAP: continue raw_sensor_value = transceiver_dom_entry_data.get( sensor_key.encode()).decode() sensor = get_transceiver_sensor(sensor_key) sub_id = mibs.get_transceiver_sensor_sub_id( ifindex, sensor_key) try: mib_values = sensor.mib_values(raw_sensor_value) except (ValueError, ArithmeticError): mibs.logger.error( "Exception occured when converting" "value for sensor {} interface {}".format( sensor, interface)) # skip continue else: self.ent_phy_sensor_type_map[sub_id], \ self.ent_phy_sensor_scale_map[sub_id], \ self.ent_phy_sensor_precision_map[sub_id], \ self.ent_phy_sensor_value_map[sub_id], \ self.ent_phy_sensor_oper_state_map[sub_id] = mib_values self.sub_ids.append(sub_id) self.sub_ids.sort()
def update_data(self): """ Update redis (caches config) Pulls the table references for each interface. """ self.if_counters = \ {sai_id: Namespace.dbs_get_all(self.db_conn, mibs.COUNTERS_DB, mibs.counter_table(sai_id), blocking=True) for sai_id in self.if_id_map} self.lag_name_if_name_map, \ self.if_name_lag_name_map, \ self.oid_lag_name_map = Namespace.init_namespace_sync_d_lag_tables(self.db_conn) self.if_range = sorted(list(self.oid_sai_map.keys()) + list(self.oid_lag_name_map.keys()) + list(self.mgmt_oid_name_map.keys())) self.if_range = [(i,) for i in self.if_range]
def __init__(self): super().__init__() self.db_conn = Namespace.init_namespace_dbs() self.arp_dest_map = {} self.arp_dest_list = [] self.arp_dest_map = {} self.arp_dest_list = [] self.neigh_key_list = {}
def __init__(self): super().__init__() self.tos = 0 # ipCidrRouteTos self.db_conn = Namespace.init_namespace_dbs() self.route_dest_map = {} self.route_dest_list = [] ## loopback ip string -> ip address object self.loips = {}
def test_init_sync_d_lag_tables(self): db_conn = Namespace.init_namespace_dbs() lag_name_if_name_map, \ if_name_lag_name_map, \ oid_lag_name_map, \ lag_sai_map = Namespace.get_sync_d_from_all_namespace(mibs.init_sync_d_lag_tables, db_conn) self.assertTrue("PortChannel04" in lag_name_if_name_map) self.assertTrue( lag_name_if_name_map["PortChannel04"] == ["Ethernet124"]) self.assertTrue("Ethernet124" in if_name_lag_name_map) self.assertTrue(if_name_lag_name_map["Ethernet124"] == "PortChannel04") self.assertTrue("PortChannel_Temp" in lag_name_if_name_map) self.assertTrue(lag_name_if_name_map["PortChannel_Temp"] == []) self.assertTrue(lag_sai_map["PortChannel01"] == "2000000000006")
def __init__(self): super().__init__() self.db_conn = Namespace.init_namespace_dbs() self.if_name_map = {} self.if_alias_map = {} self.if_id_map = {} self.oid_name_map = {} self.lag_name_if_name_map = {} self.if_name_lag_name_map = {} self.oid_lag_name_map = {} # cache of interface counters self.if_counters = {} self.if_range = [] self.namespace_db_map = Namespace.get_namespace_db_map(self.db_conn)
def reinit_data(self): """ Re-initialize all data. """ # reinit cache 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 = {} # update interface maps _, self.if_alias_map, _, _ = \ Namespace.get_sync_d_from_all_namespace(mibs.init_sync_d_interface_tables, Namespace.init_namespace_dbs()) device_metadata = mibs.get_device_metadata(self.statedb[0]) chassis_sub_id = (self.CHASSIS_ID, ) self.physical_entities = [chassis_sub_id] if not device_metadata or not device_metadata.get( b"chassis_serial_number"): chassis_serial_number = "" else: chassis_serial_number = device_metadata[b"chassis_serial_number"] self.physical_classes_map[chassis_sub_id] = PhysicalClass.CHASSIS self.physical_serial_number_map[chassis_sub_id] = chassis_serial_number # retrieve the initial list of transceivers that are present in the system transceiver_info = Namespace.dbs_keys(self.statedb, mibs.STATE_DB, self.TRANSCEIVER_KEY_PATTERN) if transceiver_info: self.transceiver_entries = [entry.decode() \ for entry in transceiver_info] else: self.transceiver_entries = [] # update cache with initial data for transceiver_entry in self.transceiver_entries: # extract interface name interface = transceiver_entry.split( mibs.TABLE_NAME_SEPARATOR_VBAR)[-1] self._update_transceiver_cache(interface)
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 test_init_sync_d_lag_tables(self): db_conn = Namespace.init_namespace_dbs() lag_name_if_name_map, \ if_name_lag_name_map, \ oid_lag_name_map, \ lag_sai_map = Namespace.init_namespace_sync_d_lag_tables(db_conn) self.assertTrue(b"PortChannel04" in lag_name_if_name_map) self.assertTrue( lag_name_if_name_map[b"PortChannel04"] == [b"Ethernet124"]) self.assertTrue(b"Ethernet124" in if_name_lag_name_map) self.assertTrue( if_name_lag_name_map[b"Ethernet124"] == b"PortChannel04") self.assertTrue(b"PortChannel_Temp" in lag_name_if_name_map) self.assertTrue(lag_name_if_name_map[b"PortChannel_Temp"] == []) self.assertTrue(lag_sai_map[b"PortChannel01"] == b"2000000000006")
def test_init_namespace_sync_d_lag_tables(self): dbs = Namespace.init_namespace_dbs() lag_name_if_name_map, \ if_name_lag_name_map, \ oid_lag_name_map, \ lag_sai_map = Namespace.init_namespace_sync_d_lag_tables(dbs) #PortChannel in asic0 Namespace self.assertTrue(b"PortChannel01" in lag_name_if_name_map) self.assertTrue(b"Ethernet-BP0" in lag_name_if_name_map[b"PortChannel01"]) self.assertTrue(b"Ethernet-BP4" in lag_name_if_name_map[b"PortChannel01"]) #PortChannel in asic2 Namespace self.assertTrue(b"PortChannel03" in lag_name_if_name_map) self.assertTrue(b"Ethernet-BP16" in lag_name_if_name_map[b"PortChannel03"]) self.assertTrue(b"Ethernet-BP20" in lag_name_if_name_map[b"PortChannel03"]) self.assertTrue(b"PortChannel_Temp" in lag_name_if_name_map) self.assertTrue(lag_name_if_name_map[b"PortChannel_Temp"] == [])
def update_data(self): """ Update redis (caches config) Pulls the table references for each interface. """ self.vlanmac_ifindex_map = {} self.vlanmac_ifindex_list = [] fdb_strings = Namespace.dbs_keys( self.db_conn, mibs.ASIC_DB, "ASIC_STATE:SAI_OBJECT_TYPE_FDB_ENTRY:*") if not fdb_strings: return for s in fdb_strings: fdb_str = s try: fdb = json.loads(fdb_str.split(":", maxsplit=2)[-1]) except ValueError as e: # includes simplejson.decoder.JSONDecodeError mibs.logger.error( "SyncD 'ASIC_DB' includes invalid FDB_ENTRY '{}': {}.". format(fdb_str, e)) continue ent = Namespace.dbs_get_all(self.db_conn, mibs.ASIC_DB, s, blocking=True) # Example output: oid:0x3a000000000608 bridge_port_id = ent["SAI_FDB_ENTRY_ATTR_BRIDGE_PORT_ID"][6:] if bridge_port_id not in self.if_bpid_map: continue port_id = self.if_bpid_map[bridge_port_id] vlanmac = self.fdb_vlanmac(fdb) if not vlanmac: mibs.logger.error( "SyncD 'ASIC_DB' includes invalid FDB_ENTRY '{}': failed in fdb_vlanmac()." .format(fdb_str)) continue self.vlanmac_ifindex_map[vlanmac] = mibs.get_index_from_str( self.if_id_map[port_id]) self.vlanmac_ifindex_list.append(vlanmac) self.vlanmac_ifindex_list.sort()
def update_data(self): """ Update redis (caches config) Pulls the table references for each interface. """ self.route_dest_map = {} self.route_dest_list = [] ## The nexthop for loopbacks should be all zero for loip in self.loips: sub_id = ip2byte_tuple(loip) + (255, 255, 255, 255) + (self.tos, ) + (0, 0, 0, 0) self.route_dest_list.append(sub_id) self.route_dest_map[sub_id] = self.loips[loip].packed # Get list of front end asic namespaces for multi-asic platform. # This list will be empty for single asic platform. front_ns = multi_asic.get_all_namespaces()['front_ns'] ipnstr = "0.0.0.0/0" ipn = ipaddress.ip_network(ipnstr) route_str = "ROUTE_TABLE:0.0.0.0/0" for db_conn in Namespace.get_non_host_dbs(self.db_conn): # For multi-asic platform, proceed to get routes only for # front end namespaces. # For single-asic platform, front_ns will be empty list. if front_ns and db_conn.namespace not in front_ns: continue port_table = multi_asic.get_port_table_for_asic(db_conn.namespace) ent = db_conn.get_all(mibs.APPL_DB, route_str, blocking=False) if ent is None: continue nexthops = ent["nexthop"] ifnames = ent["ifname"] for nh, ifn in zip(nexthops.split(','), ifnames.split(',')): ## Ignore non front panel interfaces ## TODO: non front panel interfaces should not be in APPL_DB at very beginning ## This is to workaround the bug in current sonic-swss implementation if ifn == "eth0" or ifn == "lo" or ifn == "docker0": continue # Ignore internal asic routes if multi_asic.is_port_channel_internal(ifn, db_conn.namespace): continue if (ifn in port_table and multi_asic.PORT_ROLE in port_table[ifn] and port_table[ifn][multi_asic.PORT_ROLE] == multi_asic.INTERNAL_PORT): continue sub_id = ip2byte_tuple(ipn.network_address) + ip2byte_tuple( ipn.netmask) + (self.tos, ) + ip2byte_tuple(nh) self.route_dest_list.append(sub_id) self.route_dest_map[sub_id] = ipn.network_address.packed self.route_dest_list.sort()
def reinit_data(self): """ Subclass update interface information """ self.if_name_map, \ self.if_alias_map, \ self.if_id_map, \ self.oid_name_map = Namespace.get_sync_d_from_all_namespace(mibs.init_sync_d_interface_tables, self.db_conn) self.update_data()
def reinit_data(self): """ Subclass update interface information """ self.if_name_map, \ self.if_alias_map, \ self.if_id_map, \ self.oid_name_map = Namespace.get_sync_d_from_all_namespace(mibs.init_sync_d_interface_tables, self.db_conn) for sai_id_key in self.if_id_map: namespace, sai_id = mibs.split_sai_id_key(sai_id_key) if_idx = mibs.get_index_from_str(self.if_id_map[sai_id_key]) self.port_index_namespace[if_idx] = namespace self.port_queues_map, self.queue_stat_map, self.port_queue_list_map = \ Namespace.get_sync_d_from_all_namespace(mibs.init_sync_d_queue_tables, self.db_conn) for db_conn in Namespace.get_non_host_dbs(self.db_conn): self.queue_type_map[db_conn.namespace] = db_conn.get_all(mibs.COUNTERS_DB, "COUNTERS_QUEUE_TYPE_MAP", blocking=False)
def reinit_data(self): """ Subclass update interface information """ self.if_name_map, \ self.if_alias_map, \ self.if_id_map, \ self.oid_sai_map, \ self.oid_name_map = Namespace.init_namespace_sync_d_interface_tables(self.db_conn) self.port_queues_map, self.queue_stat_map, self.port_queue_list_map = \ Namespace.init_namespace_sync_d_queue_tables(self.db_conn) self.queue_type_map = Namespace.dbs_get_all(self.db_conn, mibs.COUNTERS_DB, "COUNTERS_QUEUE_TYPE_MAP", blocking=False) self.update_data()
def fdb_vlanmac(self, fdb): if 'vlan' in fdb: vlan_id = fdb["vlan"] elif 'bvid' in fdb: if fdb["bvid"] in self.bvid_vlan_map: vlan_id = self.bvid_vlan_map[fdb["bvid"]] else: vlan_id = Namespace.dbs_get_vlan_id_from_bvid(self.db_conn, fdb["bvid"]) self.bvid_vlan_map[fdb["bvid"]] = vlan_id return (int(vlan_id),) + mac_decimals(fdb["mac"])
def update_data(self): """ Update redis (caches config) Pulls the table references for each interface. """ self.route_dest_map = {} self.route_dest_list = [] ## The nexthop for loopbacks should be all zero for loip in self.loips: sub_id = ip2tuple_v4(loip) + (255, 255, 255, 255) + (self.tos, ) + (0, 0, 0, 0) self.route_dest_list.append(sub_id) self.route_dest_map[sub_id] = self.loips[loip].packed route_entries = Namespace.dbs_keys(self.db_conn, mibs.APPL_DB, "ROUTE_TABLE:*") if not route_entries: return for route_entry in route_entries: routestr = route_entry.decode() ipnstr = routestr[len("ROUTE_TABLE:"):] if ipnstr == "0.0.0.0/0": ipn = ipaddress.ip_network(ipnstr) ent = Namespace.dbs_get_all(self.db_conn, mibs.APPL_DB, routestr, blocking=True) nexthops = ent[b"nexthop"].decode() ifnames = ent[b"ifname"].decode() for nh, ifn in zip(nexthops.split(','), ifnames.split(',')): ## Ignore non front panel interfaces ## TODO: non front panel interfaces should not be in APPL_DB at very beginning ## This is to workaround the bug in current sonic-swss implementation if ifn == "eth0" or ifn == "lo" or ifn == "docker0": continue sub_id = ip2tuple_v4(ipn.network_address) + ip2tuple_v4( ipn.netmask) + (self.tos, ) + ip2tuple_v4(nh) self.route_dest_list.append(sub_id) self.route_dest_map[sub_id] = ipn.network_address.packed self.route_dest_list.sort()
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 reinit_data(self): """ Subclass update interface information """ self.if_name_map, \ self.if_alias_map, \ self.if_id_map, \ self.oid_sai_map, \ self.oid_name_map = Namespace.init_namespace_sync_d_interface_tables(self.db_conn) self.update_data()
def reinit_data(self): """ Subclass update interface information """ ( self.if_name_map, self.if_alias_map, self.if_id_map, self.oid_name_map, ) = Namespace.get_sync_d_from_all_namespace( mibs.init_sync_d_interface_tables, self.db_conn) self.lag_name_if_name_map, \ self.if_name_lag_name_map, \ self.oid_lag_name_map, \ _, self.sai_lag_map = Namespace.get_sync_d_from_all_namespace(mibs.init_sync_d_lag_tables, self.db_conn) self.if_bpid_map = Namespace.dbs_get_bridge_port_map( self.db_conn, mibs.ASIC_DB) self.bvid_vlan_map.clear()
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() self.if_name_map = {} self.if_alias_map = {} self.if_id_map = {} self.oid_name_map = {} self.vlanmac_ifindex_map = {} self.vlanmac_ifindex_list = [] self.if_bpid_map = {} self.bvid_vlan_map = {}