From aecfeb02b7e06d5d24d978565fd09b08cd0a62b9 Mon Sep 17 00:00:00 2001 From: davidza Date: Thu, 28 Dec 2023 16:05:09 +0200 Subject: [PATCH] Add support for multi-asic --- src/sonic_ax_impl/mibs/__init__.py | 1 - .../mibs/vendor/cisco/ciscoSwitchQosMIB.py | 11 +++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/sonic_ax_impl/mibs/__init__.py b/src/sonic_ax_impl/mibs/__init__.py index e849bfbc6..35e093ac3 100644 --- a/src/sonic_ax_impl/mibs/__init__.py +++ b/src/sonic_ax_impl/mibs/__init__.py @@ -451,7 +451,6 @@ def init_sync_d_queue_tables(db_conn): port_index = get_index_from_str(port_name) key = queue_key(port_index, queue_index) port_queues_map[key] = sai_id - queue_stat_name = queue_table(sai_id) queue_stat = db_conn.get_all(COUNTERS_DB, queue_stat_name, blocking=False) if queue_stat is not None: diff --git a/src/sonic_ax_impl/mibs/vendor/cisco/ciscoSwitchQosMIB.py b/src/sonic_ax_impl/mibs/vendor/cisco/ciscoSwitchQosMIB.py index a3d50379f..31df647d0 100644 --- a/src/sonic_ax_impl/mibs/vendor/cisco/ciscoSwitchQosMIB.py +++ b/src/sonic_ax_impl/mibs/vendor/cisco/ciscoSwitchQosMIB.py @@ -46,6 +46,9 @@ def __init__(self): """ super().__init__() self.db_conn = Namespace.init_namespace_dbs() + # establish connection to state database. + Namespace.connect_all_dbs(self.db_conn, mibs.STATE_DB) + self.lag_name_if_name_map = {} self.if_name_lag_name_map = {} self.oid_lag_name_map = {} @@ -67,10 +70,6 @@ def __init__(self): self.port_index_namespace = {} self.namespace_db_map = Namespace.get_namespace_db_map(self.db_conn) - self.statedb = mibs.init_db() - self.statedb.connect(self.statedb.STATE_DB) - - def reinit_connection(self): Namespace.connect_namespace_dbs(self.db_conn) @@ -137,8 +136,8 @@ def update_stats(self): # The first half of queue id is for ucast, and second half is for mcast # To simulate vendor OID, we wrap queues by max priority groups - port_max_queues = self.statedb.get_all(self.statedb.STATE_DB, - mibs.buffer_max_parm_table(self.oid_name_map[if_index]))['max_queues'] + port_max_queues = Namespace.dbs_get_all(self.db_conn, mibs.STATE_DB, + mibs.buffer_max_parm_table(self.oid_name_map[if_index]))['max_queues'] pq_count = math.ceil(int(port_max_queues) / 2) for queue in if_queues: