Skip to content

Commit

Permalink
Fix smart switch check command in gnmi and orchagent start script. (s…
Browse files Browse the repository at this point in the history
…onic-net#18663)

Fix smart switch check command in gnmi and orchagent start script.

#### Why I did it
Smart switch check command in gnmi and orchagent start script check wrong Redis table.

#### How I did it
Change smart switch check command check "DEVICE_METADATA|localhost" table.

#### How to verify it
Pass all UT & E2E test
  • Loading branch information
liuh-80 authored Apr 18, 2024
1 parent 9deea7b commit f2c692c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
14 changes: 12 additions & 2 deletions dockers/docker-orchagent/orchagent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,19 @@ else
fi

# Enable ZMQ for SmartSwitch
LOCALHOST_SUBTYPE=`sonic-db-cli CONFIG_DB hget localhost "subtype"`
LOCALHOST_SUBTYPE=`sonic-db-cli CONFIG_DB hget "DEVICE_METADATA|localhost" "subtype"`
if [[ x"${LOCALHOST_SUBTYPE}" == x"SmartSwitch" ]]; then
ORCHAGENT_ARGS+=" -q tcp://127.0.0.1:8100"
midplane_mgmt_ip=$( ip -json -4 addr show eth0-midplane | jq -r ".[0].addr_info[0].local" )
mgmt_ip=$( ip -json -4 addr show eth0 | jq -r ".[0].addr_info[0].local" )
if [[ $midplane_ip != "" ]]; then
# Enable ZMQ with eth0-midplane address
ORCHAGENT_ARGS+=" -q tcp://${midplane_mgmt_ip}:8100"
elif [[ $mgmt_ip != "" ]]; then
# If eth0-midplane interface does not exist, enable ZMQ with eth0 address
ORCHAGENT_ARGS+=" -q tcp://${mgmt_ip}:8100"
else
ORCHAGENT_ARGS+=" -q tcp://127.0.0.1:8100"
fi
fi

exec /usr/bin/orchagent ${ORCHAGENT_ARGS}
4 changes: 2 additions & 2 deletions dockers/docker-sonic-gnmi/gnmi-native.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ else
fi

# Enable ZMQ for SmartSwitch
LOCALHOST_SUBTYPE=`sonic-db-cli CONFIG_DB hget localhost "subtype"`
LOCALHOST_SUBTYPE=`sonic-db-cli CONFIG_DB hget "DEVICE_METADATA|localhost" "subtype"`
if [[ x"${LOCALHOST_SUBTYPE}" == x"SmartSwitch" ]]; then
TELEMETRY_ARGS+=" -zmq_address=tcp://127.0.0.1:8100"
TELEMETRY_ARGS+=" -zmq_port=8100"
fi

# Server will handle threshold connections consecutively
Expand Down

0 comments on commit f2c692c

Please sign in to comment.