diff --git a/cfgmgr/buffermgrdyn.cpp b/cfgmgr/buffermgrdyn.cpp index fb00a8a7799e..b5b045a4feb9 100644 --- a/cfgmgr/buffermgrdyn.cpp +++ b/cfgmgr/buffermgrdyn.cpp @@ -1376,15 +1376,15 @@ task_process_status BufferMgrDynamic::handleBufferPoolTable(KeyOpFieldsValuesTup { bufferPool.dynamic_size = false; } - if (field == buffer_pool_xoff_field_name) + else if (field == buffer_pool_xoff_field_name) { newSHPSize = value; } - if (field == buffer_pool_mode_field_name) + else if (field == buffer_pool_mode_field_name) { bufferPool.mode = value; } - if (field == buffer_pool_type_field_name) + else if (field == buffer_pool_type_field_name) { bufferPool.ingress = (value == buffer_value_ingress); } @@ -1503,32 +1503,32 @@ task_process_status BufferMgrDynamic::handleBufferProfileTable(KeyOpFieldsValues return task_process_status::task_failed; } } - if (field == buffer_xon_field_name) + else if (field == buffer_xon_field_name) { profileApp.xon = value; } - if (field == buffer_xoff_field_name) + else if (field == buffer_xoff_field_name) { profileApp.xoff = value; profileApp.lossless = true; } - if (field == buffer_xon_offset_field_name) + else if (field == buffer_xon_offset_field_name) { profileApp.xon_offset = value; } - if (field == buffer_size_field_name) + else if (field == buffer_size_field_name) { profileApp.size = value; } - if (field == buffer_dynamic_th_field_name) + else if (field == buffer_dynamic_th_field_name) { profileApp.threshold = value; } - if (field == buffer_static_th_field_name) + else if (field == buffer_static_th_field_name) { profileApp.threshold = value; } - if (field == buffer_headroom_type_field_name) + else if (field == buffer_headroom_type_field_name) { profileApp.dynamic_calculated = (value == "dynamic"); if (profileApp.dynamic_calculated) @@ -1692,6 +1692,13 @@ task_process_status BufferMgrDynamic::handleOneBufferPgEntry(const string &key, bufferPg.static_configured = true; bufferPg.configured_profile_name = profileName; } + + if (field != buffer_profile_field_name) + { + SWSS_LOG_ERROR("BUFFER_PG: Invalid field %s", field.c_str()); + return task_process_status::task_invalid_entry; + } + fvVector.emplace_back(field, value); SWSS_LOG_INFO("Inserting BUFFER_PG table field %s value %s", field.c_str(), value.c_str()); } diff --git a/tests/test_buffer_dynamic.py b/tests/test_buffer_dynamic.py index 932247de37d5..599c02e10718 100644 --- a/tests/test_buffer_dynamic.py +++ b/tests/test_buffer_dynamic.py @@ -328,7 +328,7 @@ def test_headroomOverride(self, dvs, testlog): self.app_db.wait_for_deleted_entry("BUFFER_PG_TABLE", "Ethernet0:6") # readd lossless PG with dynamic profile - self.config_db.update_entry('BUFFER_PG', 'Ethernet0|3-4', {'profie': 'NULL'}) + self.config_db.update_entry('BUFFER_PG', 'Ethernet0|3-4', {'profile': 'NULL'}) self.app_db.wait_for_field_match("BUFFER_PG_TABLE", "Ethernet0:3-4", {"profile": "[BUFFER_PROFILE_TABLE:" + expectedProfile + "]"}) # remove the headroom override profile