From f3adcf481d3ae076ddf738d9dc3584287561ceed Mon Sep 17 00:00:00 2001 From: bktsim <144830673+bktsim-arista@users.noreply.github.com> Date: Thu, 14 Dec 2023 09:58:53 -0800 Subject: [PATCH] watermarkstat logic --- scripts/watermarkstat | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/watermarkstat b/scripts/watermarkstat index 0660f9f2e1b..f0780b0ecb9 100755 --- a/scripts/watermarkstat +++ b/scripts/watermarkstat @@ -89,18 +89,20 @@ class Watermarkstat(object): self.counters_db.append(counters_db) def get_queue_type(table_id): + queue_type = None for counters_db in self.counters_db: queue_type = counters_db.get(counters_db.COUNTERS_DB, COUNTERS_QUEUE_TYPE_MAP, table_id) - if queue_type is None: - print("Queue Type is not available in table '{}'".format(table_id), file=sys.stderr) - sys.exit(1) - elif queue_type and queue_type == SAI_QUEUE_TYPE_MULTICAST: + if queue_type and queue_type == SAI_QUEUE_TYPE_MULTICAST: return QUEUE_TYPE_MC elif queue_type and queue_type == SAI_QUEUE_TYPE_UNICAST: return QUEUE_TYPE_UC elif queue_type and queue_type == SAI_QUEUE_TYPE_ALL: return QUEUE_TYPE_ALL - print("Queue Type '{} in table '{}' is invalid".format(queue_type, table_id), file=sys.stderr) + + if queue_type is None: + print("Queue Type is not available in table '{}'".format(table_id), file=sys.stderr) + else: + print("Queue Type '{} in table '{}' is invalid".format(queue_type, table_id), file=sys.stderr) sys.exit(1) def get_queue_port(table_id):