{
    "name"  : "接口下一跳",
    "precondition" : [],
    "problems" : {
        "port" : {
            "desc"      : "【问题】接口${0}未配置下一跳，会导致网络访问不通",
            "advice"    : "【建议】请检查下一跳地址配置，可以在web页面，网络配置->接口配置->选中接口并更改下一跳地址"
        },
		"diPort" : {
			"desc"      : "【问题】接口${0}，对端地址：${1},ping对端地址大包不通. ping ${2} source ${3}  length 1500 ntimes 5 timeout 1",
			"advice"    : "【建议】大包不通，可能会导致一些大报文转发失败，请联系运营商检查"
		},
		"noDiPort": {
			"desc"      : "【问题】接口${0}，对端地址：${1},ping下一跳大包不通. ping ${2} source ${3}  length 1500 ntimes 5 timeout 1",
			"advice"    : "【建议】大包不通，可能会导致一些大报文转发失败，请检查下一跳地址配置，或者联系运营商检查"
		}
    }
}

---------------------------code-------------------------------
isProblemFound = false

wansDetail = get_share_value('wansDetail');

foreach wan in wansDetail:
    intf = wan.intf
    nextHop = wan.nexthop

    if nextHop && wan.isUP && wan.ip :
        cmd = 'ping ' + nextHop + ' source ' + intf + ' length 1500 ntimes 5 timeout 1';
        res = cli(cmd)
        res1 = formatPing(res)
        print res1.successRate
        if !res1.successRate :
			isProblemFound = true
			if wan.isDi:
				add_problem("diPort",[intf, nextHop, nextHop, intf]);
			else:
				add_problem("noDiPort",[intf, nextHop, nextHop, intf]);
            end
        end
        continue
    end

    if nextHop && !wan.isDi && wan.isUP && wan.ip :
        isProblemFound = true
        add_problem("port",[intf])
    end
end


if isProblemFound == true :
    return 'warn'
else:
    return 'success'
end

