-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[multi-asic] teamdctl support for multi-asic (#5851)
Signed-off-by: Abhishek Dosi <[email protected]>
- Loading branch information
Showing
1 changed file
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 "$@" |