
{
    "name"  : "MCP对接异常",
    "problems" : {
        "step_1" : {
            "desc"      : "【问题】MCP对接用户重复认证",
            "advice"    : "【建议】检查配置链接及服务器通路,查看配置中的ACS链接是否正确cwmp,acs url http://172.21.154.159/mcp/tr069Servlet"
        },
		"step_2" : {
            "desc"      : "【问题】MCP服务器状态异常",
            "advice"    : "【建议】需要进行认证抓包（设备与服务器上联口抓包分析）"
        },
		"step_3" : {
            "desc"      : "【问题】MCP服务器状态异常",
            "advice"    : "【建议】需要检测服务器通路是否正常，服务器运行是否正常，若都正常，可通过设备端打开调试进行信息收集分析。（调试命令为：debug cwmp session，debug gsoap pkt，debug gsoap soap"
        }
    }
}

---------------------------code-------------------------------
res = cli("Show run")
if res.indexOf("acs url http://172.21.154.159/mcp/tr069Servlet") == -1:
	add_problem("step_1")
	return 'warn'
end
res1 = cli("Show cwmp config")
res2 = cli("Show cwmp status")
res1 = res1.split(/\r?\n/)
res2 = res2.split(/\r?\n/)
result1 = ""
result2 = ""
while i < res1.length:
	num1 = res1[i]
	if num1.indexOf("CWMP status") != -1:
		if num1.indexOf("enable") != -1:
			result1 = true
			break
		else if num1.indexOf("disable") != -1:
			result1 = false
			break
		end
	end
	i = i + 1
end
i = 0
while i < res2.length:
	num2 = res2[i]
	if num2.indexOf("CWMP status") != -1:
		if num2.indexOf("enable") != -1:
			result2 = true
			break
		else if num2.indexOf("disable") != -1:
			result2 = false
			break
		end
	end
	i = i + 1
end

if result1 == true && result1 == true:
	add_problem("step_2")
	return 'warn'
end

if result1 == true && result1 == true:
	add_problem("step_3")
	return 'warn'
end

return 'success'

