{
    "name"  : "正在检测文件系统",
    "problems" : {
        "1" : {
            "desc"      : "【问题】主引擎系统data分区未挂载，该问题会设备重启或升级后配置丢失",
            "advice"    : "【建议】该引擎需要进行系统分区格式化，请联系锐捷400工程师解决。" 
        },
        "2" : {
            "desc"      : "【问题】${0}引擎系统data分区未挂载，该问题会设备重启或升级后配置丢失",
            "advice"    : "【建议】该引擎需要进行系统分区格式化，请联系锐捷400工程师解决。" 
		},
		"3" : {
            "desc"      : "【问题】Device ${0} slot ${1}引擎系统data分区未挂载，该问题会设备重启或升级后配置丢失",
            "advice"    : "【建议】该引擎需要进行系统分区格式化，请联系锐捷400工程师解决。" 
		},
		"4" : {
            "desc"      : "【问题】Device ${0} slot ${1}引擎系统data分区未挂载，该问题会设备重启或升级后配置丢失",
            "advice"    : "【建议】该引擎需要进行系统分区格式化，请联系锐捷400工程师解决。" 
		},
		"5" : {
            "desc"      : "【问题】Device ${0} slot ${1}引擎系统data分区未挂载，该问题会设备重启或升级后配置丢失",
            "advice"    : "【建议】该引擎需要进行系统分区格式化，请联系锐捷400工程师解决。" 
        }
    }
}

---------------------------code-------------------------------
response = cli('show version slots')
reg = /CM\sII|CM\sLITE/
if reg.test(response) == false :
    add_reason("未匹配到CM II或者CM LITE")
    return 'skip'
end

check_result = 'success'

cli('run-system-shell')
response = cli('df -h')
reg = /\/dev\/emmcblk0p5/
if reg.test(response) == false :
    add_problem("1")
    check_result = 'warn'
end
cli('exit')
cli('end')
if check_result != 'success':
    return check_result
end

response = cli('show version slots')
response = response.split(/\r?\n/)
i = 0
z = 0
while i < response.length :
    res = response[i]
	res = res.trim()
	reg = /backup/
	if reg.test(res) == true :
        res = res.split(/\s+/)
		X = res[0]
		Y = res[1]
		z = 1
    end
	i = i + 1
end
if z != 1 :
    add_reason("未匹配到backup")
    return 'skip'
end

response = cli('show switch virtual config')
reg = /standalone/
if reg.test(response) == true :
    cmd = 'session slot ' + Y
	cli(cmd,['>'])
	cli('enable')
	cli('run-system-shell')
	response = cli('df -h')
    reg = /\/dev\/emmcblk0p5/
    if reg.test(response) == false :
        add_problem("2",[Y])
        return 'warn'
    end
	cli('exit')
    cli('exit')
	
else:
    cmd = 'session device ' + X + ' slot ' + Y
	cli(cmd,['>'])
	cli('enable')
	cli('run-system-shell')
	response = cli('df -h')
    reg = /\/dev\/emmcblk0p5/
    if reg.test(response) == false :
        add_problem("3",[X,Y])
		cli('exit')
	    cli('exit')
        return 'warn'
    end
	cli('exit')
	cli('exit')
end

response = cli('show version slots')
response = response.split(/\r?\n/)
j = 0
y = 0
while j < response.length :
    res = response[j]
	res = res.trim()
	reg = /candidate/
	if reg.test(res) == true :
	    if y == 1 :
		    res = res.split(/\s+/)
		    X2 = res[0]
		    Y2 = res[1]
			y = 2
	    end
	    if y == 0 :
            res = res.split(/\s+/)
		    X1 = res[0]
		    Y1 = res[1]
		    y = 1
		end
    end
	j = j + 1
end


if y == 0 :
    add_reason("未匹配到candidate")
    return 'skip'
end

cmd = 'session device ' + X1 + ' slot ' + Y1
cli(cmd,['>'])
cli('enable')
cli('run-system-shell')
response = cli('df -h')
reg = /\/dev\/emmcblk0p5/
if reg.test(response) == false :
    add_problem("4",[X1,Y1])
	cli('exit')
    cli('exit')
    return 'warn'
end
cli('exit')
cli('exit')

if y == 2 :
    cmd = 'session device ' + X2 + ' slot ' + Y2
    cli(cmd,['>'])
    cli('enable')
    cli('run-system-shell')
    response = cli('df -h')
    reg = /\/dev\/emmcblk0p5/
    if reg.test(response) == false :
        add_problem("5",[X2,Y2])
		cli('exit')
        cli('exit')
        return 'warn'
	end
	cli('exit')
    cli('exit')
end

return 'success'