{
    "name"  : "默认路由是否配置正确",
    "precondition" : [],
    "problems" : {
        "route" : {
            "desc"      : "【问题】接口 ${0} 请确认该线路是否为专线（即从该接口出去不能访问所有的外网资源），如果为专线开启默认路由可能会导致网络访问异常，不是专线则不能进行修复，否则会出现网络访问异常",
            "advice"    : [
                "【建议】确认存在问题可运行以下配置修复接口(${1})：" ,
                "配置示例：",
                "Ruijie#config",
                "Ruijie(config)#no ${2}",
                "Ruijie(config)#end",
                "Ruijie#write"          
            ]
        },
        "route1" : {
            "desc"      : "【问题】接口 ${0}  默认路由配置错误，下一跳不应该配置",
            "advice"    : [
                "【建议】确认存在问题可运行以下配置修复接口(${1})：" ,
                "配置示例：",
                "Ruijie#config",
                "Ruijie(config)#no ${2}",
                "Ruijie(config)#ip route 0.0.0.0 0.0.0.0  ${3}",
                "Ruijie(config)#end",
                "Ruijie#write"          
            ]
        },
        "route2" : {
            "desc"      : "【问题】接口 ${0}  默认路由配置错误，下一跳应该为${1}",
            "advice"    : [
                "【建议】确认存在问题可运行以下配置修复接口(${2})：" ,
                "配置示例：",
                "Ruijie#config",
                "Ruijie(config)#no ${3}",
                "Ruijie(config)#ip route 0.0.0.0 0.0.0.0  ${4}",
                "Ruijie(config)#end",
                "Ruijie#write"          
            ]
        }
    }
}
---------------------------code-------------------------------
isProblemFound = false

cmd = "show run | include ip route 0.0.0.0 0.0.0.0"
res = cli(cmd)
res1 = formateRoute(res)

wansDetail = get_share_value('wansDetail');

foreach wan in wansDetail :
    wanIp = wan.ip
    if !wan.isUP || !wanIp :
        continue
    end

    wanIntf = wan.intf;
    wanNexthop = wan.nexthop
    isDi = wan.isDi

    foreach route in res1:
        routeIntf = route.intf
        routeNexthop = route.nexthop;
        if routeIntf != wanIntf && routeNexthop != wanNexthop :
            continue;
        end
        private = isPrivateIP(wanIp)
        if private:
            isProblemFound = true
            str = route.cmd
            add_problem("route",[wanIntf,wanIntf,str])
            break
        end

        if wanNexthop && wanNexthop != routeNexthop :
            if isDi && routeNexthop != '':
                isProblemFound = true
                str = route.cmd
                add_problem("route1",[wanIntf,wanIntf,str,wanIntf])
                break
            end
            if !isDi :
                isProblemFound = true
                str = route.cmd
                add_problem("route1",[wanIntf,wanNexthop,wanIntf,str,wanIntf])
            end

        end
    end  
end


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