Skip to content

[multi-ASIC] counterpoll flowcnt-route namespace-aware capability check#4604

Open
DavidZagury wants to merge 3 commits into
sonic-net:masterfrom
DavidZagury:master_multi_asic_counterpoll_flowcnt_route_fix
Open

[multi-ASIC] counterpoll flowcnt-route namespace-aware capability check#4604
DavidZagury wants to merge 3 commits into
sonic-net:masterfrom
DavidZagury:master_multi_asic_counterpoll_flowcnt_route_fix

Conversation

@DavidZagury

Copy link
Copy Markdown
Contributor

Pass the namespace to exit_if_route_flow_counter_not_support() so the STATE_DB capability check queries the correct per-namespace instance instead of the hardcoded 127.0.0.1 address.

What I did

Added multi-ASIC support for counterpoll flowcnt-route by making the route flow counter capability check namespace-aware.

How I did it

The flowcnt_route group in counterpoll/main.py already accepted a -n/--namespace option and connected to the correct per-namespace ConfigDB, but the capability check (exit_if_route_flow_counter_not_support) was still querying STATE_DB at the hardcoded address 127.0.0.1, ignoring the selected namespace.

Two changes were made:

  • flow_counter_util/route.py: Added an optional namespace parameter to get_route_flow_counter_capability() and exit_if_route_flow_counter_not_support(). When a namespace is provided, the STATE_DB connection uses the unix socket path with the namespace (consistent with connect_to_db in counterpoll). Falls back to host="127.0.0.1" for single-ASIC, preserving backward compatibility for all existing callers.
  • counterpoll/main.py: Pass namespace to exit_if_route_flow_counter_not_support(namespace) in the flowcnt_route group callback.

How to verify it

Should check capability against the correct namespace STATE_DB
counterpoll flowcnt-route -n asic0 enable
counterpoll flowcnt-route -n asic1 enable

Single-ASIC / no namespace — backward-compatible behavior unchanged
counterpoll flowcnt-route enable
counterpoll flowcnt-route disable
counterpoll flowcnt-route interval 5000

Confirm that on a namespace where route flow counters are not supported, the command correctly exits with "Route flow counter is not supported on this platform" rather than silently succeeding or querying the wrong STATE_DB instance.

Previous command output (if the output of a command-line utility has changed)

New command output (if the output of a command-line utility has changed)

Pass the namespace to exit_if_route_flow_counter_not_support() so the
STATE_DB capability check queries the correct per-namespace instance
instead of the hardcoded 127.0.0.1 address.

Signed-off-by: david.zagury <davidza@nvidia.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@linux-foundation-easycla

linux-foundation-easycla Bot commented Jun 11, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

@azure-pipelines

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

…r branches

Pin the two SonicV2Connector paths in get_route_flow_counter_capability:
namespace=None/'' uses host='127.0.0.1', namespace='asic0' uses
unix socket with SonicDBConfig initialization.

Signed-off-by: david.zagury <davidza@nvidia.com>
@DavidZagury DavidZagury force-pushed the master_multi_asic_counterpoll_flowcnt_route_fix branch from 0d48105 to 3fe7c37 Compare June 11, 2026 12:07
@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: david.zagury <davidza@nvidia.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

@saksarav-nokia

Copy link
Copy Markdown
Contributor

I already created PR #4586 . Why do we need another PR?

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