diff --git a/orchagent/fabricportsorch.cpp b/orchagent/fabricportsorch.cpp index 0e475b3513..8252cdd53c 100644 --- a/orchagent/fabricportsorch.cpp +++ b/orchagent/fabricportsorch.cpp @@ -1480,7 +1480,11 @@ void FabricPortsOrch::doTask(swss::SelectableTimer &timer) { updateFabricPortState(); } - + if (((gMySwitchType == "voq") || (gMySwitchType == "fabric")) && (!m_isSwitchStatsGenerated)) + { + createSwitchDropCounters(); + m_isSwitchStatsGenerated = true; + } if (checkFabricPortMonState() && !m_debugTimerEnabled) { m_debugTimer->start(); @@ -1513,11 +1517,6 @@ void FabricPortsOrch::doTask(swss::SelectableTimer &timer) updateFabricCapacity(); updateFabricRate(); } - if (((gMySwitchType == "voq") || (gMySwitchType == "fabric")) && (!m_isSwitchStatsGenerated)) - { - createSwitchDropCounters(); - m_isSwitchStatsGenerated = true; - } } } diff --git a/tests/test_virtual_chassis.py b/tests/test_virtual_chassis.py index f18e4ff369..edeb8e97e4 100644 --- a/tests/test_virtual_chassis.py +++ b/tests/test_virtual_chassis.py @@ -1139,21 +1139,25 @@ def test_voq_drop_counters(self, vct): cfg_switch_type = metatbl.get("switch_type") - # Test only for line cards + # Test only for voq or fabric if cfg_switch_type == "voq" or cfg_switch_type == "fabric": print("VOQ drop counters test for {}".format(name)) # Verify that a counter has been created FLEX_COUNTER_DB and COUNTERS_DB. We will verify the state of # the counter in the next step. flex_db = dvs.get_flex_db() + dbg_flex_keys = flex_db.get_keys("*") + print("dbg_flex_keys{}".foarm(dbg_flex_keys)) keys = flex_db.get_keys("FLEX_COUNTER_TABLE:SWITCH_DEBUG_COUNTER") - assert len(keys), "No Voq Switch drop counter in FLEX_COUNTER_DB" - for key in keys: - drop_entry = flex_db.get_entry("FLEX_COUNTER_TABLE:SWITCH_DEBUG_COUNTER", key) - value = drop_entry.get("SWITCH_DEBUG_COUNTER_ID_LIST") - assert value == "SAI_SWITCH_STAT_PACKET_INTEGRITY_DROP", "Got error in getting Voq Switch Drop counter from FLEX_COUNTER_DB" + #assert len(keys), "No Voq Switch drop counter in FLEX_COUNTER_DB" + #for key in keys: + # drop_entry = flex_db.get_entry("FLEX_COUNTER_TABLE:SWITCH_DEBUG_COUNTER", key) + # value = drop_entry.get("SWITCH_DEBUG_COUNTER_ID_LIST") + # assert value == "SAI_SWITCH_STAT_PACKET_INTEGRITY_DROP", "Got error in getting Voq Switch Drop counter from FLEX_COUNTER_DB" cntr_db = dvs.get_counters_db() + dbg_cntr_keys = flex_db.get_keys("*") + print("dbg_cntr_keys{}".foarm(dbg_cntr_keys)) keys = cntr_db.get_keys("COUNTERS_DEBUG_NAME_SWITCH_STAT_MAP") assert len(keys), "No Voq Switch drop counter name map in COUNTERS_DB" for key in keys: