{
    "name"  : "是否是硬件问题导致供电异常",
    "precondition" : ["name", "type"],
    "problems" : {
        "no_poe_chip" : {
            "desc"      : "【问题】说明有硬件异常，导致供电异常；或者未检测到POE芯片",
            "advice"    : "【建议】更换设备"
        }
    }
}
---------------------------code-------------------------------
type = precondition('type')
if type != 'copper':
    add_reason('非电口类型的端口不需要进行该项诊断')
    return 'skip'
end

model = get_device_model()
if model.search(/S5750-24GT\/8SFP-P/i) == -1 && model.search(/S5750-48GT\/4SFP-P/i) == -1:
    add_reason('该诊断仅支持设备型号为S5750-24GT/8SFP-P或者S5750-48GT/4SFP-P的设备')
    return 'skip'
end
cli('debug su')
res = cli('exec drv_fs_dump')

cli('end')


#获取端口号
reg = /(?:\d+\/)+(\d+)/
intf_name = precondition('name')
tmp = intf_name.match(reg)
port_num = tmp[1]
port_num_int = parse_int(port_num)

chip_num = 0
if port_num_int >= 1 && port_num_int <= 12:
    chip_num = 1
end

if port_num_int >= 13 && port_num_int <= 24:
    chip_num = 0
end

if port_num_int >= 25 && port_num_int <= 36:
    chip_num = 3
end

if port_num_int >= 37 && port_num_int <= 48:
    chip_num = 2
end

reg = format("pd:[24]\\.[\\r\\n]+/dev/ssp_dev/pd/pd_%s\\s*dump fail\\.", chip_num)
reg = newRegExp(reg, 'i')
tmp = res.match(reg)
if tmp != null :
    add_problem('no_poe_chip')
    return 'warn'
end

return 'success'