+ ${rc} ${output}= Run And Return Rc And Output openstack router delete ${router_name}
+ Should Not Be True ${rc}
+
+Get DumpFlows And Ovsconfig
+ [Arguments] ${openstack_node_ip}
+ [Documentation] Get the OvsConfig and Flow entries from OVS from the Openstack Node
+ Log ${openstack_node_ip}
+ SSHLibrary.Open Connection ${openstack_node_ip} prompt=${DEFAULT_LINUX_PROMPT}
+ SSHKeywords.Flexible SSH Login ${OS_USER} ${DEVSTACK_SYSTEM_PASSWORD}
+ SSHLibrary.Set Client Configuration timeout=${default_devstack_prompt_timeout}
+ Write Commands Until Expected Prompt ip -o link ${DEFAULT_LINUX_PROMPT_STRICT}
+ Write Commands Until Expected Prompt ip -o addr ${DEFAULT_LINUX_PROMPT_STRICT}
+ Write Commands Until Expected Prompt ip route ${DEFAULT_LINUX_PROMPT_STRICT}
+ Write Commands Until Expected Prompt arp -an ${DEFAULT_LINUX_PROMPT_STRICT}
+ ${nslist}= Write Commands Until Expected Prompt ip netns list | awk '{print $1}' ${DEFAULT_LINUX_PROMPT_STRICT}
+ @{lines} Split To Lines ${nslist}
+ : FOR ${line} IN @{lines}
+ \ Write Commands Until Expected Prompt sudo ip netns exec ${line} ip -o link ${DEFAULT_LINUX_PROMPT_STRICT}
+ \ Write Commands Until Expected Prompt sudo ip netns exec ${line} ip -o addr ${DEFAULT_LINUX_PROMPT_STRICT}
+ \ Write Commands Until Expected Prompt sudo ip netns exec ${line} ip route ${DEFAULT_LINUX_PROMPT_STRICT}
+ Write Commands Until Expected Prompt sudo ovs-vsctl show ${DEFAULT_LINUX_PROMPT_STRICT}
+ Write Commands Until Expected Prompt sudo ovs-vsctl list Open_vSwitch ${DEFAULT_LINUX_PROMPT_STRICT}
+ Write Commands Until Expected Prompt sudo ovs-ofctl show br-int -OOpenFlow13 ${DEFAULT_LINUX_PROMPT_STRICT}
+ Write Commands Until Expected Prompt sudo ovs-ofctl dump-flows br-int -OOpenFlow13 ${DEFAULT_LINUX_PROMPT_STRICT}
+ Write Commands Until Expected Prompt sudo ovs-ofctl dump-groups br-int -OOpenFlow13 ${DEFAULT_LINUX_PROMPT_STRICT}
+ Write Commands Until Expected Prompt sudo ovs-ofctl dump-group-stats br-int -OOpenFlow13 ${DEFAULT_LINUX_PROMPT_STRICT}
+
+Get Karaf Log Type From Test Start
+ [Arguments] ${ip} ${test_name} ${type} ${user}=${ODL_SYSTEM_USER} ${password}=${ODL_SYSTEM_PASSWORD} ${prompt}=${ODL_SYSTEM_PROMPT}
+ ... ${log_file}=${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log
+ ${cmd} Set Variable sed '1,/ROBOT MESSAGE: Starting test ${test_name}/d' ${log_file} | grep '${type}'
+ ${output} Run Command On Controller ${ip} ${cmd} ${user} ${password} ${prompt}
+ Log ${output}
+
+Get Karaf Log Types From Test Start
+ [Arguments] ${ip} ${test_name} ${types} ${user}=${ODL_SYSTEM_USER} ${password}=${ODL_SYSTEM_PASSWORD} ${prompt}=${ODL_SYSTEM_PROMPT}
+ ... ${log_file}=${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log
+ : FOR ${type} IN @{types}
+ \ Get Karaf Log Type From Test Start ${ip} ${test_name} ${type} ${user} ${password}
+ \ ... ${prompt} ${log_file}
+
+Get Karaf Log Events From Test Start
+ [Arguments] ${test_name} ${user}=${ODL_SYSTEM_USER} ${password}=${ODL_SYSTEM_PASSWORD} ${prompt}=${ODL_SYSTEM_PROMPT}
+ ${log_types} = Create List ERROR WARN Exception
+ Run Keyword If 0 < ${NUM_ODL_SYSTEM} Get Karaf Log Types From Test Start ${ODL_SYSTEM_IP} ${test_name} ${log_types}
+ Run Keyword If 1 < ${NUM_ODL_SYSTEM} Get Karaf Log Types From Test Start ${ODL_SYSTEM_2_IP} ${test_name} ${log_types}
+ Run Keyword If 2 < ${NUM_ODL_SYSTEM} Get Karaf Log Types From Test Start ${ODL_SYSTEM_3_IP} ${test_name} ${log_types}
+
+Get ControlNode Connection
+ ${control_conn_id}= SSHLibrary.Open Connection ${OS_CONTROL_NODE_IP} prompt=${DEFAULT_LINUX_PROMPT_STRICT}
+ SSHKeywords.Flexible SSH Login ${OS_USER} ${DEVSTACK_SYSTEM_PASSWORD}
+ SSHLibrary.Set Client Configuration timeout=30s
+ [Return] ${control_conn_id}
+
+Get OvsDebugInfo
+ [Documentation] Get the OvsConfig and Flow entries from all Openstack nodes
+ Run Keyword If 0 < ${NUM_OS_SYSTEM} Get DumpFlows And Ovsconfig ${OS_CONTROL_NODE_IP}
+ Run Keyword If 1 < ${NUM_OS_SYSTEM} Get DumpFlows And Ovsconfig ${OS_COMPUTE_1_IP}
+ Run Keyword If 2 < ${NUM_OS_SYSTEM} Get DumpFlows And Ovsconfig ${OS_COMPUTE_2_IP}
+
+Get Test Teardown Debugs
+ [Arguments] ${test_name}=${TEST_NAME}
+ Get OvsDebugInfo
+ Run Keyword And Ignore Error Get Model Dump ${HA_PROXY_IP} ${netvirt_data_models}
+ Get Karaf Log Events From Test Start ${test_name}
+
+Show Debugs
+ [Arguments] @{vm_indices}
+ [Documentation] Run these commands for debugging, it can list state of VM instances and ip information in control node
+ ${devstack_conn_id}= Get ControlNode Connection
+ Switch Connection ${devstack_conn_id}
+ ${output}= Write Commands Until Prompt sudo ip netns list
+ Log ${output}
+ Close Connection
+ : FOR ${index} IN @{vm_indices}
+ \ ${rc} ${output}= Run And Return Rc And Output nova show ${index}
+ \ Log ${output}
+ \ Log ${rc}
+ List Nova VMs
+ List Networks
+ List Subnets
+ List Ports
+
+Neutron Security Group Show
+ [Arguments] ${SecurityGroupRuleName}
+ [Documentation] Displays the neutron security group configurations that belongs to a given neutron security group name
+ ${cmd}= Set Variable openstack security group show ${SecurityGroupRuleName}
+ Log ${cmd}
+ ${rc} ${output}= Run And Return Rc And Output ${cmd}
+ Log ${output}
+ Should Not Be True ${rc}
+ [Return] ${output}
+
+Neutron Port Show
+ [Arguments] ${PortName}
+ [Documentation] Display the port configuration that belong to a given neutron port
+ ${cmd}= Set Variable openstack port show ${PortName}
+ Log ${cmd}
+ ${rc} ${output}= Run And Return Rc And Output ${cmd}
+ Log ${output}
+ Should Not Be True ${rc}
+ [Return] ${output}
+
+Neutron Security Group Create
+ [Arguments] ${SecurityGroupName} ${additional_args}=${EMPTY}
+ [Documentation] Create a security group with specified name ,description & protocol value according to security group template
+ ${devstack_conn_id}= Get ControlNode Connection
+ Switch Connection ${devstack_conn_id}
+ ${cmd}= Set Variable openstack security group create ${SecurityGroupName} ${additional_args}
+ Log ${cmd}
+ ${rc} ${output}= Run And Return Rc And Output ${cmd}
+ Log ${output}
+ Should Not Be True ${rc}
+ ${sgp_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 ${sgp_id}
+ [Return] ${output} ${sgp_id}
+
+Neutron Security Group Update
+ [Arguments] ${SecurityGroupName} ${additional_args}=${EMPTY}
+ [Documentation] Updating security groups
+ ${cmd}= Set Variable openstack security group set ${SecurityGroupName} ${additional_args}
+ Log ${cmd}
+ ${rc} ${output}= Run And Return Rc And Output ${cmd}
+ Log ${output}
+ Should Not Be True ${rc}
+ [Return] ${output}
+
+Delete SecurityGroup
+ [Arguments] ${sg_name}
+ [Documentation] Delete Security group
+ ${rc} ${output}= Run And Return Rc And Output openstack security group delete ${sg_name}
+ Log ${output}
+ Should Not Be True ${rc}
+
+Neutron Security Group Rule Create
+ [Arguments] ${Security_group_name} &{Kwargs}
+ [Documentation] Creates neutron security rule with Openstack CLI 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 openstack 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}
+ ... ELSE Catenate ${cmd}
+ ${cmd}= Run Keyword If '${ethertype}'!='None' Catenate ${cmd} --ethertype ${ethertype}
+ ... ELSE Catenate ${cmd}
+ ${cmd}= Run Keyword If '${port_range_min}'!='None' and '${port_range_max}'!='None' Catenate ${cmd} --dst-port ${port_range_min}:${port_range_max}
+ ... ELSE IF '${port_range_max}'!='None' Catenate ${cmd} --dst-port ${port_range_max}
+ ... ELSE IF '${port_range_min}'!='None' Catenate ${cmd} --dst-port ${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 ${remote_group_id}
+ ... ELSE Catenate ${cmd}
+ ${cmd}= Run Keyword If '${remote_ip_prefix}'!='None' Catenate ${cmd} --src-ip ${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 Not Be True ${rc}
+ [Return] ${output} ${rule_id}
+
+Neutron Security Group Rule Create Legacy Cli
+ [Arguments] ${Security_group_name} &{Kwargs}
+ [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 Not Be True ${rc}
+ [Return] ${output} ${rule_id}
+
+Security Group Create Without Default Security Rules
+ [Arguments] ${sg_name} ${additional_args}=${EMPTY}
+ [Documentation] Create Neutron Security Group with no default rules, using specified name and optional arguments.
+ Neutron Security Group Create ${sg_name} ${additional_args}
+ Delete All Security Group Rules ${sg_name}
+
+Delete All Security Group Rules
+ [Arguments] ${sg_name}
+ [Documentation] Delete all security rules from a specified security group
+ ${rc} ${sg_rules_output}= Run And Return Rc And Output openstack security group rule list ${sg_name} -cID -fvalue
+ Log ${sg_rules_output}
+ Should Not Be True ${rc}
+ @{sg_rules}= Split String ${sg_rules_output} \n
+ : FOR ${rule} IN @{sg_rules}
+ \ ${rc} ${output}= Run And Return Rc And Output openstack security group rule delete ${rule}
+ \ Log ${output}
+ \ Should Not Be True ${rc}
+
+Create Allow All SecurityGroup
+ [Arguments] ${sg_name} ${ether_type}=IPv4
+ [Documentation] Allow all TCP/UDP/ICMP packets for this suite
+ Neutron Security Group Create ${sg_name}
+ Neutron Security Group Rule Create ${sg_name} direction=ingress ethertype=${ether_type} port_range_max=65535 port_range_min=1 protocol=tcp
+ Neutron Security Group Rule Create ${sg_name} direction=egress ethertype=${ether_type} port_range_max=65535 port_range_min=1 protocol=tcp
+ Neutron Security Group Rule Create ${sg_name} direction=ingress ethertype=${ether_type} protocol=icmp
+ Neutron Security Group Rule Create ${sg_name} direction=egress ethertype=${ether_type} protocol=icmp
+ Neutron Security Group Rule Create ${sg_name} direction=ingress ethertype=${ether_type} port_range_max=65535 port_range_min=1 protocol=udp
+ Neutron Security Group Rule Create ${sg_name} direction=egress ethertype=${ether_type} port_range_max=65535 port_range_min=1 protocol=udp
+
+Create Neutron Port With Additional Params
+ [Arguments] ${network_name} ${port_name} ${additional_args}=${EMPTY}
+ [Documentation] Create Port With given additional parameters
+ ${cmd}= Set Variable neutron -v port-create ${network_name} --name ${port_name} ${additional_args}
+ Log ${cmd}
+ ${rc} ${output}= Run And Return Rc And Output ${cmd}
+ Log ${output}
+ Should Not Be True ${rc}
+ ${port_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 ${port_id}
+ [Return] ${OUTPUT} ${port_id}
+
+Get Ports MacAddr
+ [Arguments] ${portName_list}
+ [Documentation] Retrieve the port MacAddr for the given list of port name and return the MAC address list.
+ ${MacAddr-list} Create List
+ : FOR ${portName} IN @{portName_list}
+ \ ${macAddr}= OpenStackOperations.Get Port Mac ${portName} ${devstack_conn_id}
+ \ Append To List ${MacAddr-list} ${macAddr}
+ [Return] ${MacAddr-list}
+
+Get Port Ip
+ [Arguments] ${port_name}
+ [Documentation] Keyword would return the IP of the ${port_name} received.
+ ${rc} ${output}= Run And Return Rc And Output openstack port list | grep "${port_name}" | awk -F\\' '{print $2}'
+ Log ${output}
+ ${splitted_output}= Split String ${output} ${EMPTY}
+ ${port_ip}= Get from List ${splitted_output} 0
+ Log ${port_ip}
+ Should Not Be True ${rc}
+ [Return] ${port_ip}
+
+Get Port Mac
+ [Arguments] ${port_name} ${conn_id}=${devstack_conn_id}
+ [Documentation] Keyword would return the MAC ID of the ${port_name} received.
+ ${rc} ${output}= Run And Return Rc And Output openstack port show ${port_name} | grep mac_address | awk '{print $4}'
+ Log ${output}
+ ${splitted_output}= Split String ${output} ${EMPTY}
+ ${port_mac}= Get from List ${splitted_output} 0
+ Log ${port_mac}
+ Should Not Be True ${rc}
+ [Return] ${port_mac}
+
+Create L2Gateway
+ [Arguments] ${bridge_name} ${intf_name} ${gw_name}
+ [Documentation] Keyword to create an L2 Gateway ${gw_name} for bridge ${bridge_name} connected to interface ${intf_name} (Using Neutron CLI).
+ ${rc} ${l2gw_output}= Run And Return Rc And Output ${L2GW_CREATE} name=${bridge_name},interface_names=${intf_name} ${gw_name}
+ Log ${l2gw_output}
+ [Return] ${l2gw_output}
+
+Create L2Gateway Connection
+ [Arguments] ${gw_name} ${net_name}
+ [Documentation] Keyword would create a new L2 Gateway Connection for ${gw_name} to ${net_name} (Using Neutron CLI).
+ ${rc} ${l2gw_output}= Run And Return Rc And Output ${L2GW_CONN_CREATE} ${gw_name} ${net_name}
+ Log ${l2gw_output}
+ Should Not Be True ${rc}
+ [Return] ${l2gw_output}
+
+Get All L2Gateway
+ [Documentation] Keyword to return all the L2 Gateways available (Using Neutron CLI).
+ ${rc} ${output}= Run And Return Rc And Output ${L2GW_GET_YAML}
+ Should Not Be True ${rc}
+ [Return] ${output}
+
+Get All L2Gateway Connection
+ [Documentation] Keyword to return all the L2 Gateway connections available (Using Neutron CLI).
+ ${rc} ${output}= Run And Return Rc And Output ${L2GW_GET_CONN_YAML}
+ Should Not Be True ${rc}
+ [Return] ${output}
+
+Get L2Gateway
+ [Arguments] ${gw_id}
+ [Documentation] Keyword to check if the ${gw_id} is available in the L2 Gateway list (Using Neutron CLI).
+ ${rc} ${output}= Run And Return Rc And Output ${L2GW_SHOW} ${gw_id}
+ Log ${output}
+ Should Not Be True ${rc}
+ [Return] ${output}
+
+Get L2gw Id
+ [Arguments] ${l2gw_name}
+ [Documentation] Keyword to retrieve the L2 Gateway ID for the ${l2gw_name} (Using Neutron CLI).
+ ${rc} ${output}= Run And Return Rc And Output ${L2GW_GET} | grep "${l2gw_name}" | awk '{print $2}'
+ Log ${output}
+ Should Not Be True ${rc}
+ ${splitted_output}= Split String ${output} ${EMPTY}
+ ${l2gw_id}= Get from List ${splitted_output} 0
+ Log ${l2gw_id}
+ [Return] ${l2gw_id}
+
+Get L2gw Connection Id
+ [Arguments] ${l2gw_name}
+ [Documentation] Keyword to retrieve the L2 Gateway Connection ID for the ${l2gw_name} (Using Neutron CLI).
+ ${l2gw_id}= OpenStackOperations.Get L2gw Id ${l2gw_name}
+ ${rc} ${output}= Run And Return Rc And Output ${L2GW_GET_CONN} | grep "${l2gw_id}" | awk '{print $2}'