Debian Codegraph @

ansible_collections/cisco/iosxr/plugins/modules/iosxr_bgp_address_family.py

raw symbols SCIP
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 # Copyright 2021 Red Hat
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 iosxr_bgp_address_family
9 """
10
11 from __future__ import absolute_import, division, print_function
12
13
14 __metaclass__ = type
15
16 DOCUMENTATION = """
17 module: iosxr_bgp_address_family
18 short_description: Resource module to configure BGP Address family.
19 description:
20 - This module configures and manages the attributes of BGP address family on Cisco IOS-XR platforms.
21 version_added: 2.0.0
22 author: Ashwini Mhatre (@amhatre)
23 notes:
24 - This module works with connection C(network_cli).
25 options:
26 config:
27 description: A list of configurations for BGP address family.
28 type: dict
29 suboptions:
30 as_number:
31 description: Autonomous system number.
32 type: str
33 address_family:
34 description: Enable address family and enter its config mode
35 type: list
36 elements: dict
37 suboptions:
38 afi:
39 description: address family.
40 type: str
41 choices: ['ipv4', 'ipv6', 'l2vpn', 'link-state', 'vpnv4', 'vpnv6']
42 safi:
43 description: Address Family modifier
44 type: str
45 choices: [ 'flowspec', 'mdt', 'multicast', 'mvpn', 'rt-filter', 'tunnel', 'unicast', 'evpn', 'mspw', 'vpls-vpws', 'link-state' ]
46 vrf:
47 description: VRF name.
48 type: str
49 additional_paths: &additional_paths
50 description: BGP additional-paths commands
51 type: str
52 choices: [ 'send', 'receive' ]
53 advertise_best_external: &advertise
54 description: Advertise best-external path.
55 type: bool
56 aggregate_address:
57 description: Configure BGP aggregate entries.
58 type: list
59 elements: dict
60 suboptions:
61 value:
62 type: str
63 description: IPv4 Aggregate address and mask or masklength.
64 as_set:
65 type: bool
66 description: Generate AS set path information.
67 as_confed_set:
68 type: bool
69 description: Generate AS confed set path information.
70 summary_only:
71 type: bool
72 description: Filter more specific routes from updates.
73 route_policy:
74 description: Policy to condition advertisement, suppression, and attributes.
75 type: str
76 allocate_label:
77 type: dict
78 description: Allocate labels.
79 suboptions:
80 all:
81 type: bool
82 description: Allocate labels for all prefixes.
83 route_policy:
84 description: Use a route policy to select prefixes for label allocation.
85 type: str
86 as_path_loopcheck_out_disable:
87 type: bool
88 description: Configure AS Path loop checking for outbound updates.
89 bgp:
90 type: dict
91 description: BGP Commands.
92 suboptions:
93 attribute_download: &attribute_download
94 type: bool
95 description: Configure attribute download for this address-family.
96 bestpath:
97 type: dict
98 description: Change default route selection criteria.
99 suboptions:
100 origin_as:
101 description: BGP origin-AS knobs.
102 type: dict
103 suboptions:
104 use:
105 description: BGP origin-AS knobs.
106 type: dict
107 suboptions:
108 validity:
109 description: BGP bestpath selection will use origin-AS validity
110 type: bool
111 allow:
112 description: BGP origin-AS knobs.
113 type: dict
114 suboptions:
115 invalid:
116 description: BGP bestpath selection will allow 'invalid' origin-AS
117 type: bool
118 client_to_client:
119 type: dict
120 description: Configure client to client route reflection.
121 suboptions:
122 reflection:
123 type: dict
124 description: disable client to client reflection of cluster id.
125 suboptions:
126 cluster_id_disable:
127 type: dict
128 description: ID of Cluster for which reflection is to be disabled.
129 suboptions:
130 cluster_id:
131 type: str
132 description: ID of Cluster for which reflection is to be disabled.
133 disable:
134 type: bool
135 description: disable cluster id.
136 disable:
137 type: bool
138 description: disable reflection.
139 dampening:
140 type: dict
141 description: Enable route-flap dampening
142 suboptions:
143 set:
144 type: bool
145 description: Enable dampening.
146 value:
147 type: int
148 description: Half-life time for the penalty
149 route_policy:
150 description: Route policy to specify criteria for dampening.
151 type: str
152 label_delay:
153 type: dict
154 description: Specify delay for batching label processing
155 suboptions:
156 delay_second_parts:
157 type: int
158 description: Delay, seconds part <0-10>.
159 delay_ms_parts:
160 type: int
161 description: milliseconds part <0-999>.
162 import_delay:
163 type: dict
164 description: Specify delay for batching import processing.
165 suboptions:
166 delay_second_parts:
167 type: int
168 description: Delay, seconds part <0-10>.
169 delay_ms_parts:
170 type: int
171 description: milliseconds part <0-999>.
172 origin_as:
173 description: BGP origin-AS knobs.
174 type: dict
175 suboptions:
176 validation:
177 description: BGP origin-AS validation knobs.
178 type: dict
179 suboptions:
180 disable:
181 description: Disable RPKI origin-AS validation.
182 type: bool
183 signal:
184 description: Signal origin-AS validity towards peers.
185 type: dict
186 suboptions:
187 ibgp:
188 description: Signal origin-AS validity towards iBGP peers
189 type: bool
190 scan_time:
191 description: Configure background scanner interval for this address-family Example- <5-3600>.
192 type: int
193 default_martian_check_disable:
194 type: bool
195 description: Martian check default
196 distance: &distance
197 type: dict
198 description: Define an administrative distance.
199 suboptions:
200 routes_external_to_as:
201 type: int
202 description: Distance for routes external to the AS <1-255>.
203 routes_internal_to_as:
204 type: int
205 description: Distance for routes internal to the AS <1-255>.
206 local_routes:
207 type: int
208 description: Distance for local routes <1-255>.
209 dynamic_med:
210 type: int
211 description: Dynamic MED Interval.
212 maximum_paths:
213 type: dict
214 description: Forward packets over multiple paths.
215 suboptions:
216 ibgp:
217 type: dict
218 description: iBGP-multipath.
219 suboptions:
220 max_path_value:
221 type: int
222 description: <2-64> Number of paths (limit includes backup path).
223 order_igp_metric:
224 description: Order candidate multipaths for selection as per configured number(cisco-support).
225 type: bool
226 selective_order_igp_metric:
227 description: Allow multipaths only from marked neighbors
228 type: bool
229 unequal_cost:
230 type: dict
231 description: Allow multipaths to have different BGP nexthop IGP metrics.
232 suboptions:
233 set:
234 type: bool
235 description: set unequal_cost.
236 order_igp_metric:
237 description: Order candidate multipaths for selection as per configured number(cisco-support).
238 type: bool
239 selective_order_igp_metric:
240 description: Allow multipaths only from marked neighbors
241 type: bool
242 ebgp:
243 type: dict
244 description: ebgp-multipath.
245 suboptions:
246 max_path_value:
247 type: int
248 description: <2-64> Number of paths (limit includes backup path).
249 order_igp_metric:
250 description: Order candidate multipaths for selection as per configured number(cisco-support).
251 type: bool
252 selective_order_igp_metric:
253 description: Allow multipaths only from marked neighbors
254 type: bool
255 eibgp:
256 type: dict
257 description: eiBGP-multipath.
258 suboptions:
259 max_path_value:
260 type: int
261 description: <2-64> Number of paths (limit includes backup path).
262 order_igp_metric:
263 description: Order candidate multipaths for selection as per configured number(cisco-support).
264 type: bool
265 selective_order_igp_metric:
266 description: Allow multipaths only from marked neighbors
267 type: bool
268 networks:
269 type: list
270 description: Specify a network to announce via BGP.
271 elements: dict
272 suboptions:
273 network:
274 type: str
275 description: Specify a network to announce via BGP.
276 backdoor_route_policy:
277 type: str
278 description: Specify a BGP backdoor route.
279 route_policy:
280 type: str
281 description: Route-policy to modify the attributes.
282 nexthop:
283 type: dict
284 description: Nexthop
285 suboptions:
286 resolution_prefix_length_minimum:
287 type: int
288 description: Set minimum prefix-length for nexthop resolution.
289 choices: [0,32]
290 route_policy:
291 type: str
292 description: Policy to filter out nexthop notification.
293 trigger_delay_critical:
294 description: For critical notification
295 type: int
296 trigger_delay_non_critical:
297 type: int
298 description: For non critical notification.
299 optimal_route_reflection:
300 type: dict
301 description: Configure optimal-route-reflection group.
302 suboptions:
303 group_name:
304 type: str
305 description: ORR group name - maximum 32 characters.
306 primary_address:
307 type: str
308 description: IPv4 primary address.
309 secondary_address:
310 type: str
311 description: IPv4 secondary address
312 permanent_network_route_policy:
313 type: str
314 description: Name of the policy.
315 retain_local_label:
316 type: int
317 description: Label retention time in minutes <3-60>.
318 table_policy:
319 type: str
320 description: Configure policy for installation of routes to RIB.
321 update:
322 type: dict
323 description: BGP Update generation configuration.
324 suboptions:
325 limit:
326 type: dict
327 description: Update limit.
328 suboptions:
329 sub_group:
330 type: dict
331 description: Update limit for address-family.
332 suboptions:
333 ibgp:
334 type: int
335 description: Update limit for iBGP sub-groups<1-512.
336 ebgp:
337 type: int
338 description: Update limit for eBGP sub-groups<1-512.
339 address_family:
340 type: int
341 description: Update limit for sub-groups.
342 wait_install:
343 type: bool
344 description: Wait for route install.
345 redistribute:
346 type: list
347 elements: dict
348 description: Redistribute information from another routing protocol.
349 suboptions:
350 protocol:
351 description: Specifies the protocol for configuring redistribute information.
352 type: str
353 choices:
354 - ospf
355 - application
356 - eigrp
357 - isis
358 - static
359 - connected
360 - lisp
361 - mobile
362 - rip
363 - subscriber
364 required: true
365 id:
366 type: str
367 description:
368 - Identifier for the routing protocol for configuring redistribute
369 information. Example-application name, eigrp/is-is instance name, ospf tag
370 - Valid for protocols 'ospf', 'eigrp', 'isis' and 'application'.
371 metric:
372 description:
373 - Specifies the metric for redistributed routes.
374 type: int
375 route_policy:
376 description:
377 - Specifies the route policy reference.
378 type: str
379 internal:
380 type: bool
381 description: Redistribute EIGRP internal routes.applicable for eigrp.
382 external:
383 type: bool
384 description: Redistribute EIGRP external routes.applicable for eigrp.
385 level:
386 type: str
387 description:
388 - Redistribute routes from the specified ISIS levels.
389 - Redistribute ISIS level 1 routes
390 - Redistribute ISIS level 1 inter-area routes
391 - Redistribute ISIS level 2 ISIS routes
392 choices: [ '1', '2', '1-inter-area' ]
393 nssa_external:
394 type: bool
395 description: Redistribute OSPF NSSA external routes.applicable for ospf.
396 external_ospf:
397 type: int
398 description: Redistribute OSPF external routes.applicable for ospf.
399 choices: [ 1, 2 ]
400 inter_as_install:
401 type: bool
402 description: Install remote mvpn routes in default vrf.This is applicable for mvpn afi.
403 segmented_multicast:
404 type: bool
405 description: Enable segmented multicast.This is applicable for mvpn afi.
406 global_table_multicast:
407 type: bool
408 description: Enable global table multicast.
409 vrf_all_conf:
410 type: dict
411 description: configuration is for all vrfs and its applicable for afi vpn6 and modifier unicast.
412 suboptions:
413 source_rt_import_policy:
414 type: bool
415 description: Source import route-targets from import-policy.
416 table_policy:
417 type: str
418 description: Configure policy for installation of routes to RIB.
419 label_mode:
420 type: dict
421 description: Label-related configuration.
422 suboptions:
423 per_ce: &per_ce
424 type: bool
425 description: Set per CE label mode
426 per_vrf: &per_vrf
427 type: bool
428 description: Set per VRF label mode.
429 route_policy: &route_policy
430 type: str
431 description: Use a route policy to select prefixes for label allocation mode.
432 weight: &wt
433 type: dict
434 description: Define or modify weight.
435 suboptions:
436 reset_on_import_disable:
437 type: bool
438 description: disable reset_on_import.
439 reset_on_import:
440 type: bool
441 description: set reset_on_import.
442 allow_vpn_default_originate:
443 type: bool
444 description: Allow sending default originate route to VPN neighbor.
445 label_mode:
446 type: dict
447 description: label configuration.
448 suboptions:
449 per_ce: *per_ce
450 per_vrf: *per_vrf
451 route_policy: *route_policy
452 per_prefix:
453 type: bool
454 description: Set per perfix label mode.
455 mvpn_single_forwarder_selection_all:
456 type: bool
457 description: Enable single forwarder selection for all
458 mvpn_single_forwarder_selection_highest_ip_address:
459 type: bool
460 description: Enable single forwarder selection for PE with highest ip address.
461 route_target_download:
462 description: Route target RIB installation.
463 type: bool
464 running_config:
465 description:
466 - This option is used only with state I(parsed).
467 - The value of this option should be the output received from the Iosxr device by
468 executing the command B(show running-config router bgp).
469 - The state I(parsed) reads the configuration from C(running_config) option and
470 transforms it into Ansible structured data as per the resource module's argspec
471 and the value is then returned in the I(parsed) key within the result.
472 type: str
473 state:
474 description:
475 - The state the configuration should be left in.
476 type: str
477 choices: [deleted, merged, overridden, replaced, gathered, rendered, parsed]
478 default: merged
479 """
480 EXAMPLES = """
481 # Using merged
482 # Before state:
483 # -------------
484 # RP/0/0/CPU0:iosxr-02#show running-config router bgp
485 # Sat Feb 20 03:49:43.618 UTC
486 # router bgp 65536
487 # bgp router-id 192.0.2.1
488 # address-family vpnv4 unicast
489 # vrf vrf1
490 # rd auto
491 - name: Merge the provided configuration with the existing running configuration
492 cisco.iosxr.iosxr_bgp_address_family:
493 state: merged
494 config:
495 as_number: '65536'
496 address_family:
497 - afi: ipv4
498 safi: unicast
499 vrf: vrf1
500 dynamic_med: 9
501 redistribute:
502 - protocol: connected
503 metric: 10
504 - afi: ipv4
505 safi: unicast
506 dynamic_med: 10
507 redistribute:
508 - protocol: application
509 id: test1
510 metric: 10
511 bgp:
512 scan_time: 20
513 attribute_download: true
514 advertise_best_external: true
515 allocate_label:
516 all: true
517 # Task output
518 # -------------
519 # commands:
520 # - router bgp 65536
521 # - address-family ipv4 unicast
522 # - advertise best-external
523 # - allocate-label all
524 # - bgp attribute-download
525 # - bgp scan-time 20
526 # - dynamic-med interval 10
527 # - redistribute application test1 metric 10
528 # - vrf vrf1
529 # - address-family ipv4 unicast
530 # - dynamic-med interval 9
531 # - redistribute connected metric 10
532 #
533 #
534 # after:
535 # as_number: "65536"
536 # address_family:
537 # - afi: "ipv4"
538 # safi: "unicast"
539 # vrf: vrf1
540 # dynamic_med: 9
541 # redistribute:
542 # - protocol: connected
543 # metric: 10
544 # - afi: "ipv4"
545 # safi: "unicast"
546 # dynamic_med: 10
547 # redistribute:
548 # - protocol: application
549 # id: "test1"
550 # metric: 10
551 # bgp:
552 # scan_time: 20
553 # attribute_download: true
554 # advertise_best_external: true
555 # allocate_label:
556 # all: true
557 #
558 # After state:
559 # -------------
560 # RP/0/0/CPU0:iosxr-02#show running-config router bgp
561 # Sat Feb 20 03:49:43.618 UTC
562 # router bgp 65536
563 # bgp router-id 192.0.1.1
564 # address-family ipv4 unicast
565 # advertise best-external
566 # allocate-label all
567 # bgp attribute-download
568 # bgp scan-time 20
569 # address-family vpnv4 unicast
570 # vrf vrf1
571 # rd auto
572 # address-family ipv4 unicast
573 # dynamic-med interval 9
574 # redistribute connected metric 10
575 #
576 # Using replaced
577 # Before state:
578 # -------------
579 # RP/0/0/CPU0:iosxr-02#show running-config router bgp
580 # Sat Feb 20 03:49:43.618 UTC
581 # router bgp 65536
582 # bgp router-id 192.0.1.1
583 # address-family ipv4 unicast
584 # advertise best-external
585 # allocate-label all
586 # bgp attribute-download
587 # bgp scan-time 20
588 # address-family vpnv4 unicast
589 # vrf vrf1
590 # rd auto
591 # address-family ipv4 unicast
592 # dynamic-med interval 9
593 # redistribute connected metric 10
594 #
595 #
596 - name: Replace the provided configuration with the existing running configuration
597 cisco.iosxr.iosxr_bgp_address_family:
598 state: replaced
599 config:
600 as_number: '65536'
601 address_family:
602 - afi: ipv4
603 safi: unicast
604 vrf: vrf1
605 dynamic_med: 10
606 # Task output
607 # -------------
608 # commands:
609 # - router bgp 65536
610 # - vrf vrf1
611 # - address-family ipv4 unicast
612 # - dynamic-med interval 10
613 # - no redistribute connected metric 10
614 #
615 # after:
616 # as_number: "65536"
617 # address_family:
618 # - afi: "ipv4"
619 # safi: "unicast"
620 # vrf: vrf1
621 # dynamic_med: 10
622 # - afi: "ipv4"
623 # safi: "unicast"
624 # dynamic_med: 10
625 # redistribute:
626 # - protocol: application
627 # id: "test1"
628 # metric: 10
629 # bgp:
630 # scan_time: 20
631 # attribute_download: true
632 # advertise_best_external: true
633 # allocate_label:
634 # all: true
635 # After state:
636 # -------------
637 # RP/0/0/CPU0:iosxr-02#show running-config router bgp
638 # Sat Feb 20 03:49:43.618 UTC
639 # router bgp 65536
640 # bgp router-id 192.0.1.1
641 # address-family ipv4 unicast
642 # advertise best-external
643 # allocate-label all
644 # bgp attribute-download
645 # bgp scan-time 20
646 # address-family vpnv4 unicast
647 # vrf vrf1
648 # rd auto
649 # address-family ipv4 unicast
650 # dynamic-med interval 10
651 #
652 #
653 # Using overridden
654 # Before state:
655 # -------------
656 # RP/0/0/CPU0:iosxr-02#show running-config router bgp
657 # Sat Feb 20 03:49:43.618 UTC
658 # router bgp 65536
659 # bgp router-id 192.0.1.1
660 # address-family ipv4 unicast
661 # advertise best-external
662 # allocate-label all
663 # bgp attribute-download
664 # bgp scan-time 20
665 # address-family vpnv4 unicast
666 # vrf vrf1
667 # rd auto
668 # address-family ipv4 unicast
669 # dynamic-med interval 9
670 # redistribute connected metric 10
671 #
672 #
673 - name: Override the provided configuration with the existing running configuration
674 cisco.iosxr.iosxr_bgp_address_family:
675 state: overridden
676 config:
677 as_number: '65536'
678 address_family:
679 - afi: ipv4
680 safi: unicast
681 vrf: vrf1
682 dynamic_med: 10
683
684 # Task output
685 # -------------
686 # commands:
687 # - router bgp 65536
688 # - no address-family ipv4 unicast
689 # - vrf vrf1
690 # - address-family ipv4 unicast
691 # - dynamic-med interval 10
692 # - no redistribute connected metric 10
693 #
694 #
695 # after:
696 # as_number: "65536"
697 # address_family:
698 # - afi: "ipv4"
699 # safi: "unicast"
700 # vrf: vrf1
701 # dynamic_med: 10
702 #
703 # After state:
704 # -------------
705 # RP/0/0/CPU0:iosxr-02#show running-config router bgp
706 # Sat Feb 20 03:49:43.618 UTC
707 # router bgp 65536
708 # bgp router-id 192.0.1.1
709 # address-family vpnv4 unicast
710 # vrf vrf1
711 # rd auto
712 # address-family ipv4 unicast
713 # dynamic-med interval 10
714 #
715 #
716 # Using deleted
717 # Before state:
718 # -------------
719 # RP/0/0/CPU0:iosxr-02#show running-config router bgp
720 # Sat Feb 20 03:49:43.618 UTC
721 # router bgp 65536
722 # bgp router-id 192.0.1.1
723 # address-family ipv4 unicast
724 # advertise best-external
725 # allocate-label all
726 # bgp attribute-download
727 # bgp scan-time 20
728 # address-family vpnv4 unicast
729 # vrf vrf1
730 # rd auto
731 # address-family ipv4 unicast
732 # dynamic-med interval 9
733 # redistribute connected metric 10
734 #
735 #
736 - name: Delete the provided configuration
737 cisco.iosxr.iosxr_bgp_address_family:
738 state: deleted
739 config:
740
741 # Task output
742 # -------------
743 # commands:
744 # - router bgp 65536
745 # - no address-family ipv4 unicast
746 # - vrf vrf1
747 # - no address-family ipv4 unicast
748 #
749 #
750 # after:
751 # as_number: "65536"
752 #
753 #
754 # After state:
755 # -------------
756 # RP/0/0/CPU0:iosxr-02#show running-config router bgp
757 # Sat Feb 20 03:49:43.618 UTC
758 # router bgp 65536
759 # bgp router-id 192.0.1.1
760 # address-family vpnv4 unicast
761 # vrf vrf1
762 # rd auto
763 #
764 # Using rendered
765 # -------------
766 #
767 - name: rendered state example
768 cisco.iosxr.iosxr_bgp_address_family:
769 state: rendered
770 config:
771 as_number: '65536'
772 address_family:
773 - afi: ipv4
774 safi: unicast
775 vrf: vrf1
776 dynamic_med: 9
777 redistribute:
778 - protocol: connected
779 metric: 10
780 - afi: ipv4
781 safi: unicast
782 dynamic_med: 10
783 redistribute:
784 - protocol: application
785 id: test1
786 metric: 10
787 bgp:
788 scan_time: 20
789 attribute_download: true
790 advertise_best_external: true
791 allocate_label:
792 all: true
793 # Task output
794 # -------------
795 # commands:
796 # - router bgp 65536
797 # - address-family ipv4 unicast
798 # - advertise best-external
799 # - allocate-label all
800 # - bgp attribute-download
801 # - bgp scan-time 20
802 # - dynamic-med interval 10
803 # - redistribute application test1 metric 10
804 # - vrf vrf1
805 # - address-family ipv4 unicast
806 # - dynamic-med interval 9
807 # - redistribute connected metric 10
808 #
809 # Using gathered
810 # -------------
811 - name: Gather existing running configuration
812 cisco.iosxr.iosxr_bgp_address_family:
813 state: gathered
814 config:
815 as_number: '65536'
816 address_family:
817 - afi: ipv4
818 safi: unicast
819 vrf: vrf1
820 dynamic_med: 9
821 redistribute:
822 - protocol: connected
823 metric: 10
824 - afi: ipv4
825 safi: unicast
826 dynamic_med: 10
827 redistribute:
828 - protocol: application
829 id: test1
830 metric: 10
831 bgp:
832 scan_time: 20
833 attribute_download: true
834 advertise_best_external: true
835 allocate_label:
836 all: true
837 # gathered:
838 # as_number: "65536"
839 # address_family:
840 # - afi: "ipv4"
841 # safi: "unicast"
842 # vrf: vrf1
843 # dynamic_med: 9
844 # redistribute:
845 # - protocol: connected
846 # metric: 10
847 # - afi: "ipv4"
848 # safi: "unicast"
849 # dynamic_med: 10
850 # redistribute:
851 # - protocol: application
852 # id: "test1"
853 # metric: 10
854 # bgp:
855 # scan_time: 20
856 # attribute_download: true
857 # advertise_best_external: true
858 # allocate_label:
859 # all: true
860 #
861 # Using parsed
862 #
863 # parsed.cfg
864 # ------------
865 # router bgp 65536
866 # bgp router-id 192.0.1.1
867 # address-family ipv4 unicast
868 # advertise best-external
869 # allocate-label all
870 # bgp attribute-download
871 # bgp scan-time 20
872 # address-family vpnv4 unicast
873 # vrf vrf1
874 # rd auto
875 # address-family ipv4 unicast
876 # dynamic-med interval 9
877 # redistribute connected metric 10
878 #
879 - name: Parse externally provided BGP neighbor AF config
880 cisco.iosxr.iosxr_bgp_address_family:
881 running_config: "{{ lookup('file', 'parsed.cfg') }}"
882 state: parsed
883
884 # Task output (redacted)
885 # -----------------------
886 # parsed:
887 # as_number: "65536"
888 # address_family:
889 # - afi: "ipv4"
890 # safi: "unicast"
891 # vrf: vrf1
892 # dynamic_med: 9
893 # redistribute:
894 # - protocol: connected
895 # metric: 10
896 # - afi: "ipv4"
897 # safi: "unicast"
898 # dynamic_med: 10
899 # redistribute:
900 # - protocol: application
901 # id: "test1"
902 # metric: 10
903 # bgp:
904 # scan_time: 20
905 # attribute_download: true
906 # advertise_best_external: true
907 # allocate_label:
908 # all: true
909 """
910
911 from ansible.module_utils.basic import AnsibleModule
912
913 from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.bgp_address_family.bgp_address_family import (
914 Bgp_address_familyArgs,
915 )
916 from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.config.bgp_address_family.bgp_address_family import (
917 Bgp_address_family,
918 )
919
920
921 def main():
922 """
923 Main entry point for module execution
924
925 :returns: the result form module invocation
926 """
927 module = AnsibleModule(
928 argument_spec=Bgp_address_familyArgs.argument_spec,
929 mutually_exclusive=[["config", "running_config"]],
930 required_if=[
931 ["state", "merged", ["config"]],
932 ["state", "replaced", ["config"]],
933 ["state", "overridden", ["config"]],
934 ["state", "rendered", ["config"]],
935 ["state", "parsed", ["running_config"]],
936 ],
937 supports_check_mode=True,
938 )
939
940 result = Bgp_address_family(module).execute_module()
941 module.exit_json(**result)
942
943
944 if __name__ == "__main__":
945 main()