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