{
    "name"  : "设备性能是否不足",
    "problems" : {
        "performance" : {
            "desc"      : "【问题】接口存在no buffer",
            "advice"    : "【建议】请联系400协助处理"
        }
    }
}
---------------------------code-------------------------------
noBufferBeforeArr = []
noBufferNowArr = []
response = cli("show ip i b | in up") 
results = response.split(/\r?\n/)
interfaceArr = []
i = 1
while i < (results.length - 1):
    resultTmp = results[i]
    resultTmp = resultTmp.trim()
    arr = resultTmp.split(/\s+/)
    interfaceHead = arr[0]
    interfaceNum = arr[1]
    interface = interfaceHead + " " + interfaceNum
    interfaceArr.push(interface)
    i = i + 1
end

j = 0
while j < interfaceArr.length:
    interface = interfaceArr[j]
    cmd = "show interface " + interface + " | in no buffer"
    response = cli(cmd)
    matchArr = response.match(/bytes, (.+) no buffer,/)
    matchTmp = matchArr[1]
    noBufferBeforeArr.push(matchTmp)
    #if noBufferBefore > 1000: 
        #add_problem("performance")
        #return "warn"
    #end
    j = j + 1
end

sleep(5000)

response = cli("show ip i b | in up")
results = response.split(/\r?\n/)

interfaceArr = []
i = 1
while i < (results.length - 1):
    resultTmp = results[i]
    resultTmp = resultTmp.trim()
    arr = resultTmp.split(/\s+/)
    interfaceHead = arr[0]
    interfaceNum = arr[1]
    interface = interfaceHead + interfaceNum
    interfaceArr.push(interface)
    i = i + 1
end

j = 0
while j < interfaceArr.length:
    interface = interfaceArr[j]
    cmd = "show interface " + interface + " | in no buffer"
    response = cli(cmd)
    matchArr = response.match(/bytes, (.+) no buffer,/)
    matchTmp = matchArr[1]
    noBufferNowArr.push(matchTmp)
    #if noBufferNow > 1000:
        #add_problem("performance")
        #return "warn"
    #end
    j = j + 1
end

k = 0 
while k < noBufferBeforeArr.length :
    noBufferNow = noBufferNowArr[k]
    noBufferBefore = noBufferBeforeArr[k]
    if noBufferNow - noBufferBefore > 1000:
        add_problem("performance")
        return "warn"
    end
    k = k + 1
end


return "success"
