Skip to content

Commit

Permalink
[multi-asic] teamdctl support for multi-asic (#5851)
Browse files Browse the repository at this point in the history
Signed-off-by: Abhishek Dosi <[email protected]>
  • Loading branch information
abdosi authored Nov 9, 2020
1 parent c972052 commit 84aa99d
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion dockers/docker-teamd/base_image_files/teamdctl
Original file line number Diff line number Diff line change
@@ -1,10 +1,43 @@
#!/bin/bash

[ -f /etc/sonic/sonic-environment ] && . /etc/sonic/sonic-environment

function help()
{
echo -e "Usage: $0 -n [0 to $(($NUM_ASIC-1))] [OPTION]... " 1>&2; exit 1;
}

DOCKER_EXEC_FLAGS="i"

# Determine whether stdout is on a terminal
if [ -t 1 ] ; then
DOCKER_EXEC_FLAGS+="t"
fi

docker exec -$DOCKER_EXEC_FLAGS teamd teamdctl "$@"
DEV=""
PLATFORM=${PLATFORM:-`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform`}

# Parse the device specific asic conf file, if it exists
ASIC_CONF=/usr/share/sonic/device/$PLATFORM/asic.conf
[ -f $ASIC_CONF ] && . $ASIC_CONF

if [[ ($NUM_ASIC -gt 1) ]]; then
while getopts ":n:h:" opt; do
case "${opt}" in
h) help
;;
n) DEV=${OPTARG}
[ $DEV -lt $NUM_ASIC -a $DEV -ge 0 ] || help
;;
esac
done

if [ -z "${DEV}" ]; then
help
fi

# Skip the arguments -n <inst> while passing to docker command
shift 2
fi

docker exec -$DOCKER_EXEC_FLAGS teamd$DEV teamdctl "$@"

0 comments on commit 84aa99d

Please sign in to comment.