{
    "name"  : "24XS4QXS-DB线卡CPLD故障",
    "problems" : {
        "cpld" : {
            "desc"      : "【风险】检测到当前DB线卡${0}对应的CPLD版本过低会导致40G端口UP较慢影响环境业务，若40G端口作为VSL链路会导致VSU无法建立",
            "advice"    : "【建议】升级CPLD版本，可联系4008-111-000或升级CPLD方法"
        }
    }
}
---------------------------code-------------------------------
version_slot = cli('show version slots')
version_cpld = cli('show cpld version')
version_slotList = version_slot.split("\r\n")
reg = /([\d])\s+([\d]+)\s+[\d]+\s+[^ ]+\s+[^ ]+24XS4QXS-DB/
result = "pass"
port = ""
stepResult = 'PASS'
foreach data in version_slotList:
    r = data.match(reg)
    if r != null:
        stepResult = 'FAIL'
        dev = r[1]
        slot = r[2]
        print slot
        reg1 = format('%s\\s+(\\d+)', slot)
        reg2 = format('%s%s\\s+(\\d+)',dev,slot)
        r1 = version_cpld.match(reg1)
        r2 = version_cpld.match(reg2)
        if r1 != null:
            c_version = r1[1]
            if c_version != null && c_version < 140512:
                result = "fail"
                port = port + dev + "/" + slot + "、"
            end
        end
        if r2 != null:
            c_version = r2[1]
            if c_version != null && c_version < 140512:
                result = "fail"
                port = port + dev + "/" + slot
            end
        end
    end
end
if stepResult == 'PASS':
    return 'skip'
end
if result == "fail":
    change_title('检测到24XS4QXS-DB线卡CPLD版本问题')
    add_problem('cpld',[port])
    return 'warn'
end
if result == 'pass'
    return 'skip'
end
return 'success'