Skip to content

Commit

Permalink
debug vs test failure
Browse files Browse the repository at this point in the history
Signed-off-by: saksarav <[email protected]>
  • Loading branch information
saksarav-nokia committed Jun 10, 2024
1 parent 9b6d684 commit 4e8b93b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
11 changes: 5 additions & 6 deletions orchagent/fabricportsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -1513,11 +1517,6 @@ void FabricPortsOrch::doTask(swss::SelectableTimer &timer)
updateFabricCapacity();
updateFabricRate();
}
if (((gMySwitchType == "voq") || (gMySwitchType == "fabric")) && (!m_isSwitchStatsGenerated))
{
createSwitchDropCounters();
m_isSwitchStatsGenerated = true;
}
}
}

Expand Down
31 changes: 17 additions & 14 deletions tests/test_virtual_chassis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1139,35 +1139,38 @@ 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()
keys = flex_db.get_keys("FLEX_COUNTER_TABLE:SWITCH_DEBUG_COUNTER")
assert len(keys), "No Voq Switch drop counter in FLEX_COUNTER_DB"
keys = flex_db.get_keys("FLEX_COUNTER_TABLE")
assert len(keys), "No FLEX_COUNTER_TABLE 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"
if "SWITCH_DEBUG_COUNTER" in key:
drop_entry = flex_db.get_entry("FLEX_COUNTER_TABLE", key)
value = drop_entry.get("SWITCH_DEBUG_COUNTER_ID_LIST")
print("drop_entry:",drop_entry)
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()
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:
stat_name_entry = cntr_db.get_entry("COUNTERS_DEBUG_NAME_SWITCH_STAT_MAP", key)
value = stat_name_entry.get("SWITCH_STD_DROP_COUNTER-SAI_SWITCH_STAT_PACKET_INTEGRITY_DROP")
assert value == "SAI_SWITCH_STAT_PACKET_INTEGRITY_DROP", "Got error in getting Voq Switch Drop counter name map from COUNTERS_DB"
stat_name_entry = cntr_db.get_entry("COUNTERS_DEBUG_NAME_SWITCH_STAT_MAP", "")
print("stat_name_entry:",stat_name_entry)
value = stat_name_entry.get("SWITCH_STD_DROP_COUNTER-SAI_SWITCH_STAT_PACKET_INTEGRITY_DROP")
print("name value:",value)
assert value == "SAI_SWITCH_STAT_PACKET_INTEGRITY_DROP", "Got error in getting Voq Switch Drop counter name map from COUNTERS_DB"

asic_db = dvs.get_asic_db()
keys = asic_db.get_keys("ASIC_STATE:SAI_OBJECT_TYPE_SWITCH")
switch_oid_key = keys[0]
keys = cntr_db.get_keys("COUNTERS")
print("swtch_oid_key", switch_oid_key)
stat_entry = cntr_db.get_entry("COUNTERS", switch_oid_key)
print("stat_entry:",stat_entry)
value = stat_entry.get("SAI_SWITCH_STAT_PACKET_INTEGRITY_DROP")
assert value == "0", "SAI_SWITCH_STAT_PACKET_INTEGRITY_DROP is non zero in COUNTERS_DB"
print("cntr_value:",value)
assert value == "1", "SAI_SWITCH_STAT_PACKET_INTEGRITY_DROP is non zero in COUNTERS_DB"

# Add Dummy always-pass test at end as workaroud
# for issue when Flaky fail on final test it invokes module tear-down before retrying
Expand Down

0 comments on commit 4e8b93b

Please sign in to comment.