Add VXLAN scale perf tests
[csit.git] / resources / libraries / robot / ip / ip4.robot
1 # Copyright (c) 2016 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13 *** Settings ***
14 | Resource | resources/libraries/robot/shared/default.robot
15 | Resource | resources/libraries/robot/shared/counters.robot
16 | Library | resources.libraries.python.IPv4Util.IPv4Util
17 | Library | resources.libraries.python.IPv4Setup.IPv4Setup
18 | Library | resources.libraries.python.NodePath
19 | Library | resources.libraries.python.Routing
20 | Library | resources.libraries.python.TrafficScriptExecutor
21 | Library | resources.libraries.python.InterfaceUtil
22 | Variables | resources/libraries/python/IPv4NodeAddress.py | ${nodes}
23
24 *** Keywords ***
25
26 | Show IP FIB On All DUTs
27 | | [Documentation] | Show IP FIB on all DUTs.
28 | | ...
29 | | ${duts}= | Get Matches | ${nodes} | DUT*
30 | | :FOR | ${dut} | IN | @{duts}
31 | | | VPP Show IP Table | ${nodes['${dut}']}
32
33 | Configure IPv4 addresses on all DUTs
34 | | [Documentation] | Setup IPv4 address on all DUTs in topology
35 | | [Arguments] | ${nodes} | ${nodes_addr}
36 | | ${interfaces}= | VPP nodes set ipv4 addresses | ${nodes} | ${nodes_addr}
37 | | :FOR | ${interface} | IN | @{interfaces}
38 | | | Set Interface State | @{interface} | up | if_type=name
39
40 | Configure routes for IPv4 test
41 | | [Documentation] | Setup routing on all VPP nodes required for IPv4 tests
42 | | [Arguments] | ${nodes} | ${nodes_addr}
43 | | Append Nodes | ${nodes['DUT1']} | ${nodes['DUT2']}
44 | | Compute Path
45 | | ${tg}= | Set Variable | ${nodes['TG']}
46 | | ${dut1_if} | ${dut1}= | First Interface
47 | | ${dut2_if} | ${dut2}= | Last Interface
48 | | ${dut1_if_addr}= | Get IPv4 address of node "${dut1}" interface "${dut1_if}" from "${nodes_addr}"
49 | | ${dut2_if_addr}= | Get IPv4 address of node "${dut2}" interface "${dut2_if}" from "${nodes_addr}"
50 | | @{tg_dut1_links}= | Get active links connecting "${tg}" and "${dut1}"
51 | | @{tg_dut2_links}= | Get active links connecting "${tg}" and "${dut2}"
52 | | :FOR | ${link} | IN | @{tg_dut1_links}
53 | | | ${net}= | Get Link Address | ${link} | ${nodes_addr}
54 | | | ${prefix}= | Get Link Prefix | ${link} | ${nodes_addr}
55 | | | Vpp Route Add | ${dut2} | ${net} | ${prefix} | ${dut1_if_addr} | ${dut2_if}
56 | | :FOR | ${link} | IN | @{tg_dut2_links}
57 | | | ${net}= | Get Link Address | ${link} | ${nodes_addr}
58 | | | ${prefix}= | Get Link Prefix | ${link} | ${nodes_addr}
59 | | | Vpp Route Add | ${dut1} | ${net} | ${prefix} | ${dut2_if_addr} | ${dut1_if}
60
61 | Configure DUT nodes for IPv4 testing
62 | | Configure IPv4 addresses on all DUTs | ${nodes} | ${nodes_ipv4_addr}
63 | | Setup ARP on all DUTs | ${nodes} | ${nodes_ipv4_addr}
64 | | Configure routes for IPv4 test | ${nodes} | ${nodes_ipv4_addr}
65 | | All Vpp Interfaces Ready Wait | ${nodes}
66
67 | Route traffic from interface '${from_port}' on node '${from_node}' to interface '${to_port}' on node '${to_node}' '${hops}' hops away using IPv4
68 | | ${src_ip}= | Get IPv4 address of node "${from_node}" interface "${from_port}" from "${nodes_ipv4_addr}"
69 | | ${dst_ip}= | Get IPv4 address of node "${to_node}" interface "${to_port}" from "${nodes_ipv4_addr}"
70 | | ${src_mac}= | Get interface mac | ${from_node} | ${from_port}
71 | | ${dst_mac}= | Get interface mac | ${to_node} | ${to_port}
72 | | ${is_dst_tg}= | Is TG node | ${to_node}
73 | | ${adj_node} | ${adj_int}= | Get adjacent node and interface | ${nodes} | ${from_node} | ${from_port}
74 | | ${from_port_name}= | Get interface name | ${from_node} | ${from_port}
75 | | ${to_port_name}= | Get interface name | ${to_node} | ${to_port}
76 | | ${adj_int_mac}= | Get interface MAC | ${adj_node} | ${adj_int}
77 | | ${args}= | Traffic Script Gen Arg | ${to_port_name} | ${from_port_name} | ${src_mac}
78 | |          | ...                    | ${dst_mac} | ${src_ip} | ${dst_ip}
79 | | ${args}= | Catenate | ${args} | --hops ${hops} | --first_hop_mac ${adj_int_mac}
80 | |          | ...      | --is_dst_tg ${is_dst_tg}
81 | | Run Traffic Script On Node | ipv4_ping_ttl_check.py | ${from_node} | ${args}
82
83 | Execute IPv4 ICMP echo sweep
84 | | [Documentation] | Type of the src_node must be TG and dst_node must be DUT
85 | | [Arguments] | ${src_node} | ${dst_node} | ${start_size} | ${end_size} | ${step}
86 | | Append Nodes | ${src_node} | ${dst_node}
87 | | Compute Path
88 | | ${src_port} | ${src_node}= | First Interface
89 | | ${dst_port} | ${dst_node}= | Last Interface
90 | | ${src_ip}= | Get IPv4 address of node "${src_node}" interface "${src_port}" from "${nodes_ipv4_addr}"
91 | | ${dst_ip}= | Get IPv4 address of node "${dst_node}" interface "${dst_port}" from "${nodes_ipv4_addr}"
92 | | ${src_mac}= | Get Interface Mac | ${src_node} | ${src_port}
93 | | ${dst_mac}= | Get Interface Mac | ${dst_node} | ${dst_port}
94 | | ${src_port_name}= | Get interface name | ${src_node} | ${src_port}
95 | | ${args}= | Traffic Script Gen Arg | ${src_port_name} | ${src_port_name}
96 | |          | ... | ${src_mac} | ${dst_mac} | ${src_ip} | ${dst_ip}
97 | | ${args}= | Set Variable
98 | | ... | ${args} --start_size ${start_size} --end_size ${end_size} --step ${step}
99 | | Run Traffic Script On Node | ipv4_sweep_ping.py | ${src_node} | ${args}
100 | | ... | timeout=${180}
101
102 | Send ARP request and verify response
103 | | [Arguments] | ${tg_node} | ${vpp_node}
104 | | ${link_name}= | Get first active connecting link between node "${tg_node}" and "${vpp_node}"
105 | | ${src_if}= | Get interface by link name | ${tg_node} | ${link_name}
106 | | ${dst_if}= | Get interface by link name | ${vpp_node} | ${link_name}
107 | | ${src_ip}= | Get IPv4 address of node "${tg_node}" interface "${src_if}" from "${nodes_ipv4_addr}"
108 | | ${dst_ip}= | Get IPv4 address of node "${vpp_node}" interface "${dst_if}" from "${nodes_ipv4_addr}"
109 | | ${src_mac}= | Get node link mac | ${tg_node} | ${link_name}
110 | | ${dst_mac}= | Get node link mac | ${vpp_node} | ${link_name}
111 | | ${src_if_name}= | Get interface name | ${tg_node} | ${src_if}
112 | | ${args}= | Traffic Script Gen Arg | ${src_if_name} | ${src_if_name} | ${src_mac}
113 | |          | ...                    | ${dst_mac} | ${src_ip} | ${dst_ip}
114 | | Run Traffic Script On Node | arp_request.py | ${tg_node} | ${args}
115
116 | Configure IP addresses on interfaces
117 | | [Documentation] | Iterates through @{args} list and Set Interface Address
118 | | ... | for every (${dut_node}, ${interface}, ${address},
119 | | ... | ${prefix}) tuple.
120 | | ...
121 | | ... | *Arguments:*
122 | | ... | - ${dut_node} - Node where IP address should be set to.
123 | | ... | Type: dictionary
124 | | ... | - ${interface} - Interface name. Type: string
125 | | ... | - ${address} - IP address. Type: string
126 | | ... | - ${prefix} - Prefix length. Type: integer
127 | | ...
128 | | ... | *Example:*
129 | | ...
130 | | ... | \| Configure IP addresses on interfaces \
131 | | ... | \| ${dut1_node} \| ${dut1_to_dut2} \| 192.168.1.1 \| 24 \|
132 | | ... | \| ... \| ${dut1_node} \| ${dut1_to_tg}   \| 192.168.2.1 \| 24 \|
133 | | ...
134 | | [Arguments] | @{args}
135 | | :FOR | ${dut_node} | ${interface} | ${address} | ${prefix} | IN | @{args}
136 | | | Set Interface Address | ${dut_node} | ${interface} | ${address}
137 | | | ... | ${prefix}
138
139 | Send ICMP echo request and verify answer
140 | | [Documentation] | Run traffic script that waits for ICMP reply and ignores
141 | | ... | all other packets.
142 | | ...
143 | | ... | *Arguments:*
144 | | ... | - tg_node - TG node where run traffic script. Type: dictionary
145 | | ... | - tg_interface - TG interface where send ICMP echo request.
146 | | ... | Type: string
147 | | ... | - dst_mac - Destination MAC address. Type: string
148 | | ... | - src_mac - Source MAC address. Type: string
149 | | ... | - dst_ip - Destination IP address. Type: string
150 | | ... | - src_ip - Source IP address. Type: string
151 | | ... | - timeout - Wait timeout in seconds (Default: 10). Type: integer
152 | | ...
153 | | ... | *Example:*
154 | | ...
155 | | ... | \| Send ICMP echo request and verify answer \
156 | | ... | \| ${nodes['TG']} \| eth2 \
157 | | ... | \| 08:00:27:46:2b:4c \| 08:00:27:66:b8:57 \
158 | | ... | \| 192.168.23.10 \| 192.168.23.1 \| 10 \|
159 | | ...
160 | | [Arguments] | ${tg_node} | ${tg_interface}
161 | | ... | ${dst_mac} | ${src_mac} | ${dst_ip} | ${src_ip} | ${timeout}=${10}
162 | | ${tg_interface_name}= | Get interface name | ${tg_node} | ${tg_interface}
163 | | ${args}= | Catenate | --rx_if | ${tg_interface_name} | --tx_if | ${tg_interface_name}
164 | | ... | --dst_mac | ${dst_mac} | --src_mac | ${src_mac}
165 | | ... | --dst_ip | ${dst_ip} | --src_ip | ${src_ip} | --timeout | ${timeout}
166 | | Run Traffic Script On Node | send_icmp_wait_for_reply.py
167 | | ... | ${tg_node} | ${args}