X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Flibraries%2Frobot%2Fipv4.robot;h=d122932c8956d453edc325a3ff3b7e324761ee51;hp=a4e1086d386ca33ff92e6926291390101d3e55c5;hb=c8d76a16533edac586a98d2842932804709fea30;hpb=33499c81c94c2d3baef9d3e9f061cd76ef86fa74 diff --git a/resources/libraries/robot/ipv4.robot b/resources/libraries/robot/ipv4.robot index a4e1086d38..d122932c89 100644 --- a/resources/libraries/robot/ipv4.robot +++ b/resources/libraries/robot/ipv4.robot @@ -13,39 +13,89 @@ *** Settings *** | Resource | resources/libraries/robot/default.robot | Resource | resources/libraries/robot/counters.robot -| Library | resources/libraries/python/IPv4Util.py -| Variables | resources/libraries/python/IPv4NodeAddress.py +| Library | resources.libraries.python.IPv4Util.IPv4Util +| Library | resources.libraries.python.IPv4Setup.IPv4Setup +| Library | resources.libraries.python.NodePath +| Library | resources.libraries.python.Routing +| Library | resources.libraries.python.TrafficScriptExecutor +| Library | resources.libraries.python.InterfaceUtil +| Variables | resources/libraries/python/IPv4NodeAddress.py | ${nodes} *** Keywords *** -| Setup IPv4 adresses on all nodes in topology -| | [Documentation] | Setup IPv4 address on all DUTs and TG in topology +| Setup IPv4 adresses on all DUT nodes in topology +| | [Documentation] | Setup IPv4 address on all DUTs in topology | | [Arguments] | ${nodes} | ${nodes_addr} -| | Nodes setup IPv4 addresses | ${nodes} | ${nodes_addr} - -| Interfaces needed for IPv4 testing are in "${state}" state -| | Node "${nodes['DUT1']}" interface "${nodes['DUT1']['interfaces']['port1']['name']}" is in "${state}" state -| | Node "${nodes['DUT1']}" interface "${nodes['DUT1']['interfaces']['port3']['name']}" is in "${state}" state -| | Node "${nodes['DUT2']}" interface "${nodes['DUT2']['interfaces']['port1']['name']}" is in "${state}" state -| | Node "${nodes['DUT2']}" interface "${nodes['DUT2']['interfaces']['port3']['name']}" is in "${state}" state +| | VPP nodes setup ipv4 addresses | ${nodes} | ${nodes_addr} | Routes are set up for IPv4 testing -| | ${gateway} = | Get IPv4 address of node "${nodes['DUT2']}" interface "${nodes['DUT2']['interfaces']['port3']['name']}" -| | ${subnet} = | Get IPv4 subnet of node "${nodes['DUT2']}" interface "${nodes['DUT2']['interfaces']['port1']['name']}" -| | ${prefix_length} = | Get IPv4 address prefix of node "${nodes['DUT2']}" interface "${nodes['DUT2']['interfaces']['port1']['name']}" -| | Node "${nodes['DUT1']}" routes to IPv4 network "${subnet}" with prefix length "${prefix_length}" using interface "${nodes['DUT1']['interfaces']['port3']['name']}" via "${gateway}" -| | ${gateway} = | Get IPv4 address of node "${nodes['DUT1']}" interface "${nodes['DUT1']['interfaces']['port3']['name']}" -| | ${subnet} = | Get IPv4 subnet of node "${nodes['DUT1']}" interface "${nodes['DUT1']['interfaces']['port1']['name']}" -| | ${prefix_length} = | Get IPv4 address prefix of node "${nodes['DUT1']}" interface "${nodes['DUT1']['interfaces']['port1']['name']}" -| | Node "${nodes['DUT2']}" routes to IPv4 network "${subnet}" with prefix length "${prefix_length}" using interface "${nodes['DUT2']['interfaces']['port3']['name']}" via "${gateway}" - -| Setup nodes for IPv4 testing -| | Interfaces needed for IPv4 testing are in "up" state -| | Setup IPv4 adresses on all nodes in topology | ${nodes} | ${nodes_ipv4_addr} -| | Routes are set up for IPv4 testing +| | [Documentation] | Setup routing on all VPP nodes required for IPv4 tests +| | [Arguments] | ${nodes} | ${nodes_addr} +| | Append Nodes | ${nodes['DUT1']} | ${nodes['DUT2']} +| | Compute Path +| | ${tg}= | Set Variable | ${nodes['TG']} +| | ${dut1_if} | ${dut1}= | First Interface +| | ${dut2_if} | ${dut2}= | Last Interface +| | ${dut1_if_addr}= | Get IPv4 address of node "${dut1}" interface "${dut1_if}" from "${nodes_addr}" +| | ${dut2_if_addr}= | Get IPv4 address of node "${dut2}" interface "${dut2_if}" from "${nodes_addr}" +| | @{tg_dut1_links}= | Get active links connecting "${tg}" and "${dut1}" +| | @{tg_dut2_links}= | Get active links connecting "${tg}" and "${dut2}" +| | :FOR | ${link} | IN | @{tg_dut1_links} +| | | ${net}= | Get Link Address | ${link} | ${nodes_addr} +| | | ${prefix}= | Get Link Prefix | ${link} | ${nodes_addr} +| | | Vpp Route Add | ${dut2} | ${net} | ${prefix} | ${dut1_if_addr} | ${dut2_if} +| | :FOR | ${link} | IN | @{tg_dut2_links} +| | | ${net}= | Get Link Address | ${link} | ${nodes_addr} +| | | ${prefix}= | Get Link Prefix | ${link} | ${nodes_addr} +| | | Vpp Route Add | ${dut1} | ${net} | ${prefix} | ${dut2_if_addr} | ${dut1_if} + +| Setup DUT nodes for IPv4 testing +| | Setup IPv4 adresses on all DUT nodes in topology | ${nodes} | ${nodes_ipv4_addr} +| | Setup ARP on all DUTs | ${nodes} | ${nodes_ipv4_addr} +| | Routes are set up for IPv4 testing | ${nodes} | ${nodes_ipv4_addr} +| | All Vpp Interfaces Ready Wait | ${nodes} | TG interface "${tg_port}" can route to node "${node}" interface "${port}" "${hops}" hops away using IPv4 | | Node "${nodes['TG']}" interface "${tg_port}" can route to node "${node}" interface "${port}" "${hops}" hops away using IPv4 -| Node "${from_node}" interface "${from_port}" can route to node "${to_node}" interface "${to_port}" "${hops}" hops away using IPv4 -| | After ping is sent from node "${from_node}" interface "${from_port}" with destination IPv4 address of node "${to_node}" interface "${to_port}" a ping response arrives and TTL is decreased by "${hops}" +| Node "${from_node}" interface "${from_port}" can route to node "${to_node}" interface "${to_port}" ${hops} hops away using IPv4 +| | ${src_ip}= | Get IPv4 address of node "${from_node}" interface "${from_port}" from "${nodes_ipv4_addr}" +| | ${dst_ip}= | Get IPv4 address of node "${to_node}" interface "${to_port}" from "${nodes_ipv4_addr}" +| | ${src_mac}= | Get interface mac | ${from_node} | ${from_port} +| | ${dst_mac}= | Get interface mac | ${to_node} | ${to_port} +| | ${is_dst_tg}= | Is TG node | ${to_node} +| | ${adj_node} | ${adj_int}= | Get adjacent node and interface | ${nodes} | ${from_node} | ${from_port} +| | ${args}= | Traffic Script Gen Arg | ${to_port} | ${from_port} | ${src_mac} +| | | ... | ${dst_mac} | ${src_ip} | ${dst_ip} +| | ${args}= | Catenate | ${args} | --hops ${hops} | --first_hop_mac ${adj_int['mac_address']} +| | | ... | --is_dst_tg ${is_dst_tg} +| | Run Traffic Script On Node | ipv4_ping_ttl_check.py | ${from_node} | ${args} + +| Ipv4 icmp echo sweep +| | [Documentation] | Type of the src_node must be TG and dst_node must be DUT +| | [Arguments] | ${src_node} | ${dst_node} | ${src_port} | ${dst_port} +| | ${src_ip}= | Get IPv4 address of node "${src_node}" interface "${src_port}" from "${nodes_ipv4_addr}" +| | ${dst_ip}= | Get IPv4 address of node "${dst_node}" interface "${dst_port}" from "${nodes_ipv4_addr}" +| | ${src_mac}= | Get Interface Mac | ${src_node} | ${src_port} +| | ${dst_mac}= | Get Interface Mac | ${dst_node} | ${dst_port} +| | ${args}= | Traffic Script Gen Arg | ${src_port} | ${src_port} | ${src_mac} +| | | ... | ${dst_mac} | ${src_ip} | ${dst_ip} +| # TODO: end_size is currently minimum MTU size for Ethernet minus IPv4 and +| # ICMP echo header size (1500 - 20 - 8), +| # MTU info is not in VAT sw_interface_dump output +| | ${args}= | Set Variable | ${args} --start_size 1 --end_size 1472 --step 1 +| | Run Traffic Script On Node | ipv4_sweep_ping.py | ${src_node} | ${args} + +| Send ARP request and validate response +| | [Arguments] | ${tg_node} | ${vpp_node} +| | ${link_name}= | Get first active connecting link between node "${tg_node}" and "${vpp_node}" +| | ${src_if}= | Get interface by link name | ${tg_node} | ${link_name} +| | ${dst_if}= | Get interface by link name | ${vpp_node} | ${link_name} +| | ${src_ip}= | Get IPv4 address of node "${tg_node}" interface "${src_if}" from "${nodes_ipv4_addr}" +| | ${dst_ip}= | Get IPv4 address of node "${vpp_node}" interface "${dst_if}" from "${nodes_ipv4_addr}" +| | ${src_mac}= | Get node link mac | ${tg_node} | ${link_name} +| | ${dst_mac}= | Get node link mac | ${vpp_node} | ${link_name} +| | ${args}= | Traffic Script Gen Arg | ${src_if} | ${src_if} | ${src_mac} +| | | ... | ${dst_mac} | ${src_ip} | ${dst_ip} +| | Run Traffic Script On Node | arp_request.py | ${tg_node} | ${args} +