diff options
author | Filip Tehlar <ftehlar@cisco.com> | 2016-02-17 06:59:08 -0800 |
---|---|---|
committer | Filip Tehlar <ftehlar@cisco.com> | 2016-02-17 07:01:28 -0800 |
commit | da15035461569ea175aabbac1df735cd5598b0b3 (patch) | |
tree | 39cb6be4f0082c8032f8f455bdd2057a6403baea /resources/libraries/robot | |
parent | da23519d72dc9415b112f7bab1fd3617750fa79e (diff) |
Refactor IPv4 utils
Change-Id: Iae12444efba33e2d37b5d7beb1620e859abd84d7
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'resources/libraries/robot')
-rw-r--r-- | resources/libraries/robot/ipv4.robot | 48 | ||||
-rw-r--r-- | resources/libraries/robot/l2_xconnect.robot | 11 |
2 files changed, 31 insertions, 28 deletions
diff --git a/resources/libraries/robot/ipv4.robot b/resources/libraries/robot/ipv4.robot index b5f313df89..a5745a8ce0 100644 --- a/resources/libraries/robot/ipv4.robot +++ b/resources/libraries/robot/ipv4.robot @@ -13,31 +13,26 @@ *** Settings *** | Resource | resources/libraries/robot/default.robot | Resource | resources/libraries/robot/counters.robot -| Library | resources.libraries.python.IPv4Util +| Library | resources.libraries.python.IPv4Util.IPv4Util +| Library | resources.libraries.python.IPv4Setup.IPv4Setup | Library | resources.libraries.python.TrafficScriptExecutor -| Variables | resources/libraries/python/IPv4NodeAddress.py +| Variables | resources/libraries/python/IPv4NodeAddress.py | ${nodes} *** Keywords *** | Setup IPv4 adresses on all DUT nodes in topology | | [Documentation] | Setup IPv4 address on all DUTs in topology | | [Arguments] | ${nodes} | ${nodes_addr} -| | DUT 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']}" +| | ${gateway}= | Get IPv4 address of node "${nodes['DUT2']}" interface "${nodes['DUT2']['interfaces']['port3']['name']}" from "${nodes_ipv4_addr}" +| | ${subnet} = | Get IPv4 subnet of node "${nodes['DUT2']}" interface "${nodes['DUT2']['interfaces']['port1']['name']}" from "${nodes_ipv4_addr}" +| | ${prefix_length} = | Get IPv4 address prefix of node "${nodes['DUT2']}" interface "${nodes['DUT2']['interfaces']['port1']['name']}" from "${nodes_ipv4_addr}" | | 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']}" +| | ${gateway} = | Get IPv4 address of node "${nodes['DUT1']}" interface "${nodes['DUT1']['interfaces']['port3']['name']}" from "${nodes_ipv4_addr}" +| | ${subnet} = | Get IPv4 subnet of node "${nodes['DUT1']}" interface "${nodes['DUT1']['interfaces']['port1']['name']}" from "${nodes_ipv4_addr}" +| | ${prefix_length} = | Get IPv4 address prefix of node "${nodes['DUT1']}" interface "${nodes['DUT1']['interfaces']['port1']['name']}" from "${nodes_ipv4_addr}" | | Node "${nodes['DUT2']}" routes to IPv4 network "${subnet}" with prefix length "${prefix_length}" using interface "${nodes['DUT2']['interfaces']['port3']['name']}" via "${gateway}" | Setup DUT nodes for IPv4 testing @@ -47,22 +42,31 @@ | | Routes are set up for IPv4 testing | Setup nodes for IPv4 testing -| | Interfaces needed for IPv4 testing are in "up" state | | Setup IPv4 adresses on all DUT nodes in topology | ${nodes} | ${nodes_ipv4_addr} -| | Setup ARP on all DUTs | ${nodes} +| | Setup ARP on all DUTs | ${nodes} | ${nodes_ipv4_addr} | | Routes are set up for IPv4 testing | 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 in topology "${nodes}" 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}" +| | ${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_defined ${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}" -| | ${dst_ip}= | Get IPv4 address of node "${dst_node}" interface "${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} @@ -78,8 +82,8 @@ | | ${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}" -| | ${dst_ip}= | Get IPv4 address of node "${vpp_node}" interface "${dst_if}" +| | ${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} diff --git a/resources/libraries/robot/l2_xconnect.robot b/resources/libraries/robot/l2_xconnect.robot index 2603863c91..f42c748970 100644 --- a/resources/libraries/robot/l2_xconnect.robot +++ b/resources/libraries/robot/l2_xconnect.robot @@ -17,7 +17,7 @@ | Library | resources.libraries.python.CrossConnectSetup | Library | resources.libraries.python.topology.Topology | Library | resources.libraries.python.TrafficScriptExecutor -| Library | resources.libraries.python.IPv4Util +| Library | resources.libraries.python.InterfaceUtil.InterfaceUtil | Variables | resources/libraries/python/constants.py *** Keywords *** @@ -52,8 +52,7 @@ | Interfaces on all DUTs 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 - +| | Set interface state | ${nodes['DUT1']} | ${nodes['DUT1']['interfaces']['port1']['name']} | ${state} +| | Set interface state | ${nodes['DUT1']} | ${nodes['DUT1']['interfaces']['port3']['name']} | ${state} +| | Set interface state | ${nodes['DUT2']} | ${nodes['DUT2']['interfaces']['port1']['name']} | ${state} +| | Set interface state | ${nodes['DUT2']} | ${nodes['DUT2']['interfaces']['port3']['name']} | ${state} |