Skip to content

[hft] Add aggregator CLI support#4631

Open
Pterosaur wants to merge 4 commits into
sonic-net:masterfrom
Pterosaur:hft-harmonizer-cli
Open

[hft] Add aggregator CLI support#4631
Pterosaur wants to merge 4 commits into
sonic-net:masterfrom
Pterosaur:hft-harmonizer-cli

Conversation

@Pterosaur

@Pterosaur Pterosaur commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

What I did

Added HFT aggregator CLI support to config and show.

This PR adds:

  • config hft add aggregator <name> with optional --reporting_rate, --rollover_counters, and --heatmap_counters.
  • config hft del aggregator <name>.
  • Deletion protection so an aggregator cannot be removed while any HFT profile still references it.
  • config hft add profile <profile> --aggregator <name>.
  • config hft bind-aggregator <profile> <aggregator> and config hft unbind-aggregator <profile>.
  • show hft output for profile aggregator binding and aggregator details.
  • Unit tests for config payload generation, delete protection, and show row formatting.

Why I did it

This exposes the HFT aggregator CONFIG_DB schema added by the HFT HLD and sonic-buildimage YANG updates.

How I verified it

Ran Python compile checks:

python -m py_compile config/hft.py show/hft.py tests/config_hft_test.py tests/show_hft_test.py

Ran targeted HFT CLI checks covering:

  • config hft add aggregator payload generation.
  • config hft bind-aggregator and unbind-aggregator payload generation.
  • config hft del aggregator payload generation.
  • Rejecting config hft del aggregator when an HFT profile still references the aggregator.
  • show hft row formatting for bound and unbound aggregators.

Full pytest tests/config_hft_test.py tests/show_hft_test.py was not runnable in this Windows environment because the repository test conftest.py requires SONiC runtime packages (sonic_py_common, swsscommon, swsssdk) that are not installed locally.

Details if related

Related HLD PR: sonic-net/SONiC#2079.

Signed-off-by: Ze Gan <ganze718@gmail.com>
Copilot AI review requested due to automatic review settings June 21, 2026 12:43
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds CLI and display support for HFT “harmonizer” configuration, extending existing HFT profile/group management to include harmonizer creation, binding, and show hft rendering.

Changes:

  • Add config hft commands to add/delete harmonizers and bind/unbind them to profiles, including delete protection when referenced.
  • Extend show hft to display harmonizer binding and harmonizer attributes (reporting rate, rollover counters, heatmap counters), including unbound harmonizers.
  • Update unit tests to validate harmonizer payload generation and show row formatting.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
config/hft.py Adds harmonizer CRUD + bind/unbind CLI commands and payload builders, plus delete protection logic.
show/hft.py Reads harmonizer table from CONFIG_DB and expands displayed columns/rows to include harmonizer details.
tests/config_hft_test.py Adds/updates CLI unit tests for harmonizer payload generation and delete protection messaging.
tests/show_hft_test.py Updates row-format expectations and adds coverage for bound/unbound harmonizer display formatting.

Comment thread config/hft.py Outdated
Signed-off-by: Ze Gan <ganze718@gmail.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Ze Gan <ganze718@gmail.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: Ze Gan <ganze718@gmail.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@Pterosaur Pterosaur changed the title [hft] Add harmonizer CLI support [hft] Add aggregator CLI support Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants