2017-10-24 00:01:42 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
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
|
2019-03-06 18:27:41 -06:00
|
|
|
export platform=$fake_platform
|
2021-11-02 01:21:06 -05:00
|
|
|
else
|
|
|
|
export platform=vs
|
2019-03-06 18:27:41 -06:00
|
|
|
fi
|
2018-07-13 02:07:30 -05:00
|
|
|
|
2020-10-23 15:08:35 -05:00
|
|
|
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')
|
2020-02-20 21:16:14 -06:00
|
|
|
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
|
2017-10-24 00:01:42 -05:00
|
|
|
|
2018-07-13 02:07:30 -05:00
|
|
|
# Create a folder for SwSS record files
|
2017-10-24 00:01:42 -05:00
|
|
|
mkdir -p /var/log/swss
|
|
|
|
ORCHAGENT_ARGS="-d /var/log/swss "
|
|
|
|
|
|
|
|
# Set orchagent pop batch size to 8192
|
|
|
|
ORCHAGENT_ARGS+="-b 8192 "
|
|
|
|
|
2020-08-24 16:04:10 -05:00
|
|
|
# Set synchronous mode if it is enabled in CONFIG_DB
|
2020-10-23 15:08:35 -05:00
|
|
|
SYNC_MODE=$(echo $SWSS_VARS | jq -r '.synchronous_mode')
|
2020-08-24 16:04:10 -05:00
|
|
|
if [ "$SYNC_MODE" == "enable" ]; then
|
|
|
|
ORCHAGENT_ARGS+="-s "
|
|
|
|
fi
|
|
|
|
|
2017-10-24 00:01:42 -05:00
|
|
|
# Set mac address
|
|
|
|
ORCHAGENT_ARGS+="-m $MAC_ADDRESS"
|
|
|
|
|
|
|
|
exec /usr/bin/orchagent ${ORCHAGENT_ARGS}
|