sonic-buildimage/platform/p4/docker-sonic-p4/orchagent.sh
shi-su f3feb56c8a
Add switch for synchronous mode (#5237)
Add a master switch so that the sync/async mode can be configured.
Example usage of the switch:
1.  Configure mode while building an image
    `make ENABLE_SYNCHRONOUS_MODE=y <target>`
2. Configure when the device is running 
    Change CONFIG_DB with `sonic-cfggen -a '{"DEVICE_METADATA":{"localhost": {"synchronous_mode": "enable"}}}' --write-to-db`
    Restart swss with `systemctl restart swss`
2020-08-24 14:04:10 -07:00

26 lines
756 B
Bash
Executable File

#!/usr/bin/env bash
MAC_ADDRESS=$(sonic-cfggen -d -v 'DEVICE_METADATA.localhost.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 SsWW 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=$(sonic-cfggen -d -v DEVICE_METADATA.localhost.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}