{
    "name"  : "局域网是否包含10.1.0.6相关网段",
    "problems" : {
        "local_net" : {
            "desc"      : "【问题】局域网包含10.1.0.6相关网段",
            "advice"    : "【建议】请修改局域网的网段" 
        }
    }
}

---------------------------code-------------------------------
STARTNUM = 1
MATCH_IP = "10.1.0.6"

ip_pri_start = -1
ip_pri_end = -1
ip_sec_start = -1
ip_sec_end = -1
ip = []
ip_final = []

res = cli("show ip i b")
print res
if res.search(/Invalid input/i) != -1 :
    add_reason('该设备不支持命令show ip i b')
    return 'skip'
end

res = res.split(/\r?\n/)
if res.length == 2 :
    return 'success'
end

#10x网关设备和11x网关设备该命令返回结果不同
res_index = res[1]
ip_pri = res_index.search(/IP-Address\(Pri\)/i)
ip_sec = res_index.search(/IP-Address\(Sec\)/i)
if ip_sec != -1 :
    ip_pri_start = ip_pri
    ip_pri_end = ip_sec
    ip_Status = res_index.search(/Status/i)
    ip_sec_start = ip_sec
    ip_sec_end = ip_Status
else :
    ip_ok = res_index.search(/OK\?/i)
    ip_pri_start = ip_pri
    ip_pri_end = ip_ok
end

i = 2
while i < (res.length - 1) :
    res_tmp = res[i]    
    ip_tmp = res_tmp.slice(ip_pri_start, ip_pri_end)
    ip.push(ip_tmp)
    
    if ip_sec != -1 :
        ip_tmp = res_tmp.slice(ip_sec_start, ip_sec_end)
        ip.push(ip_tmp)
    end
    
    i = i + 1
end

i = 0
while i < ip.length :
    ip_tmp = ip[i]
    
    if ip_tmp.search(/no address/i) == -1 :
        ip_tmp = ip_tmp.replace(/\s/g, "")
        
        #考虑为空的情况
        if ip_tmp != "" :
            ip_final.push(ip_tmp)
        end
    end
    
    i = i + 1
end

i = 0
while i < ip_final.length :
    ip_tmp = ip_final[i]
    print ip_tmp
    
    ip_tmp = ip_tmp.split('/')
    ip_id = ip_tmp[0]
    ip_mask = ip_tmp[1]
    isTrue = isSameIpseg(ip_id, MATCH_IP, ip_mask)
    if isTrue == true :
        add_problem('local_net')
        return 'warn'
        break
    end
    
    i = i + 1
end

return 'success'