CSIT-1459: Migrate IP libraries from VAT to PAPI
[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.IPUtil
19 | Library  | resources.libraries.python.Trace
20
21 *** Keywords ***
22 | Honeycomb configures SPAN on interface
23 | | [Documentation] | Uses Honeycomb API to configure SPAN on the specified\
24 | | ... | interface, mirroring one or more interfaces.
25 | | ...
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
31 | | ...
32 | | ... | *Example:*
33 | | ...
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'}] \|
38 | | ...
39 | | [Arguments] | ${node} | ${dst_interface} | @{src_interfaces}
40 | | Configure interface SPAN
41 | | ... | ${node} | ${dst_interface} | ${src_interfaces}
42
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.
46 | | ...
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
52 | | ...
53 | | ... | *Example:*
54 | | ...
55 | | ... | \| Interface SPAN Operational Data From Honeycomb Should Be \
56 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| GigabitEthernet0/9/0 \|
57 | | ...
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}
65
66 | Interface SPAN Operational Data From Honeycomb Should Be empty
67 | | [Documentation] | Checks whether SPAN configuration from Honeycomb is empty.
68 | | ...
69 | | ... | *Arguments:*
70 | | ... | - node - Information about a DUT node. Type: dictionary
71 | | ... | - dst_interface - Mirroring destination interface. Type: string
72 | | ...
73 | | ... | *Example:*
74 | | ...
75 | | ... | \| Interface SPAN Operational Data From Honeycomb Should Be empty \
76 | | ... | \| ${node} \| GigabitEthernetO/8/0 \|
77 | | ...
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']}
82
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.
86 | | ...
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
92 | | ...
93 | | ... | *Example:*
94 | | ...
95 | | ... | \| Interface SPAN Operational Data From VAT Should Be \
96 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| GigabitEthernet0/9/0 \|
97 | | ...
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}
104
105 | Honeycomb removes interface SPAN configuration
106 | | [Documentation] | Uses Honeycomb API to remove SPAN configuration\
107 | | ... | from the specified interface.
108 | | ...
109 | | ... | *Arguments:*
110 | | ... | - node - information about a DUT node. Type: dictionary
111 | | ... | - dst_interface - Mirroring destination interface. Type: string
112 | | ...
113 | | ... | *Example:*
114 | | ...
115 | | ... | \| Honeycomb removes interface SPAN configuration \
116 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \|
117 | | ...
118 | | [Arguments] | ${node} | ${dst_interface}
119 | | Configure interface SPAN | ${node} | ${dst_interface}
120
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.
124 | | ...
125 | | ... | *Arguments:*
126 | | ... | - node - information about a DUT node. Type: dictionary
127 | | ... | - dst_interface - Mirroring destination interface. Type: string
128 | | ...
129 | | ... | *Example:*
130 | | ...
131 | | ... | \|
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']}
136
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.
140 | | ...
141 | | ... | *Arguments:*
142 | | ... | - node - information about a DUT node. Type: dictionary
143 | | ...
144 | | ... | *Example:*
145 | | ...
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
150
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.
154 | | ...
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
161 | | ...
162 | | ... | *Example:*
163 | | ...
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'}] \|
168 | | ...
169 | | [Arguments] | ${node} | ${dst_interface} | ${index} | @{src_interfaces}
170 | | Configure sub interface SPAN
171 | | ... | ${node} | ${dst_interface} | ${index} | ${src_interfaces}
172
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.
176 | | ...
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
183 | | ...
184 | | ... | *Example:*
185 | | ...
186 | | ... | \| Sub-Interface SPAN Operational Data from Honeycomb should be \
187 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \
188 | | ... | \| GigabitEthernet0/9/0 \|
189 | | ...
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}
198
199 | Sub-Interface SPAN Operational Data from Honeycomb should be empty
200 | | [Documentation] | Checks whether SPAN Operational Data from Honeycomb is empty.
201 | | ...
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
206 | | ...
207 | | ... | *Example:*
208 | | ...
209 | | ... | \| Interface SPAN Operational Data from Honeycomb should be empty \
210 | | ... | \| ${node} \| GigabitEthernetO/8/0 \| ${1} \|
211 | | ...
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']}
217
218 | Honeycomb removes sub-interface SPAN configuration
219 | | [Documentation] | Uses Honeycomb API to remove SPAN Operational Data\
220 | | ... | from the specified sub-interface.
221 | | ...
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
226 | | ...
227 | | ... | *Example:*
228 | | ...
229 | | ... | \| Honeycomb removes sub-interface SPAN configuration \
230 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \|
231 | | ...
232 | | [Arguments] | ${node} | ${dst_interface} | ${index}
233 | | Configure sub interface SPAN
234 | | ... | ${node} | ${dst_interface} | ${index}
235
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.
239 | | ...
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
244 | | ...
245 | | ... | *Example:*
246 | | ...
247 | | ... | \| Sub-Interface SPAN Operational Data from Honeycomb should not exist \
248 | | ... | \| ${nodes['DUT1']} \| GigabitEthernet0/8/0 \| ${1} \|
249 | | ....
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']}