CSIT-233 IPv4 IPFIX - baseline tests
[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
49 *** Test Cases ***
50 | TC01: DUT sends IPFIX template and data packets
51 | | [Documentation]
52 | | ... | [Top] TG-DUT1-DUT2-TG. [Cfg] On DUT1 configure IPFIX with TG interface
53 | | ... | address as collector and a basic classify session.
54 | | ... | [Ver] Make TG listen for IPFIX template and data packets, verify
55 | | ... | that packet is received and correct. No packets are sent from TG.
56 | | ... | [Ref] RFC 7011
57 | | Given Path for 3-node testing is set
58 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
59 | | And Interfaces in 3-node path are up
60 | | And Set Interface Address | ${dut1_node}
61 | | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length}
62 | | And Add ARP on DUT | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip}
63 | | ... | ${tg_to_dut1_mac}
64 | | ${table_index} | ${skip_n} | ${match_n}=
65 | | ... | And VPP creates classify table L3 | ${dut1_node} | ${ip_version} | src
66 | | And VPP configures classify session L3 | ${dut1_node} | permit
67 | | ... | ${table_index} | ${skip_n} | ${match_n} | ${ip_version} | src
68 | | ... | ${tg_to_dut1_ip}
69 | | When Assign interface to flow table | ${dut1_node} | ${dut1_to_tg}
70 | | ... | ${table_index} | ip_version=${ip_version}
71 | | And Setup IPFIX exporter | ${dut1_node} | ${tg_to_dut1_ip}
72 | | ... | ${dut1_to_tg_ip} | interval=5
73 | | And Set IPFIX stream | ${dut1_node} | ${1}
74 | | And Assign classify table to exporter | ${dut1_node} | ${table_index}
75 | | ... | ${ip_version}
76 | | Then Send packets and verify IPFIX | ${tg_node} | ${dut1_node}
77 | | ... | ${tg_to_dut1} | ${dut1_to_tg} | ${tg_to_dut1_ip} | ${dut1_to_tg_ip}
78 | | ... | count=0
79
80 | TC02: DUT reports packet flow for traffic by source address
81 | | [Documentation]
82 | | ... | [Top] TG-DUT1-DUT2-TG. [Cfg] On DUT1 configure IPFIX with TG interface
83 | | ... | address as collector and add classify session with TG source address.
84 | | ... | [Ver] Make TG send a packet to DUT1, then listen for IPFIX template
85 | | ... | and data packets, verify that IPFIX reported the received packet.
86 | | ... | [Ref] RFC 7011
87 | | Given Path for 3-node testing is set
88 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
89 | | And Interfaces in 3-node path are up
90 | | And Set Interface Address | ${dut1_node}
91 | | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length}
92 | | And Add ARP on DUT | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip}
93 | | ... | ${tg_to_dut1_mac}
94 | | ${table_index} | ${skip_n} | ${match_n}=
95 | | ... | And VPP creates classify table L3 | ${dut1_node} | ${ip_version} | src
96 | | And VPP configures classify session L3 | ${dut1_node} | permit
97 | | ... | ${table_index} | ${skip_n} | ${match_n} | ${ip_version} | src
98 | | ... | ${tg_to_dut1_ip}
99 | | When Assign interface to flow table | ${dut1_node} | ${dut1_to_tg}
100 | | ... | ${table_index} | ip_version=${ip_version}
101 | | And Setup IPFIX exporter | ${dut1_node} | ${tg_to_dut1_ip}
102 | | ... | ${dut1_to_tg_ip} | interval=5
103 | | And Set IPFIX stream | ${dut1_node} | ${1}
104 | | And Assign classify table to exporter | ${dut1_node} | ${table_index}
105 | | ... | ${ip_version}
106 | | Then Send packets and verify IPFIX | ${tg_node} | ${dut1_node}
107 | | ... | ${tg_to_dut1} | ${dut1_to_tg} | ${tg_to_dut1_ip} | ${dut1_to_tg_ip}
108
109 | TC03: DUT reports packet flow for traffic with local destination address
110 | | [Documentation]
111 | | ... | [Top] TG-DUT1-DUT2-TG. [Cfg] On DUT1 configure IPFIX with TG interface
112 | | ... | address as collector and add classify session with destination
113 | | ... | address of DUT1.
114 | | ... | [Ver] Make TG send a packet to DUT1, then listen for IPFIX template
115 | | ... | and data packets, verify that IPFIX reported the received packet.
116 | | ... | [Ref] RFC 7011
117 | | Given Path for 3-node testing is set
118 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
119 | | And Interfaces in 3-node path are up
120 | | And Set Interface Address | ${dut1_node}
121 | | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length}
122 | | And Add ARP on DUT | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip}
123 | | ... | ${tg_to_dut1_mac}
124 | | ${table_index} | ${skip_n} | ${match_n}=
125 | | ... | And VPP creates classify table L3 | ${dut1_node} | ${ip_version} | dst
126 | | And VPP configures classify session L3 | ${dut1_node} | permit
127 | | ... | ${table_index} | ${skip_n} | ${match_n} | ${ip_version} | dst
128 | | ... | ${dut1_to_tg_ip}
129 | | When Assign interface to flow table | ${dut1_node} | ${dut1_to_tg}
130 | | ... | ${table_index} | ip_version=${ip_version}
131 | | And Setup IPFIX exporter | ${dut1_node} | ${tg_to_dut1_ip}
132 | | ... | ${dut1_to_tg_ip} | interval=5
133 | | And Set IPFIX stream | ${dut1_node} | ${1}
134 | | And Assign classify table to exporter | ${dut1_node} | ${table_index}
135 | | ... | ${ip_version}
136 | | Then Send packets and verify IPFIX | ${tg_node} | ${dut1_node}
137 | | ... | ${tg_to_dut1} | ${dut1_to_tg} | ${tg_to_dut1_ip} | ${dut1_to_tg_ip}
138
139 | TC04: DUT reports packet flow for traffic with remote destination address
140 | | [Documentation]
141 | | ... | [Top] TG-DUT1-DUT2-TG. [Cfg] On DUT1 configure IPFIX with TG interface
142 | | ... | address as collector and add classify session with destination
143 | | ... | address of DUT2.
144 | | ... | [Ver] Make TG send a packet to DUT2 through DUT1, then listen
145 | | ... | for IPFIX template and data packets, verify that IPFIX reported
146 | | ... | the received packet.
147 | | ... | [Ref] RFC 7011
148 | | Given Path for 3-node testing is set
149 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
150 | | And Interfaces in 3-node path are up
151 | | And Set Interface Address | ${dut1_node}
152 | | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length}
153 | | And Add ARP on DUT | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip}
154 | | ... | ${tg_to_dut1_mac}
155 | | And Add ARP on DUT | ${dut1_node} | ${dut1_to_dut2} | ${dut2_to_dut1_ip}
156 | | ... | ${dut2_to_dut1_mac}
157 | | ${table_index} | ${skip_n} | ${match_n}=
158 | | ... | And VPP creates classify table L3 | ${dut1_node} | ${ip_version} | dst
159 | | And VPP configures classify session L3 | ${dut1_node} | permit
160 | | ... | ${table_index} | ${skip_n} | ${match_n} | ${ip_version} | dst
161 | | ... | ${dut2_to_dut1_ip}
162 | | When Assign interface to flow table | ${dut1_node} | ${dut1_to_tg}
163 | | ... | ${table_index} | ip_version=${ip_version}
164 | | And Setup IPFIX exporter | ${dut1_node} | ${tg_to_dut1_ip}
165 | | ... | ${dut1_to_tg_ip} | interval=5
166 | | And Set IPFIX stream | ${dut1_node} | ${1}
167 | | And Assign classify table to exporter | ${dut1_node} | ${table_index}
168 | | ... | ${ip_version}
169 | | Then Send packets and verify IPFIX | ${tg_node} | ${dut1_node}
170 | | ... | ${tg_to_dut1} | ${dut1_to_tg} | ${tg_to_dut1_ip} | ${dut2_to_dut1_ip}
171
172 | TC05: DUT reports packet flow for traffic by source and destination port
173 | | [Documentation]
174 | | ... | [Top] TG-DUT1-DUT2-TG. [Cfg] On DUT1 configure IPFIX with TG interface
175 | | ... | address as collector and add classify session with TG source address
176 | | ... | and source and destination ports.
177 | | ... | [Ver] Make TG send a packet to DUT1, then listen for IPFIX template
178 | | ... | and data packets, verify that IPFIX reported the received packet.
179 | | ... | [Ref] RFC 7011
180 | | Given Path for 3-node testing is set
181 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
182 | | And Interfaces in 3-node path are up
183 | | And Set Interface Address | ${dut1_node}
184 | | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length}
185 | | And Add ARP on DUT | ${dut1_node} | ${dut1_to_tg} | ${tg_to_dut1_ip}
186 | | ... | ${tg_to_dut1_mac}
187 | | ${table_index} | ${skip_n} | ${match_n}=
188 | | ... | And VPP creates classify table L3 | ${dut1_node} | ${ip_version}
189 | | ... | src proto l4 src_port dst_port
190 | | And VPP configures classify session generic | ${dut1_node}
191 | | ... | acl-hit-next permit | ${table_index} | ${skip_n} | ${match_n}
192 | | ... | l3 ${ip_version} src ${tg_to_dut1_ip}
193 | | ... | proto 6 l4 src_port ${port} dst_port ${port}
194 | | When Assign interface to flow table | ${dut1_node} | ${dut1_to_tg}
195 | | ... | ${table_index} | ip_version=${ip_version}
196 | | And Setup IPFIX exporter | ${dut1_node} | ${tg_to_dut1_ip}
197 | | ... | ${dut1_to_tg_ip} | interval=5
198 | | And Set IPFIX stream | ${dut1_node} | ${1}
199 | | And Assign classify table to exporter | ${dut1_node} | ${table_index}
200 | | ... | ${ip_version}
201 | | Then Send packets and verify IPFIX | ${tg_node} | ${dut1_node}
202 | | ... | ${tg_to_dut1} | ${dut1_to_tg} | ${tg_to_dut1_ip} | ${dut1_to_tg_ip}
203 | | ... | port=${port}
204
205 # TODO: DUT reports packet flow when ACL is configured with wildcards