Skip to content

Commit 0b02be3

Browse files
committed
Handle the case where enable is "false"
Signed-off-by: Stephen Sun <[email protected]>
1 parent 238488f commit 0b02be3

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

orchagent/qosorch.cpp

+12-3
Original file line numberDiff line numberDiff line change
@@ -739,13 +739,22 @@ sai_object_id_t WredMapHandler::addQosItem(const vector<sai_attribute_t> &attrib
739739
switch (attrib.id)
740740
{
741741
case SAI_WRED_ATTR_GREEN_ENABLE:
742-
wred_enable_set |= GREEN_WRED_ENABLED;
742+
if (attrib.value.booldata)
743+
{
744+
wred_enable_set |= GREEN_WRED_ENABLED;
745+
}
743746
break;
744747
case SAI_WRED_ATTR_YELLOW_ENABLE:
745-
wred_enable_set |= YELLOW_WRED_ENABLED;
748+
if (attrib.value.booldata)
749+
{
750+
wred_enable_set |= YELLOW_WRED_ENABLED;
751+
}
746752
break;
747753
case SAI_WRED_ATTR_RED_ENABLE:
748-
wred_enable_set |= RED_WRED_ENABLED;
754+
if (attrib.value.booldata)
755+
{
756+
wred_enable_set |= RED_WRED_ENABLED;
757+
}
749758
break;
750759
case SAI_WRED_ATTR_GREEN_DROP_PROBABILITY:
751760
drop_prob_set |= GREEN_DROP_PROBABILITY_SET;

tests/mock_tests/qosorch_ut.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -1381,6 +1381,7 @@ namespace qosorch_test
13811381
// QoS orchagent should guarantee that the new min is configured first and then new max
13821382
vector<FieldValueTuple> greenProfile = {
13831383
{"wred_green_enable", "true"},
1384+
{"wred_yellow_enable", "false"},
13841385
};
13851386
qos_wred_max_drop_probability_t greenProbabilities = {
13861387
100, // green_max_drop_probability
@@ -1395,6 +1396,7 @@ namespace qosorch_test
13951396

13961397
vector<FieldValueTuple> yellowProfile = {
13971398
{"wred_yellow_enable", "true"},
1399+
{"wred_red_enable", "false"},
13981400
};
13991401
qos_wred_max_drop_probability_t yellowProbabilities = {
14001402
0, // green_max_drop_probability
@@ -1408,6 +1410,7 @@ namespace qosorch_test
14081410
updateMaxDropProbabilityAndCheck("yellow", yellowProfile, yellowProbabilities);
14091411

14101412
vector<FieldValueTuple> redProfile = {
1413+
{"wred_green_enable", "false"},
14111414
{"wred_red_enable", "true"},
14121415
};
14131416
qos_wred_max_drop_probability_t redProbabilities = {

0 commit comments

Comments
 (0)