{
    "name"  : "dns代理服务器地址工作正常",
    "precondition" : [],
    "problems" : {
        "dns" : {
            "desc"      : "【问题】接口 ${0}下域名服务器${1}访问不通，可能线路存在问题也可能该dns服务器地址配置错误，请排查下线路或者尝试更换dns服务器地址",
            "advice"    : [
                "【建议】 "           
            ]
        },
        "dns1" : {
            "desc"      : "【问题】接口 ${0}下域名服务器${1}访问时通时不通，存在震荡",
            "advice"    : [
                "【建议】请排查下线路是否存在问题或者可能该dns服务器不稳定尝试更换一个,也可运行如下配置尝试进行修复" ,
                "配置示例：",
                "Ruijie#config",
                "Ruijie(config)#track ${2}",
                "Ruijie(config)#delay up 11 down 11",
                "Ruijie(config)#end",
                "Ruijie#write"          
            ]
        }
    }
}

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

isProblemFound = false

isProblemFound = false
wansDetail = get_share_value('wansDetail')

foreach wan in wansDetail:
    dns = wan.dns
    if wan.isUP && wan.ip && dns.length:
        wanIntf = wan.intf
        dns = wan.dns
        foreach data in dns:
            trackId = data.trackId;
            dnsIp = data.dnsIp;
            cmd = 'show track ' + trackId;
            res = cli(cmd)
            _data = formatShowTrack(res, trackId, dnsIp, wanIntf)
            print _data.intf 
            _intf = _data.intf;
            _trackId = _data.trackId;
            _dnsIp = _data.dnsIp;
            if _data.down :
                isProblemFound = true
                add_problem("dns",[_intf,_dnsIp]) 
                continue
            end
            if _data.concussion :
                isProblemFound = true
                add_problem("dns1",[_intf,_dnsIp,_trackId])
            end
        end

    end
end


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