Skip to content

Commit f45d896

Browse files
authored
[smartswitch] Update get_gnmi_port() based on smartswitch config updates (sonic-net#4041)
* Update get_gnmi_port() based on config updates * Add a local define of DPU_NAME in gnmi_reboot_dpu()
1 parent ea33ef3 commit f45d896

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

scripts/reboot_smartswitch_helper

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ function get_dpu_ip()
4040
# Function to retrieve GNMI port from CONFIG_DB
4141
function get_gnmi_port()
4242
{
43-
local DPU_NAME=$1
44-
sonic-db-cli CONFIG_DB HGET "DPU_PORT|$DPU_NAME" "gnmi_port"
43+
local DPU_NAME=${1:-dpu0}
44+
for k in $(sonic-db-cli CONFIG_DB keys "DPU|*$DPU_NAME"); do
45+
sonic-db-cli CONFIG_DB hget "$k" 'gnmi_port'
46+
done
4547
}
4648

4749
# Function to get reboot status from DPU
@@ -138,6 +140,8 @@ function wait_for_dpu_reboot_status()
138140
# Function to send reboot command to DPU
139141
function gnmi_reboot_dpu()
140142
{
143+
local DPU_NAME=$1
144+
141145
# Retrieve DPU IP and GNMI port
142146
dpu_ip=$(get_dpu_ip "${DPU_NAME}")
143147
port=$(get_gnmi_port "${DPU_NAME}")

0 commit comments

Comments
 (0)