
{
    "name"  : "无感知认证场景IP授权配置是否正确",
    "problems" : {
        "JJ_bypass" : {
            "desc"      : "【问题】会导致无感知认证时SAM出现IP为0.0.0.0的地址表项，可能存在全0 IP地址互相抢占导致用户掉线的问题。",
            "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 = []
if log_run.indexOf('dot1x mac-auth-bypass') > -1:
	if log_run.indexOf('ip dhcp snooping')==-1:
		result = 'fail'
		config = config + 'ip dhcp snooping ;' 
		restore_cmd.push('config')
		restore_cmd.push('ip dhcp snooping')
		restore_cmd.push('end')
	end
	if log_run.indexOf('aaa authorization ip-auth-mode mixed')==-1:
		result = 'fail'
		config = config + 'aaa authorization ip-auth-mode mixed ;' 
		restore_cmd.push('config')
		restore_cmd.push('aaa authorization ip-auth-mode mixed')
		restore_cmd.push('end')
	end
	if log_run.indexOf('dot1x mac-auth-bypass valid-ip-auth')==-1:
		result = 'fail'
		config = config + 'dot1x mac-auth-bypass valid-ip-auth ;' 
		restore_cmd.push('config')
		restore_cmd.push('dot1x mac-auth-bypass valid-ip-auth')
		restore_cmd.push('end')
	end
	if log_run.indexOf('dot1x valid-ip-acct enable')==-1:
		result = 'fail'
		config = config + 'dot1x valid-ip-acct enable ;' 
		restore_cmd.push('config')
		restore_cmd.push('dot1x valid-ip-acct enable')
		restore_cmd.push('end')
	end
end
if result =='fail':
	change_title('无感知认证IP授权配置错误')
	add_problem('JJ_bypass',[config],restore_cmd)
    return 'warn'
end
return 'success'

