@@ -273,6 +273,50 @@ def test_buffer_profile_config_update_validator(self, scope, asic, field, value,
273273 ):
274274 assert fov .buffer_profile_config_update_validator (scope , patch_element ) is True
275275
276+ def test_buffer_profile_config_update_validator_object_level_remove (self ):
277+ """Test that object-level remove operations are allowed (fixes rollback issue)"""
278+ patch_element = {
279+ "path" : "/BUFFER_PROFILE/pg_lossless_40000_5m_profile" ,
280+ "op" : "remove"
281+ }
282+
283+ # Object-level remove should be allowed without ASIC/version validation
284+ assert fov .buffer_profile_config_update_validator ("localhost" , patch_element ) is True
285+
286+ def test_buffer_profile_config_update_validator_object_level_add (self ):
287+ """Test that object-level add operations are allowed"""
288+ patch_element = {
289+ "path" : "/BUFFER_PROFILE/new_profile" ,
290+ "op" : "add" ,
291+ "value" : {"size" : "1024" , "pool" : "ingress_lossless_pool" }
292+ }
293+
294+ # Object-level add should be allowed
295+ assert fov .buffer_profile_config_update_validator ("localhost" , patch_element ) is True
296+
297+ def test_buffer_profile_config_update_validator_object_level_unsupported_op (self ):
298+ """Test that unsupported operations on object-level are denied"""
299+ patch_element = {
300+ "path" : "/BUFFER_PROFILE/my_profile" ,
301+ "op" : "move" , # Unsupported operation
302+ "from" : "/BUFFER_PROFILE/old_profile"
303+ }
304+
305+ assert fov .buffer_profile_config_update_validator ("localhost" , patch_element ) is False
306+
307+ def test_buffer_profile_config_update_validator_field_level_uses_existing_validation (self ):
308+ """Test that field-level operations use existing validation logic"""
309+ patch_element = {
310+ "path" : "/BUFFER_PROFILE/my_profile/dynamic_th" ,
311+ "op" : "replace" ,
312+ "value" : "2"
313+ }
314+
315+ # Mock the existing validation to return True
316+ with patch ("generic_config_updater.field_operation_validators.rdma_config_update_validator_common" ,
317+ return_value = True ):
318+ assert fov .buffer_profile_config_update_validator ("localhost" , patch_element ) is True
319+
276320 @patch ("sonic_py_common.device_info.get_sonic_version_info" ,
277321 mock .Mock (return_value = {"build_version" : "SONiC.20220530" }))
278322 @patch ("generic_config_updater.field_operation_validators.get_asic_name" ,
0 commit comments