{
    "name"  : "DNS ALG功能关闭检查",
    "problems" : {
        "dnsAlg" : {
            "desc"      : "【问题】DNS ALG开启",
            "advice"    : "【建议】如果内网用户需要使用域名访问内网私网地址的服务器，需要关闭DNS ALG功能，关闭方法如下：no ip nat translation dns"
        }
    }
}
---------------------------code-------------------------------
res = cli("show run | in ip nat inside source static")
resArr = res.split(/\r?\n/)
matchJson = {}
i = 0
while i < resArr.length :
    resSingle = resArr[i]
    resSingle = resSingle.trim()
    resSingleArr = resSingle.split(/\s+/)
    if resSingle.indexOf("tcp") != -1 || resSingle.indexOf("udp") != -1 :
        if resSingle.indexOf("interface") != -1 :
            value = resSingleArr[9] + resSingleArr[10]
            key = resSingleArr[6]
            matchJson[key] = value
        else :
            value = resSingleArr[8]
            key = resSingleArr[6]
            matchJson[key] = value
        end
    else :
        if resSingle.indexOf("interface") != -1 :
            value = resSingleArr[7] + resSingleArr[8]
            key = resSingleArr[5]
            matchJson[key] = value
        else :
            value = resSingleArr[6]
            key = resSingleArr[5]
            matchJson[key] = value
        end
    end
    i = i + 1
end

isProblem = false
foreach innerIP in matchJson :
    foreach innerIP2 in matchJson:
        if innerIP != innerIP2 && matchJson[innerIP] == matchJson[innerIP2] :
            isProblem = true
        end
    end
end

if isProblem :
    res = cli("show run | in no ip nat translation dns")
    resArr = res.split(/\r?\n/)
    if resArr.length == 2 :
        add_problem("dnsAlg")
        return "warn"
    end
end

return "success"
