sonic-buildimage/files/image_config/config-topology/config-topology.sh
anamehra 26af468a99
Add support for platform topology configuration service (#12066)
* Add support for platform topology configuration service

    This service invokes the platform plugin for platform specific topology
    configuration.
    The path for platform plugin script is:
    /usr/share/sonic/device/$PLATFORM/plugins/config-topology.sh
    If the platform plugin is not available, this service does nothing.

Signed-off-by: anamehra <anamehra@cisco.com>
2023-02-01 12:53:45 -08:00

35 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# This script is invoked by config-topology.service.
# This script invokes platform plugin script if present
# which could be used for platform specific topology configuration
#
start() {
PLATFORM=`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform`
#Path to platform topology script
TOPOLOGY_SCRIPT="/usr/share/sonic/device/$PLATFORM/plugins/config-topology.sh"
#if topology script file not present, do nothing and return 0
[ ! -f $TOPOLOGY_SCRIPT ] && exit 0
$TOPOLOGY_SCRIPT start
}
stop() {
PLATFORM=`sonic-cfggen -H -v DEVICE_METADATA.localhost.platform`
#Path to platform topology script
TOPOLOGY_SCRIPT="/usr/share/sonic/device/$PLATFORM/plugins/config-topology.sh"
#if topology script file not present, do nothing and return 0
[ ! -f $TOPOLOGY_SCRIPT ] && exit 0
$TOPOLOGY_SCRIPT stop
}
# read SONiC immutable variables
[ -f /etc/sonic/sonic-environment ] && . /etc/sonic/sonic-environment
case "$1" in
start|stop)
$1
;;
*)
echo "Usage: $0 {start|stop}"
;;
esac