Commit f289374
authored
[202405][GCU] Don't remove all entries in a table when just adding/modifying keys within an existing table
What I did
Fixed an issue in config apply-patch where adding a new entry to a table (e.g., INTERFACE) incorrectly removes all existing entries in that table before adding them back, causing unnecessary disruption.
Fixes: sonic-net/sonic-buildimage#24464 for 202405-msft
How I did it
Made two changes to generic_config_updater/patch_sorter.py:
KeyLevelMoveGenerator: Added check to prevent deleting entire table when it has a single key if that table will continue to exist in the target config. Now only deletes the whole table when table not in diff.target_config.
UpperLevelMoveExtender: Added logic to prevent key-level ADD/REPLACE operations from being extended to table-level operations when the table exists in both current and target configs. This keeps operations at the key level, avoiding unnecessary removal of unaffected entries.
How to verify it
Create a config with an INTERFACE table containing one entry (e.g., Ethernet0)
Apply a patch that adds a new entry (e.g., Ethernet10) to the INTERFACE table
Verify that only the new entry is added and the existing Ethernet0 entry is NOT removed during the operation
Check logs to confirm no REMOVE operations are generated for unaffected entries1 file changed
Lines changed: 14 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1075 | 1075 | | |
1076 | 1076 | | |
1077 | 1077 | | |
1078 | | - | |
| 1078 | + | |
| 1079 | + | |
1079 | 1080 | | |
1080 | 1081 | | |
1081 | 1082 | | |
| |||
1477 | 1478 | | |
1478 | 1479 | | |
1479 | 1480 | | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
1480 | 1493 | | |
1481 | 1494 | | |
1482 | 1495 | | |
| |||
0 commit comments