
{
    "name"  : "生成树震荡检测",
    "problems" : {
        "spanning" : {
            "desc"      : "【问题】检测出生成树出现震荡，判断依据show spanning-tree中TopologyChanges计数较大。生成树震荡会造成业务转发丢包，认证异常等。",
            "advice"    : "【建议】请检查网络中是否有端口反复震荡情况，若无法排除先手工将环网变为单链路，同时删除生成树功能。（若计数为历史记录，可通过clear spanning-tree counters清空）"
        }
    }
}

---------------------------code-------------------------------
result = 'pass'
log_span = cli('show spanning-tree')
reg = /TopologyChanges\s+:\s+(\d+)/
r = log_span.match(reg)
if r != null :
	count = r[1]
	if count>=50:
		change_title('检测出设备生成树状态存在反复震荡')
		add_problem('spanning')
		return 'warn'
	end
end

change_title('设备生成树无震荡')
return 'success'
