Skip to content

[smartswitch] Update get_gnmi_port() based on smartswitch config updates#4041

Merged
judyjoseph merged 2 commits intosonic-net:masterfrom
vvolam:fix-dpu
Aug 23, 2025
Merged

[smartswitch] Update get_gnmi_port() based on smartswitch config updates#4041
judyjoseph merged 2 commits intosonic-net:masterfrom
vvolam:fix-dpu

Conversation

@vvolam
Copy link
Copy Markdown
Contributor

@vvolam vvolam commented Aug 21, 2025

What I did

This PR updates the get_gnmi_port() function in the smartswitch reboot helper script to align with recent YANG model changes for DPU configuration. The function now retrieves the GNMI port from the updated CONFIG_DB schema.

https://github.com/sonic-net/sonic-buildimage/blob/master/src/sonic-yang-models/doc/Configuration.md#dpu-configuration

How I did it

  • Modified database key pattern from DPU_PORT|$DPU_NAME to DPU|*$DPU_NAME
  • Added default parameter value for DPU_NAME
  • Updated query method to iterate through matching keys

How to verify it

Run the reboot command with latest configuration changes.

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)

@vvolam vvolam requested a review from Copilot August 21, 2025 23:14
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the get_gnmi_port() function in the smartswitch reboot helper script to align with recent YANG model changes for DPU configuration. The function now retrieves the GNMI port from the updated CONFIG_DB schema.

Key changes:

  • Modified database key pattern from DPU_PORT|$DPU_NAME to DPU|*$DPU_NAME
  • Added default parameter value for DPU_NAME
  • Updated query method to iterate through matching keys

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread scripts/reboot_smartswitch_helper
Comment thread scripts/reboot_smartswitch_helper
@prabhataravind
Copy link
Copy Markdown
Contributor

hi @vvolam This change looks fine but I had another question. In function gnmi_reboot_dpu, DPU_NAME is not explicitly declared inside it, so how is it having the right value? I would assume a local DPU_NAME which then gets the value from $1, is it not?

@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@vvolam
Copy link
Copy Markdown
Contributor Author

vvolam commented Aug 22, 2025

hi @vvolam This change looks fine but I had another question. In function gnmi_reboot_dpu, DPU_NAME is not explicitly declared inside it, so how is it having the right value? I would assume a local DPU_NAME which then gets the value from $1, is it not?

Good catch! Added a local variable for robustness, though it is working as expected.

@judyjoseph judyjoseph merged commit f45d896 into sonic-net:master Aug 23, 2025
7 checks passed
@@ -138,6 +140,8 @@ function wait_for_dpu_reboot_status()
# Function to send reboot command to DPU
function gnmi_reboot_dpu()
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.

gnmi_reboot_dpu

Suggest rewritten this script in python/Rust and add unit test.

@mssonicbld
Copy link
Copy Markdown
Collaborator

Cherry-pick PR to 202505: #4043

YairRaviv pushed a commit to YairRaviv/sonic-utilities that referenced this pull request Jan 12, 2026
…tes (sonic-net#4041)

* Update get_gnmi_port() based on config updates
* Add a local define of DPU_NAME in gnmi_reboot_dpu()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants