
{
    "name"  : "Radius逃生配置命令是否正确",
    "problems" : {
        "JJ_radius" : {
            "desc"      : "【问题】当Radius服务器down机时，用户无法认证访问外网。",
            "advice"    : "【建议】增加配置${0}。"
        }
    }
}

---------------------------code-------------------------------
result='pass'
response = get_share_value('log_versionDetail')
if response.indexOf('N18000') == -1 :
	return 'skip'
end
log_run = get_share_value('log_showrun')
if log_run.indexOf('auth-mode gateway') == -1:
	return 'skip'
end
config = ''
restore_cmd = []
reback_cmd = []
reg = /radius-server host [^ ]+ test username [^ ]+ idle-time 2 key/
r = log_run.match(reg)
if !r :
	config = config + 'radius-server host xxx test username xxx idle-time 2 key xxx;' 
	result = 'fail'
end
if log_run.indexOf('radius-server dead-criteria time 120 tries 12')==-1:
	result = 'fail'
	config = config + 'radius-server dead-criteria time 120 tries 12 ;' 
	restore_cmd.push('config')
	restore_cmd.push('radius-server dead-criteria time 120 tries 12')
	restore_cmd.push('end')
end
if log_run.indexOf('web-auth radius-escape')==-1:
	result = 'fail'
	config = config + 'web-auth radius-escape ;' 
	restore_cmd.push('config')
	restore_cmd.push('web-auth radius-escape')
	restore_cmd.push('end')
end
if log_run.indexOf('dot1x critical')==-1:
	result = 'fail'
	config = config + 'dot1x critical ;' 
	restore_cmd.push('config')
	restore_cmd.push('dot1x critical')
	restore_cmd.push('end')
end
if log_run.indexOf('dot1x critical recovery action reinitialize')==-1:
	result = 'fail'
	config = config + 'dot1x critical recovery action reinitialize ;' 
	restore_cmd.push('config')
	restore_cmd.push('dot1x critical recovery action reinitialize')
	restore_cmd.push('end')
end
if result =='fail':
	change_title('Radius逃生功能配置错误')
	add_problem('JJ_radius',[config],restore_cmd)
    return 'warn'
end
return 'success'

