sonic-buildimage/platform/vs/docker-sonic-vs/orchagent.sh

42 lines
1.2 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
[docker-sonic-vs]Added support for Mellanox-SN2700 based SKU for docker-sonic-vs (#9044) Added support for Mellanox-SN2700 based SKU for docker-sonic-vs and to differentiate platform based on hw-sku rather than on fake_platform in VS. Currently SAI VS library uses hwsku based SAI profile to differentiate and mock different platform implementations. The same functionality in swss is achieved using a fake_platform env variable. Using a fake_platform has some drawbacks that the vs container appears to still use a different vendor hw-sku env PLATFORM=x86_64-kvm_x86_64-r0 HOSTNAME=dd21a1637723 PWD=/ HOME=/root TERM=xterm HWSKU=Force10-S6000 SHLVL=1 fake_platform=mellanox PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin DEBIAN_FRONTEND=noninteractive _=/usr/bin/env In order to unify the approach at both swss and vs SAI and to be uniform throughout this PR introduces the approach of using hw-sku to differentiate different platforms. This requires support for Mellanox-SN2700 HWSKU for Mellanox platform which is also addressed by this PR. root@23c9ba83b0aa:/# show platform summary /bin/sh: 1: sudo: not found Platform: x86_64-kvm_x86_64-r0 HwSKU: Mellanox-SN2700 ASIC: vs ASIC Count: 1 Serial Number: N/A Model Number: N/A Hardware Revision: N/A root@23c9ba83b0aa:/# env PLATFORM=x86_64-kvm_x86_64-r0 HOSTNAME=23c9ba83b0aa PWD=/ HOME=/root TERM=xterm HWSKU=Mellanox-SN2700 SHLVL=1 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin DEBIAN_FRONTEND=noninteractive _=/usr/bin/env root@23c9ba83b0aa:/# Signed-off-by: Sudharsan Dhamal Gopalarathnam <sudharsand@nvidia.com>
2021-11-02 01:21:06 -05:00
#This is required since we have platform based checks in orchagent
#fakeplatform to be removed once swss migrates to hw-sku
if [ "$HWSKU" == "Mellanox-SN2700" ]; then
export platform="mellanox"
elif [ -n "$fake_platform" ]; then
export platform=$fake_platform
[docker-sonic-vs]Added support for Mellanox-SN2700 based SKU for docker-sonic-vs (#9044) Added support for Mellanox-SN2700 based SKU for docker-sonic-vs and to differentiate platform based on hw-sku rather than on fake_platform in VS. Currently SAI VS library uses hwsku based SAI profile to differentiate and mock different platform implementations. The same functionality in swss is achieved using a fake_platform env variable. Using a fake_platform has some drawbacks that the vs container appears to still use a different vendor hw-sku env PLATFORM=x86_64-kvm_x86_64-r0 HOSTNAME=dd21a1637723 PWD=/ HOME=/root TERM=xterm HWSKU=Force10-S6000 SHLVL=1 fake_platform=mellanox PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin DEBIAN_FRONTEND=noninteractive _=/usr/bin/env In order to unify the approach at both swss and vs SAI and to be uniform throughout this PR introduces the approach of using hw-sku to differentiate different platforms. This requires support for Mellanox-SN2700 HWSKU for Mellanox platform which is also addressed by this PR. root@23c9ba83b0aa:/# show platform summary /bin/sh: 1: sudo: not found Platform: x86_64-kvm_x86_64-r0 HwSKU: Mellanox-SN2700 ASIC: vs ASIC Count: 1 Serial Number: N/A Model Number: N/A Hardware Revision: N/A root@23c9ba83b0aa:/# env PLATFORM=x86_64-kvm_x86_64-r0 HOSTNAME=23c9ba83b0aa PWD=/ HOME=/root TERM=xterm HWSKU=Mellanox-SN2700 SHLVL=1 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin DEBIAN_FRONTEND=noninteractive _=/usr/bin/env root@23c9ba83b0aa:/# Signed-off-by: Sudharsan Dhamal Gopalarathnam <sudharsand@nvidia.com>
2021-11-02 01:21:06 -05:00
else
export platform=vs
fi
SWSS_VARS_FILE=/usr/share/sonic/templates/swss_vars.j2
# Retrieve SWSS vars from sonic-cfggen
SWSS_VARS=$(sonic-cfggen -d -y /etc/sonic/sonic_version.yml -t $SWSS_VARS_FILE) || exit 1
MAC_ADDRESS=$(echo $SWSS_VARS | jq -r '.mac')
if [ "$MAC_ADDRESS" == "None" ] || [ -z "$MAC_ADDRESS" ]; then
MAC_ADDRESS=$(ip link show eth0 | grep ether | awk '{print $2}')
logger "Mac address not found in Device Metadata, Falling back to eth0"
fi
# Create a folder for SwSS record files
mkdir -p /var/log/swss
ORCHAGENT_ARGS="-d /var/log/swss "
# Set orchagent pop batch size to 8192
ORCHAGENT_ARGS+="-b 8192 "
# Set synchronous mode if it is enabled in CONFIG_DB
SYNC_MODE=$(echo $SWSS_VARS | jq -r '.synchronous_mode')
if [ "$SYNC_MODE" == "enable" ]; then
ORCHAGENT_ARGS+="-s "
fi
# Set mac address
ORCHAGENT_ARGS+="-m $MAC_ADDRESS"
exec /usr/bin/orchagent ${ORCHAGENT_ARGS}