d0b01f690730973d069c3030b38f175bdb81b822
[csit.git] / tests / func / ipfix / ipfix_ipv4.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
14 *** Settings ***
15 | Resource | resources/libraries/robot/default.robot
16 | Resource | resources/libraries/robot/interfaces.robot
17 | Resource | resources/libraries/robot/testing_path.robot
18 | Resource | resources/libraries/robot/ipv4.robot
19 | Resource | resources/libraries/robot/ipfix.robot
20 | Library | resources.libraries.python.Classify.Classify
21 | Library | resources.libraries.python.IPFIXSetup
22 | Library | resources.libraries.python.Trace
23
24 | Force Tags | HW_ENV | VM_ENV | 3_NODE_SINGLE_LINK_TOPO | EXPECTED_FAILING
25 # TODO: Remove EXPECTED_FAILING tag once functionality is implemented (VPP-204)
26 | Suite Setup | Run Keywords | Setup all TGs before traffic script
27 | ...         | AND          | Update All Interface Data On All Nodes | ${nodes}
28 | Test Setup | Setup all DUTs before test
29 | Test Teardown | Run Keywords | Show packet trace on all DUTs | ${nodes}
30 | ...           | AND          | Vpp Show Errors | ${nodes['DUT1']}
31 | ...           | AND          | Show vpp trace dump on all DUTs
32 | Documentation | *IPFIX ipv4 test cases*
33 | ...
34 | ... | IPFIX tests use 3-node topology TG - DUT1 - DUT2 - TG with
35 | ... | one link between the nodes. DUT1 is configured with IPv4
36 | ... | routing and static routes. IPFIX is configured on DUT1 with
37 | ... | DUT1->TG interface as collector. Test packets are
38 | ... | sent from TG to DUT1. TG listens for flow report packets
39 | ... | and verifies that they contains flow record of test packets sent.
40
41 *** Variables ***
42 | ${dut1_to_tg_ip}= | 192.168.1.1
43 | ${dut2_to_dut1_ip}= | 192.168.2.1
44 | ${tg_to_dut1_ip}= | 16.0.0.1
45 | ${prefix_length}= | 24
46 | ${ip_version}= | ip4
47 | ${port}= | 80
48 | ${sessions}= | 80
49
50 *** Test Cases ***
51 | TC01: DUT sends IPFIX template and data packets
52 | | [Documentation]
53 | | ... | [Top] TG-DUT1-DUT2-TG. [Cfg] On DUT1 configure IPFIX with TG interface
54 | | ... | address as collector and a basic classify session.
55 | | ... | [Ver] Make TG listen for IPFIX template and data packets, verify
56 | | ... | that packet is received and correct. No packets are sent from TG.
57 | | ... | [Ref] RFC 7011
58 | | Given Path for 3-node testing is set
59 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
60 | | And Interfaces in 3-node path are up
61 | | And Set Interface Address | ${dut1_node}
62 | | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length}
63 | | And Add ARP on DUT | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip}
64 | | ... | ${tg_to_dut1_mac}
65 | | ${table_index} | ${skip_n} | ${match_n}=
66 | | ... | And VPP creates classify table L3 | ${dut1_node} | ${ip_version} | src
67 | | And VPP configures classify session L3 | ${dut1_node} | permit
68 | | ... | ${table_index} | ${skip_n} | ${match_n} | ${ip_version} | src
69 | | ... | ${tg_to_dut1_ip}
70 | | When Assign interface to flow table | ${dut1_node} | ${dut1_to_tg}
71 | | ... | ${table_index} | ip_version=${ip_version}
72 | | And Setup IPFIX exporter | ${dut1_node} | ${tg_to_dut1_ip}
73 | | ... | ${dut1_to_tg_ip} | interval=5
74 | | And Set IPFIX stream | ${dut1_node} | ${1}
75 | | And Assign classify table to exporter | ${dut1_node} | ${table_index}
76 | | ... | ${ip_version}
77 | | Then Send packets and verify IPFIX | ${tg_node} | ${dut1_node}
78 | | ... | ${tg_to_dut1} | ${dut1_to_tg} | ${tg_to_dut1_ip} | ${dut1_to_tg_ip}
79 | | ... | count=0
80
81 | TC02: DUT reports packet flow for traffic by source address
82 | | [Documentation]
83 | | ... | [Top] TG-DUT1-DUT2-TG. [Cfg] On DUT1 configure IPFIX with TG interface
84 | | ... | address as collector and add classify session with TG source address.
85 | | ... | [Ver] Make TG send a packet to DUT1, then listen for IPFIX template
86 | | ... | and data packets, verify that IPFIX reported the received packet.
87 | | ... | [Ref] RFC 7011
88 | | Given Path for 3-node testing is set
89 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
90 | | And Interfaces in 3-node path are up
91 | | And Set Interface Address | ${dut1_node}
92 | | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length}
93 | | And Add ARP on DUT | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip}
94 | | ... | ${tg_to_dut1_mac}
95 | | ${table_index} | ${skip_n} | ${match_n}=
96 | | ... | And VPP creates classify table L3 | ${dut1_node} | ${ip_version} | src
97 | | And VPP configures classify session L3 | ${dut1_node} | permit
98 | | ... | ${table_index} | ${skip_n} | ${match_n} | ${ip_version} | src
99 | | ... | ${tg_to_dut1_ip}
100 | | When Assign interface to flow table | ${dut1_node} | ${dut1_to_tg}
101 | | ... | ${table_index} | ip_version=${ip_version}
102 | | And Setup IPFIX exporter | ${dut1_node} | ${tg_to_dut1_ip}
103 | | ... | ${dut1_to_tg_ip} | interval=5
104 | | And Set IPFIX stream | ${dut1_node} | ${1}
105 | | And Assign classify table to exporter | ${dut1_node} | ${table_index}
106 | | ... | ${ip_version}
107 | | Then Send packets and verify IPFIX | ${tg_node} | ${dut1_node}
108 | | ... | ${tg_to_dut1} | ${dut1_to_tg} | ${tg_to_dut1_ip} | ${dut1_to_tg_ip}
109
110 | TC03: DUT reports packet flow for traffic with local destination address
111 | | [Documentation]
112 | | ... | [Top] TG-DUT1-DUT2-TG. [Cfg] On DUT1 configure IPFIX with TG interface
113 | | ... | address as collector and add classify session with destination
114 | | ... | address of DUT1.
115 | | ... | [Ver] Make TG send a packet to DUT1, then listen for IPFIX template
116 | | ... | and data packets, verify that IPFIX reported the received packet.
117 | | ... | [Ref] RFC 7011
118 | | Given Path for 3-node testing is set
119 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
120 | | And Interfaces in 3-node path are up
121 | | And Set Interface Address | ${dut1_node}
122 | | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length}
123 | | And Add ARP on DUT | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip}
124 | | ... | ${tg_to_dut1_mac}
125 | | ${table_index} | ${skip_n} | ${match_n}=
126 | | ... | And VPP creates classify table L3 | ${dut1_node} | ${ip_version} | dst
127 | | And VPP configures classify session L3 | ${dut1_node} | permit
128 | | ... | ${table_index} | ${skip_n} | ${match_n} | ${ip_version} | dst
129 | | ... | ${dut1_to_tg_ip}
130 | | When Assign interface to flow table | ${dut1_node} | ${dut1_to_tg}
131 | | ... | ${table_index} | ip_version=${ip_version}
132 | | And Setup IPFIX exporter | ${dut1_node} | ${tg_to_dut1_ip}
133 | | ... | ${dut1_to_tg_ip} | interval=5
134 | | And Set IPFIX stream | ${dut1_node} | ${1}
135 | | And Assign classify table to exporter | ${dut1_node} | ${table_index}
136 | | ... | ${ip_version}
137 | | Then Send packets and verify IPFIX | ${tg_node} | ${dut1_node}
138 | | ... | ${tg_to_dut1} | ${dut1_to_tg} | ${tg_to_dut1_ip} | ${dut1_to_tg_ip}
139
140 | TC04: DUT reports packet flow for traffic with remote destination address
141 | | [Documentation]
142 | | ... | [Top] TG-DUT1-DUT2-TG. [Cfg] On DUT1 configure IPFIX with TG interface
143 | | ... | address as collector and add classify session with destination
144 | | ... | address of DUT2.
145 | | ... | [Ver] Make TG send a packet to DUT2 through DUT1, then listen
146 | | ... | for IPFIX template and data packets, verify that IPFIX reported
147 | | ... | the received packet.
148 | | ... | [Ref] RFC 7011
149 | | Given Path for 3-node testing is set
150 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
151 | | And Interfaces in 3-node path are up
152 | | And Set Interface Address | ${dut1_node}
153 | | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length}
154 | | And Add ARP on DUT | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip}
155 | | ... | ${tg_to_dut1_mac}
156 | | And Add ARP on DUT | ${dut1_node} | ${dut1_to_dut2} | ${dut2_to_dut1_ip}
157 | | ... | ${dut2_to_dut1_mac}
158 | | ${table_index} | ${skip_n} | ${match_n}=
159 | | ... | And VPP creates classify table L3 | ${dut1_node} | ${ip_version} | dst
160 | | And VPP configures classify session L3 | ${dut1_node} | permit
161 | | ... | ${table_index} | ${skip_n} | ${match_n} | ${ip_version} | dst
162 | | ... | ${dut2_to_dut1_ip}
163 | | When Assign interface to flow table | ${dut1_node} | ${dut1_to_tg}
164 | | ... | ${table_index} | ip_version=${ip_version}
165 | | And Setup IPFIX exporter | ${dut1_node} | ${tg_to_dut1_ip}
166 | | ... | ${dut1_to_tg_ip} | interval=5
167 | | And Set IPFIX stream | ${dut1_node} | ${1}
168 | | And Assign classify table to exporter | ${dut1_node} | ${table_index}
169 | | ... | ${ip_version}
170 | | Then Send packets and verify IPFIX | ${tg_node} | ${dut1_node}
171 | | ... | ${tg_to_dut1} | ${dut1_to_tg} | ${tg_to_dut1_ip} | ${dut2_to_dut1_ip}
172
173 | TC05: DUT reports packet flow for traffic by source and destination port
174 | | [Documentation]
175 | | ... | [Top] TG-DUT1-DUT2-TG. [Cfg] On DUT1 configure IPFIX with TG interface
176 | | ... | address as collector and add classify session with TG source address
177 | | ... | and source and destination ports.
178 | | ... | [Ver] Make TG send a packet to DUT1, then listen for IPFIX template
179 | | ... | and data packets, verify that IPFIX reported the received packet.
180 | | ... | [Ref] RFC 7011
181 | | Given Path for 3-node testing is set
182 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
183 | | And Interfaces in 3-node path are up
184 | | And Set Interface Address | ${dut1_node}
185 | | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length}
186 | | And Add ARP on DUT | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip}
187 | | ... | ${tg_to_dut1_mac}
188 | | ${table_index} | ${skip_n} | ${match_n}=
189 | | ... | And VPP creates classify table L3 | ${dut1_node} | ${ip_version}
190 | | ... | src proto l4 src_port dst_port
191 | | And VPP configures classify session generic | ${dut1_node}
192 | | ... | acl-hit-next permit | ${table_index} | ${skip_n} | ${match_n}
193 | | ... | l3 ${ip_version} src ${tg_to_dut1_ip}
194 | | ... | proto 6 l4 src_port ${port} dst_port ${port}
195 | | When Assign interface to flow table | ${dut1_node} | ${dut1_to_tg}
196 | | ... | ${table_index} | ip_version=${ip_version}
197 | | And Setup IPFIX exporter | ${dut1_node} | ${tg_to_dut1_ip}
198 | | ... | ${dut1_to_tg_ip} | interval=5
199 | | And Set IPFIX stream | ${dut1_node} | ${1}
200 | | And Assign classify table to exporter | ${dut1_node} | ${table_index}
201 | | ... | ${ip_version}
202 | | Then Send packets and verify IPFIX | ${tg_node} | ${dut1_node}
203 | | ... | ${tg_to_dut1} | ${dut1_to_tg} | ${tg_to_dut1_ip} | ${dut1_to_tg_ip}
204 | | ... | port=${port}
205
206 | TC06: DUT reports packet flow with a large number of packets
207 | | [Documentation]
208 | | ... | [Top] TG-DUT1-DUT2-TG. [Cfg] On DUT1 configure IPFIX with TG interface
209 | | ... | address as collector and add classify session with TG source address.
210 | | ... | [Ver] Make TG send packets to DUT1, then listen for IPFIX template
211 | | ... | and data packets, verify that IPFIX reported the received packets.
212 | | ... | [Ref] RFC 7011
213 | | Given Path for 3-node testing is set
214 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
215 | | And Interfaces in 3-node path are up
216 | | And Set Interface Address | ${dut1_node}
217 | | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length}
218 | | And Add ARP on DUT | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip}
219 | | ... | ${tg_to_dut1_mac}
220 | | ${table_index} | ${skip_n} | ${match_n}=
221 | | ... | And VPP creates classify table L3 | ${dut1_node} | ${ip_version} | src
222 | | And VPP configures classify session L3 | ${dut1_node} | permit
223 | | ... | ${table_index} | ${skip_n} | ${match_n} | ${ip_version} | src
224 | | ... | ${tg_to_dut1_ip}
225 | | When Assign interface to flow table | ${dut1_node} | ${dut1_to_tg}
226 | | ... | ${table_index} | ip_version=${ip_version}
227 | | And setup IPFIX exporter | ${dut1_node} | ${tg_to_dut1_ip} | ${dut1_to_tg_ip}
228 | | ... | interval=5
229 | | And Set IPFIX stream | ${dut1_node} | ${1}
230 | | And Assign classify table to exporter | ${dut1_node} | ${table_index}
231 | | ... | ${ip_version}
232 | | Then Send packets and verify IPFIX | ${tg_node} | ${dut1_node}
233 | | ... | ${tg_to_dut1} | ${dut1_to_tg} | ${tg_to_dut1_ip} | ${dut1_to_tg_ip}
234 | | ... | count=20000 | timeout=10
235
236 | TC07: DUT reports packet flow when multiple sessions are configured
237 | | [Documentation]
238 | | ... | [Top] TG-DUT1-DUT2-TG. [Cfg] On DUT1 configure IPFIX with TG interface
239 | | ... | address as collector and add several classify sessions with different
240 | | ... | ports.
241 | | ... | [Ver] Make TG send packets to DUT1 using a range of ports matching
242 | | ... | configured sessions, then listen for IPFIX template and data packets,
243 | | ... | verify that IPFIX reported the received packets for each session.
244 | | ... | [Ref] RFC 7011
245 | | Given Path for 3-node testing is set
246 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
247 | | And Interfaces in 3-node path are up
248 | | And Set Interface Address | ${dut1_node}
249 | | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length}
250 | | And Add ARP on DUT | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip}
251 | | ... | ${tg_to_dut1_mac}
252 | | ${table_index} | ${skip_n} | ${match_n}=
253 | | ... | And VPP creates classify table L3 | ${dut1_node} | ${ip_version}
254 | | ... | src proto l4 src_port dst_port
255 | | :FOR | ${index} | IN RANGE | ${sessions}
256 | | | VPP configures classify session generic | ${dut1_node}
257 | | | ... | acl-hit-next permit | ${table_index} | ${skip_n} | ${match_n}
258 | | | ... | l3 ${ip_version} src ${tg_to_dut1_ip}
259 | | | ... | proto 6 l4 src_port ${index} dst_port ${index}
260 | | When Assign interface to flow table | ${dut1_node} | ${dut1_to_tg}
261 | | ... | ${table_index} | ip_version=${ip_version}
262 | | And setup IPFIX exporter | ${dut1_node} | ${tg_to_dut1_ip}
263 | | ... | ${dut1_to_tg_ip}
264 | | ... | mtu=1450 | interval=5
265 | | And Set IPFIX stream | ${dut1_node} | ${1}
266 | | And Assign classify table to exporter | ${dut1_node} | ${table_index}
267 | | ... | ${ip_version}
268 | | Then Send session sweep and verify IPFIX | ${tg_node} | ${dut1_node}
269 | | ... | ${tg_to_dut1} | ${dut1_to_tg} | ${tg_to_dut1_ip} | ${dut1_to_tg_ip}
270 | | ... | ${sessions} | timeout=10 | count=3
271 # TODO: DUT reports packet flow when ACL is configured with wildcards