Debian Codegraph @

ansible_collections/cisco/ios/plugins/modules/ios_route_maps.py

raw
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 cisco.ios_route_maps
9 """
10
11 from __future__ import absolute_import, division, print_function
12
13
14 __metaclass__ = type
15
16 DOCUMENTATION = """
17 module: ios_route_maps
18 short_description: Resource module to configure route maps.
19 description:
20 - This module configures and manages the attributes of Route maps on Cisco IOS.
21 version_added: 2.1.0
22 author: Sumit Jaiswal (@justjais)
23 notes:
24 - Tested against Cisco IOSXE Version 17.3 on CML.
25 - This module works with connection C(network_cli).
26 See U(https://docs.ansible.com/ansible/latest/network/user_guide/platform_ios.html)
27 options:
28 config:
29 description: A list of configurations for Route maps.
30 type: list
31 elements: dict
32 suboptions:
33 route_map:
34 description: Route map tag/name
35 type: str
36 entries:
37 description: A list of configurations entries for Route maps.
38 type: list
39 elements: dict
40 suboptions:
41 sequence:
42 description:
43 - Sequence to insert to/delete from existing route-map entry
44 - Please refer vendor documentation for valid values
45 type: int
46 action:
47 description: Route map set operations
48 type: str
49 choices: ["deny", "permit"]
50 continue_entry:
51 description: Continue on a different entry within the route-map
52 type: dict
53 suboptions:
54 set:
55 description: Set continue
56 type: bool
57 entry_sequence:
58 description:
59 - Route-map entry sequence number
60 - Please refer vendor documentation for valid values
61 type: int
62 description:
63 description: Route-map comment
64 type: str
65 match:
66 description: Match values from routing table
67 type: dict
68 suboptions:
69 additional_paths:
70 description:
71 - BGP Add-Path match policie
72 - BGP Add-Path advertise-set policy
73 type: dict
74 suboptions:
75 all:
76 description: BGP Add-Path advertise all paths
77 type: bool
78 best:
79 description: BGP Add-Path advertise best n paths (1-3)
80 type: int
81 best_range:
82 description: BGP Add-Path advertise best paths (range m to n)
83 type: dict
84 suboptions:
85 lower_limit:
86 description: BGP Add-Path best paths to advertise (lower limit) (1-3)
87 type: int
88 upper_limit:
89 description: BGP Add-Path best paths to advertise (upper limit) (1-3)
90 type: int
91 group_best:
92 description: BGP Add-Path advertise group-best path
93 type: bool
94 as_path:
95 description: Match BGP AS path list
96 type: dict
97 suboptions:
98 set:
99 description: Set AS path list
100 type: bool
101 acls:
102 description:
103 - AS path access-list
104 - Please refer vendor documentation for valid values
105 type: list
106 elements: int
107 clns:
108 description: CLNS information
109 type: dict
110 suboptions:
111 address:
112 description: Match address of route or match packet
113 type: str
114 next_hop:
115 description: Match next-hop address of route
116 type: str
117 route_source:
118 description: Match advertising source address of route
119 type: str
120 community:
121 description: Match BGP community list
122 type: dict
123 suboptions:
124 name:
125 description:
126 - Community-list number/Community-list name
127 - Please refer vendor documentation for valid values
128 type: list
129 elements: str
130 exact_match:
131 description: Do exact matching of communities
132 type: bool
133 extcommunity:
134 description:
135 - Match BGP/VPN extended community list
136 - Extended community-list number
137 - Please refer vendor documentation for valid values
138 type: list
139 elements: str
140 interfaces:
141 description: Match first hop interface of route
142 type: list
143 elements: str
144 ip:
145 description: IP specific information
146 type: dict
147 suboptions:
148 address:
149 description: Match address of route or match packet
150 type: dict
151 suboptions:
152 acls: &acls
153 description:
154 - Match entries of acl
155 - IP acl name/number
156 - Please refer vendor documentation for valid values
157 type: list
158 elements: str
159 prefix_lists: &prefix_lists
160 description:
161 - Match entries of prefix-lists
162 - IP prefix-list name
163 type: list
164 elements: str
165 flowspec:
166 description: Match src/dest prefix component of flowspec prefix
167 type: dict
168 suboptions:
169 dest_pfx:
170 description: Match dest prefix component of flowspec prefix
171 type: bool
172 src_pfx:
173 description: Match source prefix component of flowspec prefix
174 type: bool
175 acls: *acls
176 prefix_lists: *prefix_lists
177 next_hop:
178 description: Match next-hop address of route
179 type: dict
180 suboptions:
181 set:
182 description: Set next-hop address
183 type: bool
184 acls: *acls
185 prefix_lists: *prefix_lists
186 redistribution_source:
187 description: route redistribution source (EIGRP only)
188 type: dict
189 suboptions:
190 set:
191 description: Set redistribution-source
192 type: bool
193 acls: *acls
194 prefix_lists: *prefix_lists
195 route_source:
196 description: Match advertising source address of route
197 type: dict
198 suboptions:
199 set:
200 description: Set redistribution-source
201 type: bool
202 redistribution_source:
203 description: route redistribution source (EIGRP only)
204 type: bool
205 acls: *acls
206 prefix_lists: *prefix_lists
207 ipv6:
208 description: IPv6 specific information
209 type: dict
210 suboptions:
211 address:
212 type: dict
213 description: Match address of route or match packet
214 suboptions:
215 acl:
216 description: IPv6 access-list name
217 type: str
218 prefix_list:
219 description: IPv6 prefix-list name
220 type: str
221 flowspec:
222 description: Match next-hop address of route
223 type: dict
224 suboptions:
225 dest_pfx:
226 description: Match dest prefix component of flowspec prefix
227 type: bool
228 src_pfx:
229 description: Match source prefix component of flowspec prefix
230 type: bool
231 acl:
232 description: IPv6 access-list name
233 type: str
234 prefix_list:
235 description: IPv6 prefix-list name
236 type: str
237 next_hop:
238 description: Match next-hop address of route
239 type: dict
240 suboptions:
241 acl:
242 description: IPv6 access-list name
243 type: str
244 prefix_list:
245 description: IPv6 prefix-list name
246 type: str
247 route_source:
248 description: Match advertising source address of route
249 type: dict
250 suboptions:
251 acl:
252 description: IPv6 access-list name
253 type: str
254 prefix_list:
255 description: IPv6 prefix-list name
256 type: str
257 length:
258 description: Packet length
259 type: dict
260 suboptions:
261 minimum:
262 description:
263 - Minimum packet length
264 - Please refer vendor documentation for valid values
265 type: int
266 maximum:
267 description:
268 - Maximum packet length
269 - Please refer vendor documentation for valid values
270 type: int
271 local_preference:
272 description: Local preference for route
273 type: dict
274 suboptions:
275 set:
276 description: Set the Local preference for route
277 type: bool
278 value:
279 description:
280 - Local preference value
281 - Please refer vendor documentation for valid values
282 type: list
283 elements: str
284 mdt_group:
285 description: Match routes corresponding to MDT group
286 type: dict
287 suboptions:
288 set:
289 description: Set and Match routes corresponding to MDT group
290 type: bool
291 acls:
292 description:
293 - IP access-list number/IP standard access-list name
294 - Please refer vendor documentation for valid values
295 type: list
296 elements: str
297 metric:
298 description: Match metric of route
299 type: dict
300 suboptions:
301 value:
302 description:
303 - Metric value
304 - Please refer vendor documentation for valid values
305 type: int
306 external:
307 description: Match route using external protocol metric
308 type: bool
309 deviation:
310 description: Deviation option to match metric in a range
311 type: bool
312 deviation_value:
313 description:
314 - deviation value, 500 +- 10 creates the range 490 - 510
315 - Please refer vendor documentation for valid values
316 type: int
317 mpls_label:
318 description: Match routes which have MPLS labels
319 type: bool
320 policy_lists:
321 description: Match IP policy list
322 type: list
323 elements: str
324 route_type:
325 description: Match route-type of route
326 type: dict
327 suboptions:
328 external:
329 description: external route (BGP, EIGRP and OSPF type 1/2)
330 type: dict
331 suboptions:
332 set:
333 description: Set external route
334 type: bool
335 type_1:
336 description: OSPF external type 1 route
337 type: bool
338 type_2:
339 description: OSPF external type 2 route
340 type: bool
341 internal:
342 description: internal route (including OSPF intra/inter area)
343 type: bool
344 level_1:
345 description: IS-IS level-1 route
346 type: bool
347 level_2:
348 description: IS-IS level-2 route
349 type: bool
350 local:
351 description: locally generated route
352 type: bool
353 nssa_external:
354 description: nssa-external route (OSPF type 1/2)
355 type: dict
356 suboptions:
357 set:
358 description: Set nssa-external route
359 type: bool
360 type_1:
361 description: OSPF external type 1 route
362 type: bool
363 type_2:
364 description: OSPF external type 2 route
365 type: bool
366 rpki:
367 description: Match RPKI state of route
368 type: dict
369 suboptions:
370 invalid:
371 description: RPKI Invalid State
372 type: bool
373 not_found:
374 description: RPKI Not Found State
375 type: bool
376 valid:
377 description: RPKI Valid State
378 type: bool
379 security_group:
380 description: Security Group
381 type: dict
382 suboptions:
383 source:
384 description:
385 - Source Security Group, source Security tag
386 - Please refer vendor documentation for valid values
387 type: list
388 elements: int
389 destination:
390 description:
391 - Destination Security Group, destination Security tag
392 - Please refer vendor documentation for valid values
393 type: list
394 elements: int
395 source_protocol:
396 description: Match source-protocol of route
397 type: dict
398 suboptions:
399 bgp:
400 description:
401 - Border Gateway Protocol (BGP)
402 - Autonomous system number
403 - Please refer vendor documentation for valid values
404 type: str
405 connected:
406 description: Connected
407 type: bool
408 eigrp:
409 description:
410 - Enhanced Interior Gateway Routing Protocol (EIGRP)
411 - Autonomous system number
412 - Please refer vendor documentation for valid values
413 type: int
414 isis:
415 description: ISO IS-IS
416 type: bool
417 lisp:
418 description: Locator ID Separation Protocol (LISP)
419 type: bool
420 mobile:
421 description: Mobile routes
422 type: bool
423 ospf:
424 description:
425 - Open Shortest Path First (OSPF) Process ID
426 - Please refer vendor documentation for valid values
427 type: int
428 ospfv3:
429 description:
430 - OSPFv3 Process ID
431 - Please refer vendor documentation for valid values
432 type: int
433 rip:
434 description: Routing Information Protocol (RIP)
435 type: bool
436 static:
437 description: Static routes
438 type: bool
439 tag:
440 description: Match tag of route
441 type: dict
442 suboptions:
443 value:
444 description: Tag value/Tag in Dotted Decimal eg, 10.10.10.10
445 type: list
446 elements: str
447 tag_list:
448 description: Route Tag List/Tag list name
449 type: list
450 elements: str
451 track:
452 description: tracking object
453 type: int
454 set:
455 description: Match source-protocol of route
456 type: dict
457 suboptions:
458 aigp_metric:
459 description: accumulated metric value
460 type: dict
461 suboptions:
462 value:
463 description: manual value
464 type: int
465 igp_metric:
466 description: metric value from rib
467 type: bool
468 as_path:
469 description: Prepend string for a BGP AS-path attribute
470 type: dict
471 suboptions:
472 prepend:
473 description: Prepend to the as-path
474 type: dict
475 suboptions:
476 as_number:
477 description:
478 - AS number
479 - Please refer vendor documentation for valid values
480 type: list
481 elements: str
482 last_as:
483 description:
484 - Prepend last AS to the as-path
485 - Number of last-AS prepends
486 - Please refer vendor documentation for valid values
487 type: int
488 tag:
489 description: Set the tag as an AS-path attribute
490 type: bool
491 automatic_tag:
492 description: Automatically compute TAG value
493 type: bool
494 clns:
495 description:
496 - OSI summary address
497 - Next hop address
498 - CLNS summary prefix
499 type: str
500 comm_list:
501 description:
502 - set BGP community list (for deletion)
503 - Community-list name/number
504 - Delete matching communities
505 type: str
506 community:
507 description: BGP community attribute
508 type: dict
509 suboptions:
510 number:
511 description:
512 - community number
513 - community number in aa:nn format
514 - Please refer vendor documentation for valid values
515 type: str
516 additive:
517 description: Add to the existing community
518 type: bool
519 gshut:
520 description: Graceful Shutdown (well-known community)
521 type: bool
522 internet:
523 description: Internet (well-known community)
524 type: bool
525 local_as:
526 description: Do not send outside local AS (well-known community)
527 type: bool
528 no_advertise:
529 description: Do not advertise to any peer (well-known community)
530 type: bool
531 no_export:
532 description: Do not export to next AS (well-known community)
533 type: bool
534 none:
535 description: No community attribute
536 type: bool
537 dampening:
538 description: Set BGP route flap dampening parameters
539 type: dict
540 suboptions:
541 penalty_half_time:
542 description:
543 - half-life time for the penalty
544 - Please refer vendor documentation for valid values
545 type: int
546 reuse_route_val:
547 description:
548 - Penalty to start reusing a route
549 - Please refer vendor documentation for valid values
550 type: int
551 suppress_route_val:
552 description:
553 - Penalty to start suppressing a route
554 - Please refer vendor documentation for valid values
555 type: int
556 max_suppress:
557 description:
558 - Maximum duration to suppress a stable route
559 - Please refer vendor documentation for valid values
560 type: int
561 default:
562 description:
563 - Set default information
564 - Default output interface
565 type: str
566 extcomm_list:
567 description:
568 - Set BGP/VPN extended community list (for deletion)
569 - Extended community-list number/name
570 - Delete matching extended communities
571 type: str
572 extcommunity:
573 description: BGP extended community attribute
574 type: dict
575 suboptions:
576 cost:
577 description: Cost extended community
578 type: dict
579 suboptions:
580 id:
581 description:
582 - Community ID
583 - Please refer vendor documentation for valid values
584 type: str
585 cost_value:
586 description:
587 - Cost Value (No-preference Cost = 2147483647)
588 - Please refer vendor documentation for valid values
589 type: int
590 igp:
591 description: Compare following IGP cost comparison
592 type: bool
593 pre_bestpath:
594 description: Compare before all other steps in bestpath calculation
595 type: bool
596 rt:
597 description: Route Target extended community
598 type: dict
599 suboptions:
600 address:
601 description: VPN extended community
602 type: str
603 range:
604 description: Specify a range of extended community
605 type: dict
606 suboptions:
607 lower_limit:
608 description: VPN extended community
609 type: str
610 upper_limit:
611 description: VPN extended community
612 type: str
613 additive:
614 description: Add to the existing extcommunity
615 type: bool
616 soo:
617 description: Site-of-Origin extended community
618 type: str
619 vpn_distinguisher:
620 description: VPN Distinguisher
621 type: dict
622 suboptions:
623 address:
624 description: VPN extended community
625 type: str
626 range:
627 description: Specify a range of extended community
628 type: dict
629 suboptions:
630 lower_limit:
631 description: VPN extended community
632 type: str
633 upper_limit:
634 description: VPN extended community
635 type: str
636 additive:
637 description: Add to the existing extcommunity
638 type: bool
639 global_route:
640 description: Set to global routing table
641 type: bool
642 interfaces:
643 description: Output interface
644 type: list
645 elements: str
646 ip:
647 description: IP specific information
648 type: dict
649 suboptions:
650 address:
651 description:
652 - Specify IP address
653 - Prefix-list name to set ip address
654 type: str
655 df:
656 description: Set DF bit
657 choices: [0, 1]
658 type: int
659 global_route:
660 description: global routing table
661 type: dict
662 suboptions:
663 address:
664 description: IP address of next hop
665 type: str
666 verify_availability:
667 description: Verify if nexthop is reachable
668 type: dict
669 suboptions:
670 address:
671 description: IP address of next hop
672 type: str
673 sequence:
674 description:
675 - Sequence to insert into next-hop list
676 - Please refer vendor documentation for valid values
677 type: int
678 track:
679 description:
680 - Set the next hop depending on the state of a tracked object
681 - tracked object number
682 - Please refer vendor documentation for valid values
683 type: int
684 next_hop:
685 description: Next hop address
686 type: dict
687 suboptions:
688 address:
689 description: IP address of next hop
690 type: str
691 dynamic:
692 description:
693 - application dynamically sets next hop
694 - DHCP learned next hop
695 type: bool
696 encapsulate:
697 description:
698 - Encapsulation profile for VPN nexthop
699 - L3VPN
700 - Encapsulation profile name
701 type: str
702 peer_address:
703 description: Use peer address (for BGP only)
704 type: bool
705 recursive:
706 description: Recursive next-hop
707 type: dict
708 suboptions:
709 global_route:
710 description: global routing table
711 type: bool
712 vrf:
713 description: VRF
714 type: str
715 address:
716 description: IP address of recursive next hop
717 type: str
718 self:
719 description: Use self address (for BGP only)
720 type: bool
721 verify_availability:
722 description: Verify if nexthop is reachable
723 type: dict
724 suboptions:
725 set:
726 description: Set and Verify if nexthop is reachable
727 type: bool
728 address:
729 description: IP address of next hop
730 type: str
731 sequence:
732 description:
733 - Sequence to insert into next-hop list
734 - Please refer vendor documentation for valid values
735 type: int
736 track:
737 description:
738 - Set the next hop depending on the state of a tracked object
739 - tracked object number
740 - Please refer vendor documentation for valid values
741 type: int
742 precedence:
743 description: Set precedence field
744 type: dict
745 suboptions:
746 set:
747 description: Just set precedence field
748 type: bool
749 critical:
750 description: Set critical precedence (5)
751 type: bool
752 flash:
753 description: Set flash precedence (3)
754 type: bool
755 flash_override:
756 description: Set flash override precedence (4)
757 type: bool
758 immediate:
759 description: Set immediate precedence (2)
760 type: bool
761 internet:
762 description: Set internetwork control precedence (6)
763 type: bool
764 network:
765 description: Set network control precedence (7)
766 type: bool
767 priority:
768 description: Set priority precedence (1)
769 type: bool
770 routine:
771 description: Set routine precedence (0)
772 type: bool
773 qos_group:
774 description:
775 - Set QOS Group ID
776 - Please refer vendor documentation for valid values
777 type: int
778 tos:
779 description: Set type of service field
780 type: dict
781 suboptions:
782 set:
783 description: Just set type of service field
784 type: bool
785 max_reliability:
786 description: Set max reliable TOS (2)
787 type: bool
788 max_throughput:
789 description: Set max throughput TOS (4)
790 type: bool
791 min_delay:
792 description: Set min delay TOS (8)
793 type: bool
794 min_monetary_cost:
795 description: Set min monetary cost TOS (1)
796 type: bool
797 normal:
798 description: Set normal TOS (0)
799 type: bool
800 vrf:
801 description: VRF
802 type: dict
803 suboptions:
804 name:
805 description: VRF name
806 type: str
807 address:
808 description: IP address of next hop
809 type: str
810 verify_availability:
811 description: Verify if nexthop is reachable
812 type: dict
813 suboptions:
814 set:
815 description: Set and Verify if nexthop is reachable
816 type: bool
817 address:
818 description: IP address of next hop
819 type: str
820 sequence:
821 description:
822 - Sequence to insert into next-hop list
823 - Please refer vendor documentation for valid values
824 type: int
825 track:
826 description:
827 - Set the next hop depending on the state of a tracked object
828 - tracked object number
829 - Please refer vendor documentation for valid values
830 type: int
831 ipv6:
832 description: IPv6 specific information
833 type: dict
834 suboptions:
835 address:
836 description:
837 - IPv6 address
838 - IPv6 prefix-list
839 type: str
840 default:
841 description: Set default information
842 type: bool
843 global_route:
844 description: global routing table
845 type: dict
846 suboptions:
847 address:
848 description: Next hop address (X:X:X:X::X)
849 type: str
850 verify_availability:
851 description: Verify if nexthop is reachable
852 type: dict
853 suboptions:
854 address:
855 description: Next hop address (X:X:X:X::X)
856 type: str
857 sequence:
858 description:
859 - Sequence to insert into next-hop list
860 - Please refer vendor documentation for valid values
861 type: int
862 track:
863 description:
864 - Set the next hop depending on the state of a tracked object
865 - tracked object number
866 - Please refer vendor documentation for valid values
867 type: int
868 next_hop:
869 description: IPv6 Next hop
870 type: dict
871 suboptions:
872 address:
873 description: Next hop address (X:X:X:X::X)
874 type: str
875 encapsulate:
876 description:
877 - Encapsulation profile for VPN nexthop
878 - L3VPN
879 - Encapsulation profile name
880 type: str
881 peer_address:
882 description: Use peer address (for BGP only)
883 type: bool
884 recursive:
885 description:
886 - Recursive next-hop
887 - IPv6 address of recursive next-hop
888 type: str
889 precedence:
890 description:
891 - Set precedence field
892 - Precedence value
893 - Please refer vendor documentation for valid values
894 type: int
895 vrf:
896 description: VRF name
897 type: dict
898 suboptions:
899 name:
900 description: VRF name
901 type: str
902 verify_availability:
903 description: Verify if nexthop is reachable
904 type: dict
905 suboptions:
906 address:
907 description: IPv6 address of next hop
908 type: str
909 sequence:
910 description:
911 - Sequence to insert into next-hop list
912 - Please refer vendor documentation for valid values
913 type: int
914 track:
915 description:
916 - Set the next hop depending on the state of a tracked object
917 - tracked object number
918 - Please refer vendor documentation for valid values
919 type: int
920 level:
921 description: Where to import route
922 type: dict
923 suboptions:
924 level_1:
925 description: Import into a level-1 area
926 type: bool
927 level_1_2:
928 description: Import into level-1 and level-2
929 type: bool
930 level_2:
931 description: Import into level-2 sub-domain
932 type: bool
933 nssa_only:
934 description: Import only into OSPF NSSA areas and don't propagate
935 type: bool
936 lisp:
937 description:
938 - Locator ID Separation Protocol specific information
939 - Specify a locator-set to use in LISP route-import
940 - The name of the locator set
941 type: str
942 local_preference:
943 description:
944 - BGP local preference path attribute
945 - Please refer vendor documentation for valid values
946 type: int
947 metric:
948 description: Metric value for destination routing protocol
949 type: dict
950 suboptions:
951 deviation:
952 description: Add or subtract metric
953 choices: ["plus", "minus"]
954 type: str
955 metric_value:
956 description:
957 - Metric value or Bandwidth in Kbits per second
958 - Please refer vendor documentation for valid values
959 type: int
960 eigrp_delay:
961 description:
962 - EIGRP delay metric, in 10 microsecond units
963 - Please refer vendor documentation for valid values
964 type: int
965 metric_reliability:
966 description:
967 - EIGRP reliability metric where 255 is 100 reliable
968 - Please refer vendor documentation for valid values
969 type: int
970 metric_bandwidth:
971 description:
972 - EIGRP Effective bandwidth metric (Loading) where 255 is 100 loaded
973 - Please refer vendor documentation for valid values
974 type: int
975 mtu:
976 description:
977 - EIGRP MTU of the path
978 - Please refer vendor documentation for valid values
979 type: int
980 metric_type:
981 description: Type of metric for destination routing protocol
982 type: dict
983 suboptions:
984 external:
985 description: IS-IS external metric
986 type: bool
987 internal:
988 description: IS-IS internal metric or Use IGP metric as the MED for BGP
989 type: bool
990 type_1:
991 description: OSPF external type 1 metric
992 type: bool
993 type_2:
994 description: OSPF external type 2 metric
995 type: bool
996 mpls_label:
997 description: Set MPLS label for prefix
998 type: bool
999 origin:
1000 description: BGP origin code
1001 type: dict
1002 suboptions:
1003 igp:
1004 description: local IGP
1005 type: bool
1006 incomplete:
1007 description: unknown heritage
1008 type: bool
1009 tag:
1010 description:
1011 - Tag value for destination routing protocol
1012 - Tag value A.B.C.D(dotted decimal format)/Tag value
1013 type: str
1014 traffic_index:
1015 description:
1016 - BGP traffic classification number for accounting
1017 - Please refer vendor documentation for valid values
1018 type: int
1019 vrf:
1020 description:
1021 - Define VRF name
1022 - VPN Routing/Forwarding instance name
1023 type: str
1024 weight:
1025 description:
1026 - BGP weight for routing table
1027 - Please refer vendor documentation for valid values
1028 type: int
1029 running_config:
1030 description:
1031 - This option is used only with state I(parsed).
1032 - The value of this option should be the output received from the IOS
1033 device by executing the command B(sh running-config | section ^route-map).
1034 - The state I(parsed) reads the configuration from C(running_config)
1035 option and transforms it into Ansible structured data as per the
1036 resource module's argspec and the value is then returned in the
1037 I(parsed) key within the result.
1038 type: str
1039 state:
1040 choices:
1041 - merged
1042 - replaced
1043 - overridden
1044 - deleted
1045 - gathered
1046 - parsed
1047 - rendered
1048 default: merged
1049 description:
1050 - The state the configuration should be left in
1051 - The states I(rendered), I(gathered) and I(parsed) does not perform any change
1052 on the device.
1053 - The state I(rendered) will transform the configuration in C(config) option to
1054 platform specific CLI commands which will be returned in the I(rendered) key
1055 within the result. For state I(rendered) active connection to remote host is
1056 not required.
1057 - The state I(gathered) will fetch the running configuration from device and transform
1058 it into structured data in the format as per the resource module argspec and
1059 the value is returned in the I(gathered) key within the result.
1060 - The state I(parsed) reads the configuration from C(running_config) option and
1061 transforms it into JSON format as per the resource module parameters and the
1062 value is returned in the I(parsed) key within the result. The value of C(running_config)
1063 option should be the same format as the output of command I(sh running-config
1064 | section ^route-map) executed on device. For state I(parsed) active
1065 connection to remote host is not required.
1066 type: str
1067 """
1068
1069 EXAMPLES = """
1070 # Using deleted
1071
1072 # Before state:
1073 # -------------
1074 #
1075 # router-ios#sh running-config | section ^route-map
1076 # route-map test_1 deny 10
1077 # description this is test route
1078 # match ip next-hop prefix-list test_2_new test_1_new
1079 # match ip route-source 10
1080 # match security-group source tag 10 20
1081 # match local-preference 100 50
1082 # match mpls-label
1083 # route-map test_1 deny 20
1084 # match track 105
1085 # match tag list test_match_tag
1086 # match route-type level-1
1087 # match additional-paths advertise-set all group-best
1088 # match as-path 200 100
1089 # match ipv6 address test_acl_20
1090 # continue 100
1091 # route-map test_2 deny 10
1092 # match security-group source tag 10 20
1093 # match local-preference 55 105
1094 # match mpls-label
1095 # match ipv6 address test_ip_acl
1096 # match ipv6 next-hop prefix-list test_new
1097 # match ipv6 route-source route_src_acl
1098 # set automatic-tag
1099 # set ip precedence critical
1100 # set ip address prefix-list 192.0.2.1
1101 # set aigp-metric 100
1102 # set extcommunity cost pre-bestpath 10 100
1103 # set ip df 1
1104 # set ip next-hop verify-availability 198.51.111.1 100 track 10
1105 # set ip next-hop recursive global 198.51.110.1
1106
1107 - name: Delete provided Route maps config
1108 cisco.ios.ios_route_maps:
1109 config:
1110 - route_map: test_1
1111 state: deleted
1112
1113 # Commands Fired:
1114 # ---------------
1115 #
1116 # "commands": [
1117 # "no route-map test_1"
1118 # ]
1119
1120 # After state:
1121 # -------------
1122 # router-ios#sh running-config | section ^route-map
1123 # route-map test_2 deny 10
1124 # match security-group source tag 10 20
1125 # match local-preference 55 105
1126 # match mpls-label
1127 # match ipv6 address test_ip_acl
1128 # match ipv6 next-hop prefix-list test_new
1129 # match ipv6 route-source route_src_acl
1130 # set automatic-tag
1131 # set ip precedence critical
1132 # set ip address prefix-list 192.0.2.1
1133 # set aigp-metric 100
1134 # set extcommunity cost pre-bestpath 10 100
1135 # set ip df 1
1136 # set ip next-hop verify-availability 198.51.111.1 100 track 10
1137 # set ip next-hop recursive global 198.51.110.1
1138
1139 # Using deleted without any config passed (NOTE: This will delete all Route maps configuration from device)
1140
1141 # Before state:
1142 # -------------
1143 #
1144 # router-ios#sh running-config | section ^route-map
1145 # route-map test_1 deny 10
1146 # description this is test route
1147 # match ip next-hop prefix-list test_2_new test_1_new
1148 # match ip route-source 10
1149 # match security-group source tag 10 20
1150 # match local-preference 100 50
1151 # match mpls-label
1152 # route-map test_1 deny 20
1153 # match track 105
1154 # match tag list test_match_tag
1155 # match route-type level-1
1156 # match additional-paths advertise-set all group-best
1157 # match as-path 200 100
1158 # match ipv6 address test_acl_20
1159 # continue 100
1160 # route-map test_2 deny 10
1161 # match security-group source tag 10 20
1162 # match local-preference 55 105
1163 # match mpls-label
1164 # match ipv6 address test_ip_acl
1165 # match ipv6 next-hop prefix-list test_new
1166 # match ipv6 route-source route_src_acl
1167 # set automatic-tag
1168 # set ip precedence critical
1169 # set ip address prefix-list 192.0.2.1
1170 # set aigp-metric 100
1171 # set extcommunity cost pre-bestpath 10 100
1172 # set ip df 1
1173 # set ip next-hop verify-availability 198.51.111.1 100 track 10
1174 # set ip next-hop recursive global 198.51.110.1
1175
1176 - name: Delete all Route maps config
1177 cisco.ios.ios_route_maps:
1178 state: deleted
1179
1180 # Commands Fired:
1181 # ---------------
1182 #
1183 # "commands": [
1184 # "no route-map test_1",
1185 # "no route-map test_2"
1186 # ]
1187
1188 # After state:
1189 # -------------
1190 # router-ios#sh running-config | section ^route-map
1191 # router-ios#
1192
1193 # Using merged
1194
1195 # Before state:
1196 # -------------
1197 #
1198 # router-ios#sh running-config | section ^route-map
1199 # router-ios#
1200
1201 - name: Merge provided Route maps configuration
1202 cisco.ios.ios_route_maps:
1203 config:
1204 - route_map: test_1
1205 entries:
1206 - sequence: 10
1207 action: deny
1208 description: this is test route
1209 match:
1210 ip:
1211 next_hop:
1212 prefix_lists:
1213 - test_1_new
1214 - test_2_new
1215 route_source:
1216 acls:
1217 - 10
1218 security_group:
1219 source:
1220 - 10
1221 - 20
1222 local_preference:
1223 value:
1224 - 50
1225 - 100
1226 mpls_label: true
1227 - sequence: 20
1228 action: deny
1229 continue_entry:
1230 entry_sequence: 100
1231 match:
1232 additional_paths:
1233 all: true
1234 group_best: true
1235 as_path:
1236 acls:
1237 - 100
1238 - 200
1239 ipv6:
1240 address:
1241 acl: test_acl_20
1242 route_type:
1243 level_1: true
1244 tag:
1245 tag_list:
1246 - test_match_tag
1247 track: 105
1248 - route_map: test_2
1249 entries:
1250 - sequence: 10
1251 action: deny
1252 match:
1253 ipv6:
1254 address:
1255 acl: test_ip_acl
1256 next_hop:
1257 prefix_list: test_new
1258 route_source:
1259 acl: route_src_acl
1260 security_group:
1261 source:
1262 - 10
1263 - 20
1264 local_preference:
1265 value:
1266 - 55
1267 - 105
1268 mpls_label: true
1269 set:
1270 aigp_metric:
1271 value: 100
1272 automatic_tag: true
1273 extcommunity:
1274 cost:
1275 id: 10
1276 cost_value: 100
1277 pre_bestpath: true
1278 ip:
1279 address: 192.0.2.1
1280 df: 1
1281 next_hop:
1282 recursive:
1283 global_route: true
1284 address: 198.51.110.1
1285 verify_availability:
1286 address: 198.51.111.1
1287 sequence: 100
1288 track: 10
1289 precedence:
1290 critical: true
1291 state: merged
1292
1293 # Commands Fired:
1294 # ---------------
1295 #
1296 # "commands": [
1297 # "route-map test_2 deny 10",
1298 # "match security-group source tag 10 20",
1299 # "match local-preference 55 105",
1300 # "match mpls-label",
1301 # "match ipv6 next-hop prefix-list test_new",
1302 # "match ipv6 route-source route_src_acl",
1303 # "match ipv6 address test_ip_acl",
1304 # "set extcommunity cost pre-bestpath 10 100",
1305 # "set ip df 1",
1306 # "set ip next-hop recursive global 198.51.110.1",
1307 # "set ip next-hop verify-availability 198.51.111.1 100 track 10",
1308 # "set ip precedence critical",
1309 # "set ip address prefix-list 192.0.2.1",
1310 # "set automatic-tag",
1311 # "set aigp-metric 100",
1312 # "route-map test_1 deny 20",
1313 # "continue 100",
1314 # "match track 105",
1315 # "match tag list test_match_tag",
1316 # "match ipv6 address test_acl_20",
1317 # "match route-type level-1",
1318 # "match as-path 200 100",
1319 # "match additional-paths advertise-set all group-best",
1320 # "route-map test_1 deny 10",
1321 # "description this is test route",
1322 # "match security-group source tag 10 20",
1323 # "match ip next-hop prefix-list test_2_new test_1_new",
1324 # "match ip route-source 10",
1325 # "match local-preference 100 50",
1326 # "match mpls-label"
1327 # ]
1328
1329 # After state:
1330 # -------------
1331 #
1332 # router-ios#sh running-config | section ^route-map
1333 # route-map test_1 deny 10
1334 # description this is test route
1335 # match ip next-hop prefix-list test_2_new test_1_new
1336 # match ip route-source 10
1337 # match security-group source tag 10 20
1338 # match local-preference 100 50
1339 # match mpls-label
1340 # route-map test_1 deny 20
1341 # match track 105
1342 # match tag list test_match_tag
1343 # match route-type level-1
1344 # match additional-paths advertise-set all group-best
1345 # match as-path 200 100
1346 # match ipv6 address test_acl_20
1347 # continue 100
1348 # route-map test_2 deny 10
1349 # match security-group source tag 10 20
1350 # match local-preference 55 105
1351 # match mpls-label
1352 # match ipv6 address test_ip_acl
1353 # match ipv6 next-hop prefix-list test_new
1354 # match ipv6 route-source route_src_acl
1355 # set automatic-tag
1356 # set ip precedence critical
1357 # set ip address prefix-list 192.0.2.1
1358 # set aigp-metric 100
1359 # set extcommunity cost pre-bestpath 10 100
1360 # set ip df 1
1361 # set ip next-hop verify-availability 198.51.111.1 100 track 10
1362 # set ip next-hop recursive global 198.51.110.1
1363
1364 # Using overridden
1365
1366 # Before state:
1367 # -------------
1368 #
1369 # router-ios#sh running-config | section ^route-map
1370 # route-map test_1 deny 10
1371 # description this is test route
1372 # match ip next-hop prefix-list test_2_new test_1_new
1373 # match ip route-source 10
1374 # match security-group source tag 10 20
1375 # match local-preference 100 50
1376 # match mpls-label
1377 # route-map test_1 deny 20
1378 # match track 105
1379 # match tag list test_match_tag
1380 # match route-type level-1
1381 # match additional-paths advertise-set all group-best
1382 # match as-path 200 100
1383 # match ipv6 address test_acl_20
1384 # continue 100
1385 # route-map test_2 deny 10
1386 # match security-group source tag 10 20
1387 # match local-preference 55 105
1388 # match mpls-label
1389 # match ipv6 address test_ip_acl
1390 # match ipv6 next-hop prefix-list test_new
1391 # match ipv6 route-source route_src_acl
1392 # set automatic-tag
1393 # set ip precedence critical
1394 # set ip address prefix-list 192.0.2.1
1395 # set aigp-metric 100
1396 # set extcommunity cost pre-bestpath 10 100
1397 # set ip df 1
1398 # set ip next-hop verify-availability 198.51.111.1 100 track 10
1399 # set ip next-hop recursive global 198.51.110.1
1400
1401 - name: Override provided Route maps configuration
1402 cisco.ios.ios_route_maps:
1403 config:
1404 - route_map: test_1
1405 entries:
1406 - sequence: 10
1407 action: deny
1408 description: this is override route
1409 match:
1410 ip:
1411 next_hop:
1412 acls:
1413 - 10
1414 - test1_acl
1415 flowspec:
1416 dest_pfx: true
1417 acls:
1418 - test_acl_1
1419 - test_acl_2
1420 length:
1421 minimum: 10
1422 maximum: 100
1423 metric:
1424 value: 10
1425 external: true
1426 security_group:
1427 source:
1428 - 10
1429 - 20
1430 mpls_label: true
1431 set:
1432 extcommunity:
1433 vpn_distinguisher:
1434 address: 192.0.2.1:12
1435 additive: true
1436 metric:
1437 metric_value: 100
1438 deviation: plus
1439 eigrp_delay: 100
1440 metric_reliability: 10
1441 metric_bandwidth: 20
1442 mtu: 30
1443 - route_map: test_override
1444 entries:
1445 - sequence: 10
1446 action: deny
1447 match:
1448 ipv6:
1449 address:
1450 acl: test_acl
1451 next_hop:
1452 prefix_list: test_new
1453 route_source:
1454 acl: route_src_acl
1455 security_group:
1456 source:
1457 - 15
1458 - 20
1459 local_preference:
1460 value:
1461 - 105
1462 - 110
1463 mpls_label: true
1464 set:
1465 aigp_metric:
1466 value: 100
1467 automatic_tag: true
1468 extcommunity:
1469 cost:
1470 id: 10
1471 cost_value: 100
1472 pre_bestpath: true
1473 ip:
1474 address: 192.0.2.1
1475 df: 1
1476 next_hop:
1477 recursive:
1478 global_route: true
1479 address: 198.110.51.1
1480 verify_availability:
1481 address: 198.110.51.2
1482 sequence: 100
1483 track: 10
1484 precedence:
1485 critical: true
1486 state: overridden
1487
1488 # Commands Fired:
1489 # ---------------
1490 #
1491 # "commands": [
1492 # "no route-map test_2",
1493 # "route-map test_override deny 10",
1494 # "match security-group source tag 15 20",
1495 # "match local-preference 110 105",
1496 # "match mpls-label",
1497 # "match ipv6 next-hop prefix-list test_new",
1498 # "match ipv6 route-source route_src_acl",
1499 # "match ipv6 address test_acl",
1500 # "set extcommunity cost pre-bestpath 10 100",
1501 # "set ip df 1",
1502 # "set ip next-hop recursive global 198.110.51.1",
1503 # "set ip next-hop verify-availability 198.110.51.2 100 track 10",
1504 # "set ip precedence critical",
1505 # "set ip address prefix-list 192.0.2.1",
1506 # "set automatic-tag",
1507 # "set aigp-metric 100",
1508 # "route-map test_1 deny 10",
1509 # "no description this is test route",
1510 # "description this is override route",
1511 # "match ip flowspec dest-pfx test_acl_1 test_acl_2",
1512 # "no match ip next-hop prefix-list test_2_new test_1_new",
1513 # "match ip next-hop test1_acl 10",
1514 # "no match ip route-source 10",
1515 # "match metric external 10",
1516 # "match length 10 100",
1517 # "no match local-preference 100 50",
1518 # "set extcommunity vpn-distinguisher 192.0.2.1:12 additive",
1519 # "set metric 100 +100 10 20 30",
1520 # "no route-map test_1 deny 20"
1521 # ]
1522
1523 # After state:
1524 # -------------
1525 #
1526 # router-ios#sh running-config | section ^route-map
1527 # route-map test_override deny 10
1528 # match security-group source tag 15 20
1529 # match local-preference 110 105
1530 # match mpls-label
1531 # match ipv6 address test_acl
1532 # match ipv6 next-hop prefix-list test_new
1533 # match ipv6 route-source route_src_acl
1534 # set automatic-tag
1535 # set ip precedence critical
1536 # set ip address prefix-list 192.0.2.1
1537 # set aigp-metric 100
1538 # set extcommunity cost pre-bestpath 10 100
1539 # set ip df 1
1540 # set ip next-hop verify-availability 198.110.51.2 100 track 10
1541 # set ip next-hop recursive global 198.110.51.1
1542 # route-map test_1 deny 10
1543 # description this is override route
1544 # match ip flowspec dest-pfx test_acl_1 test_acl_2
1545 # match ip next-hop test1_acl 10
1546 # match security-group source tag 10 20
1547 # match metric external 10
1548 # match mpls-label
1549 # match length 10 100
1550 # set metric 100 +100 10 20 30
1551 # set extcommunity vpn-distinguisher 192.0.2.1:12 additive
1552
1553 # Using replaced
1554
1555 # Before state:
1556 # -------------
1557 #
1558 # router-ios#sh running-config | section ^route-map
1559 # route-map test_1 deny 10
1560 # description this is test route
1561 # match ip next-hop prefix-list test_2_new test_1_new
1562 # match ip route-source 10
1563 # match security-group source tag 10 20
1564 # match local-preference 100 50
1565 # match mpls-label
1566 # route-map test_1 deny 20
1567 # match track 105
1568 # match tag list test_match_tag
1569 # match route-type level-1
1570 # match additional-paths advertise-set all group-best
1571 # match as-path 200 100
1572 # match ipv6 address test_acl_20
1573 # continue 100
1574 # route-map test_2 deny 10
1575 # match security-group source tag 10 20
1576 # match local-preference 55 105
1577 # match mpls-label
1578 # match ipv6 address test_ip_acl
1579 # match ipv6 next-hop prefix-list test_new
1580 # match ipv6 route-source route_src_acl
1581 # set automatic-tag
1582 # set ip precedence critical
1583 # set ip address prefix-list 192.0.2.1
1584 # set aigp-metric 100
1585 # set extcommunity cost pre-bestpath 10 100
1586 # set ip df 1
1587 # set ip next-hop verify-availability 198.51.111.1 100 track 10
1588 # set ip next-hop recursive global 198.51.110.1
1589
1590 - name: Replaced provided Route maps configuration
1591 cisco.ios.ios_route_maps:
1592 config:
1593 - route_map: test_1
1594 entries:
1595 - sequence: 10
1596 action: deny
1597 description: this is replaced route
1598 match:
1599 ip:
1600 next_hop:
1601 acls:
1602 - 10
1603 - test1_acl
1604 flowspec:
1605 dest_pfx: true
1606 acls:
1607 - test_acl_1
1608 - test_acl_2
1609 length:
1610 minimum: 10
1611 maximum: 100
1612 metric:
1613 value: 10
1614 external: true
1615 security_group:
1616 source:
1617 - 10
1618 - 20
1619 mpls_label: true
1620 set:
1621 extcommunity:
1622 vpn_distinguisher:
1623 address: 192.0.2.1:12
1624 additive: true
1625 metric:
1626 metric_value: 100
1627 deviation: plus
1628 eigrp_delay: 100
1629 metric_reliability: 10
1630 metric_bandwidth: 20
1631 mtu: 30
1632 - route_map: test_replaced
1633 entries:
1634 - sequence: 10
1635 action: deny
1636 match:
1637 ipv6:
1638 address:
1639 acl: test_acl
1640 next_hop:
1641 prefix_list: test_new
1642 route_source:
1643 acl: route_src_acl
1644 security_group:
1645 source:
1646 - 15
1647 - 20
1648 local_preference:
1649 value:
1650 - 105
1651 - 110
1652 mpls_label: true
1653 set:
1654 aigp_metric:
1655 value: 100
1656 automatic_tag: true
1657 extcommunity:
1658 cost:
1659 id: 10
1660 cost_value: 100
1661 pre_bestpath: true
1662 ip:
1663 address: 192.0.2.1
1664 df: 1
1665 next_hop:
1666 recursive:
1667 global_route: true
1668 address: 198.110.51.1
1669 verify_availability:
1670 address: 198.110.51.2
1671 sequence: 100
1672 track: 10
1673 precedence:
1674 critical: true
1675 state: replaced
1676
1677 # Commands Fired:
1678 # ---------------
1679 # "commands": [
1680 # "route-map test_replaced deny 10",
1681 # "match security-group source tag 15 20",
1682 # "match local-preference 110 105",
1683 # "match mpls-label",
1684 # "match ipv6 next-hop prefix-list test_new",
1685 # "match ipv6 route-source route_src_acl",
1686 # "match ipv6 address test_acl",
1687 # "set extcommunity cost pre-bestpath 10 100",
1688 # "set ip df 1",
1689 # "set ip next-hop recursive global 198.110.51.1",
1690 # "set ip next-hop verify-availability 198.110.51.2 100 track 10",
1691 # "set ip precedence critical",
1692 # "set ip address prefix-list 192.0.2.1",
1693 # "set automatic-tag",
1694 # "set aigp-metric 100",
1695 # "route-map test_1 deny 10",
1696 # "no description this is test route",
1697 # "description this is replaced route",
1698 # "match ip flowspec dest-pfx test_acl_1 test_acl_2",
1699 # "no match ip next-hop prefix-list test_2_new test_1_new",
1700 # "match ip next-hop test1_acl 10",
1701 # "no match ip route-source 10",
1702 # "match metric external 10",
1703 # "match length 10 100",
1704 # "no match local-preference 100 50",
1705 # "set extcommunity vpn-distinguisher 192.0.2.1:12 additive",
1706 # "set metric 100 +100 10 20 30",
1707 # "no route-map test_1 deny 20"
1708 # ]
1709
1710 # After state:
1711 # -------------
1712 #
1713 # router-ios#sh running-config | section ^route-map
1714 # route-map test_replaced deny 10
1715 # match security-group source tag 15 20
1716 # match local-preference 110 105
1717 # match mpls-label
1718 # match ipv6 address test_acl
1719 # match ipv6 next-hop prefix-list test_new
1720 # match ipv6 route-source route_src_acl
1721 # set automatic-tag
1722 # set ip precedence critical
1723 # set ip address prefix-list 192.0.2.1
1724 # set aigp-metric 100
1725 # set extcommunity cost pre-bestpath 10 100
1726 # set ip df 1
1727 # set ip next-hop verify-availability 198.110.51.2 100 track 10
1728 # set ip next-hop recursive global 198.110.51.1
1729 # route-map test_1 deny 10
1730 # description this is replaced route
1731 # match ip flowspec dest-pfx test_acl_1 test_acl_2
1732 # match ip next-hop test1_acl 10
1733 # match security-group source tag 10 20
1734 # match metric external 10
1735 # match mpls-label
1736 # match length 10 100
1737 # set metric 100 +100 10 20 30
1738 # set extcommunity vpn-distinguisher 192.0.2.1:12 additive
1739 # route-map test_2 deny 10
1740 # match security-group source tag 10 20
1741 # match local-preference 55 105
1742 # match mpls-label
1743 # match ipv6 address test_ip_acl
1744 # match ipv6 next-hop prefix-list test_new
1745 # match ipv6 route-source route_src_acl
1746 # set automatic-tag
1747 # set ip precedence critical
1748 # set ip address prefix-list 192.0.2.1
1749 # set aigp-metric 100
1750 # set extcommunity cost pre-bestpath 10 100
1751 # set ip df 1
1752 # set ip next-hop verify-availability 198.51.111.1 100 track 10
1753 # set ip next-hop recursive global 198.51.110.1
1754
1755 # Using Gathered
1756
1757 # Before state:
1758 # -------------
1759 #
1760 # router-ios#sh running-config | section ^route-map
1761 # route-map test_1 deny 10
1762 # description this is test route
1763 # match ip next-hop prefix-list test_2_new test_1_new
1764 # match ip route-source 10
1765 # match security-group source tag 10 20
1766 # match local-preference 100 50
1767 # match mpls-label
1768 # route-map test_1 deny 20
1769 # match track 105
1770 # match tag list test_match_tag
1771 # match route-type level-1
1772 # match additional-paths advertise-set all group-best
1773 # match as-path 200 100
1774 # match ipv6 address test_acl_20
1775 # continue 100
1776 # route-map test_2 deny 10
1777 # match security-group source tag 10 20
1778 # match local-preference 55 105
1779 # match mpls-label
1780 # match ipv6 address test_ip_acl
1781 # match ipv6 next-hop prefix-list test_new
1782 # match ipv6 route-source route_src_acl
1783 # set automatic-tag
1784 # set ip precedence critical
1785 # set ip address prefix-list 192.0.2.1
1786 # set aigp-metric 100
1787 # set extcommunity cost pre-bestpath 10 100
1788 # set ip df 1
1789 # set ip next-hop verify-availability 198.51.111.1 100 track 10
1790 # set ip next-hop recursive global 198.51.110.1
1791
1792 - name: Gather Route maps provided configurations
1793 cisco.ios.ios_route_maps:
1794 config:
1795 state: gathered
1796
1797 # Module Execution Result:
1798 # ------------------------
1799 #
1800 # "gathered": [
1801 # {
1802 # "entries": [
1803 # {
1804 # "action": "deny",
1805 # "description": "this is test route",
1806 # "match": {
1807 # "ip": {
1808 # "next_hop": {
1809 # "prefix_lists": [
1810 # "test_2_new",
1811 # "test_1_new"
1812 # ]
1813 # },
1814 # "route_source": {
1815 # "acls": [
1816 # "10"
1817 # ]
1818 # }
1819 # },
1820 # "local_preference": {
1821 # "value": [
1822 # "100",
1823 # "50"
1824 # ]
1825 # },
1826 # "mpls_label": true,
1827 # "security_group": {
1828 # "source": [
1829 # 10,
1830 # 20
1831 # ]
1832 # }
1833 # },
1834 # "sequence": 10
1835 # },
1836 # {
1837 # "action": "deny",
1838 # "continue_entry": {
1839 # "entry_sequence": 100
1840 # },
1841 # "match": {
1842 # "additional_paths": {
1843 # "all": true,
1844 # "group_best": true
1845 # },
1846 # "as_path": {
1847 # "acls": [
1848 # 200,
1849 # 100
1850 # ]
1851 # },
1852 # "ipv6": {
1853 # "address": {
1854 # "acl": "test_acl_20"
1855 # }
1856 # },
1857 # "route_type": {
1858 # "external": {
1859 # "set": true
1860 # },
1861 # "level_1": true,
1862 # "nssa_external": {
1863 # "set": true
1864 # }
1865 # },
1866 # "tag": {
1867 # "tag_list": [
1868 # "test_match_tag"
1869 # ]
1870 # },
1871 # "track": 105
1872 # },
1873 # "sequence": 20
1874 # }
1875 # ],
1876 # "route_map": "test_1"
1877 # },
1878 # {
1879 # "entries": [
1880 # {
1881 # "action": "deny",
1882 # "match": {
1883 # "ipv6": {
1884 # "address": {
1885 # "acl": "test_ip_acl"
1886 # },
1887 # "next_hop": {
1888 # "prefix_list": "test_new"
1889 # },
1890 # "route_source": {
1891 # "acl": "route_src_acl"
1892 # }
1893 # },
1894 # "local_preference": {
1895 # "value": [
1896 # "55",
1897 # "105"
1898 # ]
1899 # },
1900 # "mpls_label": true,
1901 # "security_group": {
1902 # "source": [
1903 # 10,
1904 # 20
1905 # ]
1906 # }
1907 # },
1908 # "sequence": 10,
1909 # "set": {
1910 # "aigp_metric": {
1911 # "value": 100
1912 # },
1913 # "automatic_tag": true,
1914 # "extcommunity": {
1915 # "cost": {
1916 # "cost_value": 100,
1917 # "id": "10",
1918 # "pre_bestpath": true
1919 # }
1920 # },
1921 # "ip": {
1922 # "address": "192.0.2.1",
1923 # "df": 1,
1924 # "next_hop": {
1925 # "recursive": {
1926 # "address": "198.51.110.1",
1927 # "global_route": true
1928 # },
1929 # "verify_availability": {
1930 # "address": "198.51.111.1",
1931 # "sequence": 100,
1932 # "track": 10
1933 # }
1934 # },
1935 # "precedence": {
1936 # "critical": true
1937 # }
1938 # }
1939 # }
1940 # }
1941 # ],
1942 # "route_map": "test_2"
1943 # }
1944 # ]
1945
1946 # After state:
1947 # ------------
1948 #
1949 # router-ios#sh running-config | section ^route-map
1950 # route-map test_1 deny 10
1951 # description this is test route
1952 # match ip next-hop prefix-list test_2_new test_1_new
1953 # match ip route-source 10
1954 # match security-group source tag 10 20
1955 # match local-preference 100 50
1956 # match mpls-label
1957 # route-map test_1 deny 20
1958 # match track 105
1959 # match tag list test_match_tag
1960 # match route-type level-1
1961 # match additional-paths advertise-set all group-best
1962 # match as-path 200 100
1963 # match ipv6 address test_acl_20
1964 # continue 100
1965 # route-map test_2 deny 10
1966 # match security-group source tag 10 20
1967 # match local-preference 55 105
1968 # match mpls-label
1969 # match ipv6 address test_ip_acl
1970 # match ipv6 next-hop prefix-list test_new
1971 # match ipv6 route-source route_src_acl
1972 # set automatic-tag
1973 # set ip precedence critical
1974 # set ip address prefix-list 192.0.2.1
1975 # set aigp-metric 100
1976 # set extcommunity cost pre-bestpath 10 100
1977 # set ip df 1
1978 # set ip next-hop verify-availability 198.51.111.1 100 track 10
1979 # set ip next-hop recursive global 198.51.110.1
1980
1981 # Using Rendered
1982
1983 - name: Render the commands for provided configuration
1984 cisco.ios.ios_route_maps:
1985 config:
1986 - route_map: test_1
1987 entries:
1988 - sequence: 10
1989 action: deny
1990 description: this is test route
1991 match:
1992 ip:
1993 next_hop:
1994 prefix_lists:
1995 - test_1_new
1996 - test_2_new
1997 route_source:
1998 acls:
1999 - 10
2000 security_group:
2001 source:
2002 - 10
2003 - 20
2004 local_preference:
2005 value:
2006 - 50
2007 - 100
2008 mpls_label: true
2009 - sequence: 20
2010 action: deny
2011 continue_entry:
2012 entry_sequence: 100
2013 match:
2014 additional_paths:
2015 all: true
2016 group_best: true
2017 as_path:
2018 acls:
2019 - 100
2020 - 200
2021 ipv6:
2022 address:
2023 acl: test_acl_20
2024 route_type:
2025 level_1: true
2026 tag:
2027 tag_list:
2028 - test_match_tag
2029 track: 105
2030 - route_map: test_2
2031 entries:
2032 - sequence: 10
2033 action: deny
2034 match:
2035 ipv6:
2036 address:
2037 acl: test_ip_acl
2038 next_hop:
2039 prefix_list: test_new
2040 route_source:
2041 acl: route_src_acl
2042 security_group:
2043 source:
2044 - 10
2045 - 20
2046 local_preference:
2047 value:
2048 - 55
2049 - 105
2050 mpls_label: true
2051 set:
2052 aigp_metric:
2053 value: 100
2054 automatic_tag: true
2055 extcommunity:
2056 cost:
2057 id: 10
2058 cost_value: 100
2059 pre_bestpath: true
2060 ip:
2061 address: 192.0.2.1
2062 df: 1
2063 next_hop:
2064 recursive:
2065 global_route: true
2066 address: 198.51.110.1
2067 verify_availability:
2068 address: 198.51.111.1
2069 sequence: 100
2070 track: 10
2071 precedence:
2072 critical: true
2073 state: rendered
2074
2075 # Module Execution Result:
2076 # ------------------------
2077 #
2078 # "rendered": [
2079 # "route-map test_2 deny 10",
2080 # "match security-group source tag 10 20",
2081 # "match local-preference 55 105",
2082 # "match mpls-label",
2083 # "match ipv6 next-hop prefix-list test_new",
2084 # "match ipv6 route-source route_src_acl",
2085 # "match ipv6 address test_ip_acl",
2086 # "set extcommunity cost pre-bestpath 10 100",
2087 # "set ip df 1",
2088 # "set ip next-hop recursive global 198.51.110.1",
2089 # "set ip next-hop verify-availability 198.51.111.1 100 track 10",
2090 # "set ip precedence critical",
2091 # "set ip address prefix-list 192.0.2.1",
2092 # "set automatic-tag",
2093 # "set aigp-metric 100",
2094 # "route-map test_1 deny 20",
2095 # "continue 100",
2096 # "match track 105",
2097 # "match tag list test_match_tag",
2098 # "match ipv6 address test_acl_20",
2099 # "match route-type level-1",
2100 # "match as-path 200 100",
2101 # "match additional-paths advertise-set all group-best",
2102 # "route-map test_1 deny 10",
2103 # "description this is test route",
2104 # "match security-group source tag 10 20",
2105 # "match ip next-hop prefix-list test_2_new test_1_new",
2106 # "match ip route-source 10",
2107 # "match local-preference 100 50",
2108 # "match mpls-label"
2109 # ]
2110
2111 # Using Parsed
2112
2113 # File: parsed.cfg
2114 # ----------------
2115 #
2116 # route-map test_1 deny 10
2117 # description this is test route
2118 # match ip next-hop prefix-list test_2_new test_1_new
2119 # match ip route-source 10
2120 # match security-group source tag 10 20
2121 # match local-preference 100 50
2122 # match mpls-label
2123 # route-map test_1 deny 20
2124 # match track 105
2125 # match tag list test_match_tag
2126 # match route-type level-1
2127 # match additional-paths advertise-set all group-best
2128 # match as-path 200 100
2129 # match ipv6 address test_acl_20
2130 # continue 100
2131 # route-map test_2 deny 10
2132 # match security-group source tag 10 20
2133 # match local-preference 55 105
2134 # match mpls-label
2135 # match ipv6 address test_ip_acl
2136 # match ipv6 next-hop prefix-list test_new
2137 # match ipv6 route-source route_src_acl
2138 # set automatic-tag
2139 # set ip precedence critical
2140 # set ip address prefix-list 192.0.2.1
2141 # set aigp-metric 100
2142 # set extcommunity cost pre-bestpath 10 100
2143 # set ip df 1
2144 # set ip next-hop verify-availability 198.51.111.1 100 track 10
2145 # set ip next-hop recursive global 198.51.110.1
2146
2147 - name: Parse the provided configuration with the existing running configuration
2148 cisco.ios.ios_route_maps:
2149 running_config: "{{ lookup('file', 'parsed.cfg') }}"
2150 state: parsed
2151
2152 # Module Execution Result:
2153 # ------------------------
2154 #
2155 # "parsed": [
2156 # {
2157 # "entries": [
2158 # {
2159 # "action": "deny",
2160 # "description": "this is test route",
2161 # "match": {
2162 # "ip": {
2163 # "next_hop": {
2164 # "prefix_lists": [
2165 # "test_2_new",
2166 # "test_1_new"
2167 # ]
2168 # },
2169 # "route_source": {
2170 # "acls": [
2171 # "10"
2172 # ]
2173 # }
2174 # },
2175 # "local_preference": {
2176 # "value": [
2177 # "100",
2178 # "50"
2179 # ]
2180 # },
2181 # "mpls_label": true,
2182 # "security_group": {
2183 # "source": [
2184 # 10,
2185 # 20
2186 # ]
2187 # }
2188 # },
2189 # "sequence": 10
2190 # },
2191 # {
2192 # "action": "deny",
2193 # "continue_entry": {
2194 # "entry_sequence": 100
2195 # },
2196 # "match": {
2197 # "additional_paths": {
2198 # "all": true,
2199 # "group_best": true
2200 # },
2201 # "as_path": {
2202 # "acls": [
2203 # 200,
2204 # 100
2205 # ]
2206 # },
2207 # "ipv6": {
2208 # "address": {
2209 # "acl": "test_acl_20"
2210 # }
2211 # },
2212 # "route_type": {
2213 # "external": {
2214 # "set": true
2215 # },
2216 # "level_1": true,
2217 # "nssa_external": {
2218 # "set": true
2219 # }
2220 # },
2221 # "tag": {
2222 # "tag_list": [
2223 # "test_match_tag"
2224 # ]
2225 # },
2226 # "track": 105
2227 # },
2228 # "sequence": 20
2229 # }
2230 # ],
2231 # "route_map": "test_1"
2232 # },
2233 # {
2234 # "entries": [
2235 # {
2236 # "action": "deny",
2237 # "match": {
2238 # "ipv6": {
2239 # "address": {
2240 # "acl": "test_ip_acl"
2241 # },
2242 # "next_hop": {
2243 # "prefix_list": "test_new"
2244 # },
2245 # "route_source": {
2246 # "acl": "route_src_acl"
2247 # }
2248 # },
2249 # "local_preference": {
2250 # "value": [
2251 # "55",
2252 # "105"
2253 # ]
2254 # },
2255 # "mpls_label": true,
2256 # "security_group": {
2257 # "source": [
2258 # 10,
2259 # 20
2260 # ]
2261 # }
2262 # },
2263 # "sequence": 10,
2264 # "set": {
2265 # "aigp_metric": {
2266 # "value": 100
2267 # },
2268 # "automatic_tag": true,
2269 # "extcommunity": {
2270 # "cost": {
2271 # "cost_value": 100,
2272 # "id": "10",
2273 # "pre_bestpath": true
2274 # }
2275 # },
2276 # "ip": {
2277 # "address": "192.0.2.1",
2278 # "df": 1,
2279 # "next_hop": {
2280 # "recursive": {
2281 # "address": "198.51.110.1",
2282 # "global_route": true
2283 # },
2284 # "verify_availability": {
2285 # "address": "198.51.111.1",
2286 # "sequence": 100,
2287 # "track": 10
2288 # }
2289 # },
2290 # "precedence": {
2291 # "critical": true
2292 # }
2293 # }
2294 # }
2295 # }
2296 # ],
2297 # "route_map": "test_2"
2298 # }
2299 # ]
2300 """
2301
2302 RETURN = """
2303 before:
2304 description: The configuration prior to the model invocation.
2305 returned: always
2306 sample: >
2307 The configuration returned will always be in the same format
2308 of the parameters above.
2309 type: list
2310 after:
2311 description: The resulting configuration model invocation.
2312 returned: when changed
2313 sample: >
2314 The configuration returned will always be in the same format
2315 of the parameters above.
2316 type: list
2317 commands:
2318 description: The set of commands pushed to the remote device.
2319 returned: always
2320 type: list
2321 sample: ['route-map test_1 deny 10', 'description this is test route', 'match ip route-source 10', 'match track 105']
2322 """
2323
2324 from ansible.module_utils.basic import AnsibleModule
2325
2326 from ansible_collections.cisco.ios.plugins.module_utils.network.ios.argspec.route_maps.route_maps import (
2327 Route_mapsArgs,
2328 )
2329 from ansible_collections.cisco.ios.plugins.module_utils.network.ios.config.route_maps.route_maps import (
2330 Route_maps,
2331 )
2332
2333
2334 def main():
2335 """
2336 Main entry point for module execution
2337
2338 :returns: the result form module invocation
2339 """
2340 module = AnsibleModule(
2341 argument_spec=Route_mapsArgs.argument_spec,
2342 mutually_exclusive=[["config", "running_config"]],
2343 required_if=[
2344 ["state", "merged", ["config"]],
2345 ["state", "replaced", ["config"]],
2346 ["state", "overridden", ["config"]],
2347 ["state", "rendered", ["config"]],
2348 ["state", "parsed", ["running_config"]],
2349 ],
2350 supports_check_mode=True,
2351 )
2352
2353 result = Route_maps(module).execute_module()
2354 module.exit_json(**result)
2355
2356
2357 if __name__ == "__main__":
2358 main()