aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/robot/honeycomb/interfaces.robot
blob: 19f4ddac716a657f2473ceae0b84a35c47000565 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
# Copyright (c) 2016 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

*** Settings ***
| Library | resources.libraries.python.InterfaceUtil
| ...     | WITH NAME | interfaceCLI
| Library | resources.libraries.python.honeycomb.HcAPIKwInterfaces.InterfaceKeywords
| ...     | WITH NAME | InterfaceAPI

*** Keywords ***
| Interface state is
| | [Documentation] | Uses VPP binary API to ensure that the interface under\
| | ... | test is in the specified admin state.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - state - state to set on interface. Type:string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Interface state is \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \
| | ... | \| up \|
| | [Arguments] | ${node} | ${interface} | ${state}
| | interfaceCLI.Set interface state | ${node} | ${interface} | ${state}

| Honeycomb sets interface state
| | [Documentation] | Uses Honeycomb API to change the admin state\
| | ... | of the specified interface.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - state - state to set on interface. Type:string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb sets interface state \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \| up \|
| | [Arguments] | ${node} | ${interface} | ${state}
| | interfaceAPI.Set interface state | ${node} | ${interface} | ${state}

| Interface state from Honeycomb should be
| | [Documentation] | Retrieves interface admin state through Honeycomb and\
| | ... | compares with state supplied in argument.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - state - expected interface state. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Interface state from Honeycomb should be \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \| up \|
| | [Arguments] | ${node} | ${interface} | ${state}
| | ${api_data}= | interfaceAPI.Get interface oper data | ${node} | ${interface}
| | ${api_state}= | Set Variable | ${api_data['admin-status']}
| | Should be equal | ${api_state} | ${state}

| Interface state from VAT should be
| | [Documentation] | Retrieves interface admin state through VAT and compares\
| | ... | with state supplied in argument.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - state - expected interface state. Type: string
| | ...
| | ... | _NOTE:_ Vat returns state as int (1/0) instead of string (up/down).
| | ... | This keyword also handles translation.
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Interface state from VAT should be \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \| up \|
| | [Arguments] | ${node} | ${interface} | ${state}
| | ${vat_data}= | InterfaceCLI.VPP get interface data | ${node} | ${interface}
| | ${vat_state}= | Set Variable if
| | ... | ${vat_data['admin_up_down']} == 1 | up | down
| | Should be equal | ${vat_state} | ${state}

| Honeycomb sets interface ipv4 configuration
| | [Documentation] | Uses Honeycomb API to change ipv4 configuration\
| | ... | of the specified interface.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - address - IP address to set. Type: string
| | ... | - netmask - subnet mask to set. Type: string
| | ... | - fib_address - IP address to add to fib table. Type: string
| | ... | - fib_mac - MAC address to add to fib table. Type: string
| | ... | - settings - ipv4 interface settings. Type: dictionary
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb sets interface ipv4 configuration \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \| 192.168.0.2 \| 255.255.255.0 \
| | ... | \| 192.168.0.3 \| 08:00:27:c0:5d:37 \
| | ... | \| ${{'enabled': True, 'mtu': 1500}} \|
| | [Arguments] | ${node} | ${interface} | ${address} | ${netmask}
| | ... | ${fib_address} | ${fib_mac} | ${settings}
| | interfaceAPI.Add first ipv4 address
| | ... | ${node} | ${interface} | ${address} | ${netmask}
| | interfaceAPI.Add first ipv4 neighbor
| | ... | ${node} | ${interface} | ${fib_address} | ${fib_mac}
| | :FOR | ${key} | IN | @{settings.keys()}
| | | interfaceAPI.Configure interface ipv4
| | | ... | ${node} | ${interface} | ${key} | ${settings['${key}']}

| Honeycomb sets interface ipv4 address with prefix
| | [Documentation] | Uses Honeycomb API to assign an ipv4 address to the\
| | ... | specified interface. Any existing addresses will be removed.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - address - IP address to set. Type: string
| | ... | - prefix - length of address network prefix. Type: int
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb sets interface ipv4 address with prefix \
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| 192.168.0.2 \| 24 \|
| | [Arguments] | ${node} | ${interface} | ${address} | ${prefix}
| | interfaceAPI.Add first ipv4 address
| | ... | ${node} | ${interface} | ${address} | ${prefix}

| IPv4 config from Honeycomb should be
| | [Documentation] | Retrieves interface ipv4 configuration through Honeycomb\
| | ... | and compares with state supplied in argument.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - address - IP address to expect. Type: string
| | ... | - netmask - subnet mask to expect. Type: string
| | ... | - fib_address - IP address to expect in fib table. Type: string
| | ... | - fib_mac - MAC address to expect in fib table. Type: string
| | ... | - settings - ipv4 interface settings to expect. Type: dictionary
| | ...
| | ... | *Example:*
| | ...
| | ... | \| IPv4 config from Honeycomb should be \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \| 192.168.0.2 \| 255.255.255.0 \
| | ... | \| 192.168.0.3 \| 08:00:27:c0:5d:37 \
| | ... | \| ${{'enabled': True, 'mtu': 1500}} \|
| | [Arguments] | ${node} | ${interface} | ${address} | ${netmask}
| | ... | ${fib_address} | ${fib_mac} | ${settings}
| | ${api_data}= | interfaceAPI.Get interface oper data | ${node} | ${interface}
| | Should be equal | ${address}
| | ... | ${api_data['ietf-ip:ipv4']['address'][0]['ip']}
| | Should be equal | ${netmask}
| | ... | ${api_data['ietf-ip:ipv4']['address'][0]['netmask']}
| | Should be equal | ${fib_address}
| | ... | ${api_data['ietf-ip:ipv4']['neighbor'][0]['ip']
| | Should be equal | ${fib_mac}
| | ... | ${api_data['ietf-ip:ipv4']['neighbor'][0]['link-layer-address']
| | :FOR | ${key} | IN | @{settings.keys()}
| | | Should be equal
| | | ... | ${settings['{key']} | ${api_data['ietf-ip:ipv4']['{$key}']}

| IPv4 config from VAT should be
| | [Documentation] | Retrieves interface ipv4 configuration through VAT and\
| | ... | compares with state supplied in argument.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - address - IP address to expect. Type: string
| | ... | - netmask - subnet mask to expect. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| IPv4 config from VAT should be \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \| 192.168.0.2 \| 255.255.255.0 \|
| | [Arguments] | ${node} | ${interface} | ${address} | ${netmask}
| | ${vpp_data}= | interfaceCLI.VPP get interface ip addresses
| | ... | ${node} | ${interface} | ipv4
| | Should be equal | ${vpp_data[0]['ip']} | ${address}
| | Should be equal | ${vpp_data[0]['netmask']} | ${netmask}

| Honeycomb sets interface ipv6 configuration
| | [Documentation] | Uses Honeycomb API to change ipv6 configuration\
| | ... | of the specified interface.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - address - IP address to set. Type: string
| | ... | - prefix - length of subnet prefix to set. Type: string
| | ... | - fib_address - IP address to add to fib table. Type: string
| | ... | - fib_mac - MAC address to add to fib table. Type: string
| | ... | - settings - ipv6 interface settings. Type: dictionary
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb sets interface ipv6 configuration \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \| 10::10 \| 64 \
| | ... | \| 10::11 \| 08:00:27:c0:5d:37 \| ${{'enabled': True, 'mtu': 1500}} \|
| | [Arguments] | ${node} | ${interface} | ${address} | ${prefix}
| | ... | ${fib_address} | ${fib_mac} | ${settings}
| | interfaceAPI.Add first ipv6 address
| | ... | ${node} | ${interface} | ${address} | ${prefix}
| | interfaceAPI.Add first ipv6 neighbor
| | ... | ${node} | ${interface} | ${fib_address} | ${fib_mac}
| | :FOR | ${key} | IN | @{settings.keys()}
| | | interfaceAPI.Configure interface ipv6
| | | ... | ${node} | ${interface} | ${key} | ${settings['${key}']}

| IPv6 config from Honeycomb should be
| | [Documentation] | Retrieves interface ipv6 configuration through Honeycomb\
| | ... | and compares with state supplied in argument.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - address - IP address to expect. Type: string
| | ... | - prefix - length of subnet prefix to expect. Type: string
| | ... | - fib_address - IP address to expect in fib table. Type: string
| | ... | - fib_mac - MAC address to expect in fib table. Type: string
| | ... | - settings - ipv6 interface settings to expect. Type: dictionary
| | ...
| | ... | *Example:*
| | ...
| | ... | \| IPv6 config from Honeycomb should be \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \| 10::10 \| 64 \
| | ... | \| 10::11 \| 08:00:27:c0:5d:37 \| ${{'enabled': True, 'mtu': 1500}} \|
| | [Arguments] | ${node} | ${interface} | ${address} | ${prefix}
| | ... | ${fib_address} | ${fib_mac} | ${settings}
| | ${api_data}= | interfaceAPI.Get interface oper data | ${node} | ${interface}
| | Should be equal | ${address}
| | ... | ${api_data['ietf-ip:ipv6']['address'][0]['ip']}
| | Should be equal | ${prefix}
| | ... | ${api_data['ietf-ip:ipv6']['address'][0]['prefix-length']}
| | Should be equal | ${fib_address}
| | ... | ${api_data['ietf-ip:ipv6']['neighbor'][0]['ip']
| | Should be equal | ${fib_mac}
| | ... | ${api_data['ietf-ip:ipv6']['neighbor'][0]['link-layer-address']
| | :FOR | ${key} | IN | @{settings.keys()}
| | | Should be equal
| | ... | ${settings['{key']} | ${api_data['ietf-ip:ipv6']['{$key}']}

| IPv6 config from VAT should be
| | [Documentation] | Retrieves interface ipv6 configuration through VAT and\
| | ... | compares with state supplied in argument.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - address - IP address to expect. Type: string
| | ... | - prefix - length of subnet prefix to expect. Type: string
| | ...
| | ... | *Example:*
| | ...
| | ... | \| IPv6 config from VAT should be \| ${nodes['DUT1']} \
| | ... | \| GigabitEthernet0/8/0 \| 10::10 \| 64 \|
| | [Arguments] | ${node} | ${interface} | ${address} | ${prefix}
| | ${vpp_data}= | interfaceCLI.VPP get interface ip addresses
| | ... | ${node} | ${interface} | ipv6
| | Should be equal | ${vpp_data[0]['ip']} | ${address}
| | Should be equal | ${vpp_data[0]['prefix-length']} | ${prefix}

| Honeycomb sets interface ethernet and routing configuration
| | [Documentation] | Uses Honeycomb API to change interface configuration.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - ethernet - interface ethernet settings. Type: dictionary
| | ... | - routing - interface routing settings. Type: dictionary
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Honeycomb sets interface ethernet and routing configuration \
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${{'mtu': 1500}} \
| | ... | \| ${{'vrf-if': 2}} \|
| | [Arguments] | ${node} | ${interface} | ${ethernet} | ${routing}
| | :FOR | ${key} | IN | @{ethernet.keys()}
| | | interfaceAPI.Configure interface ethernet
| | | ... | ${node} | ${interface} | ${key} | ${ethernet['${key}']}
| | :FOR | ${key} | IN | @{routing.keys()}
| | | interfaceAPI.Configure interface routing
| | | ... | ${node} | ${interface} | ${key} | ${routing['${key}']}

| Interface ethernet and routing configuration from Honeycomb should be
| | [Documentation] | Retrieves interface routing and ethernet configuration\
| | ... | through Honeycomb and compares with settings supplied in arguments.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - ethernet - interface ethernet settings. Type: dictionary
| | ... | - routing - interface routing settings. Type: dictionary
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Interface ethernet and routing configuration from Honeycomb \
| | ... | should be \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \
| | ... | \| ${{'mtu': 1500}} \| ${{'vrf-id': 2}} \|
| | [Arguments] | ${node} | ${interface} | ${ethernet} | ${routing}
| | ${api_data}= | interfaceAPI.Get interface oper data | ${node} | ${interface}
| | :FOR | ${key} | IN | @{ethernet.keys()}
| | | Should be equal | ${api_data['${key}']} | ${ethernet['${key}']}
| | :FOR | ${key} | IN | @{routing.keys()}
| | | Should be equal | ${api_data['${key}']} | ${routing['${key}']}

| Interface ethernet and routing configuration from VAT should be
| | [Documentation] | Retrieves interface routing and ethernet configuration\
| | ... | through VAT and compares with settings supplied in arguments.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of an interface on the specified node. Type: string
| | ... | - mtu - value of maximum transmission unit expected. Type: integer
| | ... | - vrf-id - ID number of a VPN expected on interface. Type: integer
| | ...
| | ... | *Example:*
| | ...
| | ... | \| Interface ethernet and routing configuration from VAT \
| | ... | should be \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1500} \
| | ... | \| ${2} \|
| | [Arguments] | ${node} | ${interface} | ${mtu} | ${vrf-id}
| | ${vat_data}= | InterfaceCLI.VPP get interface data | ${node} | ${interface}
| | Should be equal | ${vat_data['mtu']} | ${mtu}

| Interface configuration from Honeycomb should be empty
| | [Documentation] | Attempts to retrieve interface configuration through\
| | ... | Honeycomb and expects to get empty dictionary.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of a interface on the specified node. Type:\
| | ... | string
| | ...
| | ... | *Example:*
| | ... | \| Interface configuration from Honeycomb should be empty\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \|
| | ...
| | [Arguments] | ${node} | ${interface}
| | ${api_data}= | interfaceAPI.Get interface oper data | ${node} | ${interface}
| | Should be empty | ${api_data}

| Interface configuration from VAT should be empty
| | [Documentation] | Attempts to retrieve Interface configuration through\
| | ... | VAT and expects to get empty dictionary.
| | ...
| | ... | *Arguments:*
| | ... | - node - information about a DUT node. Type: dictionary
| | ... | - interface - name of a Interface on the specified node. Type:\
| | ... | string
| | ...
| | ... | *Example:*
| | ... | \| Interface configuration from VAT should be empty\
| | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \|
| | ...
| | [Arguments] | ${node} | ${interface} |
| | ${vat_data}= | InterfaceCLI.VPP get interface data | ${node} | ${interface}
| | Should be empty | ${vat_data}