Fix Tap failing tests
[csit.git] / resources / libraries / robot / honeycomb / port_mirroring.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.honeycomb.HcAPIKwInterfaces.InterfaceKeywords
16 | Library | resources.libraries.python.telemetry.SPAN
17 | Library  | resources.libraries.python.InterfaceUtil
18 | Library  | resources.libraries.python.IPv4Util
19 | Library  | resources.libraries.python.IPv4Setup
20 | Library  | resources.libraries.python.Trace
21
22 *** Keywords ***
23 | Honeycomb configures SPAN on interface
24 | | [Documentation] | Uses Honeycomb API to configure SPAN on the specified\
25 | | ... | interface, mirroring one or more interfaces.
26 | | ...
27 | | ... | *Arguments:*
28 | | ... | - node - information about a DUT node. Type: dictionary
29 | | ... | - dst_interface - Mirroring destination interface. Type: string
30 | | ... | - src_interfaces - Mirroring source interfaces. Type: list \
31 | | ... | of dictionaries
32 | | ...
33 | | ... | *Example:*
34 | | ...
35 | | ... | \| Honeycomb configures SPAN on interface \| ${nodes['DUT1']} \
36 | | ... | \| GigabitEthernet0/8/0 \| [{'iface-ref': 'GigabitEthernet0/10/0', \
37 | | ... | \| 'state': 'transmit'}, \
38 | | ... | \| {'iface-ref': 'local0', 'state': 'both'}] \|
39 | | ...
40 | | [Arguments] | ${node} | ${dst_interface} | @{src_interfaces}
41 | | Configure interface SPAN
42 | | ... | ${node} | ${dst_interface} | ${src_interfaces}
43
44 | Interface SPAN Operational Data From Honeycomb Should Be
45 | | [Documentation] | Retrieves interface operational data and verifies that\
46 | | ... | SPAN mirroring is configured with the provided interfaces.
47 | | ...
48 | | ... | *Arguments:*
49 | | ... | - node - information about a DUT node. Type: dictionary
50 | | ... | - dst_interface - Mirroring destination interface. Type: string
51 | | ... | - src_interfaces - Mirroring source interfaces. Type: Argument list -\
52 | | ... | any number of strings
53 | | ...
54 | | ... | *Example:*
55 | | ...
56 | | ... | \| Interface SPAN Operational Data From Honeycomb Should Be \
57 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| GigabitEthernet0/9/0 \|
58 | | ...
59 | | [Arguments] | ${node} | ${dst_interface} | @{src_interfaces}
60 | | ${data}= | Get interface oper data | ${node} | ${dst_interface}
61 | | ${data}= | Set Variable
62 | | ... | ${data['v3po:span']['mirrored-interfaces']['mirrored-interface']}
63 | | Sort list | ${data}
64 | | Sort list | ${src_interfaces}
65 | | Lists should be equal | ${data} | ${src_interfaces}
66
67 | Interface SPAN Operational Data From Honeycomb Should Be empty
68 | | [Documentation] | Checks whether SPAN configuration from Honeycomb is empty.
69 | | ...
70 | | ... | *Arguments:*
71 | | ... | - node - Information about a DUT node. Type: dictionary
72 | | ... | - dst_interface - Mirroring destination interface. Type: string
73 | | ...
74 | | ... | *Example:*
75 | | ...
76 | | ... | \| Interface SPAN Operational Data From Honeycomb Should Be empty \
77 | | ... | \| ${node} \| GigabitEthernetO/8/0 \|
78 | | ...
79 | | [Arguments] | ${node} | ${dst_interface}
80 | | ${data}= | Get interface oper data | ${node} | ${dst_interface}
81 | | Variable should not exist
82 | | ... | ${data['v3po:span']['mirrored-interfaces']['mirrored-interface']}
83
84 | Interface SPAN Operational Data From VAT Should Be
85 | | [Documentation] | Retrieves SPAN configuration from VAT dump and verifies\
86 | | ... | that SPAN mirroring is configured with the provided interfaces.
87 | | ...
88 | | ... | *Arguments:*
89 | | ... | - node - information about a DUT node. Type: dictionary
90 | | ... | - dst_interface - Mirroring destination interface. Type: string
91 | | ... | - src_interfaces - Mirroring source interfaces. Type: Argument list -\
92 | | ... | any number of strings
93 | | ...
94 | | ... | *Example:*
95 | | ...
96 | | ... | \| Interface SPAN Operational Data From VAT Should Be \
97 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| GigabitEthernet0/9/0 \|
98 | | ...
99 | | [Arguments] | ${node} | ${dst_interface} | @{src_interfaces}
100 | | ${data}= | VPP get SPAN configuration by interface
101 | | ... | ${node} | ${dst_interface} | name
102 | | Sort list | ${data}
103 | | Sort list | ${src_interfaces}
104 | | Lists should be equal | ${data} | ${src_interfaces}
105
106 | Honeycomb removes interface SPAN configuration
107 | | [Documentation] | Uses Honeycomb API to remove SPAN configuration\
108 | | ... | from the specified interface.
109 | | ...
110 | | ... | *Arguments:*
111 | | ... | - node - information about a DUT node. Type: dictionary
112 | | ... | - dst_interface - Mirroring destination interface. Type: string
113 | | ...
114 | | ... | *Example:*
115 | | ...
116 | | ... | \| Honeycomb removes interface SPAN configuration \
117 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \|
118 | | ...
119 | | [Arguments] | ${node} | ${dst_interface}
120 | | Configure interface SPAN | ${node} | ${dst_interface}
121
122 | Interface SPAN Operational Data from Honeycomb should not exist
123 | | [Documentation] | Retrieves interface operational data and verifies that\
124 | | ... | SPAN mirroring is not configured.
125 | | ...
126 | | ... | *Arguments:*
127 | | ... | - node - information about a DUT node. Type: dictionary
128 | | ... | - dst_interface - Mirroring destination interface. Type: string
129 | | ...
130 | | ... | *Example:*
131 | | ...
132 | | ... | \|
133 | | [Arguments] | ${node} | ${dst_interface}
134 | | ${data}= | Get interface oper data | ${node} | ${dst_interface}
135 | | Run keyword and expect error | *KeyError* | Set Variable
136 | | ... | ${data['span']['mirrored-interfaces']['mirrored-interface']}
137
138 | SPAN Operational Data from VAT should not exist
139 | | [Documentation] | Attmepts to retrieve SPAN Operational Data from VAT dump,\
140 | | ... | and expects to fail with no data retrieved.
141 | | ...
142 | | ... | *Arguments:*
143 | | ... | - node - information about a DUT node. Type: dictionary
144 | | ...
145 | | ... | *Example:*
146 | | ...
147 | | ... | \| SPAN Operational Data from VAT should not exist \| ${nodes['DUT1']} \|
148 | | [Arguments] | ${node}
149 | | Run keyword and expect error | ValueError: No JSON object could be decoded
150 | | ... | VPP get SPAN configuration by interface | ${node} | local0
151
152 | Honeycomb Configures SPAN on sub-interface
153 | | [Documentation] | Uses Honeycomb API to configure SPAN on the specified\
154 | | ... | sub-interface, mirroring one or more interfaces.
155 | | ...
156 | | ... | *Arguments:*
157 | | ... | - node - information about a DUT node. Type: dictionary
158 | | ... | - dst_interface - Mirroring destination super-interface. Type: string
159 | | ... | - index - Index of mirroring destination sub-interface. Type: integer
160 | | ... | - src_interfaces - Mirroring source interfaces. Type: list \
161 | | ... | of dictionaries
162 | | ...
163 | | ... | *Example:*
164 | | ...
165 | | ... | \| Honeycomb Configures SPAN on sub-interface \| ${nodes['DUT1']} \
166 | | ... | \| GigabitEthernet0/8/0 \| ${1} \
167 | | ... | \|[{'iface-ref': 'GigabitEthernet0/10/0', 'state': 'transmit'}, \
168 | | ... | \| {'iface-ref': 'local0', 'state': 'both'}] \|
169 | | ...
170 | | [Arguments] | ${node} | ${dst_interface} | ${index} | @{src_interfaces}
171 | | Configure sub interface SPAN
172 | | ... | ${node} | ${dst_interface} | ${index} | ${src_interfaces}
173
174 | Sub-Interface SPAN Operational Data from Honeycomb should be
175 | | [Documentation] | Retrieves sub-interface operational data and verifies\
176 | | ... | that SPAN mirroring is configured with the provided interfaces.
177 | | ...
178 | | ... | *Arguments:*
179 | | ... | - node - information about a DUT node. Type: dictionary
180 | | ... | - dst_interface - Mirroring destination super-interface. Type: string
181 | | ... | - index - Index of mirroring destination sub-interface. Type: integer
182 | | ... | - src_interfaces - Mirroring source interfaces. Type: Argument list -\
183 | | ... | any number of strings
184 | | ...
185 | | ... | *Example:*
186 | | ...
187 | | ... | \| Sub-Interface SPAN Operational Data from Honeycomb should be \
188 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \
189 | | ... | \| GigabitEthernet0/9/0 \|
190 | | ...
191 | | [Arguments] | ${node} | ${dst_interface} | ${index} | @{src_interfaces}
192 | | ${data}= | Get sub interface oper data
193 | | ... | ${node} | ${dst_interface} | ${index}
194 | | ${data}= | Set Variable
195 | | ... | ${data['subinterface-span:span-state']['mirrored-interfaces']['mirrored-interface']}
196 | | Sort list | ${data}
197 | | Sort list | ${src_interfaces}
198 | | Lists should be equal | ${data} | ${src_interfaces}
199
200 | Sub-Interface SPAN Operational Data from Honeycomb should be empty
201 | | [Documentation] | Checks whether SPAN Operational Data from Honeycomb is empty.
202 | | ...
203 | | ... | *Arguments:*
204 | | ... | - node - Information about a DUT node. Type: dictionary
205 | | ... | - dst_interface - Mirroring destination super-interface. Type: string
206 | | ... | - index - Index of mirroring destination sub-interface. Type: integer
207 | | ...
208 | | ... | *Example:*
209 | | ...
210 | | ... | \| Interface SPAN Operational Data from Honeycomb should be empty \
211 | | ... | \| ${node} \| GigabitEthernetO/8/0 \| ${1} \|
212 | | ...
213 | | [Arguments] | ${node} | ${dst_interface} | ${index}
214 | | ${data}= | Get sub interface oper data
215 | | ... | ${node} | ${dst_interface} | ${index}
216 | | Variable should not exist
217 | | ... | ${data['subinterface-span:span-state']['mirrored-interfaces']['mirrored-interface']}
218
219 | Honeycomb removes sub-interface SPAN configuration
220 | | [Documentation] | Uses Honeycomb API to remove SPAN Operational Data\
221 | | ... | from the specified sub-interface.
222 | | ...
223 | | ... | *Arguments:*
224 | | ... | - node - information about a DUT node. Type: dictionary
225 | | ... | - dst_interface - Mirroring destination super-interface. Type: string
226 | | ... | - index - Index of mirroring destination sub-interface. Type: integer
227 | | ...
228 | | ... | *Example:*
229 | | ...
230 | | ... | \| Honeycomb removes sub-interface SPAN configuration \
231 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \|
232 | | ...
233 | | [Arguments] | ${node} | ${dst_interface} | ${index}
234 | | Configure sub interface SPAN
235 | | ... | ${node} | ${dst_interface} | ${index}
236
237 | Sub-Interface SPAN Operational Data from Honeycomb should not exist
238 | | [Documentation] | Retrieves sub-interface operational data and verifies
239 | | ... | that SPAN mirroring is not configured.
240 | | ...
241 | | ... | *Arguments:*
242 | | ... | - node - information about a DUT node. Type: dictionary
243 | | ... | - dst_interface - Mirroring destination super-interface. Type: string
244 | | ... | - index - Index of mirroring destination sub-interface. Type: integer
245 | | ...
246 | | ... | *Example:*
247 | | ...
248 | | ... | \| Sub-Interface SPAN Operational Data from Honeycomb should not exist \
249 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \|
250 | | ....
251 | | [Arguments] | ${node} | ${dst_interface} | ${index}
252 | | ${data}= | Get sub interface oper data
253 | | ... | ${node} | ${dst_interface} | ${index}
254 | | Run keyword and expect error | *KeyError* | Set Variable
255 | | ... | ${data['subinterface-span:span-state']['mirrored-interfaces']['mirrored-interface']}