{
    "name"  : "检测外网口线路是否正常",
    "problems" : {
        "error" : {
            "desc"      : "【问题】外网口线路异常",
            "advice"    : "【建议】请检查线路是否接入正确的设备端口、公网IP地址是否配置正确及网线是否松动"
        }
    }
}

---------------------------code-------------------------------
wanIntf = precondition('wanIntf')
wanIp = precondition('wanIp')
#wanIntf = 'GigabitEthernet 0/0'
#wanIp = '172.18.10.113'
if wanIntf == '' :
    add_reason('需要配置外网接口才能进行检测')
    return 'skip'
end

if wanIntf == 'Te0/0' :
    wanIntf = 'TenGigabitEthernet 0/0'
end

if wanIntf == 'Te0/1' :
    wanIntf = 'TenGigabitEthernet 0/1'
end

print 'wanIntf='+wanIntf
print 'wanIp='+wanIp


response = cli('show ip in brief')
response = response.split(/\r?\n/)
i = 1
while i < (response.length - 1) :
	res = response[i]
	print 'res='+res
	if res.match(wanIntf) != null :
		res1 = res.split(/\s\s+/)
		print 'res1='+res1
		res1 = res1[3]
		if res1 == 'up' :
			return 'success'
		end
	end
	i = i + 1
end

add_problem('error')
return 'warn'

