Skip to content

Add multi-asic namespace support for crm show resources command#4290

Open
william8545 wants to merge 1 commit intosonic-net:masterfrom
william8545:multi-asic-crm-show-resources
Open

Add multi-asic namespace support for crm show resources command#4290
william8545 wants to merge 1 commit intosonic-net:masterfrom
william8545:multi-asic-crm-show-resources

Conversation

@william8545
Copy link

What I did

Added the --namespace (-n) option to the crm show resources command. This allows users to query CRM resource usage and availability for a specific ASIC in a multi-ASIC environment.

How I did it

  • Added the @multi_asic_util.multi_asic_click_option_namespace decorator to the resources command group in crm/main.py.
  • Assigned the parsed namespace argument to the CRM context (ctx.obj["crm"].multi_asic.namespace_option).
  • Since the underlying data fetching methods (like show_resources) already utilize the @multi_asic_util.run_on_multi_asic decorator, simply setting the namespace_option allows the existing multi-ASIC framework to seamlessly handle database connections for the targeted ASIC.
  • Added unit tests in tests/crm_test.py to ensure the -n option works correctly.

How to verify it

Verify by running the crm show resources command with the -n option on a multi-ASIC device, and observing that only the specified ASIC's information is returned:

  • crm show resources -n asic0 all
  • crm show resources -n asic0 fdb
  • crm show resources -n asic0 ipv4 route
  • crm show resources -n asic0 acl group

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)

Signed-off-by: William Tsai <willtsai@nvidia.com>
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@william8545 william8545 marked this pull request as ready for review February 20, 2026 00:38
@william8545
Copy link
Author

/azpw run

@mssonicbld
Copy link
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

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