PapiExecutor always verifies
[csit.git] / tests / vpp / func / ip4 / eth2p-ethip4-ip4base-iaclbase-func.robot
1 # Copyright (c) 2019 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 | Library | resources.libraries.python.Classify.Classify
16 | Library | resources.libraries.python.Trace
17 | ...
18 | Resource | resources/libraries/robot/ip/ip4.robot
19 | Resource | resources/libraries/robot/l2/l2_traffic.robot
20 | Resource | resources/libraries/robot/l2/l2_xconnect.robot
21 | Resource | resources/libraries/robot/shared/counters.robot
22 | Resource | resources/libraries/robot/shared/default.robot
23 | Resource | resources/libraries/robot/shared/interfaces.robot
24 | Resource | resources/libraries/robot/shared/testing_path.robot
25 | Resource | resources/libraries/robot/shared/traffic.robot
26 | ...
27 | Force Tags | HW_ENV | VM_ENV | 3_NODE_SINGLE_LINK_TOPO | SKIP_VPP_PATCH
28 | ...
29 | Test Setup | Set up functional test
30 | ...
31 | Test Teardown | Tear down functional test
32 | ...
33 | Documentation | *IPv4 routing with ingress ACL test cases*
34 | ...
35 | ... | Encapsulations: Eth-IPv4 on links TG-DUT1, TG-DUT2, DUT1-DUT2. IPv4
36 | ... | ingress ACL (iACL) tests use 3-node topology TG - DUT1 - DUT2 - TG with
37 | ... | one link between the nodes. DUT1 and DUT2 are configured with IPv4
38 | ... | routing and static routes. DUT1 is configured with iACL on link to TG,
39 | ... | iACL classification and permit action are configured on a per test
40 | ... | case basis. Test ICMPv4 Echo Request packets are sent in one direction
41 | ... | by TG on link to DUT1 and received on TG link to DUT2. On receive TG
42 | ... | verifies if packets are accepted, or if received verifies packet IPv4
43 | ... | src-addr, dst-addr and MAC addresses.
44
45 *** Variables ***
46 | ${dut1_to_tg_ip}= | 192.168.1.1
47 | ${dut1_to_dut2_ip}= | 192.168.2.1
48 | ${dut1_to_dut2_ip_GW}= | 192.168.2.2
49 | ${test_dst_ip}= | 32.0.0.1
50 | ${test_src_ip}= | 16.0.0.1
51 | ${non_drop_dst_ip}= | 33.0.0.1
52 | ${non_drop_src_ip}= | 15.0.0.1
53 | ${prefix_length}= | 24
54 | ${ip_version}= | ip4
55 | ${l2_table}= | l2
56
57 *** Test Cases ***
58 | TC01: DUT with iACL IPv4 src-addr and dst-addr accepts matching pkts
59 | | [Documentation]
60 | | ... | On DUT1 add source and destination IPv4 addresses to classify table\
61 | | ... | with 'permit'.
62 | | Given Configure path in 3-node circular topology
63 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
64 | | And Set interfaces in 3-node circular topology up
65 | | And VPP Interface Set IP Address | ${dut1_node}
66 | | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length}
67 | | And VPP Interface Set IP Address | ${dut1_node}
68 | | ... | ${dut1_to_dut2} | ${dut1_to_dut2_ip} | ${prefix_length}
69 | | And VPP Add IP Neighbor
70 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_to_dut2_ip_GW}
71 | | ... | ${tg_to_dut2_mac}
72 | | And Vpp Route Add
73 | | ... | ${dut1_node} | ${test_dst_ip} | ${prefix_length}
74 | | ... | gateway=${dut1_to_dut2_ip_GW} | interface=${dut1_to_dut2}
75 | | And Vpp Route Add
76 | | ... | ${dut1_node} | ${non_drop_dst_ip} | ${prefix_length}
77 | | ... | gateway=${dut1_to_dut2_ip_GW} | interface=${dut1_to_dut2}
78 | | And Configure L2XC
79 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${dut2_to_tg}
80 | | Then Send packet and verify headers | ${tg_node}
81 | | ... | ${non_drop_src_ip} | ${non_drop_dst_ip} | ${tg_to_dut1}
82 | | ... | ${tg_to_dut1_mac} | ${dut1_to_tg_mac} | ${tg_to_dut2}
83 | | ... | ${dut1_to_dut2_mac} | ${tg_to_dut2_mac}
84 | | And Send packet and verify headers | ${tg_node}
85 | | ... | ${test_src_ip} | ${test_dst_ip} | ${tg_to_dut1} | ${tg_to_dut1_mac}
86 | | ... | ${dut1_to_tg_mac} | ${tg_to_dut2}
87 | | ... | ${dut1_to_dut2_mac} | ${tg_to_dut2_mac}
88 | | ${table_index_1} | ${skip_n_1} | ${match_n_1}=
89 | | ... | When Vpp Creates Classify Table L3 | ${dut1_node}
90 | | ... | ${ip_version} | src | ${test_src_ip}
91 | | ${table_index_2} | ${skip_n_2} | ${match_n_2}=
92 | | ... | And Vpp Creates Classify Table L3 | ${dut1_node} | ${ip_version}
93 | | ... | dst | ${test_dst_ip}
94 | | And Vpp Configures Classify Session L3
95 | | ... | ${dut1_node} | permit | ${table_index_1}
96 | | ... | ${ip_version} | src | ${test_src_ip}
97 | | And Vpp Configures Classify Session L3
98 | | ... | ${dut1_node} | permit | ${table_index_2}
99 | | ... | ${ip_version} | dst | ${test_dst_ip}
100 | | And Vpp Enable Input Acl Interface
101 | | ... | ${dut1_node} | ${dut1_to_tg} | ${ip_version} | ${table_index_1}
102 | | And Vpp Enable Input Acl Interface
103 | | ... | ${dut1_node} | ${dut1_to_tg} | ${ip_version} | ${table_index_2}
104 | | Then Send packet and verify headers | ${tg_node}
105 | | ... | ${test_src_ip} | ${test_dst_ip} | ${tg_to_dut1} | ${tg_to_dut1_mac}
106 | | ... | ${dut1_to_tg_mac} | ${tg_to_dut2}
107 | | ... | ${dut1_to_dut2_mac} | ${tg_to_dut2_mac}
108 | | And Send packet and verify headers | ${tg_node}
109 | | ... | ${non_drop_src_ip} | ${non_drop_dst_ip} | ${tg_to_dut1}
110 | | ... | ${tg_to_dut1_mac} | ${dut1_to_tg_mac} | ${tg_to_dut2}
111 | | ... | ${dut1_to_dut2_mac} | ${tg_to_dut2_mac}
112
113 | TC02: DUT with iACL IPv4 TCP src-ports and dst-ports accepts matching pkts
114 | | [Documentation]
115 | | ... | On DUT1 add TCP source and destination ports to classify table\
116 | | ... | with 'permit'.
117 | | Given Configure path in 3-node circular topology
118 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
119 | | And Set interfaces in 3-node circular topology up
120 | | And VPP Interface Set IP Address | ${dut1_node}
121 | | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length}
122 | | And VPP Interface Set IP Address | ${dut1_node}
123 | | ... | ${dut1_to_dut2} | ${dut1_to_dut2_ip} | ${prefix_length}
124 | | And VPP Add IP Neighbor
125 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_to_dut2_ip_GW}
126 | | ... | ${tg_to_dut2_mac}
127 | | And Vpp Route Add
128 | | ... | ${dut1_node} | ${test_dst_ip} | ${prefix_length}
129 | | ... | gateway=${dut1_to_dut2_ip_GW} | interface=${dut1_to_dut2}
130 | | And Configure L2XC
131 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${dut2_to_tg}
132 | | Then Send TCP or UDP packet and verify received packet | ${tg_node}
133 | | ... | ${test_src_ip} | ${test_dst_ip} | ${tg_to_dut1} | ${tg_to_dut1_mac}
134 | | ... | ${tg_to_dut2} | ${dut1_to_tg_mac} | TCP | 110 | 25
135 | | And Send TCP or UDP packet and verify received packet | ${tg_node}
136 | | ... | ${test_src_ip} | ${test_dst_ip} | ${tg_to_dut1} | ${tg_to_dut1_mac}
137 | | ... | ${tg_to_dut2} | ${dut1_to_tg_mac} | TCP | 80 | 20
138 | | ${hex_mask}= | Compute Classify Hex Mask | ${ip_version} | TCP
139 | | ... | source + destination
140 | | ${hex_value}= | Compute Classify Hex Value | ${hex_mask} | 80 | 20
141 | | ${table_index} | ${skip_n} | ${match_n}=
142 | | ... | When Vpp Creates Classify Table Hex | ${dut1_node} | ${hex_mask}
143 | | And Vpp Configures Classify Session Hex
144 | | ... | ${dut1_node} | permit | ${table_index} | ${hex_value}
145 | | And Vpp Enable Input Acl Interface
146 | | ... | ${dut1_node} | ${dut1_to_tg} | ${ip_version} | ${table_index}
147 | | Then Send TCP or UDP packet and verify received packet | ${tg_node}
148 | | ... | ${test_src_ip} | ${test_dst_ip} | ${tg_to_dut1} | ${tg_to_dut1_mac}
149 | | ... | ${tg_to_dut2} | ${dut1_to_tg_mac} | TCP | 80 | 20
150 | | And Send TCP or UDP packet and verify received packet | ${tg_node}
151 | | ... | ${test_src_ip} | ${test_dst_ip} | ${tg_to_dut1} | ${tg_to_dut1_mac}
152 | | ... | ${tg_to_dut2} | ${dut1_to_tg_mac} | TCP | 110 | 25
153
154 | TC03: DUT with iACL IPv4 UDP src-ports and dst-ports accepts matching pkts
155 | | [Documentation]
156 | | ... | On DUT1 add UDP source and destination ports to classify table\
157 | | ... | with 'permit'.
158 | | Given Configure path in 3-node circular topology
159 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
160 | | And Set interfaces in 3-node circular topology up
161 | | And VPP Interface Set IP Address | ${dut1_node}
162 | | ... | ${dut1_to_tg} | ${dut1_to_tg_ip} | ${prefix_length}
163 | | And VPP Interface Set IP Address | ${dut1_node}
164 | | ... | ${dut1_to_dut2} | ${dut1_to_dut2_ip} | ${prefix_length}
165 | | And VPP Add IP Neighbor
166 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_to_dut2_ip_GW}
167 | | ... | ${tg_to_dut2_mac}
168 | | And Vpp Route Add
169 | | ... | ${dut1_node} | ${test_dst_ip} | ${prefix_length}
170 | | ... | gateway=${dut1_to_dut2_ip_GW} | interface=${dut1_to_dut2}
171 | | And Configure L2XC
172 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${dut2_to_tg}
173 | | Then Send TCP or UDP packet and verify received packet | ${tg_node}
174 | | ... | ${test_src_ip} | ${test_dst_ip} | ${tg_to_dut1} | ${tg_to_dut1_mac}
175 | | ... | ${tg_to_dut2} | ${dut1_to_tg_mac} | UDP | 110 | 25
176 | | And Send TCP or UDP packet and verify received packet | ${tg_node}
177 | | ... | ${test_src_ip} | ${test_dst_ip} | ${tg_to_dut1} | ${tg_to_dut1_mac}
178 | | ... | ${tg_to_dut2} | ${dut1_to_tg_mac} | UDP | 80 | 20
179 | | ${hex_mask}= | Compute Classify Hex Mask | ${ip_version} | UDP
180 | | ... | source + destination
181 | | ${hex_value}= | Compute Classify Hex Value | ${hex_mask} | 80 | 20
182 | | ${table_index} | ${skip_n} | ${match_n}=
183 | | ... | When Vpp Creates Classify Table Hex | ${dut1_node} | ${hex_mask}
184 | | And Vpp Configures Classify Session Hex
185 | | ... | ${dut1_node} | permit | ${table_index} | ${hex_value}
186 | | And Vpp Enable Input Acl Interface
187 | | ... | ${dut1_node} | ${dut1_to_tg} | ${ip_version} | ${table_index}
188 | | Then Send TCP or UDP packet and verify received packet | ${tg_node}
189 | | ... | ${test_src_ip} | ${test_dst_ip} | ${tg_to_dut1} | ${tg_to_dut1_mac}
190 | | ... | ${tg_to_dut2} | ${dut1_to_tg_mac} | UDP | 80 | 20
191 | | And Send TCP or UDP packet and verify received packet | ${tg_node}
192 | | ... | ${test_src_ip} | ${test_dst_ip} | ${tg_to_dut1} | ${tg_to_dut1_mac}
193 | | ... | ${tg_to_dut2} | ${dut1_to_tg_mac} | UDP | 110 | 25