{
    "name"  : "IPSec分支配置检查",
    "problems" : {
        "NoUseMap" : {
            "desc"      : "【问题】接口下未应用map",
            "advice"    : "【建议】在接口下应用map"
        },
		"NoSetPeer" : {
            "desc"      : "【问题】接口下需要配置peer等信息",
            "advice"    : "【建议】在接口下配置peer"
        },
		"NoSetAcl" : {
            "desc"      : "【问题】需要配置acl信息",
            "advice"    : "【建议】ipsec需要配置感兴流信息"
        },
		"NoSetKey" : {
            "desc"      : "【问题】需要配置对端的共享密钥",
            "advice"    : "【建议】配置对端的共享密钥"
        }
    }
}
---------------------------code-------------------------------
ipsecBranch = precondition('ipsecBranch')
port = precondition('keyChangeBand')
if ipsecBranch == "":
    return 'skip'
end

print 'port='+port
cmd = 'show run int ' + port
result=cli(cmd)
print 'port='+port

if result.indexOf("crypto map")==-1 :
    add_problem('NoUseMap')
    return 'warn'
end
res2 = cli("show run")
print 'res2='+res2
if res2.indexOf("set peer")==-1 :
   add_problem('NoSetPeer')
return 'warn'
end

res3 = cli("show run | inc ip access-list")
print 'res3='+res3
if res3.indexOf("ip access-list")==-1 :
   add_problem('NoSetAcl')
return 'warn'
end

res4 = cli("show run | inc crypto isakmp key")
print 'res4='+res4
   if res4.indexOf("crypto isakmp key")==-1 :
	  add_problem('NoSetKey')
	  return 'warn'
   end
return 'success'
