2020-01-26 15:56:42 -06:00
|
|
|
#!/bin/bash
|
|
|
|
# This script is invoked by topology.service only
|
|
|
|
# for multi-asic virtual platform. For multi-asic platform
|
|
|
|
# multiple Database instances are present
|
|
|
|
# and HWKSU information is retrieved from first database instance.
|
|
|
|
#
|
|
|
|
|
|
|
|
start() {
|
2020-03-31 12:06:19 -05:00
|
|
|
TOPOLOGY_SCRIPT="topology.sh"
|
2020-07-31 19:59:09 -05:00
|
|
|
PLATFORM=${PLATFORM:-`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform`}
|
|
|
|
HWSKU=${HWSKU:-`sonic-cfggen -d -v 'DEVICE_METADATA["localhost"]["hwsku"]'`}
|
2020-03-31 12:06:19 -05:00
|
|
|
/usr/share/sonic/device/$PLATFORM/$HWSKU/$TOPOLOGY_SCRIPT start
|
2020-01-26 15:56:42 -06:00
|
|
|
}
|
|
|
|
stop() {
|
2020-03-31 12:06:19 -05:00
|
|
|
TOPOLOGY_SCRIPT="topology.sh"
|
2020-07-31 19:59:09 -05:00
|
|
|
PLATFORM=${PLATFORM:-`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform`}
|
|
|
|
HWSKU=${HWSKU:-`sonic-cfggen -d -v 'DEVICE_METADATA["localhost"]["hwsku"]'`}
|
2020-03-31 12:06:19 -05:00
|
|
|
usr/share/sonic/device/$PLATFORM/$HWSKU/$TOPOLOGY_SCRIPT stop
|
2020-01-26 15:56:42 -06:00
|
|
|
}
|
|
|
|
|
2020-07-31 19:59:09 -05:00
|
|
|
# read SONiC immutable variables
|
|
|
|
[ -f /etc/sonic/sonic-environment ] && . /etc/sonic/sonic-environment
|
|
|
|
|
2020-01-26 15:56:42 -06:00
|
|
|
case "$1" in
|
|
|
|
start|stop)
|
|
|
|
$1
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Usage: $0 {start|stop}"
|
|
|
|
;;
|
|
|
|
esac
|