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 | Library | resources.libraries.python.telemetry.SPAN
17 | Library | resources.libraries.python.InterfaceUtil
18 | Library | resources.libraries.python.IPUtil
19 | Library | resources.libraries.python.Trace
22 | Honeycomb configures SPAN on interface
23 | | [Documentation] | Uses Honeycomb API to configure SPAN on the specified\
24 | | ... | interface, mirroring one or more interfaces.
26 | | ... | *Arguments:*
27 | | ... | - node - information about a DUT node. Type: dictionary
28 | | ... | - dst_interface - Mirroring destination interface. Type: string
29 | | ... | - src_interfaces - Mirroring source interfaces. Type: list \
30 | | ... | of dictionaries
34 | | ... | \| Honeycomb configures SPAN on interface \| ${nodes['DUT1']} \
35 | | ... | \| GigabitEthernet0/8/0 \| [{'iface-ref': 'GigabitEthernet0/10/0', \
36 | | ... | \| 'state': 'transmit'}, \
37 | | ... | \| {'iface-ref': 'local0', 'state': 'both'}] \|
39 | | [Arguments] | ${node} | ${dst_interface} | @{src_interfaces}
40 | | Configure interface SPAN
41 | | ... | ${node} | ${dst_interface} | ${src_interfaces}
43 | Interface SPAN Operational Data From Honeycomb Should Be
44 | | [Documentation] | Retrieves interface operational data and verifies that\
45 | | ... | SPAN mirroring is configured with the provided interfaces.
47 | | ... | *Arguments:*
48 | | ... | - node - information about a DUT node. Type: dictionary
49 | | ... | - dst_interface - Mirroring destination interface. Type: string
50 | | ... | - src_interfaces - Mirroring source interfaces. Type: Argument list -\
51 | | ... | any number of strings
55 | | ... | \| Interface SPAN Operational Data From Honeycomb Should Be \
56 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| GigabitEthernet0/9/0 \|
58 | | [Arguments] | ${node} | ${dst_interface} | @{src_interfaces}
59 | | ${data}= | Get interface oper data | ${node} | ${dst_interface}
60 | | ${data}= | Set Variable
61 | | ... | ${data['v3po:span']['mirrored-interfaces']['mirrored-interface']}
62 | | Sort list | ${data}
63 | | Sort list | ${src_interfaces}
64 | | Lists should be equal | ${data} | ${src_interfaces}
66 | Interface SPAN Operational Data From Honeycomb Should Be empty
67 | | [Documentation] | Checks whether SPAN configuration from Honeycomb is empty.
69 | | ... | *Arguments:*
70 | | ... | - node - Information about a DUT node. Type: dictionary
71 | | ... | - dst_interface - Mirroring destination interface. Type: string
75 | | ... | \| Interface SPAN Operational Data From Honeycomb Should Be empty \
76 | | ... | \| ${node} \| GigabitEthernetO/8/0 \|
78 | | [Arguments] | ${node} | ${dst_interface}
79 | | ${data}= | Get interface oper data | ${node} | ${dst_interface}
80 | | Variable should not exist
81 | | ... | ${data['v3po:span']['mirrored-interfaces']['mirrored-interface']}
83 | Interface SPAN Operational Data From VAT Should Be
84 | | [Documentation] | Retrieves SPAN configuration from VAT dump and verifies\
85 | | ... | that SPAN mirroring is configured with the provided interfaces.
87 | | ... | *Arguments:*
88 | | ... | - node - information about a DUT node. Type: dictionary
89 | | ... | - dst_interface - Mirroring destination interface. Type: string
90 | | ... | - src_interfaces - Mirroring source interfaces. Type: Argument list -\
91 | | ... | any number of strings
95 | | ... | \| Interface SPAN Operational Data From VAT Should Be \
96 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| GigabitEthernet0/9/0 \|
98 | | [Arguments] | ${node} | ${dst_interface} | @{src_interfaces}
99 | | ${data}= | VPP get SPAN configuration by interface
100 | | ... | ${node} | ${dst_interface} | name
101 | | Sort list | ${data}
102 | | Sort list | ${src_interfaces}
103 | | Lists should be equal | ${data} | ${src_interfaces}
105 | Honeycomb removes interface SPAN configuration
106 | | [Documentation] | Uses Honeycomb API to remove SPAN configuration\
107 | | ... | from the specified interface.
109 | | ... | *Arguments:*
110 | | ... | - node - information about a DUT node. Type: dictionary
111 | | ... | - dst_interface - Mirroring destination interface. Type: string
115 | | ... | \| Honeycomb removes interface SPAN configuration \
116 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \|
118 | | [Arguments] | ${node} | ${dst_interface}
119 | | Configure interface SPAN | ${node} | ${dst_interface}
121 | Interface SPAN Operational Data from Honeycomb should not exist
122 | | [Documentation] | Retrieves interface operational data and verifies that\
123 | | ... | SPAN mirroring is not configured.
125 | | ... | *Arguments:*
126 | | ... | - node - information about a DUT node. Type: dictionary
127 | | ... | - dst_interface - Mirroring destination interface. Type: string
132 | | [Arguments] | ${node} | ${dst_interface}
133 | | ${data}= | Get interface oper data | ${node} | ${dst_interface}
134 | | Run keyword and expect error | *KeyError* | Set Variable
135 | | ... | ${data['span']['mirrored-interfaces']['mirrored-interface']}
137 | SPAN Operational Data from VAT should not exist
138 | | [Documentation] | Attmepts to retrieve SPAN Operational Data from VAT dump,\
139 | | ... | and expects to fail with no data retrieved.
141 | | ... | *Arguments:*
142 | | ... | - node - information about a DUT node. Type: dictionary
146 | | ... | \| SPAN Operational Data from VAT should not exist \| ${nodes['DUT1']} \|
147 | | [Arguments] | ${node}
148 | | Run keyword and expect error | ValueError: No JSON object could be decoded
149 | | ... | VPP get SPAN configuration by interface | ${node} | local0
151 | Honeycomb Configures SPAN on sub-interface
152 | | [Documentation] | Uses Honeycomb API to configure SPAN on the specified\
153 | | ... | sub-interface, mirroring one or more interfaces.
155 | | ... | *Arguments:*
156 | | ... | - node - information about a DUT node. Type: dictionary
157 | | ... | - dst_interface - Mirroring destination super-interface. Type: string
158 | | ... | - index - Index of mirroring destination sub-interface. Type: integer
159 | | ... | - src_interfaces - Mirroring source interfaces. Type: list \
160 | | ... | of dictionaries
164 | | ... | \| Honeycomb Configures SPAN on sub-interface \| ${nodes['DUT1']} \
165 | | ... | \| GigabitEthernet0/8/0 \| ${1} \
166 | | ... | \|[{'iface-ref': 'GigabitEthernet0/10/0', 'state': 'transmit'}, \
167 | | ... | \| {'iface-ref': 'local0', 'state': 'both'}] \|
169 | | [Arguments] | ${node} | ${dst_interface} | ${index} | @{src_interfaces}
170 | | Configure sub interface SPAN
171 | | ... | ${node} | ${dst_interface} | ${index} | ${src_interfaces}
173 | Sub-Interface SPAN Operational Data from Honeycomb should be
174 | | [Documentation] | Retrieves sub-interface operational data and verifies\
175 | | ... | that SPAN mirroring is configured with the provided interfaces.
177 | | ... | *Arguments:*
178 | | ... | - node - information about a DUT node. Type: dictionary
179 | | ... | - dst_interface - Mirroring destination super-interface. Type: string
180 | | ... | - index - Index of mirroring destination sub-interface. Type: integer
181 | | ... | - src_interfaces - Mirroring source interfaces. Type: Argument list -\
182 | | ... | any number of strings
186 | | ... | \| Sub-Interface SPAN Operational Data from Honeycomb should be \
187 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \
188 | | ... | \| GigabitEthernet0/9/0 \|
190 | | [Arguments] | ${node} | ${dst_interface} | ${index} | @{src_interfaces}
191 | | ${data}= | Get sub interface oper data
192 | | ... | ${node} | ${dst_interface} | ${index}
193 | | ${data}= | Set Variable
194 | | ... | ${data['subinterface-span:span']['mirrored-interfaces']['mirrored-interface']}
195 | | Sort list | ${data}
196 | | Sort list | ${src_interfaces}
197 | | Lists should be equal | ${data} | ${src_interfaces}
199 | Sub-Interface SPAN Operational Data from Honeycomb should be empty
200 | | [Documentation] | Checks whether SPAN Operational Data from Honeycomb is empty.
202 | | ... | *Arguments:*
203 | | ... | - node - Information about a DUT node. Type: dictionary
204 | | ... | - dst_interface - Mirroring destination super-interface. Type: string
205 | | ... | - index - Index of mirroring destination sub-interface. Type: integer
209 | | ... | \| Interface SPAN Operational Data from Honeycomb should be empty \
210 | | ... | \| ${node} \| GigabitEthernetO/8/0 \| ${1} \|
212 | | [Arguments] | ${node} | ${dst_interface} | ${index}
213 | | ${data}= | Get sub interface oper data
214 | | ... | ${node} | ${dst_interface} | ${index}
215 | | Variable should not exist
216 | | ... | ${data['subinterface-span:span']['mirrored-interfaces']['mirrored-interface']}
218 | Honeycomb removes sub-interface SPAN configuration
219 | | [Documentation] | Uses Honeycomb API to remove SPAN Operational Data\
220 | | ... | from the specified sub-interface.
222 | | ... | *Arguments:*
223 | | ... | - node - information about a DUT node. Type: dictionary
224 | | ... | - dst_interface - Mirroring destination super-interface. Type: string
225 | | ... | - index - Index of mirroring destination sub-interface. Type: integer
229 | | ... | \| Honeycomb removes sub-interface SPAN configuration \
230 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \|
232 | | [Arguments] | ${node} | ${dst_interface} | ${index}
233 | | Configure sub interface SPAN
234 | | ... | ${node} | ${dst_interface} | ${index}
236 | Sub-Interface SPAN Operational Data from Honeycomb should not exist
237 | | [Documentation] | Retrieves sub-interface operational data and verifies
238 | | ... | that SPAN mirroring is not configured.
240 | | ... | *Arguments:*
241 | | ... | - node - information about a DUT node. Type: dictionary
242 | | ... | - dst_interface - Mirroring destination super-interface. Type: string
243 | | ... | - index - Index of mirroring destination sub-interface. Type: integer
247 | | ... | \| Sub-Interface SPAN Operational Data from Honeycomb should not exist \
248 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \|
250 | | [Arguments] | ${node} | ${dst_interface} | ${index}
251 | | ${data}= | Get sub interface oper data
252 | | ... | ${node} | ${dst_interface} | ${index}
253 | | Run keyword and expect error | *KeyError* | Set Variable
254 | | ... | ${data['subinterface-span:span']['mirrored-interfaces']['mirrored-interface']}