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.honeycomb.HcAPIKwInterfaces.InterfaceKeywords
16 | ... | WITH NAME | InterfaceAPI
17 | Library | resources.libraries.python.telemetry.SPAN
18 | Library | resources.libraries.python.InterfaceUtil
19 | Library | resources.libraries.python.IPv4Util
20 | Library | resources.libraries.python.IPv4Setup
21 | Library | resources.libraries.python.Trace
24 | Honeycomb configures SPAN on interface
25 | | [Documentation] | Uses Honeycomb API to configure SPAN on the specified\
26 | | ... | interface, mirroring one or more interfaces.
28 | | ... | *Arguments:*
29 | | ... | - node - information about a DUT node. Type: dictionary
30 | | ... | - dst_interface - Mirroring destination interface. Type: string
31 | | ... | - src_interfaces - Mirroring source interfaces. Type: list \
32 | | ... | of dictionaries
36 | | ... | \| Honeycomb configures SPAN on interface \| ${nodes['DUT1']} \
37 | | ... | \| GigabitEthernet0/8/0 \| [{'iface-ref': 'GigabitEthernet0/10/0', \
38 | | ... | \| 'state': 'transmit'}, \
39 | | ... | \| {'iface-ref': 'local0', 'state': 'both'}] \|
41 | | [Arguments] | ${node} | ${dst_interface} | @{src_interfaces}
42 | | InterfaceAPI.Configure interface SPAN
43 | | ... | ${node} | ${dst_interface} | ${src_interfaces}
45 | Interface SPAN Operational Data From Honeycomb Should Be
46 | | [Documentation] | Retrieves interface operational data and verifies that\
47 | | ... | SPAN mirroring is configured with the provided interfaces.
49 | | ... | *Arguments:*
50 | | ... | - node - information about a DUT node. Type: dictionary
51 | | ... | - dst_interface - Mirroring destination interface. Type: string
52 | | ... | - src_interfaces - Mirroring source interfaces. Type: Argument list -\
53 | | ... | any number of strings
57 | | ... | \| Interface SPAN Operational Data From Honeycomb Should Be \
58 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| GigabitEthernet0/9/0 \|
60 | | [Arguments] | ${node} | ${dst_interface} | @{src_interfaces}
61 | | ${data}= | InterfaceAPI.Get interface oper data | ${node} | ${dst_interface}
62 | | ${data}= | Set Variable
63 | | ... | ${data['v3po:span']['mirrored-interfaces']['mirrored-interface']}
64 | | Sort list | ${data}
65 | | Sort list | ${src_interfaces}
66 | | Lists should be equal | ${data} | ${src_interfaces}
68 | Interface SPAN Operational Data From Honeycomb Should Be empty
69 | | [Documentation] | Checks whether SPAN configuration from Honeycomb is empty.
71 | | ... | *Arguments:*
72 | | ... | - node - Information about a DUT node. Type: dictionary
73 | | ... | - dst_interface - Mirroring destination interface. Type: string
77 | | ... | \| Interface SPAN Operational Data From Honeycomb Should Be empty \
78 | | ... | \| ${node} \| GigabitEthernetO/8/0 \|
80 | | [Arguments] | ${node} | ${dst_interface}
81 | | ${data}= | Get interface oper data | ${node} | ${dst_interface}
82 | | Variable should not exist
83 | | ... | ${data['v3po:span']['mirrored-interfaces']['mirrored-interface']}
85 | Interface SPAN Operational Data From VAT Should Be
86 | | [Documentation] | Retrieves SPAN configuration from VAT dump and verifies\
87 | | ... | that SPAN mirroring is configured with the provided interfaces.
89 | | ... | *Arguments:*
90 | | ... | - node - information about a DUT node. Type: dictionary
91 | | ... | - dst_interface - Mirroring destination interface. Type: string
92 | | ... | - src_interfaces - Mirroring source interfaces. Type: Argument list -\
93 | | ... | any number of strings
97 | | ... | \| Interface SPAN Operational Data From VAT Should Be \
98 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| GigabitEthernet0/9/0 \|
100 | | [Arguments] | ${node} | ${dst_interface} | @{src_interfaces}
101 | | ${data}= | VPP get SPAN configuration by interface
102 | | ... | ${node} | ${dst_interface} | name
103 | | Sort list | ${data}
104 | | Sort list | ${src_interfaces}
105 | | Lists should be equal | ${data} | ${src_interfaces}
107 | Honeycomb removes interface SPAN configuration
108 | | [Documentation] | Uses Honeycomb API to remove SPAN configuration\
109 | | ... | from the specified interface.
111 | | ... | *Arguments:*
112 | | ... | - node - information about a DUT node. Type: dictionary
113 | | ... | - dst_interface - Mirroring destination interface. Type: string
117 | | ... | \| Honeycomb removes interface SPAN configuration \
118 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \|
120 | | [Arguments] | ${node} | ${dst_interface}
121 | | InterfaceAPI.Configure interface SPAN | ${node} | ${dst_interface}
123 | Interface SPAN Operational Data from Honeycomb should not exist
124 | | [Documentation] | Retrieves interface operational data and verifies that\
125 | | ... | SPAN mirroring is not configured.
127 | | ... | *Arguments:*
128 | | ... | - node - information about a DUT node. Type: dictionary
129 | | ... | - dst_interface - Mirroring destination interface. Type: string
134 | | [Arguments] | ${node} | ${dst_interface}
135 | | ${data}= | InterfaceAPI.Get interface oper data | ${node} | ${dst_interface}
136 | | Run keyword and expect error | *KeyError* | Set Variable
137 | | ... | ${data['span']['mirrored-interfaces']['mirrored-interface']}
139 | SPAN Operational Data from VAT should not exist
140 | | [Documentation] | Attmepts to retrieve SPAN Operational Data from VAT dump,\
141 | | ... | and expects to fail with no data retrieved.
143 | | ... | *Arguments:*
144 | | ... | - node - information about a DUT node. Type: dictionary
148 | | ... | \| SPAN Operational Data from VAT should not exist \| ${nodes['DUT1']} \|
149 | | [Arguments] | ${node}
150 | | Run keyword and expect error | ValueError: No JSON object could be decoded
151 | | ... | VPP get SPAN configuration by interface | ${node} | local0
153 | Honeycomb Configures SPAN on sub-interface
154 | | [Documentation] | Uses Honeycomb API to configure SPAN on the specified\
155 | | ... | sub-interface, mirroring one or more interfaces.
157 | | ... | *Arguments:*
158 | | ... | - node - information about a DUT node. Type: dictionary
159 | | ... | - dst_interface - Mirroring destination super-interface. Type: string
160 | | ... | - index - Index of mirroring destination sub-interface. Type: integer
161 | | ... | - src_interfaces - Mirroring source interfaces. Type: list \
162 | | ... | of dictionaries
166 | | ... | \| Honeycomb Configures SPAN on sub-interface \| ${nodes['DUT1']} \
167 | | ... | \| GigabitEthernet0/8/0 \| ${1} \
168 | | ... | \|[{'iface-ref': 'GigabitEthernet0/10/0', 'state': 'transmit'}, \
169 | | ... | \| {'iface-ref': 'local0', 'state': 'both'}] \|
171 | | [Arguments] | ${node} | ${dst_interface} | ${index} | @{src_interfaces}
172 | | InterfaceAPI.Configure sub interface SPAN
173 | | ... | ${node} | ${dst_interface} | ${index} | ${src_interfaces}
175 | Sub-Interface SPAN Operational Data from Honeycomb should be
176 | | [Documentation] | Retrieves sub-interface operational data and verifies\
177 | | ... | that SPAN mirroring is configured with the provided interfaces.
179 | | ... | *Arguments:*
180 | | ... | - node - information about a DUT node. Type: dictionary
181 | | ... | - dst_interface - Mirroring destination super-interface. Type: string
182 | | ... | - index - Index of mirroring destination sub-interface. Type: integer
183 | | ... | - src_interfaces - Mirroring source interfaces. Type: Argument list -\
184 | | ... | any number of strings
188 | | ... | \| Sub-Interface SPAN Operational Data from Honeycomb should be \
189 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \
190 | | ... | \| GigabitEthernet0/9/0 \|
192 | | [Arguments] | ${node} | ${dst_interface} | ${index} | @{src_interfaces}
193 | | ${data}= | InterfaceAPI.Get sub interface oper data
194 | | ... | ${node} | ${dst_interface} | ${index}
195 | | ${data}= | Set Variable
196 | | ... | ${data['subinterface-span:span-state']['mirrored-interfaces']['mirrored-interface']}
197 | | Sort list | ${data}
198 | | Sort list | ${src_interfaces}
199 | | Lists should be equal | ${data} | ${src_interfaces}
201 | Sub-Interface SPAN Operational Data from Honeycomb should be empty
202 | | [Documentation] | Checks whether SPAN Operational Data from Honeycomb is empty.
204 | | ... | *Arguments:*
205 | | ... | - node - Information about a DUT node. Type: dictionary
206 | | ... | - dst_interface - Mirroring destination super-interface. Type: string
207 | | ... | - index - Index of mirroring destination sub-interface. Type: integer
211 | | ... | \| Interface SPAN Operational Data from Honeycomb should be empty \
212 | | ... | \| ${node} \| GigabitEthernetO/8/0 \| ${1} \|
214 | | [Arguments] | ${node} | ${dst_interface} | ${index}
215 | | ${data}= | Get sub interface oper data
216 | | ... | ${node} | ${dst_interface} | ${index}
217 | | Variable should not exist
218 | | ... | ${data['subinterface-span:span-state']['mirrored-interfaces']['mirrored-interface']}
220 | Honeycomb removes sub-interface SPAN configuration
221 | | [Documentation] | Uses Honeycomb API to remove SPAN Operational Data\
222 | | ... | from the specified sub-interface.
224 | | ... | *Arguments:*
225 | | ... | - node - information about a DUT node. Type: dictionary
226 | | ... | - dst_interface - Mirroring destination super-interface. Type: string
227 | | ... | - index - Index of mirroring destination sub-interface. Type: integer
231 | | ... | \| Honeycomb removes sub-interface SPAN configuration \
232 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \|
234 | | [Arguments] | ${node} | ${dst_interface} | ${index}
235 | | InterfaceAPI.Configure sub interface SPAN
236 | | ... | ${node} | ${dst_interface} | ${index}
238 | Sub-Interface SPAN Operational Data from Honeycomb should not exist
239 | | [Documentation] | Retrieves sub-interface operational data and verifies
240 | | ... | that SPAN mirroring is not configured.
242 | | ... | *Arguments:*
243 | | ... | - node - information about a DUT node. Type: dictionary
244 | | ... | - dst_interface - Mirroring destination super-interface. Type: string
245 | | ... | - index - Index of mirroring destination sub-interface. Type: integer
249 | | ... | \| Sub-Interface SPAN Operational Data from Honeycomb should not exist \
250 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \|
252 | | [Arguments] | ${node} | ${dst_interface} | ${index}
253 | | ${data}= | InterfaceAPI.Get sub interface oper data
254 | | ... | ${node} | ${dst_interface} | ${index}
255 | | Run keyword and expect error | *KeyError* | Set Variable
256 | | ... | ${data['subinterface-span:span-state']['mirrored-interfaces']['mirrored-interface']}