FIX: Remove old restart sequence - Honeycomb
[csit.git] / resources / libraries / robot / honeycomb / bridge_domain.robot
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:
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.L2Util
16 | Library | resources.libraries.python.honeycomb.HcAPIKwBridgeDomain.BridgeDomainKeywords
17 | Library | resources.libraries.python.honeycomb.HcAPIKwInterfaces.InterfaceKeywords
18 | Library | resources.libraries.python.InterfaceUtil
19
20 *** Keywords ***
21 | Honeycomb creates first L2 bridge domain
22 | | [Documentation] | Uses Honeycomb API to create a bridge domain on the \
23 | | ... | VPP node. Any other bridge domains will be removed in the process.
24 | | ...
25 | | ... | *Arguments:*
26 | | ... | - node - Information about a DUT node. Type: dictionary
27 | | ... | - bd_name - Name of the created bridge domain. Type: string
28 | | ... | - settings - Settings for the created bridge domain. Type: dictionary
29 | | ...
30 | | ... | *Example:*
31 | | ...
32 | | ... | \| Honeycomb creates first L2 bridge domain \| ${nodes['DUT1']} \
33 | | ... | \| bd-04 \| ${{flood:True, learn:False}} \|
34 | | [Arguments] | ${node} | ${bd_name} | ${settings}
35 | | Add first BD | ${node} | ${bd_name} | &{settings}
36
37 | Honeycomb creates L2 bridge domain
38 | | [Documentation] | Uses Honeycomb API to create a bridge domain on the \
39 | | ... | VPP node.
40 | | ...
41 | | ... | *Arguments:*
42 | | ... | - node - Information about a DUT node. Type: dictionary
43 | | ... | - bd_name - Name of the created bridge domain. Type: string
44 | | ... | - settings - Settings for the created bridge domain. Type: dictionary
45 | | ...
46 | | ... | *Example:*
47 | | ...
48 | | ... | \| Honeycomb creates L2 bridge domain \| ${nodes['DUT1']} \
49 | | ... | \| bd-04 \| ${{flood:True, learn:False}} \|
50 | | [Arguments] | ${node} | ${bd_name} | ${settings}
51 | | Add BD | ${node} | ${bd_name} | &{settings}
52
53 | Bridge domain Operational Data From Honeycomb Should Be
54 | | [Documentation] | Uses Honeycomb API to verify bridge domain settings\
55 | | ... | against provided values.
56 | | ...
57 | | ... | *Arguments:*
58 | | ... | - node - Information about a DUT node. Type: dictionary
59 | | ... | - bd_name - Name of the bridge domain. Type: string
60 | | ... | - settings - Expected settings for the bridge domain. Type: dictionary
61 | | ...
62 | | ... | *Example:*
63 | | ...
64 | | ... | \| Bridge domain Operational Data From Honeycomb Should Be \
65 | | ... | \| ${nodes['DUT1']} \| bd-04 \| ${{flood:True,learn:False}} \|
66 | | [Arguments] | ${node} | ${bd_name} | ${settings}
67 | | ${api_data}= | Get bd oper data | ${node} | ${bd_name}
68 | | :FOR | ${key} | IN | @{settings.keys()}
69 | | | Should be equal | ${settings['${key}']} | ${api_data['${key}']}
70
71 | Bridge domain Operational Data From VAT Should Be
72 | | [Documentation] | Uses VAT to verify bridge domain settings\
73 | | ... | against provided values.
74 | | ...
75 | | ... | *Arguments:*
76 | | ... | - node - Information about a DUT node. Type: dictionary
77 | | ... | - bd_name - Name of the bridge domain. Type: string
78 | | ... | - settings - Expected settings for the bridge domain. Type: dictionary
79 | | ...
80 | | ... | *Example:*
81 | | ...
82 | | ... | \| Bridge domain Operational Data From VAT Should Be \
83 | | ... | \| ${nodes['DUT1']} \| bd-04 \| ${{flood:True,learn:False}} \|
84 | | [Arguments] | ${node} | ${bd_index} | ${settings}
85 | | ${vat_data}= | VPP get bridge domain data | ${node}
86 | | ${vat_data}= | Set Variable | ${vat_data[${bd_index}]}
87 | | :FOR | ${key} | IN | @{settings.keys()}
88 | | | Run keyword if | $key in $vat_data.keys()
89 | | | ... | Should be equal | ${settings['${key}']} | ${vat_data['${key}']}
90
91 | Honeycomb adds interfaces to bridge domain
92 | | [Documentation] | Uses Honeycomb API to assign interfaces to a bridge\
93 | | ... | domain.
94 | | ...
95 | | ... | *Arguments:*
96 | | ... | - node - Information about a DUT node. Type: dictionary
97 | | ... | - interface1, interface2 - Names of interfaces to assign to bridge\
98 | | ... | domain. Type: string
99 | | ... | - bd_name - Name of the bridge domain. Type: string
100 | | ... | - settings - Bridge domain specific interface settings.\
101 | | ... | Type: dictionary
102 | | ...
103 | | ... | *Example:*
104 | | ...
105 | | ... | \| Honeycomb adds interfaces to bridge domain \| ${nodes['DUT1']} \
106 | | ... | \| GigabitEthernet0/8/0 \| GigabitEthernet0/9/0 \| bd-04 \
107 | | ... | \| ${{split_horizon_group:2, bvi:False}} \|
108 | | [Arguments] | ${node} | ${interface1} | ${interface2} | ${bd_name}
109 | | ... | ${settings}
110 | | Add bridge domain to interface
111 | | ... | ${node} | ${interface1} | ${bd_name} | &{settings}
112 | | Add bridge domain to interface
113 | | ... | ${node} | ${interface2} | ${bd_name} | &{settings}
114
115 | Honeycomb should show interfaces assigned to bridge domain
116 | | [Documentation] | Uses Honeycomb API to verify interface assignment to\
117 | | ... | bridge domain.
118 | | ...
119 | | ... | *Arguments:*
120 | | ... | - node - Information about a DUT node. Type: dictionary
121 | | ... | - interface1, interface2 - Names of interfaces to assign to bridge\
122 | | ... | domain. Type: string
123 | | ... | - bd_name - Name of the bridge domain. Type: string
124 | | ... | - settings - Bridge domain specific interface settings.\
125 | | ... | Type: dictionary
126 | | ...
127 | | ... | *Example:*
128 | | ...
129 | | ... | \| Honeycomb should show interfaces assigned to bridge domain \
130 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| GigabitEthernet0/9/0 \
131 | | ... | \| bd-04 \| ${{split_horizon_group:2, bvi:False}} \|
132 | | [Arguments] | ${node} | ${interface1} | ${interface2} | ${bd_name}
133 | | ... | ${settings}
134 | | ${if1_data}= | Get interface oper data
135 | | ... | ${node} | ${interface1}
136 | | ${if2_data}= | Get interface oper data
137 | | ... | ${node} | ${interface2}
138 | | Should be equal | ${if1_data['v3po:l2']['bridge-domain']}
139 | | ... | ${if2_data['v3po:l2']['bridge-domain']} | ${bd_name}
140 | | Should be equal | ${if1_data['v3po:l2']['split-horizon-group']}
141 | | ... | ${if2_data['v3po:l2']['split-horizon-group']}
142 | | ... | ${settings['split_horizon_group']}
143 | | Should be equal | ${if1_data['v3po:l2']['bridged-virtual-interface']}
144 | | ... | ${if2_data['v3po:l2']['bridged-virtual-interface']}
145 | | ... | ${settings['bvi']}
146
147 | PAPI should show interfaces assigned to bridge domain
148 | | [Documentation] | Uses VAT to verify interface assignment to\
149 | | ... | bridge domain.
150 | | ...
151 | | ... | *Arguments:*
152 | | ... | - node - Information about a DUT node. Type: dictionary
153 | | ... | - index - Index of bridge domains on VPP node. Starts from 0,\
154 | | ... | new BDs reuse numbers after a bridge domain is removed. Type: int
155 | | ... | - interface1, interface2 - names of interfaces to check bridge domain\
156 | | ... | assignment on. Type: string
157 | | ... | - settings - bridge domain specific interface settings.\
158 | | ... | Type: dictionary
159 | | ...
160 | | ... | *Example:*
161 | | ...
162 | | ... | \| PAPI should show interfaces assigned to bridge domain \
163 | | ... | \| ${nodes['DUT1']} \| ${4} \| GigabitEthernet0/8/0 \
164 | | ... | \| GigabitEthernet0/9/0 \| ${{split_horizon_group:2, bvi:False}} \|
165 | | [Arguments] | ${node} | ${index} | ${interface1} | ${interface2}
166 | | ... | ${settings}
167 | | ${if1_link}= | Get interface by name | ${node} | ${interface1}
168 | | ${if2_link}= | Get interface by name | ${node} | ${interface2}
169 | | ${if_indices}= | Create list
170 | | ... | ${node['interfaces']['${if1_link}']['vpp_sw_index']}
171 | | ... | ${node['interfaces']['${if2_link}']['vpp_sw_index']}
172 | | ${bd_data}= | VPP get bridge domain data | ${node}
173 | | ${bd_interfaces}= | Set Variable | ${bd_data[${index}]['sw_if_details']}
174 | | @{bd_interfaces}= | Create List | ${bd_interfaces[0]} | ${bd_interfaces[1]}
175 | | :FOR | ${interface} | IN | @{bd_interfaces}
176 # interface[1] = sw_if_index, interface[2] = shg
177 | | | Should contain | ${if_indices} | ${interface[1]}
178 | | | Should be equal | ${interface[2]} | ${settings['split_horizon_group']}
179
180 | Honeycomb removes all bridge domains
181 | | [Documentation] | Uses Honeycomb API to remove all bridge domains from the \
182 | | ... | VPP node.
183 | | ...
184 | | ... | *Arguments:*
185 | | ... | - node - Information about a DUT node. Type: dictionary
186 | | ...
187 | | ... | *Example:*
188 | | ...
189 | | ... | \| Honeycomb removes all bridge domains \| ${nodes['DUT1']} \|
190 | | [Arguments] | ${node} | @{interfaces}
191 | | :FOR | ${interface} | IN | @{interfaces}
192 | | | Remove bridge domain from interface | ${node} | ${interface}
193 | | Remove all bridge domains | ${node}
194
195 | Honeycomb should show no bridge domains
196 | | [Documentation] | Uses Honeycomb API to verify the removal of all\
197 | | ... | bridge domains.
198 | | ...
199 | | ... | *Arguments:*
200 | | ... | - node - Information about a DUT node. Type: dictionary
201 | | ...
202 | | ... | *Example:*
203 | | ...
204 | | ... | \| Honeycomb should show no bridge domains \| ${nodes['DUT1']} \|
205 | | [Arguments] | ${node}
206 | | Run keyword and expect error | *Not possible*Status code: 404*
207 | | ... | Get all BDs oper data | ${node}
208
209 | PAPI should show no bridge domains
210 | | [Documentation] | Uses VAT to verify the removal of all bridge domains.
211 | | ...
212 | | ... | *Arguments:*
213 | | ... | - node - Information about a DUT node. Type: dictionary
214 | | ...
215 | | ... | *Example:*
216 | | ...
217 | | ... | \| PAPI should show no bridge domains \| ${nodes['DUT1']} \|
218 | | [Arguments] | ${node}
219 | | ${data}= | VPP get bridge domain data | ${node}
220 | | Should be empty | ${data}
221
222 | Honeycomb adds interface to bridge domain
223 | | [Documentation] | Uses Honeycomb API to assign interface to a bridge\
224 | | ... | domain.
225 | | ...
226 | | ... | *Arguments:*
227 | | ... | - node - Information about a DUT node. Type: dictionary
228 | | ... | - interface - Name of interface to assign to bridge domain.\
229 | | ... | Type: string
230 | | ... | - bd_name - Name of the bridge domain. Type: string
231 | | ... | - settings - Bridge domain specific interface settings.\
232 | | ... | Type: dictionary
233 | | ...
234 | | ... | *Example:*
235 | | ...
236 | | ... | \| Honeycomb adds interfaces to bridge domain \| ${nodes['DUT1']} \
237 | | ... | \| GigabitEthernet0/8/0 \| bd-04 \
238 | | ... | \| ${{split_horizon_group:2, bvi:False}} \|
239 | | ...
240 | | [Arguments] | ${node} | ${interface} | ${bd_name} | ${settings}
241 | | ...
242 | | Add bridge domain to interface
243 | | ... | ${node} | ${interface} | ${bd_name}
244 | | ... | ${settings['split-horizon-group']}
245 | | ... | ${settings['bridged-virtual-interface']}
246
247 | Bridge domain Operational Interface Assignment should be empty
248 | | [Documentation] | Get interface operational data and retrieve bridge
249 | | ... | domain configuration from it. It should be empty.
250 | | ...
251 | | ... | *Arguments:*
252 | | ... | - node - Information about a DUT node. Type: dictionary
253 | | ... | - interface - Name of interface where the bridge domain parameters \
254 | | ... | will be checked.Type: string
255 | | ...
256 | | ... | *Example:*
257 | | ... | \| Bridge domain Operational Interface Assignment should \
258 | | ... | be empty \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \|
259 | | ...
260 | | [Arguments] | ${node} | ${interface}
261 | | ...
262 | | ${if_data}= | Get BD Oper Data From Interface
263 | | ... | ${node} | ${interface}
264 | | Should be empty | ${if_data}
265
266 | Bridge domain Operational Interface Assignment should be
267 | | [Documentation] | Get interface operational data and retrieve bridge
268 | | ... | domain configuration from it. Compare the data to the expected one.
269 | | ...
270 | | ... | *Arguments:*
271 | | ... | - node - Information about a DUT node. Type: dictionary
272 | | ... | - interface - Name of interface where the bridge domain parameters \
273 | | ... | will be checked. Type: string
274 | | ... | - bd_settings - The referential bridge domain data. Type: dictionary
275 | | ...
276 | | ... | *Example:*
277 | | ... | \| Bridge domain Operational Interface Assignment should \
278 | | ... | be \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${if_bd_settings} \|
279 | | ...
280 | | [Arguments] | ${node} | ${interface} | ${bd_settings}
281 | | ...
282 | | ${if_data}= | Get BD Oper Data From Interface
283 | | ... | ${node} | ${interface}
284 | | Compare Data Structures | ${if_data} | ${bd_settings}