From 060100725bd90f9dba7778e0e798acce74be106f Mon Sep 17 00:00:00 2001 From: Hua Liu <58683130+liuh-80@users.noreply.github.com> Date: Tue, 5 Nov 2024 03:41:53 +0800 Subject: [PATCH] Add VRF parameter to orchagent and GNMI start script. (#20345) Add VRF parameter to orchagent and GNMI start script. Why I did it Orchagent failed bind to ZMQ when mgmt VRF enabled: #19638 How I did it Add VRF parameter to orchagent and GNMI start script when mgmt-vrf feature enabled. How to verify it Pass all UT. --- dockers/docker-orchagent/orchagent.sh | 6 ++++++ dockers/docker-sonic-gnmi/gnmi-native.sh | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/dockers/docker-orchagent/orchagent.sh b/dockers/docker-orchagent/orchagent.sh index 705e1ea0db5d..256def591807 100755 --- a/dockers/docker-orchagent/orchagent.sh +++ b/dockers/docker-orchagent/orchagent.sh @@ -97,4 +97,10 @@ if [[ x"${LOCALHOST_SUBTYPE}" == x"SmartSwitch" ]]; then fi fi +# Add VRF parameter when mgmt-vrf enabled +MGMT_VRF_ENABLED=`sonic-db-cli CONFIG_DB hget "MGMT_VRF_CONFIG|vrf_global" "mgmtVrfEnabled"` +if [[ x"${MGMT_VRF_ENABLED}" == x"true" ]]; then + ORCHAGENT_ARGS+=" -v mgmt" +fi + exec /usr/bin/orchagent ${ORCHAGENT_ARGS} diff --git a/dockers/docker-sonic-gnmi/gnmi-native.sh b/dockers/docker-sonic-gnmi/gnmi-native.sh index e9f15810a226..b9241dca1d6a 100755 --- a/dockers/docker-sonic-gnmi/gnmi-native.sh +++ b/dockers/docker-sonic-gnmi/gnmi-native.sh @@ -78,6 +78,12 @@ if [[ x"${LOCALHOST_SUBTYPE}" == x"SmartSwitch" ]]; then TELEMETRY_ARGS+=" -zmq_port=8100" fi +# Add VRF parameter when mgmt-vrf enabled +MGMT_VRF_ENABLED=`sonic-db-cli CONFIG_DB hget "MGMT_VRF_CONFIG|vrf_global" "mgmtVrfEnabled"` +if [[ x"${MGMT_VRF_ENABLED}" == x"true" ]]; then + TELEMETRY_ARGS+=" --vrf mgmt" +fi + # Server will handle threshold connections consecutively THRESHOLD_CONNECTIONS=$(echo $GNMI | jq -r '.threshold') if [[ $THRESHOLD_CONNECTIONS =~ ^[0-9]+$ ]]; then