{
    "name"  : "PPPOE拨号获取地址检查",
    "problems" : {
        "pppoe" : {
            "desc"      : "【问题】PPPOE拨号获取地址为私网地址。",
            "advice"    : "【建议】对于拨号线路，获取到的IP地址为私网IP和公网IP两种情况，跟据故障处理经验私网IP一般会受到运营商局端出口设备的各类策略限制（各地运营商策略不尽相同）；而对于公网IP地址，运营商一般是不会做上述的限制,所以遇到运营商分配私网IP的情况可以联系运营商分配置公网IP，确保业务的正常运行。"
        }
    }
}
---------------------------code-------------------------------
res = cli("show ip i b | in dialer")
resArr = res.split(/\r?\n/)
dialerIpArr = []
i = 1
while i < (resArr.length - 1) :
    resSignal = resArr[i]
    resSignal = resSignal.trim()
    resSignalArr = resSignal.split(/\s+/)
    ipTmp = resSignalArr[2]
    dialerIpArr.push(ipTmp)
    i = i + 1
end

print dialerIpArr

j = 0 
while j < dialerIpArr.length :
    ipTmp = dialerIpArr[j]
    ipTmp = ipTmp.trim()
    ipTmpArr = ipTmp.split(".")
    ip0 = ipTmpArr[0]
    ip1 = ipTmpArr[1]
    if ip0 == 10 :
        add_problem("pppoe")
        return "warn"
    end
    if ip0 == 172 && ip1 > 15 && ip1 < 32 :
        add_problem("pppoe")
        return "warn"    
    end
    if ip0 == 192 && ip1== 168 :
        add_problem("pppoe")
        return "warn"    
    end
    j = j + 1
end

return 'success'

