CSIT-427: Honeycomb ietf-ACL tests - mixed layers
[csit.git] / tests / func / honeycomb / 081_ietf_acl_traffic.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 *** Variables ***
15 | &{if_settings}= | enabled=True
16 # Bridge domain settings
17 | ${bd_name}= | bd1
18 | &{bd_settings}= | flood=${True} | forward=${True} | learn=${True}
19 | ... | unknown-unicast-flood=${True} | arp-termination=${False}
20 | &{bd_if_settings}= | split_horizon_group=${0} | bvi=${False}
21 # Names for AC lists
22 | ${acl_name_l2}= | acl_l2
23 | ${acl_name_l3_ip4}= | acl_l3_ip4
24 | ${acl_name_l3_ip6}= | acl_l3_ip6
25 | ${acl_name_mixed}= | acl_mixed
26
27 *** Settings ***
28 | Resource | resources/libraries/robot/default.robot
29 | Resource | resources/libraries/robot/honeycomb/honeycomb.robot
30 | Resource | resources/libraries/robot/honeycomb/interfaces.robot
31 | Resource | resources/libraries/robot/honeycomb/bridge_domain.robot
32 | Resource | resources/libraries/robot/honeycomb/access_control_lists.robot
33 | Resource | resources/libraries/robot/testing_path.robot
34 | Resource | resources/libraries/robot/traffic.robot
35 | Library | resources.libraries.python.honeycomb.HcAPIKwACL.ACLKeywords
36 | Library | resources.libraries.python.Trace
37 | Library | resources.libraries.python.IPv4Setup
38 | Library | resources.libraries.python.IPv4Util
39 | Library | resources.libraries.python.IPv6Util
40 | Library | resources.libraries.python.Routing
41 | Test Teardown | Run Keywords | Clear IETF-ACL settings
42 | ... | ${node} | ${dut_to_tg_if1} | AND
43 | ... | Show Packet Trace on All DUTs | ${nodes}
44 | Suite Teardown | Run Keyword If Any Tests Failed
45 | ... | Restart Honeycomb And VPP And Clear Persisted Configuration | ${node}
46 | Documentation | *Honeycomb access control lists test suite for IETF-ACL node.*
47 | Force Tags | Honeycomb_sanity
48
49 *** Test Cases ***
50 | TC01: Honeycomb can configure L2 ACL MAC filtering through IETF-ACL node
51 | | [Documentation]
52 | | ... | [Top] TG=DUT1=TG.
53 | | ... | [Enc] Eth-IPv4-TCP.
54 | | ... | [Cfg] (Using Honeycomb API) On DUT1 bridge both interfaces to TG\
55 | | ... | and configure L2 MAC ACL on ingress interface.
56 | | ... | [Ver] Send simple TCP packets from one TG interface to the other,\
57 | | ... | using different MACs. Receive all packets except those with\
58 | | ... | MACs in the filtered ranges.
59 | | [Teardown] | Run Keywords
60 | | ... | Clear IETF-ACL settings | ${node} | ${dut_to_tg_if1} | AND
61 | | ... | Show Packet Trace on All DUTs | ${nodes} | AND
62 | | ... | Honeycomb removes all bridge domains
63 | | ... | ${node} | ${dut_to_tg_if1} | ${dut_to_tg_if2}
64 | | Given Setup interfaces and bridge domain for ietf-ACL test
65 | | ... | L2 | ${acl_name_l2}
66 | | When Honeycomb creates ACL chain through IETF node
67 | | ... | ${dut_node} | ${acl_name_l2} | L2 | ${acl_settings}
68 | | And Honeycomb assigns IETF-ACL chain to interface
69 | | ... | ${dut_node} | ${dut_to_tg_if1} | L2 | ingress | ${acl_name_l2}
70 | | ... | permit
71 | | Then Send TCP or UDP packet | ${tg_node} | ${src_ip} | ${dst_ip}
72 | | ... | ${tg_to_dut_if1} | ${src_mac}
73 | | ... | ${tg_to_dut_if2} | ${dst_mac}
74 | | ... | TCP | ${src_port} | ${dst_port}
75 | | And Run keyword and expect error | TCP/UDP Rx timeout
76 | | ... | Send TCP or UDP packet | ${tg_node} | ${src_ip} | ${dst_ip}
77 | | ... | ${tg_to_dut_if1} | ${classify_src}
78 | | ... | ${tg_to_dut_if2} | ${classify_dst}
79 | | ... | TCP | ${src_port} | ${dst_port}
80 | | And Run keyword and expect error | TCP/UDP Rx timeout
81 | | ... | Send TCP or UDP packet | ${tg_node} | ${src_ip} | ${dst_ip}
82 | | ... | ${tg_to_dut_if1} | ${classify_src2}
83 | | ... | ${tg_to_dut_if2} | ${classify_dst2}
84 | | ... | TCP | ${src_port} | ${dst_port}
85
86 | TC02: Honeycomb can configure L3 ACL IPv4 filtering through IETF-ACL node
87 | | [Documentation]
88 | | ... | [Top] TG=DUT1=TG.
89 | | ... | [Enc] Eth-IPv4-TCP.
90 | | ... | [Cfg] (Using Honeycomb API) On DUT1 set IPv4 addresses on both\
91 | | ... | interfaces to TG, add ARP entry and routes, and configure L3 IPv4 ACL\
92 | | ... | on ingress interface with src/dst IP and protocol.
93 | | ... | [Ver] Send simple TCP and UDP packets from one TG interface\
94 | | ... | to the other, using different IPv4 IPs. Receive all packets except\
95 | | ... | those with IPs in the filtered ranges and UDP protocol payload.
96 | | Given Setup interface IPs and routes for IPv4 ietf-ACL test
97 | | ... | L3_IP4 | ${acl_name_l3_ip4}
98 | | When Honeycomb creates ACL chain through IETF node
99 | | ... | ${dut_node} | ${acl_name_l3_ip4} | L3_IP4 | ${acl_settings}
100 | | And Honeycomb assigns IETF-ACL chain to interface
101 | | ... | ${dut_node} | ${dut_to_tg_if1} | L3_IP4 | ingress | ${acl_name_l3_ip4}
102 | | ... | permit
103 | | Then Send TCP or UDP packet | ${tg_node}
104 | | ... | ${src_ip} | ${dst_ip}
105 | | ... | ${tg_to_dut_if1} | ${tg_to_dut_if1_mac}
106 | | ... | ${tg_to_dut_if2} | ${dut_to_tg_if1_mac}
107 | | ... | UDP | ${src_port} | ${dst_port}
108 | | And Send TCP or UDP packet | ${tg_node}
109 | | ... | ${classify_src} | ${classify_dst}
110 | | ... | ${tg_to_dut_if1} | ${tg_to_dut_if1_mac}
111 | | ... | ${tg_to_dut_if2} | ${dut_to_tg_if1_mac}
112 | | ... | TCP | ${src_port} | ${dst_port}
113 | | And Run keyword and expect error | TCP/UDP Rx timeout
114 | | ... | Send TCP or UDP packet | ${tg_node}
115 | | ... | ${classify_src} | ${classify_dst}
116 | | ... | ${tg_to_dut_if1} | ${tg_to_dut_if1_mac}
117 | | ... | ${tg_to_dut_if2} | ${dut_to_tg_if1_mac}
118 | | ... | UDP | ${src_port} | ${dst_port}
119
120 | TC03: Honeycomb can configure L3 ACL IPv6 filtering through IETF-ACL node
121 | | [Documentation]
122 | | ... | [Top] TG=DUT1=TG.
123 | | ... | [Enc] Eth-IPv4-TCP.
124 | | ... | [Cfg] (Using Honeycomb API) On DUT1 set IPv6 addresses on both\
125 | | ... | interfaces to TG, add IP neighbor entry and routes, and configure\
126 | | ... | L3 IPv6 ACL on ingress interface with src/dst IP and next-header.
127 | | ... | [Ver] Send simple TCP and UDP packets from one TG interface\
128 | | ... | to the other, using different IPv6 IPs. Receive all packets except\
129 | | ... | those with IPs in the filtered ranges and UDP protocol payload.
130 | | Given Path for 2-node testing is set
131 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
132 | | And Import Variables | resources/test_data/honeycomb/ietf_acl.py
133 | | ... | L3_IP6 | ${acl_name_l3_ip6}
134 | | And Honeycomb sets interface state | ${dut_node} | ${dut_to_tg_if1} | up
135 | | And Honeycomb sets interface state | ${dut_node} | ${dut_to_tg_if2} | up
136 # TODO: Configure addresses through Honeycomb when implemented. (Honeycomb-102)
137 | | And Set Interface Address | ${dut_node}
138 | | ... | ${dut_to_tg_if1} | ${dut_to_tg_if1_ip} | ${prefix_length}
139 | | And Set Interface Address | ${dut_node}
140 | | ... | ${dut_to_tg_if2} | ${dut_to_tg_if2_ip} | ${prefix_length}
141 | | And VPP RA suppress link layer | ${dut_node} | ${dut_to_tg_if2}
142 # TODO: Configure route through Honeycomb when implemented.(Honeycomb-58)
143 | | And Add IP Neighbor
144 | | ... | ${node} | ${dut_to_tg_if2} | ${gateway} | ${tg_to_dut_if2_mac}
145 | | And VPP Route Add | ${node} | ${dst_net} | ${prefix_length}
146 | | ... | ${gateway} | interface=${dut_to_tg_if2} | use_sw_index=False
147 | | And VPP Route Add | ${node} | ${classify_dst_net} | ${prefix_length}
148 | | ... | ${gateway} | interface=${dut_to_tg_if2} | use_sw_index=False
149 | | When Honeycomb creates ACL chain through IETF node
150 | | ... | ${dut_node} | ${acl_name_l3_ip6} | L3_IP6 | ${acl_settings}
151 | | And Honeycomb assigns IETF-ACL chain to interface
152 | | ... | ${dut_node} | ${dut_to_tg_if1} | L3_IP6 | ingress | ${acl_name_l3_ip6}
153 | | ... | permit
154 | | Then Send TCP or UDP packet | ${tg_node}
155 | | ... | ${src_ip} | ${dst_ip}
156 | | ... | ${tg_to_dut_if1} | ${tg_to_dut_if1_mac}
157 | | ... | ${tg_to_dut_if2} | ${dut_to_tg_if1_mac}
158 | | ... | UDP | ${src_port} | ${dst_port}
159 | | And Send TCP or UDP packet | ${tg_node}
160 | | ... | ${classify_src} | ${classify_dst}
161 | | ... | ${tg_to_dut_if1} | ${tg_to_dut_if1_mac}
162 | | ... | ${tg_to_dut_if2} | ${dut_to_tg_if1_mac}
163 | | ... | TCP | ${src_port} | ${dst_port}
164 | | And Run keyword and expect error | TCP/UDP Rx timeout
165 | | ... | Send TCP or UDP packet | ${tg_node}
166 | | ... | ${classify_src} | ${classify_dst}
167 | | ... | ${tg_to_dut_if1} | ${tg_to_dut_if1_mac}
168 | | ... | ${tg_to_dut_if2} | ${dut_to_tg_if1_mac}
169 | | ... | UDP | ${src_port} | ${dst_port}
170
171 | TC04: Honeycomb can configure L2 and L3 ACL on L2-mode interface
172 | | [Documentation]
173 | | ... | [Top] TG=DUT1=TG.
174 | | ... | [Enc] Eth-IPv4-TCP.
175 | | ... | [Cfg] (Using Honeycomb API) On DUT1 bridge both interfaces to TG\
176 | | ... | and configure L2 and L3 ACL on ingress interface\
177 | | ... | with src/dst MAC, src/dst IP and protocol.
178 | | ... | [Ver] Send simple TCP and UDP packets from one TG interface\
179 | | ... | to the other, using different MACs and IPv4 IPs. Receive all packets\
180 | | ... | except those with MACs and IPs in the filtered ranges and UDP\
181 | | ... | protocol payload.
182 | | [Teardown] | Run Keywords
183 | | ... | Clear IETF-ACL settings | ${node} | ${dut_to_tg_if1} | AND
184 | | ... | Show Packet Trace on All DUTs | ${nodes} | AND
185 | | ... | Honeycomb removes all bridge domains
186 | | ... | ${node} | ${dut_to_tg_if1} | ${dut_to_tg_if2}
187 | | Given Setup interfaces and bridge domain for ietf-ACL test
188 | | ... | mixed | ${acl_name_mixed}
189 | | When Honeycomb creates ACL chain through IETF node
190 | | ... | ${dut_node} | ${acl_name_mixed} | mixed | ${acl_settings}
191 | | And Honeycomb assigns IETF-ACL chain to interface
192 | | ... | ${dut_node} | ${dut_to_tg_if1} | mixed | ingress | ${acl_name_mixed}
193 | | ... | permit | L2
194 | | Then Send TCP or UDP packet | ${tg_node} | ${src_ip} | ${dst_ip}
195 | | ... | ${tg_to_dut_if1} | ${classify_src_mac}
196 | | ... | ${tg_to_dut_if2} | ${classify_dst_mac}
197 | | ... | TCP | ${src_port} | ${dst_port}
198 | | And Send TCP or UDP packet | ${tg_node}
199 | | ... | ${classify_src_ip} | ${classify_dst_ip}
200 | | ... | ${tg_to_dut_if1} | ${tg_to_dut_if1_mac}
201 | | ... | ${tg_to_dut_if2} | ${dut_to_tg_if1_mac}
202 | | ... | UDP | ${src_port} | ${dst_port}
203 | | And Run keyword and expect error | TCP/UDP Rx timeout
204 | | ... | Send TCP or UDP packet | ${tg_node}
205 | | ... | ${classify_src_ip} | ${classify_dst_ip}
206 | | ... | ${tg_to_dut_if1} | ${classify_src_mac}
207 | | ... | ${tg_to_dut_if2} | ${classify_dst_mac}
208 | | ... | UDP | ${src_port} | ${dst_port}
209
210 | TC05: Honeycomb can configure L2 and L3 ACL on L3-mode interface
211 | | [Documentation]
212 | | ... | [Top] TG=DUT1=TG.
213 | | ... | [Enc] Eth-IPv4-TCP.
214 | | ... | [Cfg] (Using Honeycomb API) On DUT1 set IPv4 addresses on both\
215 | | ... | interfaces to TG, add ARP entry and routes, and configure\
216 | | ... | L2 and L3 ACL on ingress interface with src/dst MAC, src/dst IP\
217 | | ... | and protocol.
218 | | ... | [Ver] Send simple TCP and UDP packets from one TG interface\
219 | | ... | to the other, using different MACs and IPv4 IPs. Receive all packets\
220 | | ... | except those with MACs and IPs in the filtered ranges and UDP\
221 | | ... | protocol payload.
222 | | Setup interface IPs and routes for IPv4 ietf-ACL test
223 | | ... | mixed | ${acl_name_mixed}
224 | | When Honeycomb creates ACL chain through IETF node
225 | | ... | ${dut_node} | ${acl_name_mixed} | mixed | ${acl_settings}
226 | | And Honeycomb assigns IETF-ACL chain to interface
227 | | ... | ${dut_node} | ${dut_to_tg_if1} | mixed | ingress | ${acl_name_mixed}
228 | | ... | permit | L3
229 | | Then Send TCP or UDP packet | ${tg_node} | ${src_ip} | ${dst_ip}
230 | | ... | ${tg_to_dut_if1} | ${classify_src_mac}
231 | | ... | ${tg_to_dut_if2} | ${classify_dst_mac}
232 | | ... | TCP | ${src_port} | ${dst_port}
233 | | And Send TCP or UDP packet | ${tg_node}
234 | | ... | ${classify_src_ip} | ${classify_dst_ip}
235 | | ... | ${tg_to_dut_if1} | ${tg_to_dut_if1_mac}
236 | | ... | ${tg_to_dut_if2} | ${dut_to_tg_if1_mac}
237 | | ... | UDP | ${src_port} | ${dst_port}
238 | | And Run keyword and expect error | TCP/UDP Rx timeout
239 | | ... | Send TCP or UDP packet | ${tg_node}
240 | | ... | ${classify_src_ip} | ${classify_dst_ip}
241 | | ... | ${tg_to_dut_if1} | ${classify_src_mac}
242 | | ... | ${tg_to_dut_if2} | ${classify_dst_mac}
243 | | ... | UDP | ${src_port} | ${dst_port}
244
245 # TODO: Test case for L4 ACL port-based filtering
246 # TODO: Test case for multiple classify rules and rule ordering
247
248 *** Keywords ***
249 | Setup interface IPs and routes for IPv4 ietf-ACL test
250 | | [Arguments] | ${test_data_id} | ${acl_name}
251 | | Path for 2-node testing is set
252 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
253 | | Import Variables | resources/test_data/honeycomb/ietf_acl.py
254 | | ... | ${test_data_id} | ${acl_name}
255 | | Honeycomb sets interface state | ${dut_node} | ${dut_to_tg_if1} | up
256 | | Honeycomb sets interface state | ${dut_node} | ${dut_to_tg_if2} | up
257 | | Honeycomb sets interface ipv4 address with prefix | ${dut_node}
258 | | ... | ${dut_to_tg_if1} | ${dut_to_tg_if1_ip}
259 | | ... | ${prefix_length} | ${if_settings}
260 | | Honeycomb sets interface ipv4 address with prefix | ${dut_node}
261 | | ... | ${dut_to_tg_if2} | ${dut_to_tg_if2_ip}
262 | | ... | ${prefix_length} | ${if_settings}
263 # TODO: Configure routes through Honeycomb when implemented.(Honeycomb-58)
264 | | Add ARP on DUT
265 | | ... | ${node} | ${dut_to_tg_if2} | ${gateway} | ${tg_to_dut_if2_mac}
266 | | VPP Route Add
267 | | ... | ${node} | ${dst_net} | ${prefix_length} | ${gateway}
268 | | ... | interface=${dut_to_tg_if2} | use_sw_index=False
269 | | VPP Route Add
270 | | ... | ${node} | ${classify_dst_net} | ${prefix_length} | ${gateway}
271 | | ... | interface=${dut_to_tg_if2} | use_sw_index=False
272
273 | Setup interfaces and bridge domain for ietf-ACL test
274 | | [Arguments] | ${test_data_id} | ${acl_name}
275 | | Path For 2-node Testing Is Set
276 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
277 | | Import Variables | resources/test_data/honeycomb/ietf_acl.py
278 | | ... | ${test_data_id} | ${acl_name}
279 | | Honeycomb Sets Interface State | ${dut_node} | ${dut_to_tg_if1} | up
280 | | Honeycomb Sets Interface State | ${dut_node} | ${dut_to_tg_if2} | up
281 | | Honeycomb Creates L2 Bridge Domain
282 | | ... | ${dut_node} | ${bd_name} | ${bd_settings}
283 | | Honeycomb Adds Interfaces To Bridge Domain
284 | | ... | ${dut_node} | ${dut_to_tg_if1} | ${dut_to_tg_if2}
285 | | ... | ${bd_name} | ${bd_if_settings}