Skip to content

Commit c8f9223

Browse files
arlakshmabdosi
authored andcommitted
Vtysh support for multi asic (#5479)
Signed-off-by: Arvindsrinivasan Lakshmi Narasimhan <[email protected]>
1 parent 1a0a993 commit c8f9223

File tree

1 file changed

+36
-3
lines changed
  • dockers/docker-fpm-frr/base_image_files

1 file changed

+36
-3
lines changed
+36-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,37 @@
11
#!/bin/bash
2+
# read SONiC immutable variables
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+
10+
DEV=""
11+
PLATFORM=${PLATFORM:-`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform`}
12+
13+
# Parse the device specific asic conf file, if it exists
14+
ASIC_CONF=/usr/share/sonic/device/$PLATFORM/asic.conf
15+
[ -f $ASIC_CONF ] && . $ASIC_CONF
16+
17+
if [[ ($NUM_ASIC -gt 1) ]]; then
18+
while getopts ":n:h:" opt; do
19+
case "${opt}" in
20+
h) help
21+
;;
22+
n) DEV=${OPTARG}
23+
[ $DEV -lt $NUM_ASIC -a $DEV -ge 0 ] || help
24+
;;
25+
esac
26+
done
27+
28+
if [ -z "${DEV}" ]; then
29+
help
30+
fi
31+
32+
# Skip the arguments -n <inst> while passing to docker command
33+
shift 2
34+
fi
235

336
# Determine whether stdout is on a terminal
437
if [ -t 1 ] ; then
@@ -7,10 +40,10 @@ if [ -t 1 ] ; then
740
TTY=$(tty)
841
function cleanup
942
{
10-
docker exec -i bgp pkill -HUP -f "vtysh $TTY"
43+
docker exec -i bgp$DEV pkill -HUP -f "vtysh $TTY"
1144
}
1245
trap cleanup HUP
13-
docker exec -ti bgp vtysh "$TTY" "$@"
46+
docker exec -ti bgp$DEV vtysh "$TTY" "$@"
1447
else
15-
docker exec -i bgp vtysh "$@"
48+
docker exec -i bgp$DEV vtysh "$@"
1649
fi

0 commit comments

Comments
 (0)