{
    "name"  : "L2TPoverIPSec总部配置检查",
    "problems" : {
        "NoUseMap" : {
            "desc"      : "【问题】接口下未应用map",
            "advice"    : "【建议】在接口下应用map"
        },
		"NoMapDynamic" : {
            "desc"      : "【问题】map的类型不是dynamic",
            "advice"    : "【建议】总部建议配置为动态map"
        },
		"NoTransformSet" : {
            "desc"      : "【问题】没有配置转换集",
            "advice"    : "【建议】需要配置转换集"
        },
		"NoModeTransport" : {
            "desc"      : "【问题】转换集没有配置mode transport",
            "advice"    : "【建议】L2tp over ipsec传输模式，需要配置这个选项"
        },
		"NoSetKey" : {
            "desc"      : "【问题】需要配置对端的共享密钥",
            "advice"    : "【建议】配置对端的共享密钥"
        },
		"NoModeDetect" : {
            "desc"      : "【问题】没有配置crypto isakmp mode-detect",
            "advice"    : "【建议】需要配置该选项"
        }
    }
}
---------------------------code-------------------------------
l2tpOverIpsecHeadquarters = precondition('l2tpOverIpsecHeadquarters')
port = precondition('keyChangeBand')
print 'l2tpOverIpsecHeadquarters='+l2tpOverIpsecHeadquarters

if l2tpOverIpsecHeadquarters == "":
    return 'skip'
end

print 'port='+port
cmd = 'show run int ' + port
result=cli(cmd)
if result.indexOf("crypto map")==-1:
    add_problem('NoUseMap')
    return 'warn'
end

cmd = 'show run int ' + port
res = cli(cmd)
resArr = res.split(/\r?\n/) 
mapType = []
j = 1
while j < (resArr.length - 1):
  resArrTmp = resArr[j]
  resArrTmp = resArrTmp.trim()
  if resArrTmp.indexOf("crypto map")!=-1 :
	 mapType.push(resArrTmp)
  end
  j = j + 1
end 
cmd2 = 'show run | inc ' + mapType[0]
res2 = cli(cmd2)
if res2.indexOf("dynamic")==-1 :
   add_problem('NoMapDynamic')
return 'warn'
end


res3 = cli("show run")
print 'res3='+res3
if res3.indexOf("crypto ipsec transform-set vpdnSet")==-1 :
   add_problem('NoTransformSet')
return 'warn'
end


res4 = cli("show run")
print 'res4='+res4
if res4.indexOf("mode transport")==-1 :
   add_problem('NoModeTransport')
return 'warn'
end


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