sonic-buildimage/platform/barefoot/sonic-platform-modules-netberg/aurora-610/utils/healthstatus.sh
Andrew Sapronov 7f10b6bc35
[Netberg][Barefoot] Added support for Aurora 610 (#10579)
Why I did it
Support Intel Tofino based platforms Netberg Aurora 610
ASIC: Intel Tofino BFN-T10-032D-020
Pors: 48x 25G + 8x 100G

How I did it
Added specification to device/netberg directory
Added platform/barefoot/sonic-platform-modules-netberg contains kernel modules, scripts and sonic_platform packages.
Modified the platform/barefoot/one-image.mk and platform/barefoot/rule.mk to include Aurora 610 related ID and files.

How to verify it
Build SONiC

Install the image on the device and verify the related components are installed and shown correctly.
2022-06-30 10:40:47 -07:00

102 lines
1.9 KiB
Bash
Executable File

#!/bin/bash
normal='0 : normal'
unpowered='2 : unpowered'
fault='4 : fault'
notinstalled='7 : not installed'
FAN_UNPLUG_NUM=0
FAN_LED_RED='fan_led_red'
NUM=1
FAN_NUM=5
FIRST_READ=0
SECOND_READ=0
PSOC_PATH="/tmp/psoc"
CPLD_ADDR="/sys/bus/i2c/devices/i2c-0/0-0077"
ROUTE="/sys/class/hwmon/"
#PSU_STAUS='000'
#switch is ready , transfer control of cpld to cpu
echo 1 > $CPLD_ADDR/ctl
while true
do
#monitor how many fan modules are unplugged
#first check
FAN_UNPLUG_NUM=0
FAN_ARR=$(cat $PSOC_PATH/$FAN_LED_RED?)
while read -r line; do
fan_led_red_check=$(echo "$line")
if [ $fan_led_red_check -eq 1 ]
then
let FAN_UNPLUG_NUM=FAN_UNPLUG_NUM+1
fi
done <<< "$FAN_ARR"
FIRST_READ=$FAN_UNPLUG_NUM
#second check
FAN_UNPLUG_NUM=0
FAN_ARR=$(cat $PSOC_PATH/$FAN_LED_RED?)
while read -r line; do
fan_led_red_check=$(echo "$line")
if [ $fan_led_red_check -eq 1 ]
then
let FAN_UNPLUG_NUM=FAN_UNPLUG_NUM+1
fi
done <<< "$FAN_ARR"
SECOND_READ=$FAN_UNPLUG_NUM
if [ $FIRST_READ -ne $SECOND_READ ]
then
#echo "not equl:$FIRST_READ != $SECOND_READ"
continue
fi
if [ $FAN_UNPLUG_NUM -ge 2 ]
then
#echo "solid red"
echo 7 > $CPLD_ADDR/red_led
echo 0 > $CPLD_ADDR/grn_led
sleep 1
continue
elif [ $FAN_UNPLUG_NUM -eq 1 ]
then
#solid orange
echo 7 > $CPLD_ADDR/red_led
echo 7 > $CPLD_ADDR/grn_led
sleep 1
continue
fi
#echo "normal"
psu0var=$(cat $CPLD_ADDR/psu0) # bottom PSU
psu1var=$(cat $CPLD_ADDR/psu1) # top PSU
if [ "$psu0var" = "$normal" ] &&
[ "$psu1var" = "$normal" ] # PSU normal operatio
then
#solid green
echo 7 > $CPLD_ADDR/grn_led
echo 0 > $CPLD_ADDR/red_led
#echo "solid green"
else
if [ "$psu0var" = "$unpowered" ] ||
[ "$psu1var" = "$unpowered" ]
then
#echo solid orange
echo 7 > $CPLD_ADDR/grn_led
echo 7 > $CPLD_ADDR/red_led
fi
fi
sleep 1
done