Debian Codegraph @

ansible_collections/dellemc/enterprise_sonic/docs/dellemc.enterprise_sonic.sonic_mirroring_module.rst

raw
1 .. _dellemc.enterprise_sonic.sonic_mirroring_module:
2
3
4 ****************************************
5 dellemc.enterprise_sonic.sonic_mirroring
6 ****************************************
7
8 **Manage port mirroring configuration on SONiC.**
9
10
11 Version added: 3.1.0
12
13 .. contents::
14 :local:
15 :depth: 1
16
17
18 Synopsis
19 --------
20 - This module provides configuration management for port mirroring on devices running SONiC.
21
22
23
24
25 Parameters
26 ----------
27
28 .. raw:: html
29
30 <table border=0 cellpadding=0 class="documentation-table">
31 <tr>
32 <th colspan="3">Parameter</th>
33 <th>Choices/<font color="blue">Defaults</font></th>
34 <th width="100%">Comments</th>
35 </tr>
36 <tr>
37 <td colspan="3">
38 <div class="ansibleOptionAnchor" id="parameter-"></div>
39 <b>config</b>
40 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
41 <div style="font-size: small">
42 <span style="color: purple">dictionary</span>
43 </div>
44 </td>
45 <td>
46 </td>
47 <td>
48 <div>Specifies port mirroring configuration.</div>
49 </td>
50 </tr>
51 <tr>
52 <td class="elbow-placeholder"></td>
53 <td colspan="2">
54 <div class="ansibleOptionAnchor" id="parameter-"></div>
55 <b>erspan</b>
56 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
57 <div style="font-size: small">
58 <span style="color: purple">list</span>
59 / <span style="color: purple">elements=dictionary</span>
60 </div>
61 </td>
62 <td>
63 </td>
64 <td>
65 <div>ERSPAN mirroring sessions.</div>
66 </td>
67 </tr>
68 <tr>
69 <td class="elbow-placeholder"></td>
70 <td class="elbow-placeholder"></td>
71 <td colspan="1">
72 <div class="ansibleOptionAnchor" id="parameter-"></div>
73 <b>direction</b>
74 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
75 <div style="font-size: small">
76 <span style="color: purple">string</span>
77 </div>
78 </td>
79 <td>
80 <ul style="margin: 0; padding: 0"><b>Choices:</b>
81 <li>rx</li>
82 <li>tx</li>
83 <li>both</li>
84 </ul>
85 </td>
86 <td>
87 <div>Mirror session direction.</div>
88 </td>
89 </tr>
90 <tr>
91 <td class="elbow-placeholder"></td>
92 <td class="elbow-placeholder"></td>
93 <td colspan="1">
94 <div class="ansibleOptionAnchor" id="parameter-"></div>
95 <b>dscp</b>
96 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
97 <div style="font-size: small">
98 <span style="color: purple">integer</span>
99 </div>
100 </td>
101 <td>
102 </td>
103 <td>
104 <div>ERSPAN destination DSCP.</div>
105 <div>The range of values is from 0 to 63.</div>
106 </td>
107 </tr>
108 <tr>
109 <td class="elbow-placeholder"></td>
110 <td class="elbow-placeholder"></td>
111 <td colspan="1">
112 <div class="ansibleOptionAnchor" id="parameter-"></div>
113 <b>dst_ip</b>
114 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
115 <div style="font-size: small">
116 <span style="color: purple">string</span>
117 </div>
118 </td>
119 <td>
120 </td>
121 <td>
122 <div>ERSPAN destination IP address.</div>
123 </td>
124 </tr>
125 <tr>
126 <td class="elbow-placeholder"></td>
127 <td class="elbow-placeholder"></td>
128 <td colspan="1">
129 <div class="ansibleOptionAnchor" id="parameter-"></div>
130 <b>gre</b>
131 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
132 <div style="font-size: small">
133 <span style="color: purple">string</span>
134 </div>
135 </td>
136 <td>
137 </td>
138 <td>
139 <div>ERSPAN destination GRE type.</div>
140 <div>A hexadecimal string of the form 0xabcd.</div>
141 </td>
142 </tr>
143 <tr>
144 <td class="elbow-placeholder"></td>
145 <td class="elbow-placeholder"></td>
146 <td colspan="1">
147 <div class="ansibleOptionAnchor" id="parameter-"></div>
148 <b>name</b>
149 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
150 <div style="font-size: small">
151 <span style="color: purple">string</span>
152 / <span style="color: red">required</span>
153 </div>
154 </td>
155 <td>
156 </td>
157 <td>
158 <div>ERSPAN mirroring session name.</div>
159 </td>
160 </tr>
161 <tr>
162 <td class="elbow-placeholder"></td>
163 <td class="elbow-placeholder"></td>
164 <td colspan="1">
165 <div class="ansibleOptionAnchor" id="parameter-"></div>
166 <b>queue</b>
167 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
168 <div style="font-size: small">
169 <span style="color: purple">integer</span>
170 </div>
171 </td>
172 <td>
173 </td>
174 <td>
175 <div>ERSPAN destination queue number.</div>
176 <div>The range of values is from 0 to 63.</div>
177 <div>Only queue 0 is supported.</div>
178 </td>
179 </tr>
180 <tr>
181 <td class="elbow-placeholder"></td>
182 <td class="elbow-placeholder"></td>
183 <td colspan="1">
184 <div class="ansibleOptionAnchor" id="parameter-"></div>
185 <b>source</b>
186 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
187 <div style="font-size: small">
188 <span style="color: purple">string</span>
189 </div>
190 </td>
191 <td>
192 </td>
193 <td>
194 <div>Mirror session source interface.</div>
195 <div>It may be an Ethernet interface or a PortChannel interface.</div>
196 </td>
197 </tr>
198 <tr>
199 <td class="elbow-placeholder"></td>
200 <td class="elbow-placeholder"></td>
201 <td colspan="1">
202 <div class="ansibleOptionAnchor" id="parameter-"></div>
203 <b>src_ip</b>
204 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
205 <div style="font-size: small">
206 <span style="color: purple">string</span>
207 </div>
208 </td>
209 <td>
210 </td>
211 <td>
212 <div>ERSPAN source IP address.</div>
213 </td>
214 </tr>
215 <tr>
216 <td class="elbow-placeholder"></td>
217 <td class="elbow-placeholder"></td>
218 <td colspan="1">
219 <div class="ansibleOptionAnchor" id="parameter-"></div>
220 <b>ttl</b>
221 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
222 <div style="font-size: small">
223 <span style="color: purple">integer</span>
224 </div>
225 </td>
226 <td>
227 </td>
228 <td>
229 <div>ERSPAN destination TTL</div>
230 <div>The range of values is from 0 to 63.</div>
231 </td>
232 </tr>
233
234 <tr>
235 <td class="elbow-placeholder"></td>
236 <td colspan="2">
237 <div class="ansibleOptionAnchor" id="parameter-"></div>
238 <b>span</b>
239 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
240 <div style="font-size: small">
241 <span style="color: purple">list</span>
242 / <span style="color: purple">elements=dictionary</span>
243 </div>
244 </td>
245 <td>
246 </td>
247 <td>
248 <div>SPAN mirroring sessions.</div>
249 </td>
250 </tr>
251 <tr>
252 <td class="elbow-placeholder"></td>
253 <td class="elbow-placeholder"></td>
254 <td colspan="1">
255 <div class="ansibleOptionAnchor" id="parameter-"></div>
256 <b>direction</b>
257 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
258 <div style="font-size: small">
259 <span style="color: purple">string</span>
260 </div>
261 </td>
262 <td>
263 <ul style="margin: 0; padding: 0"><b>Choices:</b>
264 <li>rx</li>
265 <li>tx</li>
266 <li>both</li>
267 </ul>
268 </td>
269 <td>
270 <div>Mirror session direction.</div>
271 </td>
272 </tr>
273 <tr>
274 <td class="elbow-placeholder"></td>
275 <td class="elbow-placeholder"></td>
276 <td colspan="1">
277 <div class="ansibleOptionAnchor" id="parameter-"></div>
278 <b>dst_port</b>
279 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
280 <div style="font-size: small">
281 <span style="color: purple">string</span>
282 </div>
283 </td>
284 <td>
285 </td>
286 <td>
287 <div>Mirror session destination interface.</div>
288 <div>It may be CPU or an Ethernet interface.</div>
289 </td>
290 </tr>
291 <tr>
292 <td class="elbow-placeholder"></td>
293 <td class="elbow-placeholder"></td>
294 <td colspan="1">
295 <div class="ansibleOptionAnchor" id="parameter-"></div>
296 <b>name</b>
297 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
298 <div style="font-size: small">
299 <span style="color: purple">string</span>
300 / <span style="color: red">required</span>
301 </div>
302 </td>
303 <td>
304 </td>
305 <td>
306 <div>SPAN mirroring session name.</div>
307 </td>
308 </tr>
309 <tr>
310 <td class="elbow-placeholder"></td>
311 <td class="elbow-placeholder"></td>
312 <td colspan="1">
313 <div class="ansibleOptionAnchor" id="parameter-"></div>
314 <b>source</b>
315 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
316 <div style="font-size: small">
317 <span style="color: purple">string</span>
318 </div>
319 </td>
320 <td>
321 </td>
322 <td>
323 <div>Mirror session source interface.</div>
324 <div>It may be an Ethernet interface or a PortChannel interface.</div>
325 </td>
326 </tr>
327
328
329 <tr>
330 <td colspan="3">
331 <div class="ansibleOptionAnchor" id="parameter-"></div>
332 <b>state</b>
333 <a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
334 <div style="font-size: small">
335 <span style="color: purple">string</span>
336 </div>
337 </td>
338 <td>
339 <ul style="margin: 0; padding: 0"><b>Choices:</b>
340 <li><div style="color: blue"><b>merged</b>&nbsp;&larr;</div></li>
341 <li>deleted</li>
342 <li>replaced</li>
343 <li>overridden</li>
344 </ul>
345 </td>
346 <td>
347 <div>Specifies the operation to be performed on the mirroring configured on the device.</div>
348 <div>In case of merged, the input configuration will be merged with the existing configuration on the device.</div>
349 <div>In case of deleted, the input configuration will be removed from the device.</div>
350 <div>In case of overridden, all existing mirroring configuration will be deleted and the specified input configuration will be added.</div>
351 <div>In case of replaced, the existing mirroring configuration on the device will be replaced by the new specified configuration for each affected mirroring session.</div>
352 </td>
353 </tr>
354 </table>
355 <br/>
356
357
358 Notes
359 -----
360
361 .. note::
362 - Tested against Enterprise SONiC Distribution by Dell Technologies.
363 - Supports ``check_mode``.
364
365
366
367 Examples
368 --------
369
370 .. code-block:: yaml
371
372 # Using "deleted" state
373 #
374 # Before state:
375 # -------------
376 #
377 # sonic# show mirror-session
378 # ERSPAN Sessions
379 # -----------------------------------------------------------------------------------------------------------------------------------------
380 # Name Status SRC-IP DST-IP GRE DSCP TTL Queue Policer SRC-Port Direction
381 # -----------------------------------------------------------------------------------------------------------------------------------------
382 # dell-2 inactive 200.22.22.22 100.11.11.11 0 Ethernet28 both
383 # SPAN Sessions
384 # -------------------------------------------------------------------------------
385 # Name Status DST-Port SRC-Port Direction
386 # -------------------------------------------------------------------------------
387 # dell-1 active CPU Ethernet24 both
388 # dell-3 active CPU
389
390 - name: Delete mirroring configuration
391 dellemc.enterprise_sonic.sonic_mirroring:
392 config:
393 span:
394 - name: dell-3
395 erspan:
396 - name: dell-2
397 state: deleted
398
399 # After state:
400 # ------------
401 #
402 # sonic# show mirror-session
403 # SPAN Sessions
404 # -------------------------------------------------------------------------------
405 # Name Status DST-Port SRC-Port Direction
406 # -------------------------------------------------------------------------------
407 # dell-1 active CPU Ethernet24 both
408
409
410 # Using "merged" state
411 #
412 # Before state:
413 # -------------
414 #
415 # sonic# show mirror-session
416 # No sessions configured
417
418 - name: Merge mirroring configuration
419 dellemc.enterprise_sonic.sonic_mirroring:
420 config:
421 span:
422 - name: dell-1
423 dst_port: CPU
424 source: Ethernet24
425 direction: both
426 erspan:
427 - name: dell-2
428 dst_ip: 100.11.11.11
429 src_ip: 200.22.22.22
430 source: Ethernet28
431 direction: both
432 queue: 0
433 state: merged
434
435 # After state:
436 # ------------
437 #
438 # sonic# show mirror-session
439 # ERSPAN Sessions
440 # -----------------------------------------------------------------------------------------------------------------------------------------
441 # Name Status SRC-IP DST-IP GRE DSCP TTL Queue Policer SRC-Port Direction
442 # -----------------------------------------------------------------------------------------------------------------------------------------
443 # dell-2 inactive 200.22.22.22 100.11.11.11 0 Ethernet28 both
444 # SPAN Sessions
445 # -------------------------------------------------------------------------------
446 # Name Status DST-Port SRC-Port Direction
447 # -------------------------------------------------------------------------------
448 # dell-1 active CPU Ethernet24 both
449
450
451 # Using "merged" state
452 #
453 # Before state:
454 # -------------
455 #
456 # sonic# show mirror-session
457 # SPAN Sessions
458 # -------------------------------------------------------------------------------
459 # Name Status DST-Port SRC-Port Direction
460 # -------------------------------------------------------------------------------
461 # dell-1 active CPU Ethernet24 both
462
463 - name: Modify existing mirroring configuration
464 dellemc.enterprise_sonic.sonic_mirroring:
465 config:
466 span:
467 - name: dell-1
468 dst_port: Ethernet32
469 source: Ethernet4
470 direction: rx
471
472 # After state:
473 # ------------
474 #
475 # sonic# show mirror-session
476 # SPAN Sessions
477 # -------------------------------------------------------------------------------
478 # Name Status DST-Port SRC-Port Direction
479 # -------------------------------------------------------------------------------
480 # dell-1 active Ethernet32 Ethernet4 rx
481
482
483 # Using "replaced" state
484 #
485 # Before state:
486 # -------------
487 #
488 # sonic# show mirror-session
489 # ERSPAN Sessions
490 # -----------------------------------------------------------------------------------------------------------------------------------------
491 # Name Status SRC-IP DST-IP GRE DSCP TTL Queue Policer SRC-Port Direction
492 # -----------------------------------------------------------------------------------------------------------------------------------------
493 # dell-2 inactive 200.22.22.22 100.11.11.11 0 Ethernet28 both
494 # SPAN Sessions
495 # -------------------------------------------------------------------------------
496 # Name Status DST-Port SRC-Port Direction
497 # -------------------------------------------------------------------------------
498 # dell-1 active CPU Ethernet24 both
499 # dell-3 active CPU
500
501 - name: Replace mirroring configuration
502 dellemc.enterprise_sonic.sonic_mirroring:
503 config:
504 erspan:
505 - name: dell-2
506 dst_ip: 32.22.22.12
507 src_ip: 31.21.21.12
508 source: Ethernet28
509 dscp: 6
510 gre: "0x6689"
511 ttl: 9
512 queue: 0
513 direction: rx
514 - name: dell-3
515 dst_ip: 22.22.22.12
516 src_ip: 21.21.21.12
517 source: Ethernet28
518 direction: rx
519 span:
520 - name: dell-1
521 dst_port: Ethernet4
522 source: Ethernet24
523 direction: tx
524 state: replaced
525
526 # After state:
527 # ------------
528 #
529 # sonic# show mirror-session
530 # ERSPAN Sessions
531 # -----------------------------------------------------------------------------------------------------------------------------------------
532 # Name Status SRC-IP DST-IP GRE DSCP TTL Queue Policer SRC-Port Direction
533 # -----------------------------------------------------------------------------------------------------------------------------------------
534 # dell-2 inactive 32.22.22.22 31.11.11.11 0x6689 6 9 0 Ethernet28 rx
535 # dell-3 inactive 21.21.21.12 22.22.22.12 Ethernet28 rx
536 # SPAN Sessions
537 # -------------------------------------------------------------------------------
538 # Name Status DST-Port SRC-Port Direction
539 # -------------------------------------------------------------------------------
540 # dell-1 active Ethertnet4 Ethernet24 tx
541
542
543 # Using "overridden" state
544 #
545 # Before state:
546 # -------------
547 #
548 # sonic# show mirror-session
549 # ERSPAN Sessions
550 # -----------------------------------------------------------------------------------------------------------------------------------------
551 # Name Status SRC-IP DST-IP GRE DSCP TTL Queue Policer SRC-Port Direction
552 # -----------------------------------------------------------------------------------------------------------------------------------------
553 # dell-2 inactive 200.22.22.22 100.11.11.11 0 Ethernet28 both
554 # SPAN Sessions
555 # -------------------------------------------------------------------------------
556 # Name Status DST-Port SRC-Port Direction
557 # -------------------------------------------------------------------------------
558 # dell-1 active CPU Ethernet24 both
559 # dell-3 active CPU
560
561 - name: Override mirroring configuration
562 dellemc.enterprise_sonic.sonic_mirroring:
563 config:
564 erspan:
565 - name: dell-2
566 dst_ip: 32.22.22.12
567 src_ip: 31.21.21.12
568 source: Ethernet28
569 gre: "0x6689"
570 dscp: 6
571 ttl: 9
572 queue: 0
573 direction: rx
574 - name: dell-1
575 dst_ip: 22.22.22.12
576 src_ip: 21.21.21.12
577 source: Ethernet28
578 direction: rx
579 span:
580 - name: dell-6
581 dst_port: CPU
582 source: Ethernet24
583 direction: tx
584 state: overridden
585
586 # After state:
587 # ------------
588 #
589 # sonic# show mirror-session
590 # ERSPAN Sessions
591 # -----------------------------------------------------------------------------------------------------------------------------------------
592 # Name Status SRC-IP DST-IP GRE DSCP TTL Queue Policer SRC-Port Direction
593 # -----------------------------------------------------------------------------------------------------------------------------------------
594 # dell-1 inactive 21.21.21.12 22.22.22.12 Ethernet28 rx
595 # dell-2 inactive 31.21.21.12 32.22.22.12 0x6689 6 9 0 Ethernet28 rx
596 # SPAN Sessions
597 # -------------------------------------------------------------------------------
598 # Name Status DST-Port SRC-Port Direction
599 # -------------------------------------------------------------------------------
600 # dell-6 active Ethertnet4 Ethernet24 tx
601
602
603
604 Return Values
605 -------------
606 Common return values are documented `here <https://docs.ansible.com/projects/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module:
607
608 .. raw:: html
609
610 <table border=0 cellpadding=0 class="documentation-table">
611 <tr>
612 <th colspan="1">Key</th>
613 <th>Returned</th>
614 <th width="100%">Description</th>
615 </tr>
616 <tr>
617 <td colspan="1">
618 <div class="ansibleOptionAnchor" id="return-"></div>
619 <b>after</b>
620 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
621 <div style="font-size: small">
622 <span style="color: purple">dictionary</span>
623 </div>
624 </td>
625 <td>when changed</td>
626 <td>
627 <div>The configuration resulting from module invocation.</div>
628 <br/>
629 </td>
630 </tr>
631 <tr>
632 <td colspan="1">
633 <div class="ansibleOptionAnchor" id="return-"></div>
634 <b>after_generated</b>
635 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
636 <div style="font-size: small">
637 <span style="color: purple">dictionary</span>
638 </div>
639 </td>
640 <td>when <code>check_mode</code></td>
641 <td>
642 <div>The configuration that would result from non-check-mode module invocation.</div>
643 <br/>
644 </td>
645 </tr>
646 <tr>
647 <td colspan="1">
648 <div class="ansibleOptionAnchor" id="return-"></div>
649 <b>before</b>
650 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
651 <div style="font-size: small">
652 <span style="color: purple">dictionary</span>
653 </div>
654 </td>
655 <td>always</td>
656 <td>
657 <div>The configuration prior to the module invocation.</div>
658 <br/>
659 </td>
660 </tr>
661 <tr>
662 <td colspan="1">
663 <div class="ansibleOptionAnchor" id="return-"></div>
664 <b>commands</b>
665 <a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
666 <div style="font-size: small">
667 <span style="color: purple">list</span>
668 </div>
669 </td>
670 <td>always</td>
671 <td>
672 <div>The set of commands pushed to the remote device. In <code>check_mode</code> the needed commands are displayed, but not pushed to the device.</div>
673 <br/>
674 <div style="font-size: smaller"><b>Sample:</b></div>
675 <div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">[&#x27;command 1&#x27;, &#x27;command 2&#x27;, &#x27;command 3&#x27;]</div>
676 </td>
677 </tr>
678 </table>
679 <br/><br/>
680
681
682 Status
683 ------
684
685
686 Authors
687 ~~~~~~~
688
689 - M\. Zhang (@mingjunzhang2019)