From 0b02be37fcb6d816296f1376e2388509fca28447 Mon Sep 17 00:00:00 2001 From: Stephen Sun Date: Wed, 24 Aug 2022 07:03:19 +0000 Subject: [PATCH] Handle the case where enable is "false" Signed-off-by: Stephen Sun --- orchagent/qosorch.cpp | 15 ++++++++++++--- tests/mock_tests/qosorch_ut.cpp | 3 +++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/orchagent/qosorch.cpp b/orchagent/qosorch.cpp index f7a65dd946..2f8378d284 100644 --- a/orchagent/qosorch.cpp +++ b/orchagent/qosorch.cpp @@ -739,13 +739,22 @@ sai_object_id_t WredMapHandler::addQosItem(const vector &attrib switch (attrib.id) { case SAI_WRED_ATTR_GREEN_ENABLE: - wred_enable_set |= GREEN_WRED_ENABLED; + if (attrib.value.booldata) + { + wred_enable_set |= GREEN_WRED_ENABLED; + } break; case SAI_WRED_ATTR_YELLOW_ENABLE: - wred_enable_set |= YELLOW_WRED_ENABLED; + if (attrib.value.booldata) + { + wred_enable_set |= YELLOW_WRED_ENABLED; + } break; case SAI_WRED_ATTR_RED_ENABLE: - wred_enable_set |= RED_WRED_ENABLED; + if (attrib.value.booldata) + { + wred_enable_set |= RED_WRED_ENABLED; + } break; case SAI_WRED_ATTR_GREEN_DROP_PROBABILITY: drop_prob_set |= GREEN_DROP_PROBABILITY_SET; diff --git a/tests/mock_tests/qosorch_ut.cpp b/tests/mock_tests/qosorch_ut.cpp index 338c686c3d..0e1290efa7 100644 --- a/tests/mock_tests/qosorch_ut.cpp +++ b/tests/mock_tests/qosorch_ut.cpp @@ -1381,6 +1381,7 @@ namespace qosorch_test // QoS orchagent should guarantee that the new min is configured first and then new max vector greenProfile = { {"wred_green_enable", "true"}, + {"wred_yellow_enable", "false"}, }; qos_wred_max_drop_probability_t greenProbabilities = { 100, // green_max_drop_probability @@ -1395,6 +1396,7 @@ namespace qosorch_test vector yellowProfile = { {"wred_yellow_enable", "true"}, + {"wred_red_enable", "false"}, }; qos_wred_max_drop_probability_t yellowProbabilities = { 0, // green_max_drop_probability @@ -1408,6 +1410,7 @@ namespace qosorch_test updateMaxDropProbabilityAndCheck("yellow", yellowProfile, yellowProbabilities); vector redProfile = { + {"wred_green_enable", "false"}, {"wred_red_enable", "true"}, }; qos_wred_max_drop_probability_t redProbabilities = {