1 # Copyright (c) 2016 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:
6 # http://www.apache.org/licenses/LICENSE-2.0
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.
15 | Library | resources.libraries.python.L2Util
16 | Library | resources.libraries.python.honeycomb.HcAPIKwBridgeDomain.BridgeDomainKeywords
17 | Library | resources.libraries.python.honeycomb.HcAPIKwInterfaces.InterfaceKeywords
18 | ... | WITH NAME | InterfaceAPI
19 | Library | resources.libraries.python.InterfaceUtil
20 | ... | WITH NAME | interfaceCLI
23 | Honeycomb creates first L2 bridge domain
24 | | [Documentation] | Uses Honeycomb API to create a bridge domain on the \
25 | | ... | VPP node. Any other bridge domains will be removed in the process.
27 | | ... | *Arguments:*
28 | | ... | - node - Information about a DUT node. Type: dictionary
29 | | ... | - bd_name - Name of the created bridge domain. Type: string
30 | | ... | - settings - Settings for the created bridge domain. Type: dictionary
34 | | ... | \| Honeycomb creates first L2 bridge domain \| ${nodes['DUT1']} \
35 | | ... | \| bd-04 \| ${{flood:True, learn:False}} \|
36 | | [Arguments] | ${node} | ${bd_name} | ${settings}
37 | | Add first BD | ${node} | ${bd_name} | &{settings}
39 | Honeycomb creates L2 bridge domain
40 | | [Documentation] | Uses Honeycomb API to create a bridge domain on the \
43 | | ... | *Arguments:*
44 | | ... | - node - Information about a DUT node. Type: dictionary
45 | | ... | - bd_name - Name of the created bridge domain. Type: string
46 | | ... | - settings - Settings for the created bridge domain. Type: dictionary
50 | | ... | \| Honeycomb creates L2 bridge domain \| ${nodes['DUT1']} \
51 | | ... | \| bd-04 \| ${{flood:True, learn:False}} \|
52 | | [Arguments] | ${node} | ${bd_name} | ${settings}
53 | | Add BD | ${node} | ${bd_name} | &{settings}
55 | Bridge domain configuration from Honeycomb should be
56 | | [Documentation] | Uses Honeycomb API to verify bridge domain settings\
57 | | ... | against provided values.
59 | | ... | *Arguments:*
60 | | ... | - node - Information about a DUT node. Type: dictionary
61 | | ... | - bd_name - Name of the bridge domain. Type: string
62 | | ... | - settings - Expected settings for the bridge domain. Type: dictionary
66 | | ... | \| Bridge domain configuration from Honeycomb should be \
67 | | ... | \| ${nodes['DUT1']} \| bd-04 \| ${{flood:True,learn:False}} \|
68 | | [Arguments] | ${node} | ${bd_name} | ${settings}
69 | | ${api_data}= | Get bd oper data | ${node} | ${bd_name}
70 | | :FOR | ${key} | IN | @{settings.keys()}
71 | | | Should be equal | ${settings['${key}']} | ${api_data['${key}']}
73 | Bridge domain configuration from VAT should be
74 | | [Documentation] | Uses VAT to verify bridge domain settings\
75 | | ... | against provided values.
77 | | ... | *Arguments:*
78 | | ... | - node - Information about a DUT node. Type: dictionary
79 | | ... | - bd_name - Name of the bridge domain. Type: string
80 | | ... | - settings - Expected settings for the bridge domain. Type: dictionary
84 | | ... | \| Bridge domain configuration from VAT should be \
85 | | ... | \| ${nodes['DUT1']} \| bd-04 \| ${{flood:True,learn:False}} \|
86 | | [Arguments] | ${node} | ${bd_index} | ${settings}
87 | | ${vat_data}= | VPP get bridge domain data | ${node}
88 | | ${vat_data}= | Set Variable | ${vat_data[${bd_index}]}
89 | | :FOR | ${key} | IN | @{settings.keys()}
90 | | | Run keyword if | $key in $vat_data.keys()
91 | | | ... | Should be equal | ${settings['${key}']} | ${vat_data['${key}']}
93 | Honeycomb adds interfaces to bridge domain
94 | | [Documentation] | Uses Honeycomb API to assign interfaces to a bridge\
97 | | ... | *Arguments:*
98 | | ... | - node - Information about a DUT node. Type: dictionary
99 | | ... | - interface1, interface2 - Names of interfaces to assign to bridge\
100 | | ... | domain. Type: string
101 | | ... | - bd_name - Name of the bridge domain. Type: string
102 | | ... | - settings - Bridge domain specific interface settings.\
103 | | ... | Type: dictionary
107 | | ... | \| Honeycomb adds interfaces to bridge domain \| ${nodes['DUT1']} \
108 | | ... | \| GigabitEthernet0/8/0 \| GigabitEthernet0/9/0 \| bd-04 \
109 | | ... | \| ${{split_horizon_group:2, bvi:False}} \|
110 | | [Arguments] | ${node} | ${interface1} | ${interface2} | ${bd_name}
111 | | ... | ${settings}
112 | | interfaceAPI.Add bridge domain to interface
113 | | ... | ${node} | ${interface1} | ${bd_name} | &{settings}
114 | | interfaceAPI.Add bridge domain to interface
115 | | ... | ${node} | ${interface2} | ${bd_name} | &{settings}
117 | Honeycomb fails to add interfaces to bridge domain
118 | | [Documentation] | Uses Honeycomb API to assign interfaces to a bridge\
121 | | ... | *Arguments:*
122 | | ... | - node - information about a DUT node. Type: dictionary
123 | | ... | - interface1, interface2 - names of interfaces to assign to bridge\
124 | | ... | domain. Type: string
125 | | ... | - bd_name - name of the bridge domain. Type: string
126 | | ... | - settings - bridge domain specific interface settings.\
127 | | ... | Type: dictionary
131 | | ... | \| Honeycomb fails to add interfaces to bridge domain \
132 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| GigabitEthernet0/9/0 \
133 | | ... | \| bd-04 \| ${{split_horizon_group:2, bvi:True}} \|
134 | | [Arguments] | ${node} | ${interface1} | ${interface2} | ${bd_name}
135 | | ... | ${settings}
136 | | Run keyword and expect error | *Failed to validate*
137 | | ... | Honeycomb adds interfaces to bridge domain | ${node} | ${interface1}
138 | | ... | ${interface2} | ${bd_name} | ${settings}
140 | Honeycomb should show interfaces assigned to bridge domain
141 | | [Documentation] | Uses Honeycomb API to verify interface assignment to\
142 | | ... | bridge domain.
144 | | ... | *Arguments:*
145 | | ... | - node - Information about a DUT node. Type: dictionary
146 | | ... | - interface1, interface2 - Names of interfaces to assign to bridge\
147 | | ... | domain. Type: string
148 | | ... | - bd_name - Name of the bridge domain. Type: string
149 | | ... | - settings - Bridge domain specific interface settings.\
150 | | ... | Type: dictionary
154 | | ... | \| Honeycomb should show interfaces assigned to bridge domain \
155 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| GigabitEthernet0/9/0 \
156 | | ... | \| bd-04 \| ${{split_horizon_group:2, bvi:False}} \|
157 | | [Arguments] | ${node} | ${interface1} | ${interface2} | ${bd_name}
158 | | ... | ${settings}
159 | | ${if1_data}= | interfaceAPI.Get interface oper data
160 | | ... | ${node} | ${interface1}
161 | | ${if2_data}= | interfaceAPI.Get interface oper data
162 | | ... | ${node} | ${interface2}
163 | | Should be equal | ${if1_data['v3po:l2']['bridge-domain']}
164 | | ... | ${if2_data['v3po:l2']['bridge-domain']} | ${bd_name}
165 | | Should be equal | ${if1_data['v3po:l2']['split-horizon-group']}
166 | | ... | ${if2_data['v3po:l2']['split-horizon-group']}
167 | | ... | ${settings['split_horizon_group']}
168 | | Should be equal | ${if1_data['v3po:l2']['bridged-virtual-interface']}
169 | | ... | ${if2_data['v3po:l2']['bridged-virtual-interface']}
170 | | ... | ${settings['bvi']}
172 | Honeycomb should not show interfaces assigned to bridge domain
173 | | [Documentation] | Uses Honeycomb API to verify interface assignment to\
174 | | ... | bridge domain.
176 | | ... | *Arguments:*
177 | | ... | - node - information about a DUT node. Type: dictionary
178 | | ... | - interface1, interface2 - names of interfaces to check bridge domain\
179 | | ... | assignment on. Type: string
180 | | ... | - bd_name - name of the bridge domain. Type: string
181 | | ... | - settings - bridge domain specific interface settings.\
182 | | ... | Type: dictionary
186 | | ... | \| Honeycomb should not show interfaces assigned to bridge domain \
187 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| GigabitEthernet0/9/0 \
188 | | ... | \| bd-04 \| ${{split_horizon_group:2, bvi:False}} \|
189 | | [Arguments] | ${node} | ${interface1} | ${interface2} | ${bd_name}
190 | | ... | ${settings}
191 | | Run keyword and expect error | *ValueError*
192 | | ... | Honeycomb should show interfaces assigned to bridge domain
193 | | ... | ${node} | ${interface1} | ${interface2} | ${bd_name} | ${settings}
195 | VAT should show interfaces assigned to bridge domain
196 | | [Documentation] | Uses VAT to verify interface assignment to\
197 | | ... | bridge domain.
199 | | ... | *Arguments:*
200 | | ... | - node - Information about a DUT node. Type: dictionary
201 | | ... | - index - Index of bridge domains on VPP node. Starts from 0,\
202 | | ... | new BDs reuse numbers after a bridge domain is removed. Type: int
203 | | ... | - interface1, interface2 - names of interfaces to check bridge domain\
204 | | ... | assignment on. Type: string
205 | | ... | - settings - bridge domain specific interface settings.\
206 | | ... | Type: dictionary
210 | | ... | \| VAT should show interfaces assigned to bridge domain \
211 | | ... | \| ${nodes['DUT1']} \| ${4} \| GigabitEthernet0/8/0 \
212 | | ... | \| GigabitEthernet0/9/0 \| ${{split_horizon_group:2, bvi:False}} \|
213 | | [Arguments] | ${node} | ${index} | ${interface1} | ${interface2}
214 | | ... | ${settings}
215 | | ${if1_link}= | Get interface by name | ${node} | ${interface1}
216 | | ${if2_link}= | Get interface by name | ${node} | ${interface2}
217 | | ${if_indices}= | Create list
218 | | ... | ${node['interfaces']['${if1_link}']['vpp_sw_index']}
219 | | ... | ${node['interfaces']['${if2_link}']['vpp_sw_index']}
220 | | ${bd_data}= | VPP get bridge domain data | ${node}
221 | | ${bd_interfaces}= | Set Variable | ${bd_data[${index}]['sw_if']}
222 | | @{bd_interfaces}= | Create List | ${bd_interfaces[0]} | ${bd_interfaces[1]}
223 | | :FOR | ${interface} | IN | @{bd_interfaces}
224 | | | Should contain | ${if_indices} | ${interface['sw_if_index']}
225 | | | Should be equal | ${interface['shg']} | ${settings['split_horizon_group']}
227 | VAT should not show interfaces assigned to bridge domain
228 | | [Documentation] | Uses VAT to verify interface assignment to\
229 | | ... | bridge domain, and expects to fail.
231 | | ... | *Arguments:*
232 | | ... | - node - information about a DUT node. Type: dictionary
233 | | ... | - index - index of bridge domains on VPP node. Starts from 0,\
234 | | ... | new BDs reuse numbers after a bridge domain is removed. Type: integer
235 | | ... | - interface1, interface2 - names of interfaces to check bridge domain\
236 | | ... | assignment on. Type: string
237 | | ... | - settings - bridge domain specific interface settings.\
238 | | ... | Type: dictionary
242 | | ... | \| VAT should not show interfaces assigned to bridge domain \
243 | | ... | \| ${nodes['DUT1']} \| ${4} \| GigabitEthernet0/8/0 \
244 | | ... | \| GigabitEthernet0/9/0 \| ${{split_horizon_group:2, bvi:False}} \|
245 | | [Arguments] | ${node} | ${index} | ${interface1} | ${interface2}
246 | | ... | ${settings}
247 | | Run keyword and expect error | *No JSON object could be decoded*
248 | | ... | VAT should show interfaces assigned to bridge domain
249 | | ... | ${node} | ${index} | ${interface1} | ${interface2} | ${settings}
251 | Honeycomb removes all bridge domains
252 | | [Documentation] | Uses Honeycomb API to remove all bridge domains from the \
255 | | ... | *Arguments:*
256 | | ... | - node - Information about a DUT node. Type: dictionary
260 | | ... | \| Honeycomb removes all bridge domains \| ${nodes['DUT1']} \|
261 | | [Arguments] | ${node}
262 | | Remove all bds | ${node}
264 | Honeycomb should show no bridge domains
265 | | [Documentation] | Uses Honeycomb API to verify the removal of all\
266 | | ... | bridge domains.
268 | | ... | *Arguments:*
269 | | ... | - node - Information about a DUT node. Type: dictionary
273 | | ... | \| Honeycomb should show no bridge domains \| ${nodes['DUT1']} \|
274 | | [Arguments] | ${node}
275 | | ${bd_data}= | Get all BDs oper data | ${node}
276 | | Should be empty | ${bd_data}
278 | VAT should show no bridge domains
279 | | [Documentation] | Uses VAT to verify the removal of all bridge domains.
281 | | ... | *Arguments:*
282 | | ... | - node - Information about a DUT node. Type: dictionary
286 | | ... | \| VAT should show no bridge domains \| ${nodes['DUT1']} \|
287 | | [Arguments] | ${node}
288 | | Run Keyword And Expect Error | ValueError: No JSON object could be decoded
289 | | ... | VPP get bridge domain data | ${node}
291 | Honeycomb adds interface to bridge domain
292 | | [Documentation] | Uses Honeycomb API to assign interface to a bridge\
295 | | ... | *Arguments:*
296 | | ... | - node - Information about a DUT node. Type: dictionary
297 | | ... | - interface - Name of interface to assign to bridge domain.\
298 | | ... | Type: string
299 | | ... | - bd_name - Name of the bridge domain. Type: string
300 | | ... | - settings - Bridge domain specific interface settings.\
301 | | ... | Type: dictionary
305 | | ... | \| Honeycomb adds interfaces to bridge domain \| ${nodes['DUT1']} \
306 | | ... | \| GigabitEthernet0/8/0 \| bd-04 \
307 | | ... | \| ${{split_horizon_group:2, bvi:False}} \|
309 | | [Arguments] | ${node} | ${interface} | ${bd_name} | ${settings}
311 | | interfaceAPI.Add bridge domain to interface
312 | | ... | ${node} | ${interface} | ${settings['bridge-domain']}
313 | | ... | ${settings['split-horizon-group']}
314 | | ... | ${settings['bridged-virtual-interface']}
316 | Bridge domain configuration in interface operational data should be empty
317 | | [Documentation] | Get interface operational data and retrieve bridge
318 | | ... | domain configuration from it. It should be empty.
320 | | ... | *Arguments:*
321 | | ... | - node - Information about a DUT node. Type: dictionary
322 | | ... | - interface - Name of interface where the bridge domain parameters \
323 | | ... | will be checked.Type: string
326 | | ... | \| Bridge domain configuration in interface operational data should \
327 | | ... | be empty \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \|
329 | | [Arguments] | ${node} | ${interface}
331 | | ${if_data}= | interfaceAPI.Get BD Oper Data From Interface
332 | | ... | ${node} | ${interface}
333 | | Should be empty | ${if_data}
335 | Bridge domain configuration in interface operational data should be
336 | | [Documentation] | Get interface operational data and retrieve bridge
337 | | ... | domain configuration from it. Compare the data to the expected one.
339 | | ... | *Arguments:*
340 | | ... | - node - Information about a DUT node. Type: dictionary
341 | | ... | - interface - Name of interface where the bridge domain parameters \
342 | | ... | will be checked. Type: string
343 | | ... | - bd_settings - The referential bridge domain data. Type: dictionary
346 | | ... | \| Bridge domain configuration in interface operational data should \
347 | | ... | be \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${if_bd_settings} \|
349 | | [Arguments] | ${node} | ${interface} | ${bd_settings}
351 | | ${if_data}= | interfaceAPI.Get BD Oper Data From Interface
352 | | ... | ${node} | ${interface}
353 | | interfaceAPI.Compare Data Structures | ${if_data} | ${bd_settings}
355 | VAT removes bridge domain
356 | | [Documentation] Remove the specified bridge domain using VAT.
358 | | ... | *Arguments:*
359 | | ... | - node - Information about a DUT node. Type: dictionary
360 | | ... | - bd_id - Bridge domain ID. Type: integer
363 | | ... | \| VAT removes bridge domain \
364 | | ... | \| ${nodes['DUT1']} \| 1 \|
366 | | [Arguments] | ${node} | ${bd_id}
368 | | Delete Bridge Domain VAT | ${node} | ${bd_id}