{
    "name"  : "应用路由",
    "precondition" : [],
    "problems" : {
        "route" : {
            "desc"      : "【问题】当前线路存在多运营商，开启非P2P应用软件的应用路由可能会导致部分网页打不开，或者视频卡顿，如果当前网络访问正常，可以忽略该项，否则请去除非P2P应用软件项，只保留P2P应用软件做应用路由",
            "advice"    : [
                "【建议】"             
            ]
        }
    }
}

---------------------------code-------------------------------

isProblemFound = false
wansDetail = get_share_value('wansDetail')
isMultiIsp = false

operators = {}
foreach wan in wansDetail:
    if wan.isUP && wan.ip :
        if operators[wan.operator] :
            isMultiIsp = true
            break
        end
        operators[wan.operator] = true
    end
end


res = cli("show run | include app route")
appRoute = formatAppRoute(res)

if !appRoute.enable || !isMultiIsp :
    return 'success'
end
routeList = appRoute.routeList

foreach data in routeList:
    type = data.type
    reg = /P2P/im
    matchStr = reg.exec(type)
     if matchStr == null :
        add_problem("route")
        return 'warn'
     end
end

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