{
    "name"  : "检测当前在线ap未添加group情况",
    "problems" : {
        "groupEmpty" : {
            "desc"      : "【问题】检测到AP ${0}未添加group",
            "advice"    : ["【建议】建议AP ${0}添加group"
                        ,"\t\t${1}"]

        }
    }
}

---------------------------code-------------------------------
response = cli('show ap-group summary')
if response.search('Invalid input | Unknown command.') != -1 :
    return 'skip'    
end
reg = /\r?\n\d\.\s(.+)/g
result = response.match(reg)
acGroupStr = ''
if result != null :
    foreach item in result :
        group = item.replace(/\r?\n\d\.\s/,'')
        if group != 'default' :
            if acGroupStr == '' :
                acGroupStr = '当前AC创建了' + group
            else :
                acGroupStr = acGroupStr + '、' + group
            end
        end
    end
end
if acGroupStr == '' :
	acGroupStr = '当前AC未创建group，所有ap都在default组内'
end

response = cli('show ap-group aps summary')
if response.search('Invalid input | Unknown command.') != -1 :
    return 'skip'    
end
reg = /\r?\n([^\s\r\n]+)\s+?default/ig
result = response.match(reg)
apErrorStr = ''
if result != null :
    foreach item in result :
        reg = /\r?\n([^\s\r\n]+)\s+?default/i
        ap = item.match(reg)
        ap = ap[1]
        if apErrorStr == '' :
            apErrorStr = apErrorStr + ap
        else :
            apErrorStr = apErrorStr + '、' + ap
        end
    end
    add_problem('groupEmpty', [apErrorStr,acGroupStr])
    return 'warn'
end
return 'success'