#!/bin/bash
set +x
. /opt/node_type_recognize.sh
G_MML_FILE_PATH="/opt/huawei/snas/script/inspect_mml"
G_SCRIPT_PATH="/opt/inspect"
source $G_MML_FILE_PATH/CheckItems
CurInspectNum="145"
CurInspectFun="$(GetInspectType $CurInspectNum)"
RESULTFILE="/tmp/tmpResult${CurInspectFun}"
LOG_FILE="/var/log/inspect.log"
>${RESULTFILE}

isPass=0

function LOG
{
   time=$(date)
   echo [${time}][$$][${CurInspectFun}]$@ >> ${LOG_FILE}
}

IsRHNode
if [ $? -eq 1 ];then
    echo "SesFwVersion:Do not involve to inspect(T3000/C72/TaiShan)." >>${RESULTFILE}
    echo "${CurInspectFun}_Pass $isPass" >>${RESULTFILE}
    exit 0
fi
source /opt/huawei/snas/upd/upd_fw/rhfw/ses_utility.sh
isPMCboard="$(lsscsi |grep enclosu |grep LSI |grep 12G)" #为空就是 PMC背板,不检查
SESinfo=$(GetsesFwVer)
if [ "$SESinfo" = "" ] && [ ! -z "${isPMCboard}" ];then
    isPass=1
    echo "[ERR]INFO:Can't get SESfwversion information." >>${RESULTFILE}
    echo "${CurInspectFun}_Pass $isPass" >>${RESULTFILE}
    LOG "[$FUNCNAME]can not get SESfwversion information"
    exit 1
fi
if [ "$SESinfo" = "120" ];then
    isPass=1
    echo "[ERR]INFO:The SesVersion($SESinfo) is in black list" >>${RESULTFILE}
    LOG "[$FUNCNAME]The SesVersion($SESinfo) is in black list"
else
    echo "SesFwVersion:${SESinfo:--}"   >>${RESULTFILE}
fi

echo "${CurInspectFun}_Pass $isPass" >>${RESULTFILE}

exit 0

