Skip to content

Commit 84aa99d

Browse files
authored
[multi-asic] teamdctl support for multi-asic (#5851)
Signed-off-by: Abhishek Dosi <[email protected]>
1 parent c972052 commit 84aa99d

File tree

1 file changed

+34
-1
lines changed
  • dockers/docker-teamd/base_image_files

1 file changed

+34
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,43 @@
11
#!/bin/bash
22

3+
[ -f /etc/sonic/sonic-environment ] && . /etc/sonic/sonic-environment
4+
5+
function help()
6+
{
7+
echo -e "Usage: $0 -n [0 to $(($NUM_ASIC-1))] [OPTION]... " 1>&2; exit 1;
8+
}
9+
310
DOCKER_EXEC_FLAGS="i"
411

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

10-
docker exec -$DOCKER_EXEC_FLAGS teamd teamdctl "$@"
17+
DEV=""
18+
PLATFORM=${PLATFORM:-`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform`}
19+
20+
# Parse the device specific asic conf file, if it exists
21+
ASIC_CONF=/usr/share/sonic/device/$PLATFORM/asic.conf
22+
[ -f $ASIC_CONF ] && . $ASIC_CONF
23+
24+
if [[ ($NUM_ASIC -gt 1) ]]; then
25+
while getopts ":n:h:" opt; do
26+
case "${opt}" in
27+
h) help
28+
;;
29+
n) DEV=${OPTARG}
30+
[ $DEV -lt $NUM_ASIC -a $DEV -ge 0 ] || help
31+
;;
32+
esac
33+
done
34+
35+
if [ -z "${DEV}" ]; then
36+
help
37+
fi
38+
39+
# Skip the arguments -n <inst> while passing to docker command
40+
shift 2
41+
fi
42+
43+
docker exec -$DOCKER_EXEC_FLAGS teamd$DEV teamdctl "$@"

0 commit comments

Comments
 (0)