@ -201,7 +201,7 @@ EXAMPLES = '''
ce_aaa_server_host :
ce_aaa_server_host :
state : present
state : present
radius_group_name : group1
radius_group_name : group1
rad u is_server_type: Authentication
rad iu s_server_type: Authentication
radius_server_ip : 10.1 .10 .1
radius_server_ip : 10.1 .10 .1
radius_server_port : 2000
radius_server_port : 2000
radius_server_mode : Primary - server
radius_server_mode : Primary - server
@ -212,7 +212,7 @@ EXAMPLES = '''
ce_aaa_server_host :
ce_aaa_server_host :
state : absent
state : absent
radius_group_name : group1
radius_group_name : group1
rad u is_server_type: Authentication
rad iu s_server_type: Authentication
radius_server_ip : 10.1 .10 .1
radius_server_ip : 10.1 .10 .1
radius_server_port : 2000
radius_server_port : 2000
radius_server_mode : Primary - server
radius_server_mode : Primary - server
@ -1059,7 +1059,7 @@ class AaaServerHost(object):
module = kwargs [ " module " ]
module = kwargs [ " module " ]
radius_group_name = module . params [ ' radius_group_name ' ]
radius_group_name = module . params [ ' radius_group_name ' ]
rad u is_server_type = module . params [ ' rad u is_server_type' ]
rad iu s_server_type = module . params [ ' rad iu s_server_type' ]
radius_server_ip = module . params [ ' radius_server_ip ' ]
radius_server_ip = module . params [ ' radius_server_ip ' ]
radius_server_port = module . params [ ' radius_server_port ' ]
radius_server_port = module . params [ ' radius_server_port ' ]
radius_server_mode = module . params [ ' radius_server_mode ' ]
radius_server_mode = module . params [ ' radius_server_mode ' ]
@ -1099,10 +1099,10 @@ class AaaServerHost(object):
for tmp in result [ " radius_server_ip_v4 " ] :
for tmp in result [ " radius_server_ip_v4 " ] :
if " serverType " in tmp . keys ( ) :
if " serverType " in tmp . keys ( ) :
if state == " present " :
if state == " present " :
if tmp [ " serverType " ] != rad u is_server_type:
if tmp [ " serverType " ] != rad iu s_server_type:
need_cfg = True
need_cfg = True
else :
else :
if tmp [ " serverType " ] == rad u is_server_type:
if tmp [ " serverType " ] == rad iu s_server_type:
need_cfg = True
need_cfg = True
if " serverIPAddress " in tmp . keys ( ) :
if " serverIPAddress " in tmp . keys ( ) :
if state == " present " :
if state == " present " :
@ -1141,14 +1141,14 @@ class AaaServerHost(object):
module = kwargs [ " module " ]
module = kwargs [ " module " ]
radius_group_name = module . params [ ' radius_group_name ' ]
radius_group_name = module . params [ ' radius_group_name ' ]
rad u is_server_type = module . params [ ' rad u is_server_type' ]
rad iu s_server_type = module . params [ ' rad iu s_server_type' ]
radius_server_ip = module . params [ ' radius_server_ip ' ]
radius_server_ip = module . params [ ' radius_server_ip ' ]
radius_server_port = module . params [ ' radius_server_port ' ]
radius_server_port = module . params [ ' radius_server_port ' ]
radius_server_mode = module . params [ ' radius_server_mode ' ]
radius_server_mode = module . params [ ' radius_server_mode ' ]
radius_vpn_name = module . params [ ' radius_vpn_name ' ]
radius_vpn_name = module . params [ ' radius_vpn_name ' ]
conf_str = CE_MERGE_RADIUS_SERVER_CFG_IPV4 % (
conf_str = CE_MERGE_RADIUS_SERVER_CFG_IPV4 % (
radius_group_name , rad u is_server_type,
radius_group_name , rad iu s_server_type,
radius_server_ip , radius_server_port ,
radius_server_ip , radius_server_port ,
radius_server_mode , radius_vpn_name )
radius_server_mode , radius_vpn_name )
@ -1163,7 +1163,7 @@ class AaaServerHost(object):
cmd = " radius server group %s " % radius_group_name
cmd = " radius server group %s " % radius_group_name
cmds . append ( cmd )
cmds . append ( cmd )
if rad u is_server_type == " Authentication " :
if rad iu s_server_type == " Authentication " :
cmd = " radius server authentication %s %s " % (
cmd = " radius server authentication %s %s " % (
radius_server_ip , radius_server_port )
radius_server_ip , radius_server_port )
@ -1190,14 +1190,14 @@ class AaaServerHost(object):
module = kwargs [ " module " ]
module = kwargs [ " module " ]
radius_group_name = module . params [ ' radius_group_name ' ]
radius_group_name = module . params [ ' radius_group_name ' ]
rad u is_server_type = module . params [ ' rad u is_server_type' ]
rad iu s_server_type = module . params [ ' rad iu s_server_type' ]
radius_server_ip = module . params [ ' radius_server_ip ' ]
radius_server_ip = module . params [ ' radius_server_ip ' ]
radius_server_port = module . params [ ' radius_server_port ' ]
radius_server_port = module . params [ ' radius_server_port ' ]
radius_server_mode = module . params [ ' radius_server_mode ' ]
radius_server_mode = module . params [ ' radius_server_mode ' ]
radius_vpn_name = module . params [ ' radius_vpn_name ' ]
radius_vpn_name = module . params [ ' radius_vpn_name ' ]
conf_str = CE_DELETE_RADIUS_SERVER_CFG_IPV4 % (
conf_str = CE_DELETE_RADIUS_SERVER_CFG_IPV4 % (
radius_group_name , rad u is_server_type,
radius_group_name , rad iu s_server_type,
radius_server_ip , radius_server_port ,
radius_server_ip , radius_server_port ,
radius_server_mode , radius_vpn_name )
radius_server_mode , radius_vpn_name )
@ -1212,7 +1212,7 @@ class AaaServerHost(object):
cmd = " radius server group %s " % radius_group_name
cmd = " radius server group %s " % radius_group_name
cmds . append ( cmd )
cmds . append ( cmd )
if rad u is_server_type == " Authentication " :
if rad iu s_server_type == " Authentication " :
cmd = " undo radius server authentication %s %s " % (
cmd = " undo radius server authentication %s %s " % (
radius_server_ip , radius_server_port )
radius_server_ip , radius_server_port )
@ -1239,7 +1239,7 @@ class AaaServerHost(object):
module = kwargs [ " module " ]
module = kwargs [ " module " ]
radius_group_name = module . params [ ' radius_group_name ' ]
radius_group_name = module . params [ ' radius_group_name ' ]
rad u is_server_type = module . params [ ' rad u is_server_type' ]
rad iu s_server_type = module . params [ ' rad iu s_server_type' ]
radius_server_ipv6 = module . params [ ' radius_server_ipv6 ' ]
radius_server_ipv6 = module . params [ ' radius_server_ipv6 ' ]
radius_server_port = module . params [ ' radius_server_port ' ]
radius_server_port = module . params [ ' radius_server_port ' ]
radius_server_mode = module . params [ ' radius_server_mode ' ]
radius_server_mode = module . params [ ' radius_server_mode ' ]
@ -1278,10 +1278,10 @@ class AaaServerHost(object):
for tmp in result [ " radius_server_ip_v6 " ] :
for tmp in result [ " radius_server_ip_v6 " ] :
if " serverType " in tmp . keys ( ) :
if " serverType " in tmp . keys ( ) :
if state == " present " :
if state == " present " :
if tmp [ " serverType " ] != rad u is_server_type:
if tmp [ " serverType " ] != rad iu s_server_type:
need_cfg = True
need_cfg = True
else :
else :
if tmp [ " serverType " ] == rad u is_server_type:
if tmp [ " serverType " ] == rad iu s_server_type:
need_cfg = True
need_cfg = True
if " serverIPAddress " in tmp . keys ( ) :
if " serverIPAddress " in tmp . keys ( ) :
if state == " present " :
if state == " present " :
@ -1313,13 +1313,13 @@ class AaaServerHost(object):
module = kwargs [ " module " ]
module = kwargs [ " module " ]
radius_group_name = module . params [ ' radius_group_name ' ]
radius_group_name = module . params [ ' radius_group_name ' ]
rad u is_server_type = module . params [ ' rad u is_server_type' ]
rad iu s_server_type = module . params [ ' rad iu s_server_type' ]
radius_server_ipv6 = module . params [ ' radius_server_ipv6 ' ]
radius_server_ipv6 = module . params [ ' radius_server_ipv6 ' ]
radius_server_port = module . params [ ' radius_server_port ' ]
radius_server_port = module . params [ ' radius_server_port ' ]
radius_server_mode = module . params [ ' radius_server_mode ' ]
radius_server_mode = module . params [ ' radius_server_mode ' ]
conf_str = CE_MERGE_RADIUS_SERVER_CFG_IPV6 % (
conf_str = CE_MERGE_RADIUS_SERVER_CFG_IPV6 % (
radius_group_name , rad u is_server_type,
radius_group_name , rad iu s_server_type,
radius_server_ipv6 , radius_server_port ,
radius_server_ipv6 , radius_server_port ,
radius_server_mode )
radius_server_mode )
@ -1334,7 +1334,7 @@ class AaaServerHost(object):
cmd = " radius server group %s " % radius_group_name
cmd = " radius server group %s " % radius_group_name
cmds . append ( cmd )
cmds . append ( cmd )
if rad u is_server_type == " Authentication " :
if rad iu s_server_type == " Authentication " :
cmd = " radius server authentication %s %s " % (
cmd = " radius server authentication %s %s " % (
radius_server_ipv6 , radius_server_port )
radius_server_ipv6 , radius_server_port )
@ -1355,13 +1355,13 @@ class AaaServerHost(object):
module = kwargs [ " module " ]
module = kwargs [ " module " ]
radius_group_name = module . params [ ' radius_group_name ' ]
radius_group_name = module . params [ ' radius_group_name ' ]
rad u is_server_type = module . params [ ' rad u is_server_type' ]
rad iu s_server_type = module . params [ ' rad iu s_server_type' ]
radius_server_ipv6 = module . params [ ' radius_server_ipv6 ' ]
radius_server_ipv6 = module . params [ ' radius_server_ipv6 ' ]
radius_server_port = module . params [ ' radius_server_port ' ]
radius_server_port = module . params [ ' radius_server_port ' ]
radius_server_mode = module . params [ ' radius_server_mode ' ]
radius_server_mode = module . params [ ' radius_server_mode ' ]
conf_str = CE_DELETE_RADIUS_SERVER_CFG_IPV6 % (
conf_str = CE_DELETE_RADIUS_SERVER_CFG_IPV6 % (
radius_group_name , rad u is_server_type,
radius_group_name , rad iu s_server_type,
radius_server_ipv6 , radius_server_port ,
radius_server_ipv6 , radius_server_port ,
radius_server_mode )
radius_server_mode )
@ -1376,7 +1376,7 @@ class AaaServerHost(object):
cmd = " radius server group %s " % radius_group_name
cmd = " radius server group %s " % radius_group_name
cmds . append ( cmd )
cmds . append ( cmd )
if rad u is_server_type == " Authentication " :
if rad iu s_server_type == " Authentication " :
cmd = " undo radius server authentication %s %s " % (
cmd = " undo radius server authentication %s %s " % (
radius_server_ipv6 , radius_server_port )
radius_server_ipv6 , radius_server_port )
@ -1397,7 +1397,7 @@ class AaaServerHost(object):
module = kwargs [ " module " ]
module = kwargs [ " module " ]
radius_group_name = module . params [ ' radius_group_name ' ]
radius_group_name = module . params [ ' radius_group_name ' ]
rad u is_server_type = module . params [ ' rad u is_server_type' ]
rad iu s_server_type = module . params [ ' rad iu s_server_type' ]
radius_server_name = module . params [ ' radius_server_name ' ]
radius_server_name = module . params [ ' radius_server_name ' ]
radius_server_port = module . params [ ' radius_server_port ' ]
radius_server_port = module . params [ ' radius_server_port ' ]
radius_server_mode = module . params [ ' radius_server_mode ' ]
radius_server_mode = module . params [ ' radius_server_mode ' ]
@ -1437,10 +1437,10 @@ class AaaServerHost(object):
for tmp in result [ " radius_server_name_cfg " ] :
for tmp in result [ " radius_server_name_cfg " ] :
if " serverType " in tmp . keys ( ) :
if " serverType " in tmp . keys ( ) :
if state == " present " :
if state == " present " :
if tmp [ " serverType " ] != rad u is_server_type:
if tmp [ " serverType " ] != rad iu s_server_type:
need_cfg = True
need_cfg = True
else :
else :
if tmp [ " serverType " ] == rad u is_server_type:
if tmp [ " serverType " ] == rad iu s_server_type:
need_cfg = True
need_cfg = True
if " serverName " in tmp . keys ( ) :
if " serverName " in tmp . keys ( ) :
if state == " present " :
if state == " present " :
@ -1479,14 +1479,14 @@ class AaaServerHost(object):
module = kwargs [ " module " ]
module = kwargs [ " module " ]
radius_group_name = module . params [ ' radius_group_name ' ]
radius_group_name = module . params [ ' radius_group_name ' ]
rad u is_server_type = module . params [ ' rad u is_server_type' ]
rad iu s_server_type = module . params [ ' rad iu s_server_type' ]
radius_server_name = module . params [ ' radius_server_name ' ]
radius_server_name = module . params [ ' radius_server_name ' ]
radius_server_port = module . params [ ' radius_server_port ' ]
radius_server_port = module . params [ ' radius_server_port ' ]
radius_server_mode = module . params [ ' radius_server_mode ' ]
radius_server_mode = module . params [ ' radius_server_mode ' ]
radius_vpn_name = module . params [ ' radius_vpn_name ' ]
radius_vpn_name = module . params [ ' radius_vpn_name ' ]
conf_str = CE_MERGE_RADIUS_SERVER_NAME % (
conf_str = CE_MERGE_RADIUS_SERVER_NAME % (
radius_group_name , rad u is_server_type,
radius_group_name , rad iu s_server_type,
radius_server_name , radius_server_port ,
radius_server_name , radius_server_port ,
radius_server_mode , radius_vpn_name )
radius_server_mode , radius_vpn_name )
@ -1500,7 +1500,7 @@ class AaaServerHost(object):
cmd = " radius server group %s " % radius_group_name
cmd = " radius server group %s " % radius_group_name
cmds . append ( cmd )
cmds . append ( cmd )
if rad u is_server_type == " Authentication " :
if rad iu s_server_type == " Authentication " :
cmd = " radius server authentication hostname %s %s " % (
cmd = " radius server authentication hostname %s %s " % (
radius_server_name , radius_server_port )
radius_server_name , radius_server_port )
@ -1527,14 +1527,14 @@ class AaaServerHost(object):
module = kwargs [ " module " ]
module = kwargs [ " module " ]
radius_group_name = module . params [ ' radius_group_name ' ]
radius_group_name = module . params [ ' radius_group_name ' ]
rad u is_server_type = module . params [ ' rad u is_server_type' ]
rad iu s_server_type = module . params [ ' rad iu s_server_type' ]
radius_server_name = module . params [ ' radius_server_name ' ]
radius_server_name = module . params [ ' radius_server_name ' ]
radius_server_port = module . params [ ' radius_server_port ' ]
radius_server_port = module . params [ ' radius_server_port ' ]
radius_server_mode = module . params [ ' radius_server_mode ' ]
radius_server_mode = module . params [ ' radius_server_mode ' ]
radius_vpn_name = module . params [ ' radius_vpn_name ' ]
radius_vpn_name = module . params [ ' radius_vpn_name ' ]
conf_str = CE_DELETE_RADIUS_SERVER_NAME % (
conf_str = CE_DELETE_RADIUS_SERVER_NAME % (
radius_group_name , rad u is_server_type,
radius_group_name , rad iu s_server_type,
radius_server_name , radius_server_port ,
radius_server_name , radius_server_port ,
radius_server_mode , radius_vpn_name )
radius_server_mode , radius_vpn_name )
@ -1548,7 +1548,7 @@ class AaaServerHost(object):
cmd = " radius server group %s " % radius_group_name
cmd = " radius server group %s " % radius_group_name
cmds . append ( cmd )
cmds . append ( cmd )
if rad u is_server_type == " Authentication " :
if rad iu s_server_type == " Authentication " :
cmd = " undo radius server authentication hostname %s %s " % (
cmd = " undo radius server authentication hostname %s %s " % (
radius_server_name , radius_server_port )
radius_server_name , radius_server_port )
@ -2319,7 +2319,7 @@ def main():
local_user_level = dict ( type = ' str ' ) ,
local_user_level = dict ( type = ' str ' ) ,
local_user_group = dict ( type = ' str ' ) ,
local_user_group = dict ( type = ' str ' ) ,
radius_group_name = dict ( type = ' str ' ) ,
radius_group_name = dict ( type = ' str ' ) ,
rad u is_server_type= dict ( choices = [ ' Authentication ' , ' Accounting ' ] ) ,
rad iu s_server_type= dict ( choices = [ ' Authentication ' , ' Accounting ' ] ) ,
radius_server_ip = dict ( type = ' str ' ) ,
radius_server_ip = dict ( type = ' str ' ) ,
radius_server_ipv6 = dict ( type = ' str ' ) ,
radius_server_ipv6 = dict ( type = ' str ' ) ,
radius_server_port = dict ( type = ' str ' ) ,
radius_server_port = dict ( type = ' str ' ) ,
@ -2366,7 +2366,7 @@ def main():
# radius para
# radius para
radius_group_name = module . params [ ' radius_group_name ' ]
radius_group_name = module . params [ ' radius_group_name ' ]
rad u is_server_type = module . params [ ' rad u is_server_type' ]
rad iu s_server_type = module . params [ ' rad iu s_server_type' ]
radius_server_ip = module . params [ ' radius_server_ip ' ]
radius_server_ip = module . params [ ' radius_server_ip ' ]
radius_server_ipv6 = module . params [ ' radius_server_ipv6 ' ]
radius_server_ipv6 = module . params [ ' radius_server_ipv6 ' ]
radius_server_port = module . params [ ' radius_server_port ' ]
radius_server_port = module . params [ ' radius_server_port ' ]
@ -2406,8 +2406,8 @@ def main():
proposed [ " local_user_group " ] = local_user_group
proposed [ " local_user_group " ] = local_user_group
if radius_group_name :
if radius_group_name :
proposed [ " radius_group_name " ] = radius_group_name
proposed [ " radius_group_name " ] = radius_group_name
if rad u is_server_type:
if rad iu s_server_type:
proposed [ " rad u is_server_type" ] = rad u is_server_type
proposed [ " rad iu s_server_type" ] = rad iu s_server_type
if radius_server_ip :
if radius_server_ip :
proposed [ " radius_server_ip " ] = radius_server_ip
proposed [ " radius_server_ip " ] = radius_server_ip
if radius_server_ipv6 :
if radius_server_ipv6 :
@ -2480,9 +2480,9 @@ def main():
module . fail_json (
module . fail_json (
msg = ' Error: Please do not input radius_server_ip and radius_server_ipv6 at the same time. ' )
msg = ' Error: Please do not input radius_server_ip and radius_server_ipv6 at the same time. ' )
if not rad u is_server_type or not radius_server_port or not radius_server_mode or not radius_vpn_name :
if not rad iu s_server_type or not radius_server_port or not radius_server_mode or not radius_vpn_name :
module . fail_json (
module . fail_json (
msg = ' Error: Please input rad u is_server_type radius_server_port radius_server_mode radius_vpn_name.' )
msg = ' Error: Please input rad iu s_server_type radius_server_port radius_server_mode radius_vpn_name.' )
if radius_server_ip :
if radius_server_ip :
rds_server_ipv4_result = ce_aaa_server_host . get_radius_server_cfg_ipv4 (
rds_server_ipv4_result = ce_aaa_server_host . get_radius_server_cfg_ipv4 (