[hft] Target per-key path in JSON Patch ops to avoid wiping the table#4663
Open
DavidZagury wants to merge 1 commit into
Open
[hft] Target per-key path in JSON Patch ops to avoid wiping the table#4663DavidZagury wants to merge 1 commit into
DavidZagury wants to merge 1 commit into
Conversation
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
What I did
Change _build_profile_patch and _build_group_patch so they emit a
JSON Patch "add" at the row's per-key path
(/HIGH_FREQUENCY_TELEMETRY_PROFILE/<name> or
/HIGH_FREQUENCY_TELEMETRY_GROUP/<profile>|<group>) instead of an "add"
at the table-level path with a value dict containing only the new
row. Update the two CLI unit tests that asserted the old shape.
Why I did it
Per RFC 6902 section 4.1 an "add" at an existing object member
replaces that member's value, so today's
"add /HIGH_FREQUENCY_TELEMETRY_GROUP {<new>: {...}}"
overwrites the entire table value with just the new row, silently
deleting every other group already present. Concretely:
config hft add group P --group_type PORT ... # table = {P|PORT}
config hft add group P --group_type QUEUE ... # table = {P|QUEUE}, P|PORT gone
The orchagent observes PORT disappearing and tears down its TAM
resources via clearGroup. In MIXED tam_tel_type mode those resources
are shared with QUEUE, so the second add ends up recreating them.
Targeting the per-key path makes the patch a true insert
(or a row-level replace when re-adding the same row), matching what
_build_stream_state_patch and the _build_*_remove_patch helpers in
this file already do. No CLI surface or CONFIG_DB schema change.
Signed-off-by: david.zagury <davidza@nvidia.com>
DavidZagury
force-pushed
the
master_hft_mixed_mode
branch
from
July 2, 2026 22:50
0293626 to
24b5da1
Compare
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Yakiv-Huryk
approved these changes
Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What I did
Fix
config hft add profile/config hft add groupso the emittedJSON Patch no longer wipes pre-existing rows in
HIGH_FREQUENCY_TELEMETRY_PROFILE/HIGH_FREQUENCY_TELEMETRY_GROUP.How I did it
Changed _build_profile_patch and _build_group_patch in
config/hft.py to target the row's per-key path
(/HIGH_FREQUENCY_TELEMETRY_PROFILE/ or
/HIGH_FREQUENCY_TELEMETRY_GROUP/|) with the row's
attributes as the value, instead of the table-level path with a
single-entry value dict. This matches what _build_stream_state_patch
and the build*_remove_patch helpers in the same file already do.
Updated the two CLI unit tests in tests/config_hft_test.py that
asserted the old patch shape.
No CLI surface or CONFIG_DB schema change.
How to verify it
config hft add profile P --poll_interval 10000
config hft add group P --group_type PORT --object_names Ethernet0
config hft add group P --group_type QUEUE --object_names Ethernet0
sonic-cfggen -d -v 'HIGH_FREQUENCY_TELEMETRY_GROUP'
only P|QUEUE remained.
Previous command output (if the output of a command-line utility has changed)
N/A - no user-facing CLI output change.
New command output (if the output of a command-line utility has changed)
N/A - no user-facing CLI output change.