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