{
    "name"  : "IPSec协商状态",
    "problems" : {
        "checkIpsecNegotiation" : {
            "desc"      : "【问题】Ipsec未协商成功",
            "advice"    : "【建议】从以下几个方面进行排查:分支路由、中间网络不通"
        }
    }
}
---------------------------code-------------------------------
valueIP = precondition('valueIP')
ipsecBranch = precondition('ipsecBranch')
cmd = 'show crypto state | in ' + valueIP
response = cli(cmd)
resArr = response.split(/\r?\n/)
i=0
j=0
print 'response =' +response
if resArr.length > 0 :
    while i < resArr.length:
	  resArrTmp = resArr[i]
	   if resArrTmp.match(ipsecHeadquarters) != null && resArrTmp.match(ipsecBranch)!= null && (resArrTmp.indexOf("IKE_IDLE")!= -1 || resArrTmp.indexOf("QM_IDLE")!= -1 ):
	      j=j+1
       end
	   i=i+1
	end
end
if j<1 :
	  add_problem("checkIpsecNegotiation")
	  return "warn"
	end
return 'success'