Debian Codegraph @

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

raw
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 # Copyright 2022 Red Hat
4 # GNU General Public License v3.0+
5 # (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
6
7 """
8 The module file for iosxr_snmp_server
9 """
10
11 from __future__ import absolute_import, division, print_function
12
13
14 __metaclass__ = type
15
16 DOCUMENTATION = """
17 ---
18 module: iosxr_snmp_server
19 short_description: Resource module to configure snmp server.
20 description: This module configures and manages the attributes of snmp-server on Cisco
21 IOSXR platforms.
22 version_added: 2.6.0
23 author: Ashwini Mhatre (@amhatre)
24 notes:
25 - Tested against Cisco Iosxr 7.0.2
26 - This module works with connection C(network_cli).
27 options:
28 config:
29 description: SNMP server configuration.
30 type: dict
31 suboptions:
32 chassis_id:
33 description: SNMP chassis identifier.
34 type: str
35 communities:
36 description: Enable SNMP; set community string and access privileges.
37 type: list
38 elements: dict
39 suboptions:
40 name:
41 description: Community name.
42 type: str
43 acl_v4:
44 description: Ipv4 access list.
45 type: str
46 acl_v6:
47 description: IPv6 access list name.
48 type: str
49 ro:
50 description: Only reads are permitted.
51 type: bool
52 rw:
53 description: Read-write access.
54 type: bool
55 sdrowner:
56 type: bool
57 description: SDR Owner permissions for MIB Objects.
58 systemowner:
59 type: bool
60 description: System Owner permissions for MIB objects.
61 v4_acl:
62 description: V4 Access-list name.
63 type: str
64 community_maps:
65 description: Community Mapping as per RFC-2576.
66 type: list
67 elements: dict
68 suboptions:
69 name:
70 description: Community name
71 type: str
72 context:
73 description: Context Name for the community mapping.
74 type: str
75 security_name:
76 description: Security Name for the community mapping.
77 type: str
78 target_list:
79 description: list of targets valid with this community.
80 type: str
81 correlator:
82 description: Configure properties of the event correlator
83 type: dict
84 suboptions:
85 buffer_size:
86 type: int
87 description: Configure size of the correlator buffer.
88 rules:
89 type: list
90 elements: dict
91 description: Configure a specified correlation rule.
92 suboptions:
93 rule_name:
94 type: str
95 description: name of rule.
96 timeout:
97 type: int
98 description: Specify timeout.
99 rule_sets:
100 type: list
101 elements: dict
102 description: Configure a specified correlation ruleset.
103 suboptions:
104 name:
105 type: str
106 description: Name of the ruleset
107 contact:
108 description: Person to contact about the syste,.
109 type: str
110 context:
111 description: Create/Delete a context apart from default
112 type: list
113 elements: str
114 drop:
115 type: dict
116 description: Silently drop SNMP packets
117 suboptions:
118 unknown_user:
119 description: Silently drop unknown v3 user packets
120 type: bool
121 report_IPv4:
122 description: Config to drop snmpv3 error reports matching Ipv4 ACL.
123 type: str
124 report_IPv6:
125 description: Config to drop snmpv3 error reports matching Ipv4 ACL.
126 type: str
127 engineid:
128 description: SNMPv3 engine ID configuration.
129 type: dict
130 suboptions:
131 local:
132 description: Local SNMP agent
133 type: str
134 groups:
135 description: SNMP USM group
136 type: list
137 elements: dict
138 suboptions:
139 group:
140 description: SNMP group for the user
141 type: str
142 version:
143 description: snmp security group version
144 type: str
145 choices: ['v1', 'v3', 'v2c']
146 context:
147 description: Specify a context to associate with the group
148 type: str
149 notify:
150 description: View to restrict notifications
151 type: str
152 read:
153 description: View to restrict read access
154 type: str
155 write:
156 description: View to restrict write access
157 type: str
158 acl_v4:
159 description: Ipv4 Type of Access-list
160 type: str
161 aliases:
162 - Ipv4_acl
163 acl_v6:
164 description: Ipv6 Type of Access-list
165 type: str
166 aliases:
167 - Ipv6_acl
168 v4_acl:
169 description: V4 Access-list name
170 type: str
171 hosts: &hosts
172 description: Notification destinations
173 type: list
174 elements: dict
175 suboptions:
176 host:
177 description: Hostname or IP address of SNMP notification host.
178 type: str
179 community:
180 description: community string.
181 type: str
182 udp_port:
183 description: UDP destination port for notification messages.
184 type: int
185 informs:
186 description: Use SNMP inform messages.
187 type: bool
188 traps:
189 description: Use SNMP trap messages
190 type: bool
191 version:
192 description: Notification message SNMP version.
193 type: str
194 choices: ['1', '2c', '3']
195 ifindex:
196 description: Enable ifindex persistence
197 type: bool
198 ifmib:
199 type: dict
200 description: IF-MIB configuration commands.
201 suboptions:
202 ifalias_long:
203 type: bool
204 description: Modify parameters for ifAlias object.
205 internal_cache_max_duration:
206 type: int
207 description: IFMIB internal lookahead cache.
208 ipsubscriber:
209 type: bool
210 description: Enable ipsubscriber interfaces in IFMIB.
211 stats:
212 type: bool
213 description: Modify IF-MIB statistics parameters.
214 inform:
215 description: Configure SNMP Informs options
216 suboptions:
217 pending:
218 description: Set number of unacked informs to hold
219 type: int
220 retries:
221 description: Set retry count for informs
222 type: int
223 timeout:
224 description: Set timeout for informs
225 type: int
226 type: dict
227 interfaces:
228 type: list
229 elements: dict
230 description: Enter the SNMP interface configuration commands.
231 suboptions:
232 name:
233 type: str
234 description: Name of interface.
235 notification_linkupdown_disable:
236 type: bool
237 description: Disable linkUp and linkDown notification.
238 index_persistent:
239 type: bool
240 description: Configure ifIndex attributes Persistency across system reloads.
241 ipv4: &ip
242 description: Mark the dscp/precedence bit for ipv4 packets.
243 type: dict
244 suboptions:
245 dscp:
246 description: Set IP DSCP (DiffServ CodePoint).Please refer vendor document for valid entries.
247 type: str
248 precedence:
249 description: Set precedence Please refer vendor document for valid entries.
250 type: str
251 ipv6: *ip
252 location:
253 description: The sysLocation string.
254 type: str
255 logging_threshold_oid_processing:
256 type: int
257 description: Configure threshold to start logging slow OID requests processing.
258 logging_threshold_pdu_processing:
259 type: int
260 description: Configure threshold to start logging slow PDU requests processing.
261 mib_bulkstat_max_procmem_size:
262 type: int
263 description: per process memory limit in kilo bytes
264 mib_object_lists:
265 description: mib object lists
266 type: list
267 elements: str
268 mib_schema:
269 type: list
270 elements: dict
271 description: mib schema
272 suboptions:
273 name:
274 type: str
275 description: mib schema name.
276 object_list:
277 type: str
278 description: Name of an object List.
279 poll_interval:
280 type: int
281 description: Periodicity for polling of objects in this schema in Min.
282 mib_bulkstat_transfer_ids:
283 description: mib bulkstat transfer ids.
284 type: list
285 elements: dict
286 suboptions:
287 name:
288 type: str
289 description: mib transfer-id name.
290 buffer_size:
291 type: int
292 description: Bulkstat data file maximum size.
293 enable:
294 type: bool
295 description: Start Data Collection for this Configuration
296 format_schemaASCI:
297 type: bool
298 description: format
299 retain:
300 type: int
301 description: Retention period in Min.
302 retry:
303 type: int
304 description: Number of Retries.
305 schema:
306 type: str
307 description: Schema that contains objects to be collected.
308 transfer_interval:
309 type: int
310 description: transfer-interval
311 mroutemib_send_all_vrf:
312 type: bool
313 description: Configurations related to IPMROUTE-MIB(cisco-support).
314 notification_log_mib:
315 description: notification log mib.
316 type: dict
317 suboptions:
318 GlobalSize:
319 type: int
320 description: GlobalSize, max number of notifications that can be logged in all logs.
321 default:
322 type: bool
323 description: To create a default log
324 disable:
325 type: bool
326 description: disable, to disable the logging in default log.
327 size:
328 description: size, The max number of notifications that this log (default) can hold.
329 type: int
330 oid_poll_stats:
331 type: bool
332 description: Enable OID poll stats oper CLI
333 overload_control:
334 type: dict
335 description: Set overload-control params for handling incoming messages in critical processing mode.
336 suboptions:
337 overload_drop_time:
338 type: int
339 description: Overload drop time (in seconds) for incoming queue (default 1 sec).
340 overload_throttle_rate:
341 type: int
342 description: Overload throttle rate for incoming queue (default 500 msec)
343 packetsize:
344 type: int
345 description: Largest SNMP packet size.
346 queue_length:
347 type: int
348 description: Queue length (default 100).
349 targets:
350 type: list
351 elements: dict
352 description: targets
353 suboptions:
354 name:
355 type: str
356 description: Name of the target list.
357 host:
358 type: str
359 description: Specify host name.
360 vrf:
361 type: str
362 description: Specify VRF name.
363 throttle_time:
364 type: int
365 description: Set throttle time for handling incoming messages.
366 timeouts:
367 type: dict
368 description: SNMP timeouts
369 suboptions:
370 duplicate:
371 description: Duplicate request feature timeout
372 type: int
373 inQdrop:
374 type: int
375 description: incoming queue drop feature.
376 pdu_stats:
377 type: int
378 description: SNMP pdu statistics end to end.
379 subagent:
380 type: int
381 description: Sub-Agent Request timeout.
382 threshold:
383 type: int
384 description: threshold incoming queue drop feature.
385 trap:
386 type: dict
387 description: MIB trap configurations.
388 suboptions:
389 authentication_vrf_disable:
390 type: bool
391 description: Disable authentication traps for packets on a vrf.
392 link_ietf:
393 type: bool
394 description: Link up/down trap configuratio.
395 throttle_time:
396 type: int
397 description: Set throttle time for handling more traps.
398 trap_source:
399 description: Assign an interface for the source address of all traps
400 type: str
401 trap_timeout:
402 description: Set timeout for TRAP message retransmissions
403 type: int
404 traps:
405 description: Enable traps to all configured recipients.
406 type: dict
407 suboptions:
408 addrpool:
409 type: dict
410 description: Enable SNMP Address Pool traps.
411 suboptions:
412 low:
413 type: bool
414 description: Enable SNMP Address Pool Low Threshold trap.
415 high:
416 type: bool
417 description: Enable SNMP Address Pool High Threshold trap.
418 bfd:
419 type: bool
420 description: Enable BFD traps.
421 bgp:
422 description: Enable Bgp traps.
423 type: dict
424 suboptions:
425 cbgp2:
426 type: bool
427 description: Enable CISCO-BGP4-MIB v2 traps.
428 updown:
429 type: bool
430 description: Enable CISCO-BGP4-MIB v2 up/down traps.
431 bulkstat_collection:
432 type: bool
433 description: Enable Data-Collection-MIB Collection notifications.
434 bulkstat_transfer:
435 type: bool
436 description: Enable Data-Collection-MIB Trnasfer notifications.
437 bridgemib:
438 type: bool
439 description: Enable SNMP Trap for Bridge MIB.
440 copy_complete:
441 type: bool
442 description: Enable CISCO-CONFIG-COPY-MIB ccCopyCompletion traps.
443 cisco_entity_ext:
444 type: bool
445 description: Enable SNMP entity traps
446 config:
447 type: bool
448 description: Enable SNMP config traps.
449 diameter:
450 type: dict
451 description: Enable SNMP diameter traps.
452 suboptions:
453 peerdown:
454 type: bool
455 description: Enable peer connection down notification.
456 peerup:
457 type: bool
458 description: Enable peer connection up notification.
459 permanentfail:
460 type: bool
461 description: Enable permanent failure notification.
462 protocolerror:
463 type: bool
464 description: Enable protocol error notifications
465 transientfail:
466 type: bool
467 description: Enable transient failure notification.
468 entity:
469 type: bool
470 description: Enable SNMP entity traps.
471 entity_redundancy:
472 type: dict
473 description: Enable SNMP CISCO-ENTITY-REDUNDANCY-MIB traps.
474 suboptions:
475 all:
476 type: bool
477 description: Enable all CISCO-ENTITY-REDUNDANCY-MIB traps
478 status:
479 type: bool
480 description: Enable status change traps
481 switchover:
482 type: bool
483 description: Enable switchover traps.
484 entity_state:
485 type: dict
486 description: Enable SNMP entity-state traps.
487 suboptions:
488 operstatus:
489 type: bool
490 description: Enable entity oper status enable notification.
491 switchover:
492 description: Enable entity state switchover notifications
493 type: bool
494 flash:
495 type: dict
496 description: Enable flash-mib traps.
497 suboptions:
498 insertion:
499 type: bool
500 description: Enable ciscoFlashDeviceInsertedNotif.
501 removal:
502 type: bool
503 description: Enable ciscoFlashDeviceRemovedNotif.
504 fru_ctrl:
505 type: bool
506 description: Enable SNMP entity FRU control traps.
507 hsrp:
508 type: bool
509 description: Enable SNMP hsrp traps.
510 ipsla:
511 type: bool
512 description: Enable SNMP hipsla traps.
513 ipsec:
514 type: dict
515 description: Enable SNMP IPSec traps.
516 suboptions:
517 start:
518 type: bool
519 description: Enable SNMP IPsec Tunnel Start trap.
520 stop:
521 type: bool
522 description: Enable SNMP IPsec Tunnel Stop trap.
523 isakmp:
524 type: dict
525 description: Enable SNMP isakmp traps.
526 suboptions:
527 start:
528 type: bool
529 description: Enable SNMP isakmp Tunnel Start trap.
530 stop:
531 type: bool
532 description: Enable SNMP isakmp Tunnel Stop trap.
533
534 isis:
535 description: Enable isis traps. If set to enabled , all the traps are set.
536 type: dict
537 suboptions:
538 adjacency_change:
539 description: adjacency-change
540 type: bool
541 all:
542 type: bool
543 description: anable all is-is traps.
544 area_mismatch:
545 description: area-mismatch
546 type: bool
547 attempt_to_exceed_max_sequence:
548 description: attempt-to-exceed-max-sequence
549 type: bool
550 authentication_failure:
551 description: authentication-failure.
552 type: bool
553 authentication_type_failure:
554 description: authentication-type-failure.
555 type: bool
556 corrupted_lsp_detected:
557 description: isisCorruptedLSPDetected
558 type: bool
559 database_overload:
560 description: database-overload
561 type: bool
562 id_len_mismatch:
563 type: bool
564 description: isisIDLenMismatch
565 lsp_error_detected:
566 type: bool
567 description: lsp-error-detected.
568 lsp_too_large_to_propagate:
569 type: bool
570 description: lsp-too-large-to-propagate
571 manual_address_drops:
572 type: bool
573 description: manual_address_drops
574 max_area_addresses_mismatch:
575 type: bool
576 description: max_area_addresses_mismatch
577 orig_lsp_buff_size_mismatch:
578 type: bool
579 description: orig-lsp-buff-size-mismatch
580 version_skew:
581 type: bool
582 description: version-skew
583 own_lsp_purge:
584 description: own-lsp-purge
585 type: bool
586 rejected_adjacency:
587 description: rejected-adjacency
588 type: bool
589 protocols_supported_mismatch:
590 description: protocols-supported-mismatch
591 type: bool
592 sequence_number_skip:
593 description: sequence-number-skip.
594 type: bool
595 l2tun:
596 type: dict
597 description: Enable L2TUN traps.
598 suboptions:
599 pseudowire_status:
600 type: bool
601 description: Enable L2TUN pseudowire status traps.
602 sessions:
603 type: bool
604 description: Enable L2TUN sessions traps.
605 tunnel_down:
606 type: bool
607 description: Enable L2TUN tunnel DOWN traps.
608 tunnel_up:
609 type: bool
610 description: Enable L2TUN tunnel UP traps.
611 l2vpn:
612 type: dict
613 description: Enable L2VPN traps.
614 suboptions:
615 all:
616 type: bool
617 description: Enable L2VPN ALL traps.
618 cisco:
619 type: bool
620 description: Enable L2VPN CISCO traps.
621 vc_down:
622 type: bool
623 description: Enable L2VPN VC DOWN traps.
624 vc_up:
625 type: bool
626 description: Enable L2VPN VC UP traps.
627 msdp_peer_state_change:
628 type: bool
629 description: Enable SNMP MSDP traps
630 ntp:
631 type: bool
632 description: Enable SNMP Cisco Ntp traps.
633 ospf:
634 description: Enable Ospf traps. If set to enabled , all the traps are set.
635 type: dict
636 suboptions:
637 errors:
638 description: error
639 type: dict
640 suboptions:
641 bad_packet:
642 type: bool
643 description: bad-packet
644 authentication_failure:
645 type: bool
646 description: authentication-failure.
647 config_error:
648 type: bool
649 description: config-error
650 virt_bad_packet:
651 type: bool
652 description: virt-bad-packet
653 virt_authentication_failure:
654 type: bool
655 description: virt-authentication-failure
656 virt_config_error:
657 type: bool
658 description: virt_config_error
659 lsa:
660 description: lsa
661 type: dict
662 suboptions:
663 lsa_maxage:
664 type: bool
665 description: lsa-maxage
666 lsa_originate:
667 type: bool
668 description: lsa-originate
669 retransmit:
670 description: retransmit
671 type: dict
672 suboptions:
673 packets:
674 type: bool
675 description: packets
676 virt_packets:
677 type: bool
678 description: virt-packets
679 state_change:
680 description: state-change.
681 type: dict
682 suboptions:
683 if_state_change:
684 type: bool
685 description: if-state-change
686 neighbor_state_change:
687 type: bool
688 description: neighbor-state-change
689 virtif_state_change:
690 type: bool
691 description: virtif-state-change
692 virtneighbor_state_change:
693 type: bool
694 description: virtneighbor-state-change
695 ospfv3:
696 description: Enable Ospfv3 traps. If set to enabled , all the traps are set.
697 type: dict
698 suboptions:
699 errors:
700 description: error
701 type: dict
702 suboptions:
703 bad_packet:
704 type: bool
705 description: bad-packet
706 config_error:
707 type: bool
708 description: config-error
709 virt_bad_packet:
710 type: bool
711 description: virt-bad-packet
712 virt_config_error:
713 type: bool
714 description: virt_config_error
715 state_change:
716 description: state-change.
717 type: dict
718 suboptions:
719 if_state_change:
720 type: bool
721 description: if-state-change
722 neighbor_state_change:
723 type: bool
724 description: neighbor-state-change
725 virtif_state_change:
726 type: bool
727 description: virtif-state-change
728 virtneighbor_state_change:
729 type: bool
730 description: virtneighbor-state-change
731 nssa_state_change:
732 type: bool
733 description: nssa-state-change
734 restart_status_change:
735 type: bool
736 description: restart-status-change
737 restart_helper_status_change:
738 type: bool
739 description: restart-helper-status-change
740 restart_virtual_helper_status_change:
741 type: bool
742 description: restart-virtual-helper-status-change
743 power:
744 type: bool
745 description: Enable SNMP entity power traps.
746 rf:
747 type: bool
748 description: Enable SNMP RF-MIB traps.
749 pim:
750 description: Enable Pim traps. If set to enabled , all the traps are set.
751 type: dict
752 suboptions:
753 interface_state_change :
754 description: interface-state-change .
755 type: bool
756 invalid_message_received :
757 description: invalid-message-received
758 type: bool
759 neighbor_change:
760 description: neighbor-change.
761 type: bool
762 rp_mapping_change:
763 description: rp-mapping-change.
764 type: bool
765 rsvp:
766 description: Enable rsvp traps. If set to enabled , all the traps are set.
767 type: dict
768 suboptions:
769 all:
770 description: enable all traps.
771 type: bool
772 lost_flow:
773 description: lost-flow
774 type: bool
775 new_flow:
776 description: new-flow
777 type: bool
778 selective_vrf_download_role_change:
779 type: bool
780 description: Enable selective VRF download traps.
781 sensor:
782 type: bool
783 description: Enable SNMP entity sensor traps
784 snmp:
785 description: Enable snmp traps. If set to enabled , all the traps are set.
786 type: dict
787 suboptions:
788 authentication:
789 description: authentication
790 type: bool
791 linkdown:
792 description: link-down
793 type: bool
794 linkup:
795 description: link-up
796 type: bool
797 warmstart:
798 description: warmstart.
799 type: bool
800 coldstart:
801 description: coldstart.
802 type: bool
803 vrrp_events:
804 description: vrrp
805 type: bool
806 syslog:
807 type: bool
808 description: syslog
809 subscriber:
810 type: dict
811 description: Subscriber notification commands.
812 suboptions:
813 session_agg_access_interface:
814 type: bool
815 description: Subscriber notification at access interface level
816 session_agg_node:
817 type: bool
818 description: Subscriber notification at node level
819 system:
820 type: bool
821 description: Enable SNMP SYSTEMMIB-MIB traps.
822 vpls:
823 type: dict
824 description: Enable VPLS traps
825 suboptions:
826 all:
827 type: bool
828 description: Enable all VPLS traps.
829 full_clear:
830 type: bool
831 description: Enable VPLS Full Clear traps.
832 full_raise:
833 type: bool
834 description: Enable VPLS Full Raise traps.
835 status:
836 type: bool
837 description: Enable VPLS Status traps
838 users:
839 description: SNMP user configuration.
840 type: list
841 elements: dict
842 suboptions:
843 user:
844 description: SNMP user name
845 type: str
846 group:
847 description: SNMP group for the user.
848 type: str
849 acl_v4:
850 description: Ipv4 Type of Access-list
851 type: str
852 aliases:
853 - Ipv4_acl
854 acl_v6:
855 description: Ipv6 Type of Access-list
856 type: str
857 aliases:
858 - Ipv6_acl
859 SDROwner:
860 description: SDR Owner permissions for MIB Objects.
861 type: bool
862 SystemOwner:
863 description: System Owner permissions for MIB objects.
864 type: bool
865 v4_acl:
866 type: str
867 description: V4 Access-list name
868 version:
869 description: snmp security version
870 type: str
871 choices: ['v1', 'v2c', 'v3']
872 vrfs:
873 description: Specify the VRF in which the source address is used
874 type: list
875 elements: dict
876 suboptions:
877 vrf:
878 description: vrf name.
879 type: str
880 context:
881 description: Configure the source interface for SNMP notifications
882 type: list
883 elements: str
884 hosts: *hosts
885 running_config:
886 description:
887 - This option is used only with state I(parsed).
888 - The value of this option should be the output received from the IOSXR device by
889 executing the command B(show running-config snmp-server).
890 - The state I(parsed) reads the configuration from C(running_config) option and
891 transforms it into Ansible structured data as per the resource module's argspec
892 and the value is then returned in the I(parsed) key within the result.
893 type: str
894 state:
895 description:
896 - The state the configuration should be left in.
897 - The states I(replaced) and I(overridden) have identical
898 behaviour for this module.
899 - Please refer to examples for more details.
900 type: str
901 choices: [deleted, merged, overridden, replaced, gathered, rendered, parsed]
902 default: merged
903 """
904
905 EXAMPLES = """
906 # Using state: merged
907 # Before state:
908 # -------------
909 # RP/0/RP0/CPU0:test2#show running-config snmp-server
910 # --------------------- EMPTY -----------------
911 # Merged play:
912 # ------------
913
914 - name: Merge the provided configuration with the existing running configuration
915 cisco.iosxr.iosxr_snmp_server:
916 config:
917 vrfs:
918 - hosts:
919 - community: test1
920 host: 1.1.1.1
921 traps: true
922 vrf: vrf1
923 users:
924 - Ipv4_acl: test1
925 Ipv6_acl: test2
926 group: test2
927 user: u1
928 version: v1
929 timeouts:
930 duplicate: 0
931 inQdrop: 0
932 trap:
933 throttle_time: 12
934 targets:
935 - host: 1.1.1.2
936 name: test
937 ifmib:
938 internal_cache_max_duration: 4
939 inform:
940 retries: 7
941 chassis_id: test2
942 packetsize: 490
943 queue_length: 2
944 throttle_time: 60
945 trap_source: GigabitEthernet0/0/0/2
946 trap_timeout: 3
947 context:
948 - c1
949 - c2
950 contact: t1
951 correlator:
952 buffer_size: 1024
953 communities:
954 - name: test2
955 ro: true
956 sdrowner: true
957 acl_v4: test
958 acl_v6: test1
959 community_maps:
960 - name: cm1
961 context: c1
962 target_list: t1
963 security_name: s1
964 drop:
965 report_IPv4: test1
966 unknown_user: true
967 ipv6:
968 precedence: routine
969 ipv4:
970 dscp: af11
971 location: test1
972 logging_threshold_oid_processing: 1
973 logging_threshold_pdu_processing: 1
974 mib_bulkstat_max_procmem_size: 101
975 mroutemib_send_all_vrf: true
976 overload_control:
977 overload_drop_time: 4
978 overload_throttle_rate: 6
979 notification_log_mib:
980 GlobalSize: 5
981 size: 5
982 traps:
983 hsrp: true
984 ipsla: true
985 ipsec:
986 start: true
987 stop: true
988 bridgemib: true
989 bulkstat_collection: true
990 cisco_entity_ext: true
991 config: true
992 copy_complete: true
993 addrpool:
994 high: true
995 low: true
996 bfd: true
997 bgp:
998 cbgp2: true
999 l2tun:
1000 sessions: true
1001 tunnel_down: true
1002 tunnel_up: true
1003 l2vpn:
1004 all: true
1005 vc_down: true
1006 vc_up: true
1007 msdp_peer_state_change: true
1008
1009 #
1010 # Commands Fired:
1011 # ------------
1012 # "commands": [
1013 # "snmp-server chassis-id test2",
1014 # "snmp-server correlator buffer-size 1024",
1015 # "snmp-server contact t1",
1016 # "snmp-server ipv4 dscp af11",
1017 # "snmp-server ipv6 precedence routine",
1018 # "snmp-server location test1",
1019 # "snmp-server logging threshold oid-processing 1",
1020 # "snmp-server logging threshold pdu-processing 1",
1021 # "snmp-server mib bulkstat max-procmem-size 101",
1022 # "snmp-server mroutemib send-all-vrf",
1023 # "snmp-server overload-control 4 6",
1024 # "snmp-server packetsize 490",
1025 # "snmp-server queue-length 2",
1026 # "snmp-server throttle-time 60",
1027 # "snmp-server trap-source GigabitEthernet0/0/0/2",
1028 # "snmp-server trap-timeout 3",
1029 # "snmp-server drop report acl IPv4 test1",
1030 # "snmp-server drop unknown-user",
1031 # "snmp-server ifmib internal cache max-duration 4",
1032 # "snmp-server inform retries 7",
1033 # "snmp-server notification-log-mib size 5",
1034 # "snmp-server notification-log-mib GlobalSize 5",
1035 # "snmp-server trap throttle-time 12",
1036 # "snmp-server timeouts inQdrop 0",
1037 # "snmp-server timeouts duplicate 0",
1038 # "snmp-server traps addrpool low",
1039 # "snmp-server traps addrpool high",
1040 # "snmp-server traps bfd",
1041 # "snmp-server traps bgp cbgp2",
1042 # "snmp-server traps bulkstat collection",
1043 # "snmp-server traps bridgemib",
1044 # "snmp-server traps copy-complete",
1045 # "snmp-server traps cisco-entity-ext",
1046 # "snmp-server traps config",
1047 # "snmp-server traps hsrp",
1048 # "snmp-server traps ipsla",
1049 # "snmp-server traps ipsec tunnel start",
1050 # "snmp-server traps ipsec tunnel stop",
1051 # "snmp-server traps l2tun sessions",
1052 # "snmp-server traps l2tun tunnel-up",
1053 # "snmp-server traps l2tun tunnel-down",
1054 # "snmp-server traps l2vpn all",
1055 # "snmp-server traps l2vpn vc-up",
1056 # "snmp-server traps l2vpn vc-down",
1057 # "snmp-server traps msdp peer-state-change",
1058 # "snmp-server community test2 RO SDROwner IPv4 test IPv6 test1",
1059 # "snmp-server community-map cm1 context c1 security-name s1 target-list t1",
1060 # "snmp-server context c1",
1061 # "snmp-server context c2",
1062 # "snmp-server user u1 test2 v1 IPv4 test1 IPv6 test2",
1063 # "snmp-server target list test2 vrf vrf2",
1064 # "snmp-server target list test host 1.1.1.2",
1065 # "snmp-server vrf vrf1",
1066 # "host 1.1.1.1 traps test1"
1067 #
1068 # ],
1069 # After state:
1070 # ------------
1071 # RP/0/RP0/CPU0:test2#show running-config snmp-server
1072 # Mon Nov 29 12:49:29.521 UTC
1073 # snmp-server vrf vrf1
1074 # host 1.1.1.1 traps test1
1075 # !
1076 # snmp-server drop report acl IPv4 test1
1077 # snmp-server drop unknown-user
1078 # snmp-server ipv4 dscp af11
1079 # snmp-server ipv6 precedence routine
1080 # snmp-server user u1 test2 v1 IPv4 test1 IPv6 test2
1081 # snmp-server community test2 RO SDROwner IPv4 test IPv6 test1
1082 # snmp-server queue-length 2
1083 # snmp-server trap-timeout 3
1084 # snmp-server trap throttle-time 12
1085 # snmp-server traps bfd
1086 # snmp-server traps bgp cbgp2
1087 # snmp-server traps copy-complete
1088 # snmp-server traps hsrp
1089 # snmp-server traps ipsla
1090 # snmp-server traps msdp peer-state-change
1091 # snmp-server traps ipsec tunnel stop
1092 # snmp-server traps ipsec tunnel start
1093 # snmp-server traps config
1094 # snmp-server traps l2tun sessions
1095 # snmp-server traps l2tun tunnel-up
1096 # snmp-server traps l2tun tunnel-down
1097 # snmp-server traps bulkstat collection
1098 # snmp-server traps l2vpn all
1099 # snmp-server traps l2vpn vc-up
1100 # snmp-server traps l2vpn vc-down
1101 # snmp-server traps bridgemib
1102 # snmp-server traps addrpool low
1103 # snmp-server traps addrpool high
1104 # snmp-server traps cisco-entity-ext
1105 # snmp-server chassis-id test2
1106 # snmp-server contact t1
1107 # snmp-server location test1
1108 # snmp-server target list test host 1.1.1.2
1109 # snmp-server target list test2 vrf vrf2
1110 # snmp-server context c1
1111 # snmp-server context c2
1112 # snmp-server logging threshold oid-processing 1
1113 # snmp-server logging threshold pdu-processing 1
1114 # snmp-server mib bulkstat max-procmem-size 101
1115 # snmp-server timeouts duplicate 0
1116 # snmp-server timeouts inQdrop 0
1117 # snmp-server packetsize 490
1118 # snmp-server correlator buffer-size 1024
1119 # snmp-server trap-source GigabitEthernet0/0/0/2
1120 # snmp-server throttle-time 60
1121 # snmp-server community-map cm1 context c1 security-name s1 target-list t1
1122 # snmp-server inform retries 7
1123 # snmp-server overload-control 4 6
1124 # snmp-server ifmib internal cache max-duration 4
1125 # snmp-server mroutemib send-all-vrf
1126 # snmp-server notification-log-mib size 5
1127 # snmp-server notification-log-mib GlobalSize 5
1128 #
1129 #
1130 # Using state: deleted
1131 # Before state:
1132 # -------------
1133 # RP/0/RP0/CPU0:test2#show running-config snmp-server
1134 # Mon Nov 29 12:49:29.521 UTC
1135 # snmp-server vrf vrf1
1136 # host 1.1.1.1 traps test1
1137 # !
1138 # snmp-server drop report acl IPv4 test1
1139 # snmp-server drop unknown-user
1140 # snmp-server ipv4 dscp af11
1141 # snmp-server ipv6 precedence routine
1142 # snmp-server user u1 test2 v1 IPv4 test1 IPv6 test2
1143 # snmp-server community test2 RO SDROwner IPv4 test IPv6 test1
1144 # snmp-server queue-length 2
1145 # snmp-server trap-timeout 3
1146 # snmp-server trap throttle-time 12
1147 # snmp-server traps bfd
1148 # snmp-server traps bgp cbgp2
1149 # snmp-server traps copy-complete
1150 # snmp-server traps hsrp
1151 # snmp-server traps ipsla
1152 # snmp-server traps msdp peer-state-change
1153 # snmp-server traps ipsec tunnel stop
1154 # snmp-server traps ipsec tunnel start
1155 # snmp-server traps config
1156 # snmp-server traps l2tun sessions
1157 # snmp-server traps l2tun tunnel-up
1158 # snmp-server traps l2tun tunnel-down
1159 # snmp-server traps bulkstat collection
1160 # snmp-server traps l2vpn all
1161 # snmp-server traps l2vpn vc-up
1162 # snmp-server traps l2vpn vc-down
1163 # snmp-server traps bridgemib
1164 # snmp-server traps addrpool low
1165 # snmp-server traps addrpool high
1166 # snmp-server traps cisco-entity-ext
1167 # snmp-server chassis-id test2
1168 # snmp-server contact t1
1169 # snmp-server location test1
1170 # snmp-server target list test host 1.1.1.2
1171 # snmp-server target list test2 vrf vrf2
1172 # snmp-server context c1
1173 # snmp-server context c2
1174 # snmp-server logging threshold oid-processing 1
1175 # snmp-server logging threshold pdu-processing 1
1176 # snmp-server mib bulkstat max-procmem-size 101
1177 # snmp-server timeouts duplicate 0
1178 # snmp-server timeouts inQdrop 0
1179 # snmp-server packetsize 490
1180 # snmp-server correlator buffer-size 1024
1181 # snmp-server trap-source GigabitEthernet0/0/0/2
1182 # snmp-server throttle-time 60
1183 # snmp-server community-map cm1 context c1 security-name s1 target-list t1
1184 # snmp-server inform retries 7
1185 # snmp-server overload-control 4 6
1186 # snmp-server ifmib internal cache max-duration 4
1187 # snmp-server mroutemib send-all-vrf
1188 # snmp-server notification-log-mib size 5
1189 # snmp-server notification-log-mib GlobalSize 5
1190 # Deleted play:
1191 # -------------
1192 - name: Remove all existing configuration
1193 cisco.iosxr.iosxr_snmp_server:
1194 state: deleted
1195 # Commands Fired:
1196 # ---------------
1197 # "commands": [
1198 # "no snmp-server chassis-id test2",
1199 # "no snmp-server correlator buffer-size 1024",
1200 # "no snmp-server contact t1",
1201 # "no snmp-server ipv4 dscp af11",
1202 # "no snmp-server ipv6 precedence routine",
1203 # "no snmp-server location test1",
1204 # "no snmp-server logging threshold oid-processing 1",
1205 # "no snmp-server logging threshold pdu-processing 1",
1206 # "no snmp-server mib bulkstat max-procmem-size 101",
1207 # "no snmp-server mroutemib send-all-vrf",
1208 # "no snmp-server overload-control 4 6",
1209 # "no snmp-server packetsize 490",
1210 # "no snmp-server queue-length 2",
1211 # "no snmp-server throttle-time 60",
1212 # "no snmp-server trap-source GigabitEthernet0/0/0/2",
1213 # "no snmp-server trap-timeout 3",
1214 # "no snmp-server drop report acl IPv4 test1",
1215 # "no snmp-server drop unknown-user",
1216 # "no snmp-server ifmib internal cache max-duration 4",
1217 # "no snmp-server inform retries 7",
1218 # "no snmp-server notification-log-mib size 5",
1219 # "no snmp-server notification-log-mib GlobalSize 5",
1220 # "no snmp-server trap throttle-time 12",
1221 # "no snmp-server timeouts inQdrop 0",
1222 # "no snmp-server timeouts duplicate 0",
1223 # "no snmp-server traps addrpool low",
1224 # "no snmp-server traps addrpool high",
1225 # "no snmp-server traps bfd",
1226 # "no snmp-server traps bgp cbgp2",
1227 # "no snmp-server traps bulkstat collection",
1228 # "no snmp-server traps bridgemib",
1229 # "no snmp-server traps copy-complete",
1230 # "no snmp-server traps cisco-entity-ext",
1231 # "no snmp-server traps config",
1232 # "no snmp-server traps hsrp",
1233 # "no snmp-server traps ipsla",
1234 # "no snmp-server traps ipsec tunnel start",
1235 # "no snmp-server traps ipsec tunnel stop",
1236 # "no snmp-server traps l2tun sessions",
1237 # "no snmp-server traps l2tun tunnel-up",
1238 # "no snmp-server traps l2tun tunnel-down",
1239 # "no snmp-server traps l2vpn all",
1240 # "no snmp-server traps l2vpn vc-up",
1241 # "no snmp-server traps l2vpn vc-down",
1242 # "no snmp-server traps msdp peer-state-change",
1243 # "no snmp-server community test2 RO SDROwner IPv4 test IPv6 test1",
1244 # "no snmp-server community-map cm1 context c1 security-name s1 target-list t1",
1245 # "no snmp-server context c1",
1246 # "no snmp-server context c2",
1247 # "no snmp-server user u1 test2 v1 IPv4 test1 IPv6 test2",
1248 # "no snmp-server target list test host 1.1.1.2",
1249 # "no snmp-server target list test2 vrf vrf2",
1250 # "no snmp-server vrf vrf1"
1251 # ],
1252 # After state:
1253 # ------------
1254 # RP/0/0/CPU0:10#show running-config ntp
1255 # --------------------- EMPTY -----------------
1256 # Using state: overridden
1257 # Before state:
1258 # -------------
1259 # RP/0/0/CPU0:10#show running-config snmp-server
1260 # snmp-server vrf vrf1
1261 # host 1.1.1.1 traps test1
1262 # !
1263 # snmp-server drop report acl IPv4 test1
1264 # snmp-server drop unknown-user
1265 # snmp-server ipv4 dscp af11
1266 # snmp-server ipv6 precedence routine
1267 # snmp-server user u1 test2 v1 IPv4 test1 IPv6 test2
1268 # snmp-server community test2 RO SDROwner IPv4 test IPv6 test1
1269 # snmp-server queue-length 2
1270 # snmp-server trap-timeout 3
1271 # snmp-server trap throttle-time 12
1272 # snmp-server traps bfd
1273 # snmp-server traps bgp cbgp2
1274 # snmp-server traps copy-complete
1275 # snmp-server traps hsrp
1276 # snmp-server traps ipsla
1277 # snmp-server traps msdp peer-state-change
1278 # snmp-server traps ipsec tunnel stop
1279 # snmp-server traps ipsec tunnel start
1280 # snmp-server traps config
1281 # snmp-server traps l2tun sessions
1282 # snmp-server traps l2tun tunnel-up
1283 # snmp-server traps l2tun tunnel-down
1284 # snmp-server traps bulkstat collection
1285 # snmp-server traps l2vpn all
1286 # snmp-server traps l2vpn vc-up
1287 # snmp-server traps l2vpn vc-down
1288 # snmp-server traps bridgemib
1289 # snmp-server traps addrpool low
1290 # snmp-server traps addrpool high
1291 # snmp-server traps cisco-entity-ext
1292 # snmp-server chassis-id test2
1293 # snmp-server contact t1
1294 # snmp-server location test1
1295 # snmp-server target list test host 1.1.1.2
1296 # snmp-server target list test2 vrf vrf2
1297 # snmp-server context c1
1298 # snmp-server context c2
1299 # snmp-server logging threshold oid-processing 1
1300 # snmp-server logging threshold pdu-processing 1
1301 # snmp-server mib bulkstat max-procmem-size 101
1302 # snmp-server timeouts duplicate 0
1303 # snmp-server timeouts inQdrop 0
1304 # snmp-server packetsize 490
1305 # snmp-server correlator buffer-size 1024
1306 # snmp-server trap-source GigabitEthernet0/0/0/2
1307 # snmp-server throttle-time 60
1308 # snmp-server community-map cm1 context c1 security-name s1 target-list t1
1309 # snmp-server inform retries 7
1310 # snmp-server overload-control 4 6
1311 # snmp-server ifmib internal cache max-duration 4
1312 # snmp-server mroutemib send-all-vrf
1313 # snmp-server notification-log-mib size 5
1314 # snmp-server notification-log-mib GlobalSize 5
1315 # Overridden play:
1316 # ----------------
1317 - name: Override Snmp-server configuration with provided configuration
1318 cisco.iosxr.iosxr_snmp_server:
1319 config:
1320 timeouts:
1321 duplicate: 0
1322 inQdrop: 0
1323 trap:
1324 throttle_time: 13
1325 targets:
1326 - host: 1.1.1.2
1327 name: test
1328 ifmib:
1329 internal_cache_max_duration: 5
1330 inform:
1331 retries: 7
1332 chassis_id: test
1333 packetsize: 491
1334 queue_length: 2
1335 throttle_time: 60
1336 trap_source: GigabitEthernet0/0/0/2
1337 trap_timeout: 3
1338 context:
1339 - c1
1340 - c2
1341 contact: t1
1342 correlator:
1343 buffer_size: 1025
1344 communities:
1345 - name: test1
1346 ro: true
1347 sdrowner: true
1348 acl_v4: test
1349 acl_v6: test1
1350 community_maps:
1351 - name: cm2
1352 context: c1
1353 target_list: t1
1354 security_name: s1
1355 drop:
1356 report_IPv4: test2
1357 unknown_user: true
1358 ipv6:
1359 precedence: routine
1360 ipv4:
1361 dscp: af11
1362 location: test1
1363 logging_threshold_oid_processing: 2
1364 logging_threshold_pdu_processing: 2
1365 mib_bulkstat_max_procmem_size: 101
1366 mroutemib_send_all_vrf: true
1367 overload_control:
1368 overload_drop_time: 4
1369 overload_throttle_rate: 6
1370 notification_log_mib:
1371 GlobalSize: 5
1372 size: 5
1373 traps:
1374 hsrp: true
1375 ipsla: true
1376 ipsec:
1377 start: true
1378 stop: true
1379 bridgemib: true
1380 bulkstat_collection: true
1381 cisco_entity_ext: true
1382 config: true
1383 copy_complete: true
1384 l2vpn:
1385 all: true
1386 vc_down: true
1387 vc_up: true
1388 msdp_peer_state_change: true
1389 state: overridden
1390
1391 # Commands Fired:
1392 # ---------------
1393 # "commands": [
1394 # "no snmp-server traps addrpool low",
1395 # "no snmp-server traps addrpool high",
1396 # "no snmp-server traps bfd",
1397 # "no snmp-server traps bgp cbgp2",
1398 # "no snmp-server traps l2tun sessions",
1399 # "no snmp-server traps l2tun tunnel-up",
1400 # "no snmp-server traps l2tun tunnel-down",
1401 # "no snmp-server community test2 RO SDROwner IPv4 test IPv6 test1",
1402 # "no snmp-server community-map cm1 context c1 security-name s1 target-list t1",
1403 # "no snmp-server user u1 test2 v1 IPv4 test1 IPv6 test2",
1404 # "no snmp-server vrf vrf1",
1405 # "snmp-server chassis-id test",
1406 # "snmp-server correlator buffer-size 1025",
1407 # "snmp-server logging threshold oid-processing 2",
1408 # "snmp-server logging threshold pdu-processing 2",
1409 # "snmp-server packetsize 491",
1410 # "snmp-server drop report acl IPv4 test2",
1411 # "snmp-server ifmib internal cache max-duration 5",
1412 # "snmp-server trap throttle-time 13",
1413 # "snmp-server community test1 RO SDROwner IPv4 test IPv6 test1",
1414 # "snmp-server community-map cm2 context c1 security-name s1 target-list t1"
1415 # ],
1416 # After state:
1417 # ------------
1418 # RP/0/RP0/CPU0:test2#show running-config snmp-server
1419 # Mon Nov 29 12:57:34.182 UTC
1420 # snmp-server drop report acl IPv4 test2
1421 # snmp-server drop unknown-user
1422 # snmp-server ipv4 dscp af11
1423 # snmp-server ipv6 precedence routine
1424 # snmp-server community test1 RO SDROwner IPv4 test IPv6 test1
1425 # snmp-server queue-length 2
1426 # snmp-server trap-timeout 3
1427 # snmp-server trap throttle-time 13
1428 # snmp-server traps copy-complete
1429 # snmp-server traps hsrp
1430 # snmp-server traps ipsla
1431 # snmp-server traps msdp peer-state-change
1432 # snmp-server traps ipsec tunnel stop
1433 # snmp-server traps ipsec tunnel start
1434 # snmp-server traps config
1435 # snmp-server traps bulkstat collection
1436 # snmp-server traps l2vpn all
1437 # snmp-server traps l2vpn vc-up
1438 # snmp-server traps l2vpn vc-down
1439 # snmp-server traps bridgemib
1440 # snmp-server traps cisco-entity-ext
1441 # snmp-server chassis-id test
1442 # snmp-server contact t1
1443 # snmp-server location test1
1444 # snmp-server target list test host 1.1.1.2
1445 # snmp-server target list test2 vrf vrf2
1446 # snmp-server context c1
1447 # snmp-server context c2
1448 # snmp-server logging threshold oid-processing 2
1449 # snmp-server logging threshold pdu-processing 2
1450 # snmp-server mib bulkstat max-procmem-size 101
1451 # snmp-server timeouts duplicate 0
1452 # snmp-server timeouts inQdrop 0
1453 # snmp-server packetsize 491
1454 # snmp-server correlator buffer-size 1025
1455 # snmp-server trap-source GigabitEthernet0/0/0/2
1456 # snmp-server throttle-time 60
1457 # snmp-server community-map cm2 context c1 security-name s1 target-list t1
1458 # snmp-server inform retries 7
1459 # snmp-server overload-control 4 6
1460 # snmp-server ifmib internal cache max-duration 5
1461 # snmp-server mroutemib send-all-vrf
1462 # snmp-server notification-log-mib size 5
1463 # snmp-server notification-log-mib GlobalSize 5
1464 #
1465 # Using state: replaced
1466 # Before state:
1467 # -------------
1468 # RP/0/0/CPU0:10#show running-config snmp-server
1469 # snmp-server vrf vrf1
1470 # host 1.1.1.1 traps test1
1471 # !
1472 # snmp-server drop report acl IPv4 test1
1473 # snmp-server drop unknown-user
1474 # snmp-server ipv4 dscp af11
1475 # snmp-server ipv6 precedence routine
1476 # snmp-server user u1 test2 v1 IPv4 test1 IPv6 test2
1477 # snmp-server community test2 RO SDROwner IPv4 test IPv6 test1
1478 # snmp-server queue-length 2
1479 # snmp-server trap-timeout 3
1480 # snmp-server trap throttle-time 12
1481 # snmp-server traps bfd
1482 # snmp-server traps bgp cbgp2
1483 # snmp-server traps copy-complete
1484 # snmp-server traps hsrp
1485 # snmp-server traps ipsla
1486 # snmp-server traps msdp peer-state-change
1487 # snmp-server traps ipsec tunnel stop
1488 # snmp-server traps ipsec tunnel start
1489 # snmp-server traps config
1490 # snmp-server traps l2tun sessions
1491 # snmp-server traps l2tun tunnel-up
1492 # snmp-server traps l2tun tunnel-down
1493 # snmp-server traps bulkstat collection
1494 # snmp-server traps l2vpn all
1495 # snmp-server traps l2vpn vc-up
1496 # snmp-server traps l2vpn vc-down
1497 # snmp-server traps bridgemib
1498 # snmp-server traps addrpool low
1499 # snmp-server traps addrpool high
1500 # snmp-server traps cisco-entity-ext
1501 # snmp-server chassis-id test2
1502 # snmp-server contact t1
1503 # snmp-server location test1
1504 # snmp-server target list test host 1.1.1.2
1505 # snmp-server target list test2 vrf vrf2
1506 # snmp-server context c1
1507 # snmp-server context c2
1508 # snmp-server logging threshold oid-processing 1
1509 # snmp-server logging threshold pdu-processing 1
1510 # snmp-server mib bulkstat max-procmem-size 101
1511 # snmp-server timeouts duplicate 0
1512 # snmp-server timeouts inQdrop 0
1513 # snmp-server packetsize 490
1514 # snmp-server correlator buffer-size 1024
1515 # snmp-server trap-source GigabitEthernet0/0/0/2
1516 # snmp-server throttle-time 60
1517 # snmp-server community-map cm1 context c1 security-name s1 target-list t1
1518 # snmp-server inform retries 7
1519 # snmp-server overload-control 4 6
1520 # snmp-server ifmib internal cache max-duration 4
1521 # snmp-server mroutemib send-all-vrf
1522 # snmp-server notification-log-mib size 5
1523 # snmp-server notification-log-mib GlobalSize 5
1524 #
1525 #
1526 # Replaced play:
1527 # ----------------
1528 - name: Replace Snmp-server configuration with provided configuration
1529 cisco.iosxr.iosxr_snmp_server:
1530 state: replaced
1531 config:
1532 timeouts:
1533 duplicate: 0
1534 inQdrop: 0
1535 trap:
1536 throttle_time: 13
1537 targets:
1538 - host: 1.1.1.2
1539 name: test
1540 ifmib:
1541 internal_cache_max_duration: 5
1542 inform:
1543 retries: 7
1544 chassis_id: test
1545 packetsize: 491
1546 queue_length: 2
1547 throttle_time: 60
1548 trap_source: GigabitEthernet0/0/0/2
1549 trap_timeout: 3
1550 context:
1551 - c1
1552 - c2
1553 contact: t1
1554 correlator:
1555 buffer_size: 1025
1556 communities:
1557 - name: test1
1558 ro: true
1559 sdrowner: true
1560 acl_v4: test
1561 acl_v6: test1
1562 community_maps:
1563 - name: cm2
1564 context: c1
1565 target_list: t1
1566 security_name: s1
1567 drop:
1568 report_IPv4: test2
1569 unknown_user: true
1570 ipv6:
1571 precedence: routine
1572 ipv4:
1573 dscp: af11
1574 location: test1
1575 logging_threshold_oid_processing: 2
1576 logging_threshold_pdu_processing: 2
1577 mib_bulkstat_max_procmem_size: 101
1578 mroutemib_send_all_vrf: true
1579 overload_control:
1580 overload_drop_time: 4
1581 overload_throttle_rate: 6
1582 notification_log_mib:
1583 GlobalSize: 5
1584 size: 5
1585 traps:
1586 hsrp: true
1587 ipsla: true
1588 ipsec:
1589 start: true
1590 stop: true
1591 bridgemib: true
1592 bulkstat_collection: true
1593 cisco_entity_ext: true
1594 config: true
1595 copy_complete: true
1596 l2vpn:
1597 all: true
1598 vc_down: true
1599 vc_up: true
1600 msdp_peer_state_change: true
1601
1602 #
1603 # Commands Fired:
1604 # ---------------
1605 # "commands": [
1606 # "no snmp-server traps addrpool low",
1607 # "no snmp-server traps addrpool high",
1608 # "no snmp-server traps bfd",
1609 # "no snmp-server traps bgp cbgp2",
1610 # "no snmp-server traps l2tun sessions",
1611 # "no snmp-server traps l2tun tunnel-up",
1612 # "no snmp-server traps l2tun tunnel-down",
1613 # "no snmp-server community test2 RO SDROwner IPv4 test IPv6 test1",
1614 # "no snmp-server community-map cm1 context c1 security-name s1 target-list t1",
1615 # "no snmp-server user u1 test2 v1 IPv4 test1 IPv6 test2",
1616 # "no snmp-server vrf vrf1",
1617 # "snmp-server chassis-id test",
1618 # "snmp-server correlator buffer-size 1025",
1619 # "snmp-server logging threshold oid-processing 2",
1620 # "snmp-server logging threshold pdu-processing 2",
1621 # "snmp-server packetsize 491",
1622 # "snmp-server drop report acl IPv4 test2",
1623 # "snmp-server ifmib internal cache max-duration 5",
1624 # "snmp-server trap throttle-time 13",
1625 # "snmp-server community test1 RO SDROwner IPv4 test IPv6 test1",
1626 # "snmp-server community-map cm2 context c1 security-name s1 target-list t1"
1627 # ],
1628 # After state:
1629 # ------------
1630 # RP/0/RP0/CPU0:ios#show running-config snmp-server
1631 # Mon Sep 13 10:38:22.690 UTC
1632 # RP/0/0/CPU0:10#show running-config snmp-server
1633 # snmp-server vrf vrf1
1634 # host 1.1.1.1 traps test1
1635 # !
1636 # snmp-server drop report acl IPv4 test1
1637 # snmp-server drop unknown-user
1638 # snmp-server ipv4 dscp af11
1639 # snmp-server ipv6 precedence routine
1640 # snmp-server user u1 test2 v1 IPv4 test1 IPv6 test2
1641 # snmp-server community test2 RO SDROwner IPv4 test IPv6 test1
1642 # snmp-server queue-length 2
1643 # snmp-server trap-timeout 3
1644 # snmp-server trap throttle-time 12
1645 # snmp-server traps bfd
1646 # snmp-server traps bgp cbgp2
1647 # snmp-server traps copy-complete
1648 # snmp-server traps hsrp
1649 # snmp-server traps ipsla
1650 # snmp-server traps msdp peer-state-change
1651 # snmp-server traps ipsec tunnel stop
1652 # snmp-server traps ipsec tunnel start
1653 # snmp-server traps config
1654 # snmp-server traps l2tun sessions
1655 # snmp-server traps l2tun tunnel-up
1656 # snmp-server traps l2tun tunnel-down
1657 # snmp-server traps bulkstat collection
1658 # snmp-server traps l2vpn all
1659 # snmp-server traps l2vpn vc-up
1660 # snmp-server traps l2vpn vc-down
1661 # snmp-server traps bridgemib
1662 # snmp-server traps addrpool low
1663 # snmp-server traps addrpool high
1664 # snmp-server traps cisco-entity-ext
1665 # snmp-server chassis-id test2
1666 # snmp-server contact t1
1667 # snmp-server location test1
1668 # snmp-server target list test host 1.1.1.2
1669 # snmp-server target list test2 vrf vrf2
1670 # snmp-server context c1
1671 # snmp-server context c2
1672 # snmp-server logging threshold oid-processing 1
1673 # snmp-server logging threshold pdu-processing 1
1674 # snmp-server mib bulkstat max-procmem-size 101
1675 # snmp-server timeouts duplicate 0
1676 # snmp-server timeouts inQdrop 0
1677 # snmp-server packetsize 490
1678 # snmp-server correlator buffer-size 1024
1679 # snmp-server trap-source GigabitEthernet0/0/0/2
1680 # snmp-server throttle-time 60
1681 # snmp-server community-map cm1 context c1 security-name s1 target-list t1
1682 # snmp-server inform retries 7
1683 # snmp-server overload-control 4 6
1684 # snmp-server ifmib internal cache max-duration 4
1685 # snmp-server mroutemib send-all-vrf
1686 # snmp-server notification-log-mib size 5
1687 # snmp-server notification-log-mib GlobalSize 5
1688 #
1689 #
1690 # Using state: gathered
1691 # Before state:
1692 # -------------
1693 # RP/0/RP0/CPU0:test2#show running-config snmp-server
1694 # Mon Nov 29 12:49:29.521 UTC
1695 # snmp-server vrf vrf1
1696 # host 1.1.1.1 traps test1
1697 # !
1698 # snmp-server drop report acl IPv4 test1
1699 # snmp-server drop unknown-user
1700 # snmp-server ipv4 dscp af11
1701 # snmp-server ipv6 precedence routine
1702 # snmp-server user u1 test2 v1 IPv4 test1 IPv6 test2
1703 # snmp-server community test2 RO SDROwner IPv4 test IPv6 test1
1704 # snmp-server queue-length 2
1705 # snmp-server trap-timeout 3
1706 # snmp-server trap throttle-time 12
1707 # snmp-server traps bfd
1708 # snmp-server traps bgp cbgp2
1709 # snmp-server traps copy-complete
1710 # snmp-server traps hsrp
1711 # snmp-server traps ipsla
1712 # snmp-server traps msdp peer-state-change
1713 # snmp-server traps ipsec tunnel stop
1714 # snmp-server traps ipsec tunnel start
1715 # snmp-server traps config
1716 # snmp-server traps l2tun sessions
1717 # snmp-server traps l2tun tunnel-up
1718 # snmp-server traps l2tun tunnel-down
1719 # snmp-server traps bulkstat collection
1720 # snmp-server traps l2vpn all
1721 # snmp-server traps l2vpn vc-up
1722 # snmp-server traps l2vpn vc-down
1723 # snmp-server traps bridgemib
1724 # snmp-server traps addrpool low
1725 # snmp-server traps addrpool high
1726 # snmp-server traps cisco-entity-ext
1727 # snmp-server chassis-id test2
1728 # snmp-server contact t1
1729 # snmp-server location test1
1730 # snmp-server target list test host 1.1.1.2
1731 # snmp-server target list test2 vrf vrf2
1732 # snmp-server context c1
1733 # snmp-server context c2
1734 # snmp-server logging threshold oid-processing 1
1735 # snmp-server logging threshold pdu-processing 1
1736 # snmp-server mib bulkstat max-procmem-size 101
1737 # snmp-server timeouts duplicate 0
1738 # snmp-server timeouts inQdrop 0
1739 # snmp-server packetsize 490
1740 # snmp-server correlator buffer-size 1024
1741 # snmp-server trap-source GigabitEthernet0/0/0/2
1742 # snmp-server throttle-time 60
1743 # snmp-server community-map cm1 context c1 security-name s1 target-list t1
1744 # snmp-server inform retries 7
1745 # snmp-server overload-control 4 6
1746 # snmp-server ifmib internal cache max-duration 4
1747 # snmp-server mroutemib send-all-vrf
1748 # snmp-server notification-log-mib size 5
1749 # snmp-server notification-log-mib GlobalSize 5
1750 # Gathered play:
1751 # --------------
1752 - name: Gather listed snmp server
1753 cisco.iosxr.iosxr_snmp_server:
1754 state: gathered
1755 # Module Execution Result:
1756 # ------------------------
1757 # "gathered": {
1758 # "chassis_id": "test2",
1759 # "communities": [
1760 # {
1761 # "acl_v4": "test",
1762 # "acl_v6": "test1",
1763 # "name": "test2",
1764 # "ro": true,
1765 # "sdrowner": true
1766 # }
1767 # ],
1768 # "community_maps": [
1769 # {
1770 # "context": "c1",
1771 # "name": "cm1",
1772 # "security_name": "s1",
1773 # "target_list": "t1"
1774 # }
1775 # ],
1776 # "contact": "t1",
1777 # "context": [
1778 # "c1",
1779 # "c2"
1780 # ],
1781 # "correlator": {
1782 # "buffer_size": 1024
1783 # },
1784 # "drop": {
1785 # "report_IPv4": "test1",
1786 # "unknown_user": true
1787 # },
1788 # "ifmib": {
1789 # "internal_cache_max_duration": 4
1790 # },
1791 # "inform": {
1792 # "retries": 7
1793 # },
1794 # "ipv4": {
1795 # "dscp": "af11"
1796 # },
1797 # "ipv6": {
1798 # "precedence": "routine"
1799 # },
1800 # "location": "test1",
1801 # "logging_threshold_oid_processing": 1,
1802 # "logging_threshold_pdu_processing": 1,
1803 # "mib_bulkstat_max_procmem_size": 101,
1804 # "mroutemib_send_all_vrf": true,
1805 # "notification_log_mib": {
1806 # "GlobalSize": 5,
1807 # "size": 5
1808 # },
1809 # "overload_control": {
1810 # "overload_drop_time": 4,
1811 # "overload_throttle_rate": 6
1812 # },
1813 # "packetsize": 490,
1814 # "queue_length": 2,
1815 # "targets": [
1816 # {
1817 # "host": "1.1.1.2",
1818 # "name": "test"
1819 # },
1820 # {
1821 # "name": "test2",
1822 # "vrf": "vrf2"
1823 # }
1824 # ],
1825 # "throttle_time": 60,
1826 # "timeouts": {
1827 # "duplicate": 0,
1828 # "inQdrop": 0
1829 # },
1830 # "trap": {
1831 # "throttle_time": 12
1832 # },
1833 # "trap_source": "GigabitEthernet0/0/0/2",
1834 # "trap_timeout": 3,
1835 # "traps": {
1836 # "addrpool": {
1837 # "high": true,
1838 # "low": true
1839 # },
1840 # "bfd": true,
1841 # "bgp": {
1842 # "cbgp2": true
1843 # },
1844 # "bridgemib": true,
1845 # "bulkstat_collection": true,
1846 # "cisco_entity_ext": true,
1847 # "config": true,
1848 # "copy_complete": true,
1849 # "hsrp": true,
1850 # "ipsec": {
1851 # "start": true,
1852 # "stop": true
1853 # },
1854 # "ipsla": true,
1855 # "l2tun": {
1856 # "sessions": true,
1857 # "tunnel_down": true,
1858 # "tunnel_up": true
1859 # },
1860 # "l2vpn": {
1861 # "all": true,
1862 # "vc_down": true,
1863 # "vc_up": true
1864 # },
1865 # "msdp_peer_state_change": true
1866 # },
1867 # "users": [
1868 # {
1869 # "Ipv4_acl": "test1",
1870 # "Ipv6_acl": "test2",
1871 # "group": "test2",
1872 # "user": "u1",
1873 # "version": "v1"
1874 # }
1875 # ],
1876 # "vrfs": [
1877 # {
1878 # "hosts": [
1879 # {
1880 # "community": "test1",
1881 # "host": "1.1.1.1",
1882 # "traps": true
1883 # }
1884 # ],
1885 # "vrf": "vrf1"
1886 # }
1887 # ]
1888 # }
1889 #
1890 #
1891 # Using state: rendered
1892 # Rendered play:
1893 # --------------
1894 - name: >-
1895 Render platform specific configuration lines with state rendered (without
1896 connecting to the device)
1897 cisco.iosxr.iosxr_snmp_server:
1898 state: rendered
1899 config:
1900 vrfs:
1901 - hosts:
1902 - community: test1
1903 host: 1.1.1.1
1904 traps: true
1905 vrf: vrf1
1906 users:
1907 - Ipv4_acl: test1
1908 Ipv6_acl: test2
1909 group: test2
1910 user: u1
1911 version: v1
1912 timeouts:
1913 duplicate: 0
1914 inQdrop: 0
1915 trap:
1916 throttle_time: 12
1917 targets:
1918 - host: 1.1.1.2
1919 name: test
1920 ifmib:
1921 internal_cache_max_duration: 4
1922 inform:
1923 retries: 7
1924 chassis_id: test2
1925 packetsize: 490
1926 queue_length: 2
1927 throttle_time: 60
1928 trap_source: GigabitEthernet0/0/0/2
1929 trap_timeout: 3
1930 context:
1931 - c1
1932 - c2
1933 contact: t1
1934 correlator:
1935 buffer_size: 1024
1936 communities:
1937 - name: test2
1938 ro: true
1939 sdrowner: true
1940 acl_v4: test
1941 acl_v6: test1
1942 community_maps:
1943 - name: cm1
1944 context: c1
1945 target_list: t1
1946 security_name: s1
1947 drop:
1948 report_IPv4: test1
1949 unknown_user: true
1950 ipv6:
1951 precedence: routine
1952 ipv4:
1953 dscp: af11
1954 location: test1
1955 logging_threshold_oid_processing: 1
1956 logging_threshold_pdu_processing: 1
1957 mib_bulkstat_max_procmem_size: 101
1958 mroutemib_send_all_vrf: true
1959 overload_control:
1960 overload_drop_time: 4
1961 overload_throttle_rate: 6
1962 notification_log_mib:
1963 GlobalSize: 5
1964 size: 5
1965 traps:
1966 hsrp: true
1967 ipsla: true
1968 ipsec:
1969 start: true
1970 stop: true
1971 bridgemib: true
1972 bulkstat_collection: true
1973 cisco_entity_ext: true
1974 config: true
1975 copy_complete: true
1976 addrpool:
1977 high: true
1978 low: true
1979 bfd: true
1980 bgp:
1981 cbgp2: true
1982 l2tun:
1983 sessions: true
1984 tunnel_down: true
1985 tunnel_up: true
1986 l2vpn:
1987 all: true
1988 vc_down: true
1989 vc_up: true
1990 msdp_peer_state_change: true
1991 register: result
1992
1993 # Module Execution Result:
1994 # ------------------------
1995 # "rendered": [
1996 # "snmp-server chassis-id test2",
1997 # "snmp-server correlator buffer-size 1024",
1998 # "snmp-server contact t1",
1999 # "snmp-server ipv4 dscp af11",
2000 # "snmp-server ipv6 precedence routine",
2001 # "snmp-server location test1",
2002 # "snmp-server logging threshold oid-processing 1",
2003 # "snmp-server logging threshold pdu-processing 1",
2004 # "snmp-server mib bulkstat max-procmem-size 101",
2005 # "snmp-server mroutemib send-all-vrf",
2006 # "snmp-server overload-control 4 6",
2007 # "snmp-server packetsize 490",
2008 # "snmp-server queue-length 2",
2009 # "snmp-server throttle-time 60",
2010 # "snmp-server trap-source GigabitEthernet0/0/0/2",
2011 # "snmp-server trap-timeout 3",
2012 # "snmp-server drop report acl IPv4 test1",
2013 # "snmp-server drop unknown-user",
2014 # "snmp-server ifmib internal cache max-duration 4",
2015 # "snmp-server inform retries 7",
2016 # "snmp-server notification-log-mib size 5",
2017 # "snmp-server notification-log-mib GlobalSize 5",
2018 # "snmp-server trap throttle-time 12",
2019 # "snmp-server timeouts inQdrop 0",
2020 # "snmp-server timeouts duplicate 0",
2021 # "snmp-server traps addrpool low",
2022 # "snmp-server traps addrpool high",
2023 # "snmp-server traps bfd",
2024 # "snmp-server traps bgp cbgp2",
2025 # "snmp-server traps bulkstat collection",
2026 # "snmp-server traps bridgemib",
2027 # "snmp-server traps copy-complete",
2028 # "snmp-server traps cisco-entity-ext",
2029 # "snmp-server traps config",
2030 # "snmp-server traps hsrp",
2031 # "snmp-server traps ipsla",
2032 # "snmp-server traps ipsec tunnel start",
2033 # "snmp-server traps ipsec tunnel stop",
2034 # "snmp-server traps l2tun sessions",
2035 # "snmp-server traps l2tun tunnel-up",
2036 # "snmp-server traps l2tun tunnel-down",
2037 # "snmp-server traps l2vpn all",
2038 # "snmp-server traps l2vpn vc-up",
2039 # "snmp-server traps l2vpn vc-down",
2040 # "snmp-server traps msdp peer-state-change",
2041 # "snmp-server community test2 RO SDROwner IPv4 test IPv6 test1",
2042 # "snmp-server community-map cm1 context c1 security-name s1 target-list t1",
2043 # "snmp-server context c1",
2044 # "snmp-server context c2",
2045 # "snmp-server user u1 test2 v1 IPv4 test1 IPv6 test2",
2046 # "snmp-server target list test2 vrf vrf2",
2047 # "snmp-server target list test host 1.1.1.2",
2048 # "snmp-server vrf vrf1",
2049 # "host 1.1.1.1 traps test1"
2050 # ],
2051 # Using state: parsed
2052 # File: parsed.cfg
2053 # ----------------
2054 # snmp-server vrf vrf1
2055 # host 1.1.1.1 traps test1
2056 # !
2057 # snmp-server drop report acl IPv4 test1
2058 # snmp-server drop unknown-user
2059 # snmp-server ipv4 dscp af11
2060 # snmp-server ipv6 precedence routine
2061 # snmp-server user u1 test2 v1 IPv4 test1 IPv6 test2
2062 # snmp-server community test2 RO SDROwner IPv4 test IPv6 test1
2063 # snmp-server queue-length 2
2064 # snmp-server trap-timeout 3
2065 # snmp-server trap throttle-time 12
2066 # snmp-server traps bfd
2067 # snmp-server traps bgp cbgp2
2068 # snmp-server traps copy-complete
2069 # snmp-server traps hsrp
2070 # snmp-server traps ipsla
2071 # snmp-server traps msdp peer-state-change
2072 # snmp-server traps ipsec tunnel stop
2073 # snmp-server traps ipsec tunnel start
2074 # snmp-server traps config
2075 # snmp-server traps l2tun sessions
2076 # snmp-server traps l2tun tunnel-up
2077 # snmp-server traps l2tun tunnel-down
2078 # snmp-server traps bulkstat collection
2079 # snmp-server traps l2vpn all
2080 # snmp-server traps l2vpn vc-up
2081 # snmp-server traps l2vpn vc-down
2082 # snmp-server traps bridgemib
2083 # snmp-server traps addrpool low
2084 # snmp-server traps addrpool high
2085 # snmp-server traps cisco-entity-ext
2086 # snmp-server chassis-id test2
2087 # snmp-server contact t1
2088 # snmp-server location test1
2089 # snmp-server target list test host 1.1.1.2
2090 # snmp-server target list test2 vrf vrf2
2091 # snmp-server context c1
2092 # snmp-server context c2
2093 # snmp-server logging threshold oid-processing 1
2094 # snmp-server logging threshold pdu-processing 1
2095 # snmp-server mib bulkstat max-procmem-size 101
2096 # snmp-server timeouts duplicate 0
2097 # snmp-server timeouts inQdrop 0
2098 # snmp-server packetsize 490
2099 # snmp-server correlator buffer-size 1024
2100 # snmp-server trap-source GigabitEthernet0/0/0/2
2101 # snmp-server throttle-time 60
2102 # snmp-server community-map cm1 context c1 security-name s1 target-list t1
2103 # snmp-server inform retries 7
2104 # snmp-server overload-control 4 6
2105 # snmp-server ifmib internal cache max-duration 4
2106 # snmp-server mroutemib send-all-vrf
2107 # snmp-server notification-log-mib size 5
2108 # snmp-server notification-log-mib GlobalSize 5
2109 # ------------
2110 - name: Parse the provided configuration with the existing running configuration
2111 cisco.iosxr.iosxr_snmp_server:
2112 running_config: "{{ lookup('file', 'parsed.cfg') }}"
2113 state: parsed
2114 # Module Execution Result:
2115 # ------------------------
2116 # "parsed":{
2117 # "chassis_id": "test2",
2118 # "communities": [
2119 # {
2120 # "acl_v4": "test",
2121 # "acl_v6": "test1",
2122 # "name": "test2",
2123 # "ro": true,
2124 # "sdrowner": true
2125 # }
2126 # ],
2127 # "community_maps": [
2128 # {
2129 # "context": "c1",
2130 # "name": "cm1",
2131 # "security_name": "s1",
2132 # "target_list": "t1"
2133 # }
2134 # ],
2135 # "contact": "t1",
2136 # "context": [
2137 # "c1",
2138 # "c2"
2139 # ],
2140 # "correlator": {
2141 # "buffer_size": 1024
2142 # },
2143 # "drop": {
2144 # "report_IPv4": "test1",
2145 # "unknown_user": true
2146 # },
2147 # "ifmib": {
2148 # "internal_cache_max_duration": 4
2149 # },
2150 # "inform": {
2151 # "retries": 7
2152 # },
2153 # "ipv4": {
2154 # "dscp": "af11"
2155 # },
2156 # "ipv6": {
2157 # "precedence": "routine"
2158 # },
2159 # "location": "test1",
2160 # "logging_threshold_oid_processing": 1,
2161 # "logging_threshold_pdu_processing": 1,
2162 # "mib_bulkstat_max_procmem_size": 101,
2163 # "mroutemib_send_all_vrf": true,
2164 # "notification_log_mib": {
2165 # "GlobalSize": 5,
2166 # "size": 5
2167 # },
2168 # "overload_control": {
2169 # "overload_drop_time": 4,
2170 # "overload_throttle_rate": 6
2171 # },
2172 # "packetsize": 490,
2173 # "queue_length": 2,
2174 # "targets": [
2175 # {
2176 # "host": "1.1.1.2",
2177 # "name": "test"
2178 # },
2179 # {
2180 # "name": "test2",
2181 # "vrf": "vrf2"
2182 # }
2183 # ],
2184 # "throttle_time": 60,
2185 # "timeouts": {
2186 # "duplicate": 0,
2187 # "inQdrop": 0
2188 # },
2189 # "trap": {
2190 # "throttle_time": 12
2191 # },
2192 # "trap_source": "GigabitEthernet0/0/0/2",
2193 # "trap_timeout": 3,
2194 # "traps": {
2195 # "addrpool": {
2196 # "high": true,
2197 # "low": true
2198 # },
2199 # "bfd": true,
2200 # "bgp": {
2201 # "cbgp2": true
2202 # },
2203 # "bridgemib": true,
2204 # "bulkstat_collection": true,
2205 # "cisco_entity_ext": true,
2206 # "config": true,
2207 # "copy_complete": true,
2208 # "hsrp": true,
2209 # "ipsec": {
2210 # "start": true,
2211 # "stop": true
2212 # },
2213 # "ipsla": true,
2214 # "l2tun": {
2215 # "sessions": true,
2216 # "tunnel_down": true,
2217 # "tunnel_up": true
2218 # },
2219 # "l2vpn": {
2220 # "all": true,
2221 # "vc_down": true,
2222 # "vc_up": true
2223 # },
2224 # "msdp_peer_state_change": true
2225 # },
2226 # "users": [
2227 # {
2228 # "Ipv4_acl": "test1",
2229 # "Ipv6_acl": "test2",
2230 # "group": "test2",
2231 # "user": "u1",
2232 # "version": "v1"
2233 # }
2234 # ],
2235 # "vrfs": [
2236 # {
2237 # "hosts": [
2238 # {
2239 # "community": "test1",
2240 # "host": "1.1.1.1",
2241 # "traps": true
2242 # }
2243 # ],
2244 # "vrf": "vrf1"
2245 # }
2246 # ]
2247 # }
2248 """
2249
2250 RETURN = """
2251 before:
2252 description: The configuration prior to the module execution.
2253 returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged)
2254 type: dict
2255 sample: >
2256 This output will always be in the same format as the
2257 module argspec.
2258 after:
2259 description: The resulting configuration after module execution.
2260 returned: when changed
2261 type: dict
2262 sample: >
2263 This output will always be in the same format as the
2264 module argspec.
2265 commands:
2266 description: The set of commands pushed to the remote device.
2267 returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged)
2268 type: list
2269 sample:
2270 - sample command 1
2271 - sample command 2
2272 - sample command 3
2273 rendered:
2274 description: The provided configuration in the task rendered in device-native format (offline).
2275 returned: when I(state) is C(rendered)
2276 type: list
2277 sample:
2278 - sample command 1
2279 - sample command 2
2280 - sample command 3
2281 gathered:
2282 description: Facts about the network resource gathered from the remote device as structured data.
2283 returned: when I(state) is C(gathered)
2284 type: list
2285 sample: >
2286 This output will always be in the same format as the
2287 module argspec.
2288 parsed:
2289 description: The device native config provided in I(running_config) option parsed into structured data as per module argspec.
2290 returned: when I(state) is C(parsed)
2291 type: list
2292 sample: >
2293 This output will always be in the same format as the
2294 module argspec.
2295 """
2296
2297 from ansible.module_utils.basic import AnsibleModule
2298
2299 from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.argspec.snmp_server.snmp_server import (
2300 Snmp_serverArgs,
2301 )
2302 from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.config.snmp_server.snmp_server import (
2303 Snmp_server,
2304 )
2305
2306
2307 def main():
2308 """
2309 Main entry point for module execution
2310
2311 :returns: the result form module invocation
2312 """
2313 module = AnsibleModule(
2314 argument_spec=Snmp_serverArgs.argument_spec,
2315 mutually_exclusive=[["config", "running_config"]],
2316 required_if=[
2317 ["state", "merged", ["config"]],
2318 ["state", "replaced", ["config"]],
2319 ["state", "overridden", ["config"]],
2320 ["state", "rendered", ["config"]],
2321 ["state", "parsed", ["running_config"]],
2322 ],
2323 supports_check_mode=True,
2324 )
2325
2326 result = Snmp_server(module).execute_module()
2327 module.exit_json(**result)
2328
2329
2330 if __name__ == "__main__":
2331 main()