Debian Codegraph @

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

raw
1 #!/usr/bin/python
2 #
3 # This file is part of Ansible
4 #
5 # Ansible is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # Ansible is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
17 #
18
19 """
20 The module file for iosxr_ospfv2
21 """
22
23 from __future__ import absolute_import, division, print_function
24
25
26 __metaclass__ = type
27
28 DOCUMENTATION = """
29 module: iosxr_ospfv2
30 short_description: Resource module to configure OSPFv2.
31 description: This module manages global OSPFv2 configuration on devices running Cisco
32 IOS-XR
33 version_added: 1.0.0
34 author:
35 - Rohit Thakur (@rohitthakur2590)
36 notes:
37 - This module works with connection C(network_cli). See L(the IOS-XR Platform Options,../network/user_guide/platform_iosxr.html)
38 options:
39 config:
40 description: A list of OSPFv2 process configuration
41 type: dict
42 suboptions:
43 processes:
44 description: A list of OSPFv2 instances configuration
45 type: list
46 elements: dict
47 suboptions:
48 address_family_unicast:
49 description: Enable unicast topology for ipv4 address family
50 type: bool
51 adjacency_stagger:
52 description: Stagger OSPFv2 adjacency bring up
53 type: dict
54 suboptions:
55 min_adjacency:
56 description: Initial number of neighbors to bring up per area (default
57 2)
58 type: int
59 max_adjacency:
60 description: Maximum simultaneous neighbors to bring up
61 type: int
62 disable:
63 description: Disable stagger OSPFv2 adjacency
64 type: bool
65 authentication:
66 description: Enable authentication
67 type: dict
68 suboptions:
69 keychain:
70 description: Specify keychain name
71 type: str
72 message_digest:
73 description: Use message-digest authentication
74 type: dict
75 suboptions:
76 set:
77 description: Specify message-digest selection
78 type: bool
79 keychain:
80 description: Specify keychain name
81 type: str
82 no_auth:
83 description: Use no authentication
84 type: bool
85 apply_weight:
86 description: Enable weights configured under interfaces for load sharing
87 type: dict
88 suboptions:
89 bandwidth:
90 description: Reference bandwidth to use for calculation (Mbits/sec)
91 type: int
92 default_weight:
93 description: Specify default weight value to use when it is not configured
94 under interface
95 type: int
96 areas:
97 description: Configure OSPFv2 areas' properties
98 type: list
99 elements: dict
100 suboptions:
101 area_id:
102 description: Area ID as IP address or integer
103 type: str
104 required: true
105 authentication:
106 description: Enable authentication
107 type: dict
108 suboptions:
109 keychain:
110 description: Specify keychain name
111 type: str
112 message_digest:
113 description: Use message-digest authentication
114 type: dict
115 suboptions:
116 keychain:
117 description: Specify keychain name
118 type: str
119 no_auth:
120 description: Use no authentication
121 type: bool
122 authentication_key:
123 description: Used to mention authentication password (key)
124 type: dict
125 suboptions:
126 password:
127 description: The OSPFv2 password (key)
128 type: str
129 clear:
130 description: Specifies an UNENCRYPTED password (key) will follow
131 type: str
132 encrypted:
133 description: Specifies an ENCRYPTED password (key) will follow
134 type: str
135 default_cost:
136 description: Set the summary default-cost of a NSSA/stub area. Stub's
137 advertised external route metric
138 type: int
139 cost:
140 description: Interface cost
141 type: int
142 dead_interval:
143 description: Interval after which a neighbor is declared dead
144 type: int
145 hello_interval:
146 description: Time between HELLO packets
147 type: int
148 transmit_delay:
149 description: Estimated time needed to send link-state update packet
150 type: int
151 mpls:
152 description: Configure MPLS routing protocol parameters
153 type: dict
154 suboptions:
155 traffic_eng:
156 description: Configure an ospf area to run MPLS Traffic Engineering
157 type: bool
158 ldp:
159 description: Configure LDP parameters
160 type: dict
161 suboptions:
162 auto_config:
163 description: Enable LDP IGP interface auto-configuration
164 type: bool
165 sync:
166 description: Enable LDP IGP synchronization
167 type: bool
168 sync_igp_shortcuts:
169 description: LDP sync for igp-shortcut tunnels
170 type: bool
171 mtu_ignore:
172 description: Enable/Disable ignoring of MTU in DBD packets
173 type: str
174 choices:
175 - enable
176 - disable
177 bfd:
178 description: Configure BFD parameters
179 type: dict
180 suboptions:
181 fast_detect:
182 description: Configure fast detection
183 type: dict
184 suboptions:
185 set:
186 description: Enable fast detection only
187 type: bool
188 strict_mode:
189 description: Hold down neighbor session until BFD session is up
190 type: bool
191 minimum_interval:
192 description: Hello interval in milli-seconds
193 type: int
194 multiplier:
195 description: Detect multiplier
196 type: int
197 nssa:
198 description:
199 - NSSA settings for the area
200 type: dict
201 suboptions:
202 set:
203 description: Configure area as NSSA
204 type: bool
205 default_information_originate:
206 description: Originate default Type 7 LSA
207 type: dict
208 suboptions:
209 metric:
210 description: OSPFv2 default metric
211 type: int
212 metric_type:
213 description: Metric type for default routes
214 type: int
215 no_redistribution:
216 description: Do not send redistributed LSAs into NSSA area
217 type: bool
218 no_summary:
219 description: Do not send summary LSAs into NSSA area
220 type: bool
221 translate:
222 description: Translate LSA
223 type: dict
224 suboptions:
225 type7:
226 description:
227 - Translate from Type 7 to Type 5
228 type: dict
229 suboptions:
230 always:
231 description:
232 - Always translate LSAs
233 type: bool
234 ranges:
235 description: Summarize routes matching address/mask (border routers
236 only)
237 type: list
238 elements: dict
239 suboptions:
240 address:
241 description: IP in Prefix format (x.x.x.x/len)
242 type: str
243 required: true
244 advertise:
245 description: Advertise this range (default)
246 type: bool
247 not_advertise:
248 description: DoNotAdvertise this range
249 type: bool
250 route_policy:
251 description: Specify the route-policy to filter type 3 LSAs (list
252 can have one inbound and/or one outbound policy only)
253 type: list
254 elements: dict
255 suboptions:
256 parameters:
257 description: Specify parameter values for the policy
258 type: list
259 elements: str
260 direction:
261 description: Specify inbound or outbound
262 type: str
263 choices:
264 - in
265 - out
266 stub:
267 description:
268 - Settings for configuring the area as a stub
269 type: dict
270 suboptions:
271 set:
272 description:
273 - Configure the area as a stub
274 type: bool
275 no_summary:
276 description:
277 - Do not send summary LSA into stub area
278 type: bool
279 virtual_link:
280 description: Define a virtual link
281 type: list
282 elements: dict
283 suboptions:
284 id:
285 description: Router-ID of virtual link neighbor (A.B.C.D)
286 type: str
287 required: true
288 authentication:
289 description: Enable authentication
290 type: dict
291 suboptions:
292 keychain:
293 description: Specify keychain name
294 type: str
295 message_digest:
296 description: Use message-digest authentication
297 type: dict
298 suboptions:
299 keychain:
300 description: Specify keychain name
301 type: str
302 no_auth:
303 description: Use no authentication
304 type: bool
305 authentication_key:
306 description: Used to mention authentication password (key)
307 type: dict
308 suboptions:
309 password:
310 description: The OSPFv2 password (key)
311 type: str
312 clear:
313 description: Specifies an UNENCRYPTED password (key) will
314 follow
315 type: str
316 encrypted:
317 description: Specifies an ENCRYPTED password (key) will follow
318 type: str
319 dead_interval:
320 description: Interval after which a neighbor is declared dead
321 type: int
322 hello_interval:
323 description: Time between HELLO packets
324 type: int
325 retransmit_interval:
326 description: Delay between LSA retransmissions
327 type: int
328 transmit_delay:
329 description: Link state transmit delay
330 type: int
331 message_digest_key:
332 description: Message digest authentication password (key)
333 type: dict
334 suboptions:
335 id:
336 description: Key ID (1-255)
337 type: int
338 required: true
339 md5:
340 description: Use MD5 Algorithm
341 type: dict
342 suboptions:
343 password:
344 description: The OSPFv2 password (key)
345 type: str
346 clear:
347 description: Specifies an UNENCRYPTED password (key) will
348 follow
349 type: bool
350 encrypted:
351 description: Specifies an ENCRYPTED password (key) will
352 follow
353 type: bool
354
355 authentication_key:
356 description: Used to mention authentication password (key)
357 type: dict
358 suboptions:
359 password:
360 description: The OSPFv2 password (key)
361 type: str
362 clear:
363 description: Specifies an UNENCRYPTED password (key) will follow
364 type: bool
365 encrypted:
366 description: Specifies an ENCRYPTED password (key) will follow
367 type: bool
368 auto_cost:
369 description: Calculate OSPFv2 interface cost according to bandwidth
370 type: dict
371 suboptions:
372 reference_bandwidth:
373 description: Specify reference bandwidth in megabits per sec
374 type: int
375 disable:
376 description: Assign OSPFv2 cost based on interface type
377 type: bool
378 bfd:
379 description: Configure BFD parameters
380 type: dict
381 suboptions:
382 fast_detect:
383 description: Configure fast detection
384 type: dict
385 suboptions:
386 set:
387 description: Enable fast detection only
388 type: bool
389 strict_mode:
390 description: Hold down neighbor session until BFD session is up
391 type: bool
392 minimum_interval:
393 description: Hello interval in milli-seconds
394 type: int
395 multiplier:
396 description: Detect multiplier
397 type: int
398 capability:
399 description: Enable specific OSPFv2 feature
400 type: dict
401 suboptions:
402 type7:
403 description: NSSA capability
404 type: str
405 opaque:
406 description: Configure opaque LSA
407 type: dict
408 suboptions:
409 disable:
410 description: Disable Opaque LSA capability
411 type: bool
412 set:
413 description: Enable opaque LSA
414 type: bool
415 cost:
416 description: Interface cost (1-65535)
417 type: int
418 database_filter:
419 description: Filter OSPFv2 LSA during synchronization and flooding (all
420 outgoing LSA). Enable/Disable filtering
421 type: str
422 choices: [enable, disable]
423 dead_interval:
424 description: Interval after which a neighbor is declared dead
425 type: int
426 default_information_originate:
427 description: Distribute default route
428 type: dict
429 suboptions:
430 always:
431 description: Always advertise default route
432 type: bool
433 metric:
434 description: OSPFv2 default metric
435 type: int
436 metric_type:
437 description: OSPFv2 metric type for default routes
438 type: int
439 route_policy:
440 description: Apply route-policy to default-information origination
441 type: str
442 set:
443 description: Enable distribution of default route
444 type: bool
445 default_metric:
446 description: Set metric of redistributed routes
447 type: int
448 demand_circuit:
449 description: Enable/Disable OSPFv2 demand circuit
450 type: str
451 choices: [enable, disable]
452 distance:
453 description: Define an administrative distance
454 type: dict
455 suboptions:
456 admin_distance:
457 description: Administrative distance
458 type: list
459 elements: dict
460 suboptions:
461 value:
462 description: Distance value
463 type: int
464 source:
465 description: Source IP address
466 type: str
467 wildcard:
468 description: IP wild card bits (A.B.C.D)
469 type: str
470 access_list:
471 description: Access list name
472 type: str
473 ospf_distance:
474 description: OSPFv2 administrative distance
475 type: dict
476 suboptions:
477 external:
478 description: Distance for external routes
479 type: int
480 inter_area:
481 description: Distance for inter-area routes
482 type: int
483 intra_area:
484 description: Distance for intra-area routes
485 type: int
486 distribute_link_state:
487 description: Enable Distribution of LSAs to external services
488 type: dict
489 suboptions:
490 instance_id:
491 description: Set distribution process instance identifier
492 type: int
493 throttle:
494 description: Throttle time between successive LSA updates
495 type: int
496 distribute_bgp_ls:
497 description: Enable Distribution of LSAs to external services
498 type: dict
499 suboptions:
500 instance_id:
501 description: Set distribution process instance identifier
502 type: int
503 throttle:
504 description: Throttle time between successive LSA updates
505 type: int
506 distribute_list:
507 description: Filter networks in routing updates (list can have one inbound
508 and/or one outbound policy only)
509 type: list
510 elements: dict
511 suboptions:
512 access_list:
513 description: Inbound/outbound access-list
514 type: str
515 direction:
516 description: Filter incoming/outgoing routing updates
517 type: str
518 choices:
519 - in
520 - out
521 outgoing_params:
522 description: Specify additional parameters for outgoing updates only
523 type: dict
524 suboptions:
525 route_type:
526 description: Type of routes
527 type: str
528 choices:
529 - bgp
530 - connected
531 - dagr
532 - ospf
533 - static
534 id:
535 description:
536 - For BGP, specify AS number. 2-byte AS number (or) 4-byte AS
537 number in asdot (X.Y) format (or) 4-byte AS number in asplain
538 format
539 - For OSPF, specify OSPFv2 instance name
540 type: str
541 route_policy:
542 description: Route Policy to filter OSPFv2 prefixes (for incoming
543 updates only)
544 type: str
545 external_out:
546 description: Enable/Disable advertisement of intra-area prefixes as external
547 type: str
548 choices:
549 - enable
550 - disable
551 flood_reduction:
552 description: Enable/Disable OSPFv2 Flood Reduction
553 type: str
554 choices:
555 - enable
556 - disable
557 hello_interval:
558 description: Time between HELLO packets (<1-65535> seconds)
559 type: int
560 ignore_lsa_mospf:
561 description: Do not complain upon receiving MOSPFv2 Type 6 LSA
562 type: bool
563 link_down_fast_detect:
564 description: Enable fast or early detection of link-down events
565 type: bool
566 log_adjacency_changes:
567 description: Log adjacency state changes
568 type: dict
569 suboptions:
570 set:
571 description: Set log adjacency
572 type: bool
573 disable:
574 description: Disable log adjacency changes
575 type: bool
576 detail:
577 description: Log all state changes
578 type: bool
579 loopback_stub_network:
580 description: Advertise loopback as a stub network
581 type: str
582 choices:
583 - enable
584 - disable
585 max_lsa:
586 description:
587 - Feature to limit the number of non-self-originated LSAs
588 type: dict
589 suboptions:
590 threshold:
591 description:
592 - Threshold value (%) at which to generate a warning message
593 type: int
594 ignore_count:
595 description:
596 - Set count on how many times adjacencies can be suppressed
597 type: int
598 ignore_time:
599 description:
600 - Set number of minutes during which all adjacencies are suppressed
601 type: int
602 reset_time:
603 description:
604 - Set number of minutes after which ignore-count is reset to zero
605 type: int
606 warning_only:
607 description:
608 - Log a warning message when limit is exceeded
609 type: bool
610 max_metric:
611 description: Set maximum metric
612 type: dict
613 suboptions:
614 router_lsa:
615 description: Maximum metric in self-originated router-LSAs
616 type: dict
617 suboptions:
618 set:
619 description: Set router-lsa attribute
620 type: bool
621 external_lsa:
622 description: External LSA configuration
623 type: dict
624 suboptions:
625 set:
626 description: Set external-lsa attribute
627 type: bool
628 max_metric_value:
629 description: Set max metric value for external LSAs
630 type: int
631 include_stub:
632 description:
633 - Advertise Max metric for Stub links as well
634 type: bool
635 on_startup:
636 description:
637 - Effective only at startup
638 type: dict
639 suboptions:
640 set:
641 description:
642 - Set on-startup attribute
643 type: bool
644 wait_period:
645 description:
646 - Wait period in seconds after startup
647 type: int
648 wait_for_bgp_asn:
649 description:
650 - ASN of BGP to wait for
651 type: int
652 summary_lsa:
653 description:
654 - Summary LSAs configuration
655 type: dict
656 suboptions:
657 set:
658 description:
659 - Set summary-lsa attribute
660 type: bool
661 max_metric_value:
662 description:
663 - Max metric value for summary LSAs
664 type: int
665 message_digest_key:
666 description: Message digest authentication password (key)
667 type: dict
668 suboptions:
669 id:
670 description: Key ID
671 type: int
672 required: true
673 md5:
674 description: Use MD5 Algorithm
675 type: dict
676 required: true
677 suboptions:
678 password:
679 description: The OSPFv2 password (key)
680 type: str
681 clear:
682 description: Specifies an UNENCRYPTED password (key) will follow
683 type: bool
684 encrypted:
685 description: Specifies an ENCRYPTED password (key) will follow
686 type: bool
687 microloop_avoidance:
688 description: Avoid microloops
689 type: dict
690 suboptions:
691 protected:
692 description: Avoid microloops for protected prefixes only)
693 type: bool
694 rib_update_delay:
695 description: Delay to introduce between SPF and RIB updates
696 type: int
697 segment_routing:
698 description: Enable segment routing microloop avoidance
699 type: bool
700 monitor_convergence:
701 description: Enables OSPFv2 route convergence monitoring
702 type: dict
703 suboptions:
704 prefix_list:
705 description: Enables Individual Prefix Monitoring
706 type: str
707 track_external_routes:
708 description: Enables Tracking External(Type-5/7) Prefix monitoring
709 type: bool
710 track_ip_frr:
711 description: Enables Tracking IP-Frr Convergence
712 type: bool
713 track_summary_routes:
714 description: Enables Tracking Summary(Inter-Area) Prefix monitoring
715 type: bool
716 mpls:
717 description: Configure MPLS routing protocol parameters
718 type: dict
719 suboptions:
720 traffic_eng:
721 description: Routing protocol commands for MPLS Traffic Engineering
722 type: dict
723 suboptions:
724 autoroute_exclude:
725 description: Exclude IP address destinations from using TE tunnels
726 type: dict
727 suboptions:
728 route_policy:
729 description: Policy name
730 type: str
731 parameters:
732 description: Specify parameter values for the policy
733 type: list
734 elements: str
735 igp_intact:
736 description: Retain one or more IPv4 nexthops with tunnel nexthops
737 type: bool
738 ldp_sync_update:
739 description: Enable LDP sync induced metric propagation
740 type: bool
741 multicast_intact:
742 description: Publish multicast-intact paths to RIB
743 type: bool
744 router_id:
745 description: Traffic Engineering stable IP address for system
746 type: str
747 ldp:
748 description: Configure LDP parameters
749 type: dict
750 suboptions:
751 auto_config:
752 description: Enable LDP IGP interface auto-configuration
753 type: bool
754 sync:
755 description: Enable LDP IGP synchronization
756 type: bool
757 sync_igp_shortcuts:
758 description: LDP sync for igp-shortcut tunnels
759 type: bool
760 mtu_ignore:
761 description: Enable/Disable ignoring of MTU in DBD packets
762 type: str
763 choices:
764 - enable
765 - disable
766 network:
767 description: Network type
768 type: dict
769 suboptions:
770 broadcast:
771 description: Specify OSPFv2 broadcast multi-access network
772 type: bool
773 non_broadcast:
774 description: Specify OSPFv2 NBMA network
775 type: bool
776 point_to_multipoint:
777 description: Specify OSPFv2 point-to-multipoint network
778 type: bool
779 point_to_point:
780 description: Specify OSPFv2 point-to-point network
781 type: bool
782 nsf:
783 description: Non-stop forwarding
784 type: dict
785 suboptions:
786 cisco:
787 description: Cisco Non-stop forwarding
788 type: dict
789 suboptions:
790 enforce_global:
791 description: Cancel NSF restart when non-NSF-aware neighbors detected
792 for the whole OSPFv2 process
793 type: bool
794 set:
795 description: Enable Cisco NSF
796 type: bool
797 flush_delay_time:
798 description: Maximum time allowed for external route learning
799 type: int
800 ietf:
801 description: IETF graceful restart
802 type: dict
803 suboptions:
804 helper_disable:
805 description: Disable router's helper support level
806 type: bool
807 set:
808 description: Only enable ietf option
809 type: bool
810 interval:
811 description: Minimum interval between NSF restarts (<90-3600> seconds)
812 type: int
813 lifetime:
814 description: Maximum route lifetime following restart (<90-1800> seconds)
815 type: int
816 nsr:
817 description: Enable NSR for all VRFs in this process. 'False' option to
818 disable NSR for all VRFs in this process
819 type: bool
820 packet_size:
821 description: Size of OSPFv2 packets to use. min=576 max=MTU bytes
822 type: int
823 passive:
824 description: Enable/Disable passive
825 type: str
826 choices:
827 - enable
828 - disable
829 prefix_suppression:
830 description: Suppress advertisement of the prefixes
831 type: dict
832 suboptions:
833 set:
834 description: Set the suppression option
835 type: bool
836 secondary_address:
837 description: Enable/Disable secondary address suppression
838 type: bool
839 priority:
840 description: Router priority
841 type: int
842 process_id:
843 description: The OSPFv2 Process ID
844 type: str
845 required: true
846 protocol_shutdown:
847 description: Protocol specific configuration
848 type: dict
849 suboptions:
850 host_mode:
851 description: Only traffic destined for this box allowed(cisco-support)
852 type: bool
853 on_reload:
854 description: Shutdown post reload only
855 type: bool
856 set:
857 description: Shutdown the OSPFv2 Protocol
858 type: bool
859 limit:
860 description: High watermark for incoming priority events
861 type: dict
862 suboptions:
863 high:
864 description: Hello events are dropped when incoming event queue
865 exceeds this value
866 type: int
867 low:
868 description: DBD/LS Update/Req packets are dropped when incoming
869 event queue exceeds this value
870 type: int
871 medium:
872 description: LSA ACKs are dropped when incoming event queue exceeds
873 this value
874 type: int
875 redistribute:
876 description: Redistribute information from another routing Protocol
877 type: dict
878 suboptions:
879 route_type:
880 description: Route type to redistribute
881 type: str
882 choices: [application, bgp, connected, dagr, eigrp, isis, mobile,
883 ospf, rip, static, subscriber]
884 id:
885 description: OnePK application name for application routes (or) AS
886 number for bgp and eigrp (or) instance name for isis and ospf
887 type: str
888 level:
889 description: ISIS levels
890 choices: [1, 2, 12]
891 type: int
892 lsa_type_summary:
893 description: LSA type 3 for redistributed routes
894 type: bool
895 match:
896 description: Redistribution of routes. For OSPFv2 - external/internal/nssa-external
897 1/2. For EIGRP - external/internal
898 type: str
899 metric:
900 description: Metric for redistributed routes
901 type: int
902 metric_type:
903 description: OSPFv2 exterior metric type for redistributed routes
904 type: int
905 choices: [1, 2]
906 route_policy:
907 description: Apply route-policy to redistribution
908 type: dict
909 suboptions:
910 name:
911 description: Name of the policy
912 type: str
913 parameters:
914 description: Specify parameter values for the policy
915 type: list
916 elements: str
917 nssa_only:
918 description: Redistribute to NSSA areas only
919 type: bool
920 preserve_med:
921 description: Preserve med of BGP routes
922 type: bool
923 tag:
924 description: Set tag for routes redistributed into OSPFv2
925 type: int
926 retransmit_interval:
927 description: Delay between LSA retransmissions
928 type: int
929 router_id:
930 description: OSPFv2 router-id in IPv4 address format (A.B.C.D)
931 type: str
932 security_ttl:
933 description: Enable security
934 type: dict
935 suboptions:
936 set:
937 description: Enable ttl security
938 type: bool
939 hops:
940 description: Maximum number of IP hops allowed <1-254>
941 type: int
942 summary_in:
943 description: Enable/Disable advertisement of external prefixes as inter-area
944 type: str
945 choices: [enable, disable]
946 summary_prefix:
947 description: Configure IP address summaries
948 type: list
949 elements: dict
950 suboptions:
951 prefix:
952 description: IP summary address/mask (A.B.C.D/prefix)
953 type: str
954 required: true
955 not_advertise:
956 description: Suppress routes that match the specified prefix/mask
957 pair
958 type: bool
959 tag:
960 description: Set tag
961 type: int
962 timers:
963 description: Configure timer related constants
964 type: dict
965 suboptions:
966 graceful_shutdown:
967 description: Timers for graceful shutdown(cisco-support)
968 type: dict
969 suboptions:
970 initial_delay:
971 description: Delay before starting graceful shutdown
972 type: int
973 retain_routes:
974 description: Time to keep routes active after graceful shutdown
975 type: int
976 lsa:
977 description: OSPFv2 global LSA timers
978 type: dict
979 suboptions:
980 group_pacing:
981 description: OSPFv2 LSA group pacing timer. Interval between group
982 of LSA being refreshed or maxaged
983 type: int
984 min_arrival:
985 description: OSPFv2 MinLSArrival timer. The minimum interval in
986 millisec between accepting the same LSA
987 type: int
988 refresh:
989 description: OSPFv2 LSA refresh interval. How often self-originated
990 LSAs should be refreshed, in seconds
991 type: int
992 throttle:
993 description: OSPFv2 throttle timers
994 type: dict
995 suboptions:
996 lsa_all:
997 description: LSA throttle timers for all types of OSPFv2 LSAs
998 type: dict
999 suboptions:
1000 initial_delay:
1001 description: Delay to generate first occurance of LSA in milliseconds
1002 type: int
1003 min_delay:
1004 description: Minimum delay between originating the same LSA
1005 in milliseconds
1006 type: int
1007 max_delay:
1008 description: Maximum delay between originating the same LSA
1009 in milliseconds
1010 type: int
1011 spf:
1012 description: OSPFv2 SPF throttle timers
1013 type: dict
1014 suboptions:
1015 change_delay:
1016 description: Delay between receiving a change to SPF calculation
1017 in milliseconds
1018 type: int
1019 second_delay:
1020 description: Delay between first and second SPF calculation
1021 in milliseconds
1022 type: int
1023 max_wait:
1024 description: Maximum wait time in milliseconds for SPF calculations
1025 type: int
1026 fast_reroute:
1027 description: Fast-reroute throttle timer. Delay between end of
1028 SPF and start of the fast-reroute computation in milliseconds
1029 type: int
1030 pacing_flood:
1031 description: OSPFv2 flood pacing timer. Interval in msec to pace flooding
1032 on all interfaces
1033 type: int
1034 transmit_delay:
1035 description: Estimated time needed to send link-state update packet
1036 type: int
1037 weight:
1038 description: Interface weight
1039 type: int
1040 running_config:
1041 description:
1042 - This option is used only with state I(parsed).
1043 - The value of this option should be the output received from the IOS-XR device
1044 by executing the command B(show running-config router ospf).
1045 - The state I(parsed) reads the configuration from C(running_config) option and
1046 transforms it into Ansible structured data as per the resource module's argspec
1047 and the value is then returned in the I(parsed) key within the result.
1048 type: str
1049 state:
1050 description:
1051 - The state the configuration should be left in.
1052 type: str
1053 choices:
1054 - merged
1055 - replaced
1056 - deleted
1057 - parsed
1058 - gathered
1059 - rendered
1060 - overridden
1061 default: merged
1062
1063 """
1064
1065 EXAMPLES = """
1066 # Using merged
1067
1068 # Before state:
1069 # -------------
1070 #
1071 # RP/0/RP0/CPU0:anton#show running-config router ospf
1072 # Thu Jun 11 15:54:44.569 UTC
1073 # % No such configuration item(s)
1074 #
1075
1076 - name: Merge provided OSPFv2 configuration with the existing configuration
1077 cisco.iosxr.iosxr_ospfv2:
1078 config:
1079 processes:
1080 - process_id: '27'
1081 areas:
1082 - area_id: '10'
1083 hello_interval: 2
1084 authentication:
1085 keychain: ansi11393
1086 - process_id: '26'
1087 adjacency_stagger:
1088 max_adjacency: 20
1089 min_adjacency: 10
1090 - process_id: '10'
1091 authentication:
1092 keychain: ansible_test1102
1093 areas:
1094 - area_id: '11'
1095 default_cost: 5
1096 cost: 11
1097 - area_id: 22
1098 default_cost: 6
1099 - process_id: '30'
1100 areas:
1101 - area_id: 11
1102 default_cost: 5
1103 - area_id: 22
1104 default_cost: 6
1105 cost: 2
1106 default_metric: 10
1107 transmit_delay: 2
1108 hello_interval: 1
1109 dead_interval: 2
1110 retransmit_interval: 2
1111 weight: 2
1112 packet_size: 577
1113 priority: 1
1114 router_id: 2.2.2.2
1115 demand_circuit: enable
1116 passive: disable
1117 summary_in: enable
1118 flood_reduction: disable
1119 mtu_ignore: enable
1120 external_out: disable
1121 state: merged
1122
1123 # Task Output:
1124 # ------------
1125 #
1126 # before: {}
1127 #
1128 # commands:
1129 # - router ospf 30
1130 # - cost 2
1131 # - weight 2
1132 # - passive disable
1133 # - priority 1
1134 # - flood-reduction disable
1135 # - default-metric 10
1136 # - router-id 2.2.2.2
1137 # - demand-circuit enable
1138 # - packet-size 577
1139 # - transmit-delay 2
1140 # - summary-in enable
1141 # - external-out disable
1142 # - dead-interval 2
1143 # - hello-interval 1
1144 # - retransmit-interval 2
1145 # - mtu-ignore enable
1146 # - area 11 default-cost 5
1147 # - area 22 default-cost 6
1148 # - router ospf 26
1149 # - adjacency stagger 10 20
1150 # - router ospf 10
1151 # - authentication keychain ansible_test1102
1152 # - area 11 default-cost 5
1153 # - area 11 cost 11
1154 # - area 22 default-cost 6
1155 # - router ospf 27
1156 # - area 10 authentication keychain ansi11393
1157 # - area 10 hello-interval 2
1158 #
1159 # after:
1160 # processes:
1161 # - areas:
1162 # - area_id: '11'
1163 # cost: 11
1164 # default_cost: 5
1165 # - area_id: '22'
1166 # default_cost: 6
1167 # authentication:
1168 # keychain: ansible_test1102
1169 # process_id: '10'
1170 # - adjacency_stagger:
1171 # max_adjacency: 20
1172 # min_adjacency: 10
1173 # process_id: '26'
1174 # - areas:
1175 # - area_id: '10'
1176 # authentication:
1177 # keychain: ansi11393
1178 # hello_interval: 2
1179 # process_id: '27'
1180 # - areas:
1181 # - area_id: '11'
1182 # default_cost: 5
1183 # - area_id: '22'
1184 # default_cost: 6
1185 # cost: 2
1186 # dead_interval: 2
1187 # default_metric: 10
1188 # demand_circuit: enable
1189 # external_out: disable
1190 # flood_reduction: disable
1191 # hello_interval: 1
1192 # mtu_ignore: enable
1193 # packet_size: 577
1194 # passive: disable
1195 # priority: 1
1196 # process_id: '30'
1197 # retransmit_interval: 2
1198 # router_id: 2.2.2.2
1199 # summary_in: enable
1200 # transmit_delay: 2
1201 # weight: 2
1202 #
1203 # After state:
1204 # ------------
1205 #
1206 # router ospf 10
1207 # authentication keychain ansible_test1102
1208 # area 11
1209 # cost 11
1210 # default-cost 5
1211 # !
1212 # area 22
1213 # default-cost 6
1214 # !
1215 # !
1216 # router ospf 26
1217 # adjacency stagger 10 20
1218 # !
1219 # router ospf 27
1220 # area 10
1221 # authentication keychain ansi11393
1222 # hello-interval 2
1223 # !
1224 # !
1225 # router ospf 30
1226 # router-id 2.2.2.2
1227 # summary-in enable
1228 # external-out disable
1229 # cost 2
1230 # packet-size 577
1231 # weight 2
1232 # passive disable
1233 # priority 1
1234 # mtu-ignore enable
1235 # flood-reduction disable
1236 # dead-interval 2
1237 # retransmit-interval 2
1238 # demand-circuit enable
1239 # hello-interval 1
1240 # transmit-delay 2
1241 # default-metric 10
1242 # area 11
1243 # default-cost 5
1244 # !
1245 # area 22
1246 # default-cost 6
1247 # !
1248 # !
1249
1250 # Using replaced
1251 #
1252 # Before state:
1253 # -------------
1254 #
1255 #
1256 # RP/0/RP0/CPU0:anton#show running-config router ospf
1257 # Thu Jun 11 16:06:44.406 UTC
1258 # router ospf 10
1259 # authentication keychain ansible_test1102
1260 # area 11
1261 # cost 11
1262 # default-cost 5
1263 # !
1264 # area 22
1265 # default-cost 6
1266 # !
1267 # !
1268 # router ospf 26
1269 # adjacency stagger 10 20
1270 # !
1271 # router ospf 27
1272 # area 10
1273 # authentication keychain ansi11393
1274 # hello-interval 2
1275 # !
1276 # !
1277 # router ospf 30
1278 # router-id 2.2.2.2
1279 # summary-in enable
1280 # external-out disable
1281 # cost 2
1282 # packet-size 577
1283 # weight 2
1284 # passive disable
1285 # priority 1
1286 # mtu-ignore enable
1287 # flood-reduction disable
1288 # dead-interval 2
1289 # retransmit-interval 2
1290 # demand-circuit enable
1291 # hello-interval 1
1292 # transmit-delay 2
1293 # default-metric 10
1294 # area 11
1295 # default-cost 5
1296 # !
1297 # area 22
1298 # default-cost 6
1299 # !
1300 # !
1301 #
1302 - name: Replace running OSPFv2 routes configurations with provided config.
1303 cisco.iosxr.iosxr_ospfv2:
1304 config:
1305 processes:
1306 - process_id: 27
1307 areas:
1308 - area_id: 10
1309 hello_interval: 2
1310 - area_id: 20
1311 cost: 2
1312 default_cost: 2
1313 authentication:
1314 keychain: ansi11393
1315 - process_id: 26
1316 adjacency_stagger:
1317 min_adjacency: 10
1318 max_adjacency: 20
1319 state: replaced
1320
1321 # Task Output:
1322 # ------------
1323 #
1324 # before:
1325 # processes:
1326 # - areas:
1327 # - area_id: '11'
1328 # cost: 11
1329 # default_cost: 5
1330 # - area_id: '22'
1331 # default_cost: 6
1332 # authentication:
1333 # keychain: ansible_test1102
1334 # process_id: '10'
1335 # - adjacency_stagger:
1336 # max_adjacency: 20
1337 # min_adjacency: 10
1338 # process_id: '26'
1339 # - areas:
1340 # - area_id: '10'
1341 # authentication:
1342 # keychain: ansi11393
1343 # hello_interval: 2
1344 # process_id: '27'
1345 # - areas:
1346 # - area_id: '11'
1347 # default_cost: 5
1348 # - area_id: '22'
1349 # default_cost: 6
1350 # cost: 2
1351 # dead_interval: 2
1352 # default_metric: 10
1353 # demand_circuit: enable
1354 # external_out: disable
1355 # flood_reduction: disable
1356 # hello_interval: 1
1357 # mtu_ignore: enable
1358 # packet_size: 577
1359 # passive: disable
1360 # priority: 1
1361 # process_id: '30'
1362 # retransmit_interval: 2
1363 # router_id: 2.2.2.2
1364 # summary_in: enable
1365 # transmit_delay: 2
1366 # weight: 2
1367 #
1368 # commands:
1369 # - router ospf 27
1370 # - no area 10 authentication keychain ansi11393
1371 # - area 20 authentication keychain ansi11393
1372 # - area 20 default-cost 2
1373 # - area 20 cost 2
1374 #
1375 # after:
1376 # processes:
1377 # - areas:
1378 # - area_id: '11'
1379 # cost: 11
1380 # default_cost: 5
1381 # - area_id: '22'
1382 # default_cost: 6
1383 # authentication:
1384 # keychain: ansible_test1102
1385 # process_id: '10'
1386 # - adjacency_stagger:
1387 # max_adjacency: 20
1388 # min_adjacency: 10
1389 # process_id: '26'
1390 # - areas:
1391 # - area_id: '10'
1392 # hello_interval: 2
1393 # - area_id: '20'
1394 # authentication:
1395 # keychain: ansi11393
1396 # cost: 2
1397 # default_cost: 2
1398 # process_id: '27'
1399 # - areas:
1400 # - area_id: '11'
1401 # default_cost: 5
1402 # - area_id: '22'
1403 # default_cost: 6
1404 # cost: 2
1405 # dead_interval: 2
1406 # default_metric: 10
1407 # demand_circuit: enable
1408 # external_out: disable
1409 # flood_reduction: disable
1410 # hello_interval: 1
1411 # mtu_ignore: enable
1412 # packet_size: 577
1413 # passive: disable
1414 # priority: 1
1415 # process_id: '30'
1416 # retransmit_interval: 2
1417 # router_id: 2.2.2.2
1418 # summary_in: enable
1419 # transmit_delay: 2
1420 # weight: 2
1421 #
1422 # After state:
1423 # ------------
1424 #
1425 # RP/0/RP0/CPU0:anton(config)#do show running-config router ospf
1426 # Thu Jun 11 16:40:31.038 UTC
1427 # router ospf 10
1428 # authentication keychain ansible_test1102
1429 # area 11
1430 # cost 11
1431 # default-cost 5
1432 # !
1433 # area 22
1434 # default-cost 6
1435 # !
1436 # !
1437 # router ospf 26
1438 # adjacency stagger 10 20
1439 # !
1440 # router ospf 27
1441 # area 10
1442 # hello-interval 2
1443 # !
1444 # area 20
1445 # cost 2
1446 # authentication keychain ansi11393
1447 # default-cost 2
1448 # !
1449 # !
1450 # router ospf 30
1451 # router-id 2.2.2.2
1452 # summary-in enable
1453 # external-out disable
1454 # cost 2
1455 # packet-size 577
1456 # weight 2
1457 # passive disable
1458 # priority 1
1459 # mtu-ignore enable
1460 # flood-reduction disable
1461 # dead-interval 2
1462 # retransmit-interval 2
1463 # demand-circuit enable
1464 # hello-interval 1
1465 # transmit-delay 2
1466 # default-metric 10
1467 # area 11
1468 # default-cost 5
1469 # !
1470 # area 22
1471 # default-cost 6
1472 # !
1473 # !
1474
1475 # Using overridden
1476 #
1477 # Before state:
1478 # -------------
1479 #
1480 # RP/0/RP0/CPU0:anton#show running-config router ospf
1481 # Thu Jun 11 16:06:44.406 UTC
1482 # router ospf 10
1483 # authentication keychain ansible_test1102
1484 # area 11
1485 # cost 11
1486 # default-cost 5
1487 # !
1488 # area 22
1489 # default-cost 6
1490 # !
1491 # !
1492 # router ospf 26
1493 # adjacency stagger 10 20
1494 # !
1495 # router ospf 27
1496 # area 10
1497 # hello-interval 2
1498 # !
1499 # area 20
1500 # cost 2
1501 # authentication keychain ansi11393
1502 # default-cost 2
1503 # !
1504 # !
1505 # router ospf 30
1506 # router-id 2.2.2.2
1507 # summary-in enable
1508 # external-out disable
1509 # cost 2
1510 # packet-size 577
1511 # weight 2
1512 # passive disable
1513 # priority 1
1514 # mtu-ignore enable
1515 # flood-reduction disable
1516 # dead-interval 2
1517 # retransmit-interval 2
1518 # demand-circuit enable
1519 # hello-interval 1
1520 # transmit-delay 2
1521 # default-metric 10
1522 # area 11
1523 # default-cost 5
1524 # !
1525 # area 22
1526 # default-cost 6
1527 # !
1528 # !
1529
1530 - name: Override existing OSPFv2 configurations with provided config.
1531 cisco.iosxr.iosxr_ospfv2:
1532 config:
1533 processes:
1534 - process_id: 27
1535 areas:
1536 - area_id: 10
1537 hello_interval: 2
1538 authentication:
1539 keychain: ansi11393
1540 - area_id: 20
1541 cost: 2
1542 default_cost: 2
1543 authentication:
1544 keychain: ansi11393
1545 - process_id: 26
1546 adjacency_stagger:
1547 min_adjacency: 10
1548 max_adjacency: 20
1549 state: overridden
1550
1551
1552 #
1553 # Task Output:
1554 # ------------
1555 #
1556 # before:
1557 # processes:
1558 # - areas:
1559 # - area_id: '11'
1560 # cost: 11
1561 # default_cost: 5
1562 # - area_id: '22'
1563 # default_cost: 6
1564 # authentication:
1565 # keychain: ansible_test1102
1566 # process_id: '10'
1567 # - adjacency_stagger:
1568 # max_adjacency: 20
1569 # min_adjacency: 10
1570 # process_id: '26'
1571 # - areas:
1572 # - area_id: '10'
1573 # hello_interval: 2
1574 # - area_id: '20'
1575 # authentication:
1576 # keychain: ansi11393
1577 # cost: 2
1578 # default_cost: 2
1579 # process_id: '27'
1580 # - areas:
1581 # - area_id: '11'
1582 # default_cost: 5
1583 # - area_id: '22'
1584 # default_cost: 6
1585 # cost: 2
1586 # dead_interval: 2
1587 # default_metric: 10
1588 # demand_circuit: enable
1589 # external_out: disable
1590 # flood_reduction: disable
1591 # hello_interval: 1
1592 # mtu_ignore: enable
1593 # packet_size: 577
1594 # passive: disable
1595 # priority: 1
1596 # process_id: '30'
1597 # retransmit_interval: 2
1598 # router_id: 2.2.2.2
1599 # summary_in: enable
1600 # transmit_delay: 2
1601 # weight: 2
1602
1603 #
1604 # commands:
1605 # - router ospf 10
1606 # - no authentication keychain ansible_test1102
1607 # - no area 11 default-cost 5
1608 # - no area 11 cost 11
1609 # - no area 22 default-cost 6
1610 # - router ospf 30
1611 # - no cost 2
1612 # - no weight 2
1613 # - no passive disable
1614 # - no priority 1
1615 # - no flood-reduction disable
1616 # - no default-metric 10
1617 # - no router-id 2.2.2.2
1618 # - no demand-circuit enable
1619 # - no packet-size 577
1620 # - no transmit-delay 2
1621 # - no summary-in enable
1622 # - no external-out disable
1623 # - no dead-interval 2
1624 # - no hello-interval 1
1625 # - no retransmit-interval 2
1626 # - no mtu-ignore enable
1627 # - no area 11 default-cost 5
1628 # - no area 22 default-cost 6
1629 # - router ospf 27
1630 # - area 10 authentication keychain ansi11393
1631 #
1632 # after:
1633 # processes:
1634 # - process_id: '10'
1635 # - adjacency_stagger:
1636 # max_adjacency: 20
1637 # min_adjacency: 10
1638 # process_id: '26'
1639 # - areas:
1640 # - area_id: '10'
1641 # authentication:
1642 # keychain: ansi11393
1643 # hello_interval: 2
1644 # - area_id: '20'
1645 # authentication:
1646 # keychain: ansi11393
1647 # cost: 2
1648 # default_cost: 2
1649 # process_id: '27'
1650 # - process_id: '30'
1651 #
1652 # After state:
1653 # ------------
1654 #
1655 # RP/0/RP0/CPU0:anton#show running-config router ospf
1656 # Thu Jun 11 16:50:36.332 UTC
1657 # router ospf 10
1658 # area 11
1659 # !
1660 # area 22
1661 # !
1662 # !
1663 # router ospf 26
1664 # adjacency stagger 10 20
1665 # !
1666 # router ospf 27
1667 # area 10
1668 # authentication keychain ansi11393
1669 # hello-interval 2
1670 # !
1671 # area 20
1672 # cost 2
1673 # authentication keychain ansi11393
1674 # default-cost 2
1675 # !
1676 # !
1677 # router ospf 30
1678 # area 11
1679 # !
1680 # area 22
1681 # !
1682 # !
1683 #
1684
1685 # Using deleted
1686 #
1687 # Before state:
1688 # -------------
1689 #
1690 # RP/0/RP0/CPU0:anton#show running-config router ospf
1691 # Thu Jun 11 16:06:44.406 UTC
1692 # router ospf 10
1693 # authentication keychain ansible_test1102
1694 # area 11
1695 # cost 11
1696 # default-cost 5
1697 # !
1698 # area 22
1699 # default-cost 6
1700 # !
1701 # !
1702 # router ospf 26
1703 # adjacency stagger 10 20
1704 # !
1705 # router ospf 27
1706 # area 10
1707 # authentication keychain ansi11393
1708 # hello-interval 2
1709 # !
1710 # area 20
1711 # cost 2
1712 # authentication keychain ansi11393
1713 # default-cost 2
1714 # !
1715 # !
1716 # router ospf 30
1717 # router-id 2.2.2.2
1718 # summary-in enable
1719 # external-out disable
1720 # cost 2
1721 # packet-size 577
1722 # weight 2
1723 # passive disable
1724 # priority 1
1725 # mtu-ignore enable
1726 # flood-reduction disable
1727 # dead-interval 2
1728 # retransmit-interval 2
1729 # demand-circuit enable
1730 # hello-interval 1
1731 # transmit-delay 2
1732 # default-metric 10
1733 # area 11
1734 # default-cost 5
1735 # !
1736 # area 22
1737 # default-cost 6
1738 # !
1739 # !
1740
1741 - name: Deleted provided ospfv2 processes.
1742 cisco.iosxr.iosxr_ospfv2:
1743 config:
1744 processes:
1745 - process_id: '10'
1746 - process_id: '26'
1747 - process_id: '27'
1748 - process_id: '30'
1749 state: deleted
1750
1751
1752 #
1753 # Task Output:
1754 # ------------
1755 #
1756 # before:
1757 # processes:
1758 # - areas:
1759 # - area_id: '11'
1760 # cost: 11
1761 # default_cost: 5
1762 # - area_id: '22'
1763 # default_cost: 6
1764 # authentication:
1765 # keychain: ansible_test1102
1766 # process_id: '10'
1767 # - adjacency_stagger:
1768 # max_adjacency: 20
1769 # min_adjacency: 10
1770 # process_id: '26'
1771 # - areas:
1772 # - area_id: '10'
1773 # authentication:
1774 # keychain: ansi11393
1775 # hello_interval: 2
1776 # - area_id: '20'
1777 # authentication:
1778 # keychain: ansi11393
1779 # cost: 2
1780 # default_cost: 2
1781 # process_id: '27'
1782 # - areas:
1783 # - area_id: '11'
1784 # default_cost: 5
1785 # - area_id: '22'
1786 # default_cost: 6
1787 # cost: 2
1788 # dead_interval: 2
1789 # default_metric: 10
1790 # demand_circuit: enable
1791 # external_out: disable
1792 # flood_reduction: disable
1793 # hello_interval: 1
1794 # mtu_ignore: enable
1795 # packet_size: 577
1796 # passive: disable
1797 # priority: 1
1798 # process_id: '30'
1799 # retransmit_interval: 2
1800 # router_id: 2.2.2.2
1801 # summary_in: enable
1802 # transmit_delay: 2
1803 # weight: 2
1804 #
1805 # commands:
1806 # - router ospf 10
1807 # - no authentication keychain ansible_test1102
1808 # - no area 11 default-cost 5
1809 # - no area 11 cost 11
1810 # - no area 22 default-cost 6
1811 # - router ospf 26
1812 # - no adjacency stagger 10 20
1813 # - router ospf 27
1814 # - no area 10 authentication keychain ansi11393
1815 # - no area 10 hello-interval 2
1816 # - no area 20 authentication keychain ansi11393
1817 # - no area 20 default-cost 2
1818 # - no area 20 cost 2
1819 # - router ospf 30
1820 # - no cost 2
1821 # - no weight 2
1822 # - no passive disable
1823 # - no priority 1
1824 # - no flood-reduction disable
1825 # - no default-metric 10
1826 # - no router-id 2.2.2.2
1827 # - no demand-circuit enable
1828 # - no packet-size 577
1829 # - no transmit-delay 2
1830 # - no summary-in enable
1831 # - no external-out disable
1832 # - no dead-interval 2
1833 # - no hello-interval 1
1834 # - no retransmit-interval 2
1835 # - no mtu-ignore enable
1836 # - no area 11 default-cost 5
1837 # - no area 22 default-cost 6
1838 #
1839 # after:
1840 # processes:
1841 # - process_id: '10'
1842 # - process_id: '26'
1843 # - process_id: '27'
1844 # - process_id: '30'
1845
1846 # After state:
1847 # ------------
1848 #
1849 # RP/0/RP0/CPU0:anton(config)#show running-config router ospf
1850 # Thu Jun 11 17:07:34.218 UTC
1851 # router ospf 10
1852 # area 11
1853 # !
1854 # area 22
1855 # !
1856 # !
1857 # router ospf 26
1858 # !
1859 # router ospf 27
1860 # area 10
1861 # !
1862 # area 20
1863 # !
1864 # !
1865 # router ospf 30
1866 # area 11
1867 # !
1868 # area 22
1869 # !
1870 # !
1871
1872
1873 # Using parsed
1874 # parsed.cfg
1875 # ------------
1876 # Thu Jun 11 17:28:51.918 UTC
1877 # router ospf 10
1878 # authentication keychain ansible_test1102
1879 # area 11
1880 # cost 11
1881 # default-cost 5
1882 # !
1883 # area 22
1884 # default-cost 6
1885 # !
1886 # !
1887 # router ospf 26
1888 # authentication message-digest keychain ansible1101pass
1889 # adjacency stagger 10 20
1890 # !
1891 # router ospf 27
1892 # area 10
1893 # authentication keychain ansi11393
1894 # hello-interval 2
1895 # !
1896 # !
1897 # router ospf 30
1898 # router-id 2.2.2.2
1899 # summary-in enable
1900 # external-out disable
1901 # cost 2
1902 # packet-size 577
1903 # weight 2
1904 # passive disable
1905 # priority 1
1906 # mtu-ignore enable
1907 # flood-reduction disable
1908 # dead-interval 2
1909 # retransmit-interval 2
1910 # demand-circuit enable
1911 # hello-interval 1
1912 # transmit-delay 2
1913 # default-metric 10
1914 # area 11
1915 # default-cost 5
1916 # !
1917 # area 22
1918 # default-cost 6
1919 # !
1920 # !
1921 #
1922 - name: Parsed the device configuration to get output commands
1923 cisco.iosxr.iosxr_ospfv2:
1924 running_config: "{{ lookup('file', './parsed.cfg') }}"
1925 state: parsed
1926 #
1927 # Task Output:
1928 # ------------
1929 #
1930 # parsed:
1931 # processes:
1932 # - areas:
1933 # - area_id: '11'
1934 # cost: 11
1935 # default_cost: 5
1936 # - area_id: '22'
1937 # default_cost: 6
1938 # authentication:
1939 # keychain: ansible_test1102
1940 # process_id: '10'
1941 # - adjacency_stagger:
1942 # max_adjacency: 20
1943 # min_adjacency: 10
1944 # authentication:
1945 # message_digest:
1946 # keychain: ansible1101pass
1947 # process_id: '26'
1948 # - areas:
1949 # - area_id: '10'
1950 # authentication:
1951 # keychain: ansi11393
1952 # hello_interval: 2
1953 # process_id: '27'
1954 # - areas:
1955 # - area_id: '11'
1956 # default_cost: 5
1957 # - area_id: '22'
1958 # default_cost: 6
1959 # cost: 2
1960 # dead_interval: 2
1961 # default_metric: 10
1962 # demand_circuit: enable
1963 # external_out: disable
1964 # flood_reduction: disable
1965 # hello_interval: 1
1966 # mtu_ignore: enable
1967 # packet_size: 577
1968 # passive: disable
1969 # priority: 1
1970 # process_id: '30'
1971 # retransmit_interval: 2
1972 # router_id: 2.2.2.2
1973 # summary_in: enable
1974 # transmit_delay: 2
1975 # weight: 2
1976
1977 # Using rendered
1978 #
1979 - name: Render the commands for provided configuration
1980 cisco.iosxr.iosxr_ospfv2:
1981 config:
1982 processes:
1983 - process_id: 27
1984 areas:
1985 - area_id: 10
1986 hello_interval: 2
1987 authentication:
1988 keychain: ansi11393
1989 - process_id: 26
1990 adjacency_stagger:
1991 min_adjacency: 10
1992 max_adjacency: 20
1993 - process_id: 10
1994 authentication:
1995 keychain: ansible_test1102
1996 areas:
1997 - area_id: 11
1998 default_cost: 5
1999 cost: 11
2000 - area_id: 22
2001 default_cost: 6
2002 - process_id: 30
2003 areas:
2004 - area_id: 11
2005 default_cost: 5
2006 - area_id: 22
2007 default_cost: 6
2008 cost: 2
2009 default_metric: 10
2010 transmit_delay: 2
2011 hello_interval: 1
2012 dead_interval: 2
2013 retransmit_interval: 2
2014 weight: 2
2015 packet_size: 577
2016 priority: 1
2017 router_id: 2.2.2.2
2018 demand_circuit: enable
2019 passive: disable
2020 summary_in: enable
2021 flood_reduction: disable
2022 mtu_ignore: enable
2023 external_out: disable
2024 state: rendered
2025
2026
2027 #
2028 # Task Output:
2029 # ------------
2030 #
2031 # rendered:
2032 # - router ospf 27
2033 # - area 10 authentication keychain ansi11393
2034 # - area 10 hello-interval 2
2035 # - router ospf 26
2036 # - adjacency stagger 10 20
2037 # - router ospf 10
2038 # - authentication keychain ansible_test1102
2039 # - area 11 default-cost 5
2040 # - area 11 cost 11
2041 # - area 22 default-cost 6
2042 # - router ospf 30
2043 # - cost 2
2044 # - weight 2
2045 # - passive disable
2046 # - priority 1
2047 # - flood-reduction disable
2048 # - default-metric 10
2049 # - router-id 2.2.2.2
2050 # - demand-circuit enable
2051 # - packet-size 577
2052 # - transmit-delay 2
2053 # - summary-in enable
2054 # - external-out disable
2055 # - dead-interval 2
2056 # - hello-interval 1
2057 # - retransmit-interval 2
2058 # - mtu-ignore enable
2059 # - area 11 default-cost 5
2060 # - area 22 default-cost 6
2061
2062
2063 # Using gathered
2064 #
2065 # Before state:
2066 # -------------
2067 #
2068 # RP/0/RP0/CPU0:anton#show running-config router ospf
2069 # Thu Jun 11 16:06:44.406 UTC
2070 # router ospf 10
2071 # authentication keychain ansible_test1102
2072 # area 11
2073 # cost 11
2074 # default-cost 5
2075 # !
2076 # area 22
2077 # default-cost 6
2078 # !
2079 # !
2080 # router ospf 26
2081 # adjacency stagger 10 20
2082 # !
2083 # router ospf 27
2084 # area 10
2085 # authentication keychain ansi11393
2086 # hello-interval 2
2087 # !
2088 # area 20
2089 # !
2090 # !
2091 # router ospf 30
2092 # router-id 2.2.2.2
2093 # summary-in enable
2094 # external-out disable
2095 # cost 2
2096 # packet-size 577
2097 # weight 2
2098 # passive disable
2099 # priority 1
2100 # mtu-ignore enable
2101 # flood-reduction disable
2102 # dead-interval 2
2103 # retransmit-interval 2
2104 # demand-circuit enable
2105 # hello-interval 1
2106 # transmit-delay 2
2107 # default-metric 10
2108 # area 11
2109 # default-cost 5
2110 # !
2111 # area 22
2112 # default-cost 6
2113 # !
2114 # !
2115 #
2116 - name: Gather ospfv2 routes configuration
2117 cisco.iosxr.iosxr_ospfv2:
2118 state: gathered
2119 #
2120 #
2121 # Task Output:
2122 # ------------
2123 #
2124 # gathered:
2125 # processes:
2126 # - areas:
2127 # - area_id: '11'
2128 # cost: 11
2129 # default_cost: 5
2130 # - area_id: '22'
2131 # default_cost: 6
2132 # authentication:
2133 # keychain: ansible_test1102
2134 # process_id: '10'
2135 # - adjacency_stagger:
2136 # max_adjacency: 20
2137 # min_adjacency: 10
2138 # process_id: '26'
2139 # - areas:
2140 # - area_id: '10'
2141 # authentication:
2142 # keychain: ansi11393
2143 # hello_interval: 2
2144 # process_id: '27'
2145 # - areas:
2146 # - area_id: '11'
2147 # default_cost: 5
2148 # - area_id: '22'
2149 # default_cost: 6
2150 # cost: 2
2151 # dead_interval: 2
2152 # default_metric: 10
2153 # demand_circuit: enable
2154 # external_out: disable
2155 # flood_reduction: disable
2156 # hello_interval: 1
2157 # mtu_ignore: enable
2158 # packet_size: 577
2159 # passive: disable
2160 # priority: 1
2161 # process_id: '30'
2162 # retransmit_interval: 2
2163 # router_id: 2.2.2.2
2164 # summary_in: enable
2165 # transmit_delay: 2
2166 # weight: 2
2167 #
2168 # After state:
2169 # -------------
2170 #
2171 # RP/0/RP0/CPU0:anton#show running-config router ospf
2172 # Thu Jun 11 16:06:44.406 UTC
2173 # router ospf 10
2174 # authentication keychain ansible_test1102
2175 # area 11
2176 # cost 11
2177 # default-cost 5
2178 # !
2179 # area 22
2180 # default-cost 6
2181 # !
2182 # !
2183 # router ospf 26
2184 # authentication message-digest keychain ansible1101pass
2185 # adjacency stagger 10 20
2186 # !
2187 # router ospf 27
2188 # area 10
2189 # authentication keychain ansi11393
2190 # hello-interval 2
2191 # !
2192 # !
2193 # router ospf 30
2194 # router-id 2.2.2.2
2195 # summary-in enable
2196 # external-out disable
2197 # cost 2
2198 # packet-size 577
2199 # weight 2
2200 # passive disable
2201 # priority 1
2202 # mtu-ignore enable
2203 # flood-reduction disable
2204 # dead-interval 2
2205 # retransmit-interval 2
2206 # demand-circuit enable
2207 # hello-interval 1
2208 # transmit-delay 2
2209 # default-metric 10
2210 # area 11
2211 # default-cost 5
2212 # !
2213 # area 22
2214 # default-cost 6
2215 # !
2216 # !
2217 #
2218 """
2219 RETURN = """
2220 before:
2221 description: The configuration prior to the model invocation.
2222 returned: always
2223 type: dict
2224 sample: >
2225 The configuration returned will always be in the same format
2226 of the parameters above.
2227 after:
2228 description: The resulting configuration model invocation.
2229 returned: when changed
2230 type: dict
2231 sample: >
2232 The configuration returned will always be in the same format
2233 of the parameters above.
2234 commands:
2235 description: The set of commands pushed to the remote device.
2236 returned: always
2237 type: list
2238 sample:
2239 - "router ospf 30"
2240 - "authentication message-digest keychain 'ansible1101pass'"
2241 rendered:
2242 description: The provided configuration in the task rendered in device-native format (offline).
2243 returned: when I(state) is C(rendered)
2244 type: list
2245 sample:
2246 - router ospf 27
2247 - area 10 authentication keychain ansi11393
2248 gathered:
2249 description: Facts about the network resource gathered from the remote device as structured data.
2250 returned: when I(state) is C(gathered)
2251 type: dict
2252 sample: >
2253 This output will always be in the same format as the
2254 module argspec.
2255 parsed:
2256 description: The device native config provided in I(running_config) option parsed into structured data as per module argspec.
2257 returned: when I(state) is C(parsed)
2258 type: dict
2259 sample: >
2260 This output will always be in the same format as the
2261 module argspec.
2262 """
2263
2264
2265 from ansible.module_utils.basic import AnsibleModule
2266
2267 from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.ospfv2.ospfv2 import (
2268 Ospfv2Args,
2269 )
2270 from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.config.ospfv2.ospfv2 import (
2271 Ospfv2,
2272 )
2273
2274
2275 def main():
2276 """
2277 Main entry point for module execution
2278
2279 :returns: the result form module invocation
2280 """
2281 required_if = [
2282 ("state", "merged", ("config",)),
2283 ("state", "replaced", ("config",)),
2284 ("state", "overridden", ("config",)),
2285 ("state", "rendered", ("config",)),
2286 ("state", "parsed", ("running_config",)),
2287 ]
2288 mutually_exclusive = [("config", "running_config")]
2289 module = AnsibleModule(
2290 argument_spec=Ospfv2Args.argument_spec,
2291 required_if=required_if,
2292 supports_check_mode=True,
2293 mutually_exclusive=mutually_exclusive,
2294 )
2295 result = Ospfv2(module).execute_module()
2296 module.exit_json(**result)
2297
2298
2299 if __name__ == "__main__":
2300 main()