
{
    "name"  : "硬件检测-POE供电检测",
    "problems" : {
        "power_management" : {
            "desc"      : "【问题】通过show logging查询诊断有端口POE供电异常，初判硬件异常。",
            "advice"    : "【建议】请关注“锐捷网络客户中心”微信报修；或拨打热线报修：4008-111-000进行设备更换。"
        },
        "power_overload" : {
            "desc"      : "【问题】通过show logging获取到电源功率过载，可能接入终端功率过多，或疑似硬件异常。",
            "advice"    : "【建议】建议关闭部分交换机端口POE功能后看故障是否恢复，若不能则为硬件问题。请关注“锐捷网络客户中心”微信报修；或拨打热线报修：4008-111-000进行设备更换。"
        }
    }
}

---------------------------code-------------------------------
result = 'pass'
log_poe = cli('show logging | include Power')
if log_poe.indexOf('The reason is Power management') > -1 :
	change_title('检测设备POE供电异常，疑似硬件问题')
	add_problem('power_management')
	result = 'fail'
end
if log_poe.indexOf('The reason is Power overload') > -1 :
	change_title('检测到POE端口功率过载，接入终端功率过多或疑似硬件问题')
	add_problem('power_overload')
	result = 'fail'
end

if result == 'fail':
	return 'warn'
end

change_title('设备未检测到POE问题')
return 'success'
