{
    "name"  : " VT模板口配置检查",
    "problems" : {
        "noTConError" : {
            "desc"      : "【问题】没配置任何模板口。",
            "advice"    : "【建议】需要配置VT模板口。"
        },
		"noBroError" : {
            "desc"      : "【问题】VT下未借用其它接口。",
            "advice"    : "【建议】VT口需要借用其它接口，建议使用loopback口，且loopback口的地址要和地址池在同一个网段中。"
        },
		"BroNoConError" : {
            "desc"      : "【问题】VT下借用的接口IP地址未配置。",
            "advice"    : "【建议】配置VT口借用的接口的IP地址。"
        },
		"noRelError" : {
            "desc"      : "【问题】VT口下面没有关联pool池。",
            "advice"    : "【建议】配置VT口下面的pool池。"
        },
		"PoNoConError" : {
            "desc"      : "【问题】pool池未配置。",
            "advice"    : "【建议】配置对应的地址池。"
        },
		"noRegError" : {
            "desc"      : "【问题】VT口下未配置认证方式。",
            "advice"    : "【建议】配置VT口下面的认证方式。"
        }
    }
}
---------------------------code-------------------------------
isClient= precondition('isClient')
print isClient
if isClient == true :
	print 'skip'
	return 'skip'
end
errorFlag = 0
num = 0
res = cli("show ip interface brief | inc Virtual-Template")
print res
resArr = res.match(/Virtual-Template \d+/ig)
print resArr
if resArr == null :
	print 'warn'
	errorFlag = 1
	add_problem("noTConError")
	return 'warn'
end
while num < resArr.length :
	commend = "show run int "+resArr[num]+" | inc ip unnumbered"
	resAll = cli(commend)
	print resAll
	resTmp = resAll.match(/loopback \d+/ig)
	print resTmp
	if resTmp == null :
		print 'warn'
		errorFlag = 1
		add_problem("noBroError")
	end	
	if resTmp !=null :
		commend = "show run int "+resTmp[0]+" | inc ip address"
		resAl = cli(commend)
		print resAl
		resTmp1 = resAl.match(/ip address/ig)
		if resTmp1[1] == null :
			print 'warn'
			errorFlag = 1
			add_problem("BroNoConError")
		end	
	end	
	
	commend = "show run int " +resArr[num]+" | inc pool"
	resAll = cli(commend)
	print resAll
	resTmp2 = resAll.match(/pool \w+/ig)
	print resTmp2
	if resTmp2 == null :
		print 'warn'
		errorFlag = 1
		add_problem("noRelError")
	end	
	if resTmp2 !=null :
		commend = "show run | inc ip local "+resTmp2[0]
		resAl1 = cli(commend)
		print resAl1
		resTmp3 = resAl1.match(/ip local pool/ig)
		if resTmp3[1] == null :
			print 'warn'
			errorFlag = 1
			add_problem("PoNoConError")
		end	
	end		
	commend = "show run int "+resArr[num]+" | inc ppp authentication"
	resAl2 = cli(commend)
	print resAl2
	resTmp4 = resAl2.match(/ppp authentication/ig)
	if resTmp4[1] == null :
		print 'warn'
		errorFlag = 1
		add_problem("noRegError")
	end	
	num = num + 1
end
if 	errorFlag == 1 :
	return 'warn'
end
print 'success'
return 'success'