be151c347a49f4640f621e1faddc4da5573b42fe
[csit.git] / tests / func / honeycomb / mgmt-cfg-routing-apihc-apivat-func.robot
1 # Copyright (c) 2017 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.honeycomb.Routing.RoutingKeywords
16 | Library | resources.libraries.python.Trace.Trace
17 | Resource | resources/libraries/robot/default.robot
18 | Resource | resources/libraries/robot/testing_path.robot
19 | Resource | resources/libraries/robot/ipv4.robot
20 | Resource | resources/libraries/robot/ipv6.robot
21 | Resource | resources/libraries/robot/honeycomb/honeycomb.robot
22 | Resource | resources/libraries/robot/honeycomb/interfaces.robot
23 | Resource | resources/libraries/robot/honeycomb/routing.robot
24 | ...
25 | Test Setup | Clear Packet Trace on All DUTs | ${nodes}
26 | ...
27 | Suite Teardown | Restart Honeycomb And VPP | ${node}
28 | ...
29 | Test Teardown | Honeycomb routing test teardown | ${node} | ${table}
30 | ...
31 | Documentation | *Honeycomb routing test suite.*
32 | ...
33 | Force Tags | HC_FUNC
34
35 *** Test Cases ***
36 | TC01: Single hop IPv4 route
37 | | [Documentation]
38 | | ... | [Top] TG=DUT1=TG.
39 | | ... | [Enc] Eth-IPv4-ICMP.
40 | | ... | [Cfg] (Using Honeycomb API) On DUT1 add ARP entries to both TG\
41 | | ... | interfaces and configure route with TG-if2 as next-hop.
42 | | ... | [Ver] Send ICMP packet from first TG interface to configured route
43 | | ... | destination. Receive packet on the second TG interface.
44 | | ...
45 | | ${table}= | Set Variable | table1
46 | | Given Setup interfaces and neighbors for IPv4 routing test
47 | | When Honeycomb configures routing table
48 | | ... | ${node} | table1 | ipv4 | ${table1} | ${1}
49 | | Then Routing data from Honeycomb should contain
50 | | ... | ${node} | table1 | ipv4 | ${table1_oper}
51 | | And Verify route IPv4 | ${nodes['TG']}
52 | | ... | ${src_ip} | ${dst_ip}
53 | | ... | ${tg_to_dut_if1} | ${tg_to_dut_if1_mac}
54 | | ... | ${tg_to_dut_if2} | ${dut_to_tg_if1_mac}
55
56 | TC02: Multi hop IPv4 route
57 | | [Documentation]
58 | | ... | [Top] TG=DUT1=TG.
59 | | ... | [Enc] Eth-IPv4-ICMP.
60 | | ... | [Cfg] (Using Honeycomb API) On DUT1 add ARP entries to both TG\
61 | | ... | interfaces and configure two routes through the second DUT interface.
62 | | ... | [Ver] Send 100 ICMP packets from first TG interface to configured
63 | | ... | route destination. Receive all packets on the second TG interface and\
64 | | ... | verify that each destination MAC was used by exactly 50 packets.
65 | | ... | Receive packet on the second TG interface.
66 | | ...
67 | | ${table}= | Set Variable | table2
68 | | Given Setup interfaces and neighbors for IPv4 routing test
69 | | And Honeycomb adds interface IPv4 neighbor | ${dut_node} | ${dut_to_tg_if2}
70 | | ... | ${next_hop1} | ${next_hop_mac1}
71 | | And Honeycomb adds interface IPv4 neighbor | ${dut_node} | ${dut_to_tg_if2}
72 | | ... | ${next_hop2} | ${next_hop_mac2}
73 | | When Honeycomb configures routing table
74 | | ... | ${node} | table2 | ipv4 | ${table2} | ${1}
75 | | Then Routing data from Honeycomb should contain
76 | | ... | ${node} | table2 | ipv4 | ${table2_oper}
77 | | And Verify multipath Route | ${nodes['TG']}
78 | | ... | ${src_ip} | ${dst_ip}
79 | | ... | ${tg_to_dut_if1} | ${tg_to_dut_if1_mac}
80 | | ... | ${tg_to_dut_if2} | ${dut_to_tg_if1_mac}
81 | | ... | ${dut_to_tg_if2_mac} | ${next_hop_mac1} | ${next_hop_mac2}
82
83 | TC03: Special hop - blackhole IPv4 route
84 | | [Documentation]
85 | | ... | [Top] TG=DUT1=TG.
86 | | ... | [Enc] Eth-IPv4-ICMP.
87 | | ... | [Cfg] (Using Honeycomb API) On DUT1 add ARP entries to both TG\
88 | | ... | interfaces and configure route with special rule blackhole.
89 | | ... | [Ver] Send ICMP packet from first TG interface to configured route
90 | | ... | destination. Make sure no packet is received on the second TG\
91 | | ... | interface.
92 | | ...
93 | | ${table}= | Set Variable | table3
94 | | Given Setup interfaces and neighbors for IPv4 routing test
95 | | When Honeycomb configures routing table
96 | | ... | ${node} | table3 | ipv4 | ${table3} | ${1} | special=${TRUE}
97 | | Then Routing data from Honeycomb should contain
98 | | ... | ${node} | table3 | ipv4 | ${table3_oper}
99 | | And Run keyword and Expect Error | ICMP echo Rx timeout
100 | | ... | Verify route IPv4 | ${nodes['TG']}
101 | | ... | ${src_ip} | ${dst_ip}
102 | | ... | ${tg_to_dut_if1} | ${tg_to_dut_if1_mac}
103 | | ... | ${tg_to_dut_if2} | ${dut_to_tg_if1_mac}
104
105 | TC04: Single hop IPv6 route
106 | | [Documentation]
107 | | ... | [Top] TG=DUT1=TG.
108 | | ... | [Enc] Eth-IPv6-ICMPv6.
109 | | ... | [Cfg] (Using Honeycomb API) On DUT1 add ARP entries to both TG\
110 | | ... | interfaces and configure route with TG-if2 as next-hop.
111 | | ... | [Ver] Send ICMP packet from first TG interface to configured route
112 | | ... | destination. Receive packet on the second TG interface.
113 | | ...
114 | | ${table}= | Set Variable | table4
115 | | Given Setup interfaces and neighbors for IPv6 routing test
116 | | When Honeycomb configures routing table
117 | | ... | ${node} | table4 | ipv6 | ${table4} | ${1}
118 | | Then Routing data from Honeycomb should contain
119 | | ... | ${node} | table4 | ipv6 | ${table4_oper}
120 | | And Verify route IPv6 | ${nodes['TG']}
121 | | ... | ${src_ip} | ${next_hop}
122 | | ... | ${tg_to_dut_if1} | ${tg_to_dut_if1_mac}
123 | | ... | ${tg_to_dut_if2} | ${dut_to_tg_if1_mac}
124
125 | TC05: Multi hop IPv6 route
126 | | [Documentation]
127 | | ... | [Top] TG=DUT1=TG.
128 | | ... | [Enc] Eth-IPv6-ICMPv6.
129 | | ... | [Cfg] (Using Honeycomb API) On DUT1 add ARP entries to both TG\
130 | | ... | interfaces and configure two routes through the second DUT interface.
131 | | ... | [Ver] Send 100 ICMP packets from first TG interface to configured
132 | | ... | route destination. Receive all packets on the second TG interface and\
133 | | ... | verify that each destination MAC was used by exactly 50 packets.
134 | | ... | Receive packet on the second TG interface.
135 | | ...
136 | | ${table}= | Set Variable | table5
137 | | Given Setup interfaces and neighbors for IPv6 routing test
138 | | And Honeycomb adds interface IPv6 neighbor | ${dut_node} | ${dut_to_tg_if2}
139 | | ... | ${next_hop1} | ${next_hop_mac1}
140 | | And Honeycomb adds interface IPv6 neighbor | ${dut_node} | ${dut_to_tg_if2}
141 | | ... | ${next_hop2} | ${next_hop_mac2}
142 | | When Honeycomb configures routing table
143 | | ... | ${node} | table5 | ipv6 | ${table5} | ${1}
144 | | Then Routing data from Honeycomb should contain
145 | | ... | ${node} | table5 | ipv6 | ${table5_oper}
146 | | And Verify multipath Route | ${nodes['TG']}
147 | | ... | ${src_ip} | ${dst_ip}
148 | | ... | ${tg_to_dut_if1} | ${tg_to_dut_if1_mac}
149 | | ... | ${tg_to_dut_if2} | ${dut_to_tg_if1_mac}
150 | | ... | ${dut_to_tg_if2_mac} | ${next_hop_mac1} | ${next_hop_mac2}
151
152 | TC06: Special hop - blackhole IPv6 route
153 | | [Documentation]
154 | | ... | [Top] TG=DUT1=TG.
155 | | ... | [Enc] Eth-IPv6-ICMPv6.
156 | | ... | [Cfg] (Using Honeycomb API) On DUT1 add ARP entries to both TG\
157 | | ... | interfaces and configure route with special rule blackhole.
158 | | ... | [Ver] Send ICMP packet from first TG interface to configured route
159 | | ... | destination. Make sure no packet is received on the second TG\
160 | | ... | interface.
161 | | ...
162 | | ${table}= | Set Variable | table6
163 | | Given Setup interfaces and neighbors for IPv6 routing test
164 | | When Honeycomb configures routing table
165 | | ... | ${node} | table6 | ipv6 | ${table6} | ${1} | special=${TRUE}
166 | | Then Routing data from Honeycomb should contain
167 | | ... | ${node} | table6 | ipv6 | ${table6_oper}
168 | | And Run keyword and Expect Error | ICMP echo Rx timeout
169 | | ... | Verify route IPv6 | ${nodes['TG']}
170 | | ... | ${src_ip} | ${dst_ip}
171 | | ... | ${tg_to_dut_if1} | ${tg_to_dut_if1_mac}
172 | | ... | ${tg_to_dut_if2} | ${dut_to_tg_if1_mac}
173
174 *** Keywords ***
175 | Setup interfaces and neighbors for IPv4 routing test
176 | | Configure path in 2-node circular topology
177 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
178 | | Import Variables | resources/test_data/honeycomb/routing.py
179 | | ... | ${nodes['DUT1']} | ipv4 | ${dut_to_tg_if2}
180 | | Setup vrf IDs | ${dut_node} | ${dut_to_tg_if1} | ${1}
181 | | Setup vrf IDs | ${dut_node} | ${dut_to_tg_if2} | ${1}
182 | | Honeycomb configures interface state | ${dut_node} | ${dut_to_tg_if1} | up
183 | | Honeycomb configures interface state | ${dut_node} | ${dut_to_tg_if2} | up
184 | | Honeycomb sets interface IPv4 address with prefix | ${dut_node}
185 | | ... | ${dut_to_tg_if1} | ${dut_to_tg_if1_ip} | ${prefix_len}
186 | | Honeycomb sets interface IPv4 address with prefix | ${dut_node}
187 | | ... | ${dut_to_tg_if2} | ${dut_to_tg_if2_ip} | ${prefix_len}
188 | | Honeycomb adds interface IPv4 neighbor | ${dut_node} | ${dut_to_tg_if1}
189 | | ... | ${src_ip} | ${tg_to_dut_if1_mac}
190 | | Honeycomb adds interface IPv4 neighbor | ${dut_node} | ${dut_to_tg_if2}
191 | | ... | ${next_hop} | ${tg_to_dut_if2_mac}
192
193 | Setup interfaces and neighbors for IPv6 routing test
194 | | Configure path in 2-node circular topology
195 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
196 | | Import Variables | resources/test_data/honeycomb/routing.py
197 | | ... | ${nodes['DUT1']} | ipv6 | ${dut_to_tg_if2}
198 | | Honeycomb sets interface VRF ID
199 | | ... | ${dut_node} | ${dut_to_tg_if1} | ${1} | ipv6
200 | | Honeycomb sets interface VRF ID
201 | | ... | ${dut_node} | ${dut_to_tg_if2} | ${1} | ipv6
202 | | Honeycomb configures interface state | ${dut_node} | ${dut_to_tg_if1} | up
203 | | Honeycomb configures interface state | ${dut_node} | ${dut_to_tg_if2} | up
204 | | Honeycomb sets interface IPv6 address | ${dut_node}
205 | | ... | ${dut_to_tg_if1} | ${dut_to_tg_if1_ip} | ${prefix_len}
206 | | Honeycomb sets interface IPv6 address | ${dut_node}
207 | | ... | ${dut_to_tg_if2} | ${dut_to_tg_if2_ip} | ${prefix_len}
208 | | Honeycomb adds interface IPv6 neighbor | ${dut_node} | ${dut_to_tg_if1}
209 | | ... | ${src_ip} | ${tg_to_dut_if1_mac}
210 | | Honeycomb adds interface IPv6 neighbor | ${dut_node} | ${dut_to_tg_if2}
211 | | ... | ${next_hop} | ${tg_to_dut_if2_mac}
212 | | Vpp all ra suppress link layer | ${nodes}
213
214 | Honeycomb routing test teardown
215 | | ...
216 | | [arguments] | ${node} | ${routing_table}
217 | | ...
218 | | Show Packet Trace on All DUTs | ${nodes}
219 | | Log routing configuration from VAT | ${node}
220 | | Honeycomb removes routing configuration | ${node} | ${routing_table}
221
222 | Setup vrf IDs
223 | | ...
224 | | [Arguments] | ${node} | ${interface} | ${vrf}
225 | | ...
226 | | Honeycomb sets interface VRF ID
227 | | ... | ${node} | ${interface} | ${vrf} | ipv4
228 | | Honeycomb sets interface VRF ID
229 | | ... | ${node} | ${interface} | ${vrf} | ipv6