Debian Codegraph @

ansible_collections/dellemc/enterprise_sonic/plugins/modules/sonic_mclag.py

raw symbols SCIP
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 # Copyright 2025 Dell Inc. or its subsidiaries. All Rights Reserved.
4 # GNU General Public License v3.0+
5 # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
6
7 """
8 The module file for sonic_mclag
9 """
10
11 from __future__ import absolute_import, division, print_function
12 __metaclass__ = type
13
14 DOCUMENTATION = """
15 ---
16 module: sonic_mclag
17 version_added: 1.0.0
18 notes:
19 - Tested against Enterprise SONiC Distribution by Dell Technologies.
20 - Supports C(check_mode).
21 short_description: Manage multi chassis link aggregation groups domain (MCLAG) and its parameters
22 description:
23 - Manage multi chassis link aggregation groups domain (MCLAG) and its parameters.
24 author: Abirami N (@abirami-n)
25
26 options:
27 config:
28 description: Dict of mclag domain configurations.
29 type: dict
30 suboptions:
31 domain_id:
32 description:
33 - ID of the mclag domain (MCLAG domain).
34 type: int
35 required: True
36 peer_address:
37 description:
38 - The IPV4 peer-ip for corresponding MCLAG.
39 type: str
40 source_address:
41 description:
42 - The IPV4 source-ip for corresponding MCLAG.
43 type: str
44 peer_link:
45 description:
46 - Peer-link for corresponding MCLAG.
47 type: str
48 system_mac:
49 description:
50 - MAC address of MCLAG.
51 type: str
52 keepalive:
53 description:
54 - MCLAG session keepalive-interval in secs.
55 type: int
56 session_timeout:
57 description:
58 - MCLAG session timeout value in secs.
59 type: int
60 session_vrf:
61 description:
62 - MCLAG session VRF.
63 - Session VRF value can be either mgmt or a non-default VRF.
64 version_added: 2.5.0
65 type: str
66 delay_restore:
67 description:
68 - MCLAG delay restore time in secs.
69 type: int
70 gateway_mac:
71 description:
72 - Gateway MAC address for router ports over MCLAG.
73 - Configured gateway MAC address can be modified only when I(state=replaced) or I(state=overridden).
74 type: str
75 unique_ip:
76 description: Holds Vlan dictionary for MCLAG unique IP.
77 suboptions:
78 vlans:
79 description:
80 - Holds a list of VLANs and VLAN ranges for which a separate IP address is enabled for Layer 3 protocol support over MCLAG.
81 type: list
82 elements: dict
83 suboptions:
84 vlan:
85 description:
86 - Holds a VLAN name or VLAN range.
87 - Specify a single VLAN eg. Vlan10.
88 - Specify a range of VLANs eg. Vlan10-20.
89 type: str
90 type: dict
91 peer_gateway:
92 description: Holds Vlan dictionary for MCLAG peer gateway.
93 suboptions:
94 vlans:
95 description:
96 - Holds a list of VLANs and VLAN ranges for which MCLAG peer gateway functionality is enabled.
97 type: list
98 elements: dict
99 suboptions:
100 vlan:
101 description:
102 - Holds a VLAN name or VLAN range.
103 - Specify a single VLAN eg. Vlan10.
104 - Specify a range of VLANs eg. Vlan10-20.
105 type: str
106 type: dict
107 members:
108 description: Holds portchannels dictionary for an MCLAG domain.
109 suboptions:
110 portchannels:
111 description:
112 - Holds a list of portchannels for configuring as an MCLAG interface.
113 type: list
114 elements: dict
115 suboptions:
116 lag:
117 description: Holds a PortChannel ID.
118 type: str
119 type: dict
120 backup_keepalive_source_address:
121 version_added: 3.1.0
122 description:
123 - The IPV4 backup-keepalive-source-ip to establish MCLAG backup keepalive session
124 type: str
125 backup_keepalive_peer_address:
126 version_added: 3.1.0
127 description:
128 - The IPV4 backup-keepalive-peer-ip to establish MCLAG backup keepalive session
129 type: str
130 backup_keepalive_interval:
131 version_added: 3.1.0
132 description:
133 - MCLAG backup keepalive session interval in secs. Supported interval range is 1-60.
134 type: int
135 backup_keepalive_session_vrf:
136 version_added: 3.1.0
137 description:
138 - MCLAG backup keepalive session VRF
139 type: str
140 state:
141 description:
142 - The state that the configuration should be left in.
143 type: str
144 choices:
145 - merged
146 - deleted
147 - replaced
148 - overridden
149 default: merged
150 """
151
152 EXAMPLES = """
153 # Using "merged" state
154 #
155 # Before state:
156 # -------------
157 #
158 # sonic# show mclag brief
159 # MCLAG Not Configured
160
161 - name: Merge provided configuration with device configuration
162 dellemc.enterprise_sonic.sonic_mclag:
163 config:
164 domain_id: 1
165 peer_address: 1.1.1.1
166 source_address: 2.2.2.2
167 peer_link: 'Portchannel1'
168 session_vrf: 'mgmt'
169 keepalive: 1
170 session_timeout: 3
171 delay_restore: 240
172 system_mac: '00:00:00:11:11:11'
173 gateway_mac: '00:00:00:12:12:12'
174 unique_ip:
175 vlans:
176 - vlan: Vlan4
177 - vlan: Vlan21-25
178 peer_gateway:
179 vlans:
180 - vlan: Vlan4
181 - vlan: Vlan21-25
182 members:
183 portchannels:
184 - lag: PortChannel10
185 backup_keepalive_source_address: 3.3.3.3
186 backup_keepalive_peer_address: 4.4.4.4
187 backup_keepalive_interval: 5
188 backup_keepalive_session_vrf: mgmt
189 state: merged
190
191 # After state:
192 # ------------
193 #
194 # sonic# show mclag brief
195 #
196 # Domain ID : 1
197 # Role : standby
198 # Session Status : down
199 # Peer Link Status : down
200 # Source Address : 2.2.2.2
201 # Peer Address : 1.1.1.1
202 # Session Vrf : mgmt
203 # Peer Link : PortChannel1
204 # Keepalive Interval : 1 secs
205 # Session Timeout : 3 secs
206 # Delay Restore : 240 secs
207 # System Mac : 20:04:0f:37:bd:c9
208 # Mclag System Mac : 00:00:00:11:11:11
209 # Gateway Mac : 00:00:00:12:12:12
210 #
211 # Backup Keepalive Session Information:
212 # -----------------------------------
213 # Session Vrf : mgmt
214 # Session Status : down
215 # Source Address : 3.3.3.3
216 # Peer Address : 4.4.4.4
217 # Keepalive Interval : 5 secs
218 # -----------------------------------
219 #
220 # Number of MLAG Interfaces:1
221 # -----------------------------------------------------------
222 # MLAG Interface Local/Remote Status
223 # -----------------------------------------------------------
224 # PortChannel10 down/down
225 #
226 # sonic# show mclag separate-ip-interfaces
227 # Interface Name
228 # ==============
229 # Vlan4
230 # Vlan21
231 # Vlan22
232 # Vlan23
233 # Vlan24
234 # Vlan25
235 # ==============
236 # Total count : 6
237 # ==============
238 # sonic#
239 # sonic# show mclag peer-gateway-interfaces
240 # Interface Name
241 # ==============
242 # Vlan4
243 # Vlan21
244 # Vlan22
245 # Vlan23
246 # Vlan24
247 # Vlan25
248 # ==============
249 # Total count : 6
250 # ==============
251 # sonic#
252
253
254 # Using "merged" state
255 #
256 # Before state:
257 # ------------
258 #
259 # sonic# show mclag brief
260 #
261 # Domain ID : 1
262 # Role : standby
263 # Session Status : down
264 # Peer Link Status : down
265 # Source Address : 2.2.2.2
266 # Peer Address : 1.1.1.1
267 # Session Vrf : mgmt
268 # Peer Link : PortChannel1
269 # Keepalive Interval : 1 secs
270 # Session Timeout : 3 secs
271 # Delay Restore : 240 secs
272 # System Mac : 20:04:0f:37:bd:c9
273 # Mclag System Mac : 00:00:00:11:11:11
274 # Gateway Mac : 00:00:00:12:12:12
275 #
276 # Backup Keepalive Session Information:
277 # -----------------------------------
278 # Session Vrf : mgmt
279 # Session Status : down
280 # Source Address : 3.3.3.3
281 # Peer Address : 4.4.4.4
282 # Keepalive Interval : 5 secs
283 # -----------------------------------
284 #
285 # Number of MLAG Interfaces:1
286 # -----------------------------------------------------------
287 # MLAG Interface Local/Remote Status
288 # -----------------------------------------------------------
289 # PortChannel10 down/down
290 #
291 # sonic# show mclag separate-ip-interfaces
292 # Interface Name
293 # ==============
294 # Vlan4
295 # Vlan21
296 # Vlan22
297 # Vlan23
298 # Vlan24
299 # Vlan25
300 # ==============
301 # Total count : 6
302 # ==============
303 # sonic#
304 # sonic# show mclag peer-gateway-interfaces
305 # Interface Name
306 # ==============
307 # Vlan4
308 # Vlan21
309 # Vlan22
310 # Vlan23
311 # Vlan24
312 # Vlan25
313 # ==============
314 # Total count : 6
315 # ==============
316 # sonic#
317
318 - name: Merge device configuration with the provided configuration
319 dellemc.enterprise_sonic.sonic_mclag:
320 config:
321 domain_id: 1
322 source_address: 3.3.3.3
323 keepalive: 10
324 session_timeout: 30
325 session_vrf: VrfRed
326 delay_restore: 360
327 unique_ip:
328 vlans:
329 - vlan: Vlan5
330 - vlan: Vlan26-28
331 peer_gateway:
332 vlans:
333 - vlan: Vlan5
334 - vlan: Vlan26-28
335 members:
336 portchannels:
337 - lag: PortChannel12
338 backup_keepalive_source_address: 31.31.31.31
339 backup_keepalive_peer_address: 44.44.44.44
340 backup_keepalive_interval: 59
341 backup_keepalive_session_vrf: VrfRed
342 state: merged
343
344 # After state:
345 # ------------
346 #
347 # sonic# show mclag brief
348 #
349 # Domain ID : 1
350 # Role : standby
351 # Session Status : down
352 # Peer Link Status : down
353 # Source Address : 3.3.3.3
354 # Peer Address : 1.1.1.1
355 # Session Vrf : VrfRed
356 # Peer Link : PortChannel1
357 # Keepalive Interval : 10 secs
358 # Session Timeout : 30 secs
359 # Delay Restore : 360 secs
360 # System Mac : 20:04:0f:37:bd:c9
361 # Mclag System Mac : 00:00:00:11:11:11
362 # Gateway Mac : 00:00:00:12:12:12
363 #
364 # Backup Keepalive Session Information:
365 # -----------------------------------
366 # Session Vrf : VrfRed
367 # Session Status : down
368 # Source Address : 31.31.31.31
369 # Peer Address : 44.44.44.44
370 # Keepalive Interval : 59 secs
371 # -----------------------------------
372 #
373 # Number of MLAG Interfaces:2
374 # -----------------------------------------------------------
375 # MLAG Interface Local/Remote Status
376 # -----------------------------------------------------------
377 # PortChannel10 down/down
378 # PortChannel12 down/down
379 #
380 # sonic# show mclag separate-ip-interfaces
381 # Interface Name
382 # ==============
383 # Vlan4
384 # Vlan5
385 # Vlan21
386 # Vlan22
387 # Vlan23
388 # Vlan24
389 # Vlan25
390 # Vlan26
391 # Vlan27
392 # Vlan28
393 # ==============
394 # Total count : 10
395 # ==============
396 # sonic# show mclag peer-gateway-interfaces
397 # Interface Name
398 # ==============
399 # Vlan4
400 # Vlan5
401 # Vlan21
402 # Vlan22
403 # Vlan23
404 # Vlan24
405 # Vlan25
406 # Vlan26
407 # Vlan27
408 # Vlan28
409 # ==============
410 # Total count : 10
411 # ==============
412 # sonic#
413
414
415 # Using "deleted" state
416 #
417 # Before state:
418 # ------------
419 #
420 # sonic# show mclag brief
421 #
422 # Domain ID : 1
423 # Role : standby
424 # Session Status : down
425 # Peer Link Status : down
426 # Source Address : 3.3.3.3
427 # Peer Address : 1.1.1.1
428 # Session Vrf : VrfRed
429 # Peer Link : PortChannel1
430 # Keepalive Interval : 10 secs
431 # Session Timeout : 30 secs
432 # Delay Restore : 360 secs
433 # System Mac : 20:04:0f:37:bd:c9
434 # Mclag System Mac : 00:00:00:11:11:11
435 # Gateway Mac : 00:00:00:12:12:12
436 #
437 # Backup Keepalive Session Information:
438 # -----------------------------------
439 # Session Vrf : VrfRed
440 # Session Status : down
441 # Source Address : 31.31.31.31
442 # Peer Address : 44.44.44.44
443 # Keepalive Interval : 59 secs
444 # -----------------------------------
445 #
446 # Number of MLAG Interfaces:1
447 # -----------------------------------------------------------
448 # MLAG Interface Local/Remote Status
449 # -----------------------------------------------------------
450 # PortChannel10 down/down
451 #
452 # sonic# show mclag separate-ip-interfaces
453 # Interface Name
454 # ==============
455 # Vlan4
456 # Vlan21
457 # Vlan22
458 # Vlan23
459 # Vlan24
460 # Vlan25
461 # ==============
462 # Total count : 6
463 # ==============
464 # sonic#
465 # sonic# show mclag peer-gateway-interfaces
466 # Interface Name
467 # ==============
468 # Vlan4
469 # Vlan21
470 # Vlan22
471 # Vlan23
472 # Vlan24
473 # Vlan25
474 # ==============
475 # Total count : 6
476 # ==============
477 # sonic#
478
479 - name: Delete device configuration based on the provided configuration
480 dellemc.enterprise_sonic.sonic_mclag:
481 config:
482 domain_id: 1
483 source_address: 3.3.3.3
484 keepalive: 10
485 session_vrf: VrfRed
486 unique_ip:
487 vlans:
488 - vlan: Vlan22
489 - vlan: Vlan24-25
490 peer_gateway:
491 vlans:
492 - vlan: Vlan22
493 - vlan: Vlan24-25
494 members:
495 portchannels:
496 - lag: PortChannel10
497 backup_keepalive_source_address: 31.31.31.31
498 backup_keepalive_peer_address: 44.44.44.44
499 backup_keepalive_interval: 59
500 backup_keepalive_session_vrf: VrfRed
501 state: deleted
502
503 # After state:
504 # ------------
505 #
506 # sonic# show mclag brief
507 #
508 # Domain ID : 1
509 # Role : standby
510 # Session Status : down
511 # Peer Link Status : down
512 # Source Address :
513 # Peer Address : 1.1.1.1
514 # Session Vrf : default
515 # Peer Link : PortChannel1
516 # Keepalive Interval : 1 secs
517 # Session Timeout : 30 secs
518 # Delay Restore : 360 secs
519 # System Mac : 20:04:0f:37:bd:c9
520 # Mclag System Mac : 00:00:00:11:11:11
521 # Gateway Mac : 00:00:00:12:12:12
522 #
523 # Backup Keepalive Session Information:
524 # -----------------------------------
525 # Session Vrf : default
526 # Session Status : down
527 # Source Address :
528 # Peer Address :
529 # Keepalive Interval : 30 secs
530 # -----------------------------------
531 #
532 # Number of MLAG Interfaces:0
533 #
534 # sonic# show mclag separate-ip-interfaces
535 # Interface Name
536 # ==============
537 # Vlan4
538 # Vlan21
539 # Vlan23
540 # ==============
541 # Total count : 3
542 # ==============
543 # sonic#
544 # sonic# show mclag peer-gateway-interfaces
545 # Interface Name
546 # ==============
547 # Vlan4
548 # Vlan21
549 # Vlan23
550 # ==============
551 # Total count : 3
552 # ==============
553 # sonic#
554
555
556 # Using "deleted" state
557 #
558 # Before state:
559 # ------------
560 #
561 # sonic# show mclag brief
562 #
563 # Domain ID : 1
564 # Role : standby
565 # Session Status : down
566 # Peer Link Status : down
567 # Source Address : 3.3.3.3
568 # Peer Address : 1.1.1.1
569 # Session Vrf : default
570 # Peer Link : PortChannel1
571 # Keepalive Interval : 10 secs
572 # Session Timeout : 30 secs
573 # Delay Restore : 360 secs
574 # System Mac : 20:04:0f:37:bd:c9
575 # Mclag System Mac : 00:00:00:11:11:11
576 # Gateway Mac : 00:00:00:12:12:12
577 #
578 # Backup Keepalive Session Information:
579 # -----------------------------------
580 # Session Vrf : default
581 # Session Status : down
582 # Source Address :
583 # Peer Address :
584 # Keepalive Interval : 30 secs
585 # -----------------------------------
586 #
587 # Number of MLAG Interfaces:1
588 # -----------------------------------------------------------
589 # MLAG Interface Local/Remote Status
590 # -----------------------------------------------------------
591 # PortChannel10 down/down
592 #
593 # sonic# show mclag separate-ip-interfaces
594 # Interface Name
595 # ==============
596 # Vlan4
597 # ==============
598 # Total count : 1
599 # ==============
600 # sonic#
601 # sonic# show mclag peer-gateway-interfaces
602 # Interface Name
603 # ==============
604 # Vlan4
605 # ==============
606 # Total count : 1
607 # ==============
608 # sonic#
609
610 - name: Delete all device configuration
611 dellemc.enterprise_sonic.sonic_mclag:
612 config:
613 state: deleted
614
615 # After state:
616 # ------------
617 #
618 # sonic# show mclag brief
619 # MCLAG Not Configured
620 # sonic# show mclag separate-ip-interfaces
621 # MCLAG separate IP interface not configured
622 # sonic# show mclag peer-gateway-interfaces
623 # MCLAG Peer Gateway interface not configured
624 # sonic#
625
626
627 # Using "deleted" state
628 #
629 # Before state:
630 # ------------
631 #
632 # sonic# show mclag brief
633 #
634 # Domain ID : 1
635 # Role : standby
636 # Session Status : down
637 # Peer Link Status : down
638 # Source Address : 3.3.3.3
639 # Peer Address : 1.1.1.1
640 # Session Vrf : default
641 # Peer Link : PortChannel1
642 # Keepalive Interval : 10 secs
643 # Session Timeout : 30 secs
644 # Delay Restore : 360 secs
645 # System Mac : 20:04:0f:37:bd:c9
646 # Mclag System Mac : 00:00:00:11:11:11
647 # Gateway Mac : 00:00:00:12:12:12
648 #
649 # Backup Keepalive Session Information:
650 # -----------------------------------
651 # Session Vrf : VrfRed
652 # Session Status : down
653 # Source Address : 31.31.31.31
654 # Peer Address : 44.44.44.44
655 # Keepalive Interval : 59 secs
656 # -----------------------------------
657 #
658 # Number of MLAG Interfaces:2
659 # -----------------------------------------------------------
660 # MLAG Interface Local/Remote Status
661 # -----------------------------------------------------------
662 # PortChannel10 down/down
663 # PortChannel12 down/down
664 #
665 # sonic# show mclag separate-ip-interfaces
666 # Interface Name
667 # ==============
668 # Vlan4
669 # ==============
670 # Total count : 1
671 # ==============
672 # sonic#
673 # sonic# show mclag peer-gateway-interfaces
674 # Interface Name
675 # ==============
676 # Vlan4
677 # ==============
678 # Total count : 1
679 # ==============
680 # sonic#
681
682 - name: Delete device configuration based on the provided configuration
683 dellemc.enterprise_sonic.sonic_mclag:
684 config:
685 domain_id: 1
686 source_address: 3.3.3.3
687 keepalive: 10
688 peer_gateway:
689 vlans:
690 members:
691 portchannels:
692 state: deleted
693
694 # After state:
695 # ------------
696 #
697 # sonic# show mclag brief
698 #
699 # Domain ID : 1
700 # Role : standby
701 # Session Status : down
702 # Peer Link Status : down
703 # Source Address :
704 # Peer Address : 1.1.1.1
705 # Session Vrf : default
706 # Peer Link : PortChannel1
707 # Keepalive Interval : 1 secs
708 # Session Timeout : 30 secs
709 # Delay Restore : 360 secs
710 # System Mac : 20:04:0f:37:bd:c9
711 # Mclag System Mac : 00:00:00:11:11:11
712 # Gateway Mac : 00:00:00:12:12:12
713 #
714 # Backup Keepalive Session Information:
715 # -----------------------------------
716 # Session Vrf : VrfRed
717 # Session Status : down
718 # Source Address : 31.31.31.31
719 # Peer Address : 44.44.44.44
720 # Keepalive Interval : 59 secs
721 # -----------------------------------
722 #
723 # Number of MLAG Interfaces:0
724 #
725 # sonic# show mclag separate-ip-interfaces
726 # Interface Name
727 # ==============
728 # Vlan4
729 # ==============
730 # Total count : 1
731 # ==============
732 # sonic#
733 # sonic# show mclag peer-gateway-interfaces
734 # MCLAG Peer Gateway interface not configured
735 # sonic#
736
737
738 # Using "replaced" state
739 #
740 # Before state:
741 # ------------
742 #
743 # sonic# show mclag brief
744 #
745 # Domain ID : 1
746 # Role : standby
747 # Session Status : down
748 # Peer Link Status : down
749 # Source Address : 2.2.2.2
750 # Peer Address : 1.1.1.1
751 # Session Vrf : VrfRed
752 # Peer Link : PortChannel1
753 # Keepalive Interval : 1 secs
754 # Session Timeout : 3 secs
755 # Delay Restore : 240 secs
756 # System Mac : 20:04:0f:37:bd:c9
757 # Mclag System Mac : 00:00:00:11:11:11
758 # Gateway Mac : 00:00:00:12:12:12
759 #
760 #
761 # Backup Keepalive Session Information:
762 # -----------------------------------
763 # Session Vrf : VrfRed
764 # Session Status : down
765 # Source Address : 31.31.31.31
766 # Peer Address : 44.44.44.44
767 # Keepalive Interval : 59 secs
768 # -----------------------------------
769 #
770 # Number of MLAG Interfaces:2
771 # -----------------------------------------------------------
772 # MLAG Interface Local/Remote Status
773 # -----------------------------------------------------------
774 # PortChannel10 down/down
775 # PortChannel11 down/down
776 #
777 # sonic# show mclag separate-ip-interfaces
778 # Interface Name
779 # ==============
780 # Vlan4
781 # Vlan21
782 # Vlan22
783 # Vlan23
784 # Vlan24
785 # Vlan25
786 # ==============
787 # Total count : 6
788 # ==============
789 # sonic#
790 # sonic# show mclag peer-gateway-interfaces
791 # Interface Name
792 # ==============
793 # Vlan4
794 # Vlan21
795 # Vlan22
796 # Vlan23
797 # Vlan24
798 # Vlan25
799 # ==============
800 # Total count : 6
801 # ==============
802 # sonic#
803
804 - name: Replace device configuration with the provided configuration
805 dellemc.enterprise_sonic.sonic_mclag:
806 config:
807 domain_id: 1
808 unique_ip:
809 vlans:
810 - vlan: Vlan5
811 - vlan: Vlan24-28
812 session_vrf: VrfBlue
813 peer_gateway:
814 vlans:
815 - vlan: Vlan5
816 - vlan: Vlan24-28
817 members:
818 portchannels:
819 - lag: PortChannel10
820 - lag: PortChannel12
821 backup_keepalive_source_address: 131.131.131.131
822 state: replaced
823
824 # After state:
825 # ------------
826 #
827 # sonic# show mclag brief
828 #
829 # Domain ID : 1
830 # Role : standby
831 # Session Status : down
832 # Peer Link Status : down
833 # Source Address : 2.2.2.2
834 # Peer Address : 1.1.1.1
835 # Session Vrf : VrfBlue
836 # Peer Link : PortChannel1
837 # Keepalive Interval : 1 secs
838 # Session Timeout : 3 secs
839 # Delay Restore : 240 secs
840 # System Mac : 20:04:0f:37:bd:c9
841 # Mclag System Mac : 00:00:00:11:11:11
842 # Gateway Mac : 00:00:00:12:12:12
843 #
844 # Backup Keepalive Session Information:
845 # -----------------------------------
846 # Session Vrf : Default
847 # Session Status : down
848 # Source Address : 131.131.131.131
849 # Peer Address :
850 # Keepalive Interval : 30 secs
851 # -----------------------------------
852 #
853 # Number of MLAG Interfaces:2
854 # -----------------------------------------------------------
855 # MLAG Interface Local/Remote Status
856 # -----------------------------------------------------------
857 # PortChannel10 down/down
858 # PortChannel12 down/down
859 #
860 # sonic# show mclag separate-ip-interfaces
861 # Interface Name
862 # ==============
863 # Vlan5
864 # Vlan24
865 # Vlan25
866 # Vlan26
867 # Vlan27
868 # Vlan28
869 # ==============
870 # Total count : 6
871 # ==============
872 # sonic# show mclag peer-gateway-interfaces
873 # Interface Name
874 # ==============
875 # Vlan5
876 # Vlan24
877 # Vlan25
878 # Vlan26
879 # Vlan27
880 # Vlan28
881 # ==============
882 # Total count : 6
883 # ==============
884 # sonic#
885
886
887 # Using "overridden" state
888 #
889 # Before state:
890 # ------------
891 #
892 # sonic# show mclag brief
893 #
894 # Domain ID : 1
895 # Role : standby
896 # Session Status : down
897 # Peer Link Status : down
898 # Source Address : 2.2.2.2
899 # Peer Address : 1.1.1.1
900 # Session Vrf : VrfBlue
901 # Peer Link : PortChannel1
902 # Keepalive Interval : 1 secs
903 # Session Timeout : 3 secs
904 # Delay Restore : 240 secs
905 # System Mac : 20:04:0f:37:bd:c9
906 # Mclag System Mac : 00:00:00:11:11:11
907 # Gateway Mac : 00:00:00:12:12:12
908 #
909 # Backup Keepalive Session Information:
910 # -----------------------------------
911 # Session Vrf : Vrf_Red
912 # Session Status : down
913 # Source Address : 19.19.19.19
914 # Peer Address : 20.20.20.20
915 # Keepalive Interval : 3 secs
916 # -----------------------------------
917 #
918 # Number of MLAG Interfaces:2
919 # -----------------------------------------------------------
920 # MLAG Interface Local/Remote Status
921 # -----------------------------------------------------------
922 # PortChannel10 down/down
923 # PortChannel11 down/down
924 #
925 # sonic# show mclag separate-ip-interfaces
926 # Interface Name
927 # ==============
928 # Vlan4
929 # Vlan21
930 # Vlan22
931 # Vlan23
932 # Vlan24
933 # Vlan25
934 # ==============
935 # Total count : 6
936 # ==============
937 # sonic#
938 # sonic# show mclag peer-gateway-interfaces
939 # Interface Name
940 # ==============
941 # Vlan4
942 # Vlan21
943 # Vlan22
944 # Vlan23
945 # Vlan24
946 # Vlan25
947 # ==============
948 # Total count : 6
949 # ==============
950 # sonic#
951
952 - name: Override device configuration with the provided configuration
953 dellemc.enterprise_sonic.sonic_mclag:
954 config:
955 domain_id: 1
956 peer_address: 1.1.1.1
957 source_address: 3.3.3.3
958 peer_link: 'Portchannel1'
959 session_vrf: VrfRed
960 system_mac: '00:00:00:11:11:11'
961 gateway_mac: '00:00:00:12:12:12'
962 unique_ip:
963 vlans:
964 - vlan: Vlan24-28
965 peer_gateway:
966 vlans:
967 - vlan: Vlan24-28
968 members:
969 portchannels:
970 - lag: PortChannel10
971 - lag: PortChannel12
972 backup_keepalive_source_address: 131.131.131.131
973 backup_keepalive_peer_address: 144.144.144.144
974 state: overridden
975
976 # After state:
977 # ------------
978 #
979 # sonic# show mclag brief
980 #
981 # Domain ID : 1
982 # Role : standby
983 # Session Status : down
984 # Peer Link Status : down
985 # Source Address : 3.3.3.3
986 # Peer Address : 1.1.1.1
987 # Session Vrf : VrfRed
988 # Peer Link : PortChannel1
989 # Keepalive Interval : 1 secs
990 # Session Timeout : 30 secs
991 # Delay Restore : 300 secs
992 # System Mac : 20:04:0f:37:bd:c9
993 # Mclag System Mac : 00:00:00:11:11:11
994 # Gateway Mac : 00:00:00:12:12:12
995 #
996 # Backup Keepalive Session Information:
997 # -----------------------------------
998 # Session Vrf : Default
999 # Session Status : down
1000 # Source Address : 131.131.131.131
1001 # Peer Address : 141.141.141.141
1002 # Keepalive Interval : 30 secs
1003 # -----------------------------------
1004 #
1005 #
1006 # Number of MLAG Interfaces:2
1007 # -----------------------------------------------------------
1008 # MLAG Interface Local/Remote Status
1009 # -----------------------------------------------------------
1010 # PortChannel10 down/down
1011 # PortChannel12 down/down
1012 #
1013 # sonic# show mclag separate-ip-interfaces
1014 # Interface Name
1015 # ==============
1016 # Vlan24
1017 # Vlan25
1018 # Vlan26
1019 # Vlan27
1020 # Vlan28
1021 # ==============
1022 # Total count : 5
1023 # ==============
1024 # sonic# show mclag peer-gateway-interfaces
1025 # Interface Name
1026 # ==============
1027 # Vlan24
1028 # Vlan25
1029 # Vlan26
1030 # Vlan27
1031 # Vlan28
1032 # ==============
1033 # Total count : 5
1034 # ==============
1035 # sonic#
1036 """
1037
1038 RETURN = """
1039 before:
1040 description: The configuration prior to the module invocation.
1041 returned: always
1042 type: list
1043 sample: >
1044 The configuration returned always in the same format
1045 as the parameters above.
1046 after:
1047 description: The resulting configuration module invocation.
1048 returned: when changed
1049 type: list
1050 sample: >
1051 The configuration returned always in the same format
1052 as the parameters above.
1053 commands:
1054 description: The set of commands pushed to the remote device.
1055 returned: always
1056 type: list
1057 sample: ['command 1', 'command 2', 'command 3']
1058 """
1059
1060
1061 from ansible.module_utils.basic import AnsibleModule
1062 from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.argspec.mclag.mclag import MclagArgs
1063 from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.config.mclag.mclag import Mclag
1064
1065
1066 def main():
1067 """
1068 Main entry point for module execution
1069
1070 :returns: the result form module invocation
1071 """
1072 module = AnsibleModule(argument_spec=MclagArgs.argument_spec,
1073 supports_check_mode=True)
1074
1075 result = Mclag(module).execute_module()
1076 module.exit_json(**result)
1077
1078
1079 if __name__ == '__main__':
1080 main()