- [Documentation] Creates neutron security rule with neutron request with or without optional params, here security group name is mandatory args, rule with optional params can be created by passing the optional args values ex: direction=${INGRESS_EGRESS}, Then these optional params are catenated with mandatory args, example of usage: "Neutron Security Group Rule Create ${SGP_SSH} direction=${RULE_PARAMS[0]} ethertype=${RULE_PARAMS[1]} ..."
- Run Keyword If ${Kwargs} Log ${Kwargs}
- ${description} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} description default=${None}
- ${direction} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} direction default=${None}
- ${ethertype} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} ethertype default=${None}
- ${port_range_max} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} port_range_max default=${None}
- ${port_range_min} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} port_range_min default=${None}
- ${protocol} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} protocol default=${None}
- ${remote_group_id} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} remote_group_id default=${None}
- ${remote_ip_prefix} Run Keyword If ${Kwargs} Pop From Dictionary ${Kwargs} remote_ip_prefix default=${None}
- ${cmd}= Set Variable neutron security-group-rule-create ${Security_group_name}
- ${cmd}= Run Keyword If '${description}'!='None' Catenate ${cmd} --description ${description}
- ... ELSE Catenate ${cmd}
- ${cmd}= Run Keyword If '${direction}'!='None' Catenate ${cmd} --direction ${direction}
- ... ELSE Catenate ${cmd}
- ${cmd}= Run Keyword If '${ethertype}'!='None' Catenate ${cmd} --ethertype ${ethertype}
- ... ELSE Catenate ${cmd}
- ${cmd}= Run Keyword If '${port_range_max}'!='None' Catenate ${cmd} --port_range_max ${port_range_max}
- ... ELSE Catenate ${cmd}
- ${cmd}= Run Keyword If '${port_range_min}'!='None' Catenate ${cmd} --port_range_min ${port_range_min}
- ... ELSE Catenate ${cmd}
- ${cmd}= Run Keyword If '${protocol}'!='None' Catenate ${cmd} --protocol ${protocol}
- ... ELSE Catenate ${cmd}
- ${cmd}= Run Keyword If '${remote_group_id}'!='None' Catenate ${cmd} --remote_group_id ${remote_group_id}
- ... ELSE Catenate ${cmd}
- ${cmd}= Run Keyword If '${remote_ip_prefix}'!='None' Catenate ${cmd} --remote_ip_prefix ${remote_ip_prefix}
- ... ELSE Catenate ${cmd}
- ${rc} ${output}= Run And Return Rc And Output ${cmd}
- ${rule_id}= Should Match Regexp ${output} [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}
- Log ${rule_id}
- Should Be True '${rc}' == '0'
+ [Documentation] Creates neutron security rule with neutron request with or without optional params, here security group name is mandatory args, rule with optional params can be created by passing the optional args values ex: direction=${INGRESS_EGRESS}, Then these optional params are BuiltIn.Catenated with mandatory args, example of usage: "OpenStack Neutron Security Group Rule Create ${SGP_SSH} direction=${RULE_PARAMS[0]} ethertype=${RULE_PARAMS[1]} ..."
+ BuiltIn.Run Keyword If ${Kwargs} BuiltIn.Log ${Kwargs}
+ ${description} BuiltIn.Run Keyword If ${Kwargs} Collections.Pop From Dictionary ${Kwargs} description default=${None}
+ ${direction} BuiltIn.Run Keyword If ${Kwargs} Collections.Pop From Dictionary ${Kwargs} direction default=${None}
+ ${ethertype} BuiltIn.Run Keyword If ${Kwargs} Collections.Pop From Dictionary ${Kwargs} ethertype default=${None}
+ ${port_range_max} BuiltIn.Run Keyword If ${Kwargs} Collections.Pop From Dictionary ${Kwargs} port_range_max default=${None}
+ ${port_range_min} BuiltIn.Run Keyword If ${Kwargs} Collections.Pop From Dictionary ${Kwargs} port_range_min default=${None}
+ ${protocol} BuiltIn.Run Keyword If ${Kwargs} Collections.Pop From Dictionary ${Kwargs} protocol default=${None}
+ ${remote_group_id} BuiltIn.Run Keyword If ${Kwargs} Collections.Pop From Dictionary ${Kwargs} remote_group_id default=${None}
+ ${remote_ip_prefix} BuiltIn.Run Keyword If ${Kwargs} Collections.Pop From Dictionary ${Kwargs} remote_ip_prefix default=${None}
+ ${cmd} = BuiltIn.Set Variable neutron security-group-rule-create ${Security_group_name}
+ ${cmd} = BuiltIn.Run Keyword If '${description}'!='None' BuiltIn.Catenate ${cmd} --description ${description}
+ ... ELSE BuiltIn.Catenate ${cmd}
+ ${cmd} = BuiltIn.Run Keyword If '${direction}'!='None' BuiltIn.Catenate ${cmd} --direction ${direction}
+ ... ELSE BuiltIn.Catenate ${cmd}
+ ${cmd} = BuiltIn.Run Keyword If '${ethertype}'!='None' BuiltIn.Catenate ${cmd} --ethertype ${ethertype}
+ ... ELSE BuiltIn.Catenate ${cmd}
+ ${cmd} = BuiltIn.Run Keyword If '${port_range_max}'!='None' BuiltIn.Catenate ${cmd} --port_range_max ${port_range_max}
+ ... ELSE BuiltIn.Catenate ${cmd}
+ ${cmd} = BuiltIn.Run Keyword If '${port_range_min}'!='None' BuiltIn.Catenate ${cmd} --port_range_min ${port_range_min}
+ ... ELSE BuiltIn.Catenate ${cmd}
+ ${cmd} = BuiltIn.Run Keyword If '${protocol}'!='None' BuiltIn.Catenate ${cmd} --protocol ${protocol}
+ ... ELSE BuiltIn.Catenate ${cmd}
+ ${cmd} = BuiltIn.Run Keyword If '${remote_group_id}'!='None' BuiltIn.Catenate ${cmd} --remote_group_id ${remote_group_id}
+ ... ELSE BuiltIn.Catenate ${cmd}
+ ${cmd} = BuiltIn.Run Keyword If '${remote_ip_prefix}'!='None' BuiltIn.Catenate ${cmd} --remote_ip_prefix ${remote_ip_prefix}
+ ... ELSE BuiltIn.Catenate ${cmd}
+ ${rc} ${output} = OperatingSystem.Run And Return Rc And Output ${cmd}
+ ${rule_id} = BuiltIn.Should Match Regexp ${output} ${REGEX_UUID}
+ BuiltIn.Log ${rule_id}
+ BuiltIn.Should Be True '${rc}' == '0'