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