Skip to content

Latest commit

 

History

History
6883 lines (6796 loc) · 282 KB

cisco.iosxr.iosxr_snmp_server_module.rst

File metadata and controls

6883 lines (6796 loc) · 282 KB

cisco.iosxr.iosxr_snmp_server

Resource module to configure snmp server.

Version added: 2.6.0

  • This module configures and manages the attributes of snmp-server on Cisco IOSXR platforms.
Parameter Choices/Defaults Comments
config
dictionary
SNMP server configuration.
chassis_id
string
SNMP chassis identifier.
communities
list / elements=dictionary
Enable SNMP; set community string and access privileges.
acl_v4
string
Ipv4 access list.
acl_v6
string
IPv6 access list name.
name
string
Community name.
ro
boolean
    Choices:
  • no
  • yes
Only reads are permitted.
rw
boolean
    Choices:
  • no
  • yes
Read-write access.
sdrowner
boolean
    Choices:
  • no
  • yes
SDR Owner permissions for MIB Objects.
systemowner
boolean
    Choices:
  • no
  • yes
System Owner permissions for MIB objects.
v4_acl
string
V4 Access-list name.
community_maps
list / elements=dictionary
Community Mapping as per RFC-2576.
context
string
Context Name for the community mapping.
name
string
Community name
security_name
string
Security Name for the community mapping.
target_list
string
list of targets valid with this community.
contact
string
Person to contact about the syste,.
context
list / elements=string
Create/Delete a context apart from default
correlator
dictionary
Configure properties of the event correlator
buffer_size
integer
Configure size of the correlator buffer.
rule_sets
list / elements=dictionary
Configure a specified correlation ruleset.
name
string
Name of the ruleset
rules
list / elements=dictionary
Configure a specified correlation rule.
rule_name
string
name of rule.
timeout
integer
Specify timeout.
drop
dictionary
Silently drop SNMP packets
report_IPv4
string
Config to drop snmpv3 error reports matching Ipv4 ACL.
report_IPv6
string
Config to drop snmpv3 error reports matching Ipv4 ACL.
unknown_user
boolean
    Choices:
  • no
  • yes
Silently drop unknown v3 user packets
engineid
dictionary
SNMPv3 engine ID configuration.
local
string
Local SNMP agent
groups
list / elements=dictionary
SNMP USM group
acl_v4
string
Ipv4 Type of Access-list

aliases: Ipv4_acl
acl_v6
string
Ipv6 Type of Access-list

aliases: Ipv6_acl
context
string
Specify a context to associate with the group
group
string
SNMP group for the user
notify
string
View to restrict notifications
read
string
View to restrict read access
v4_acl
string
V4 Access-list name
version
string
    Choices:
  • v1
  • v3
  • v2c
snmp security group version
write
string
View to restrict write access
hosts
list / elements=dictionary
Notification destinations
community
string
community string.
host
string
Hostname or IP address of SNMP notification host.
informs
boolean
    Choices:
  • no
  • yes
Use SNMP inform messages.
traps
boolean
    Choices:
  • no
  • yes
Use SNMP trap messages
udp_port
integer
UDP destination port for notification messages.
version
string
    Choices:
  • 1
  • 2c
  • 3
Notification message SNMP version.
ifindex
boolean
    Choices:
  • no
  • yes
Enable ifindex persistence
ifmib
dictionary
IF-MIB configuration commands.
ifalias_long
boolean
    Choices:
  • no
  • yes
Modify parameters for ifAlias object.
internal_cache_max_duration
integer
IFMIB internal lookahead cache.
ipsubscriber
boolean
    Choices:
  • no
  • yes
Enable ipsubscriber interfaces in IFMIB.
stats
boolean
    Choices:
  • no
  • yes
Modify IF-MIB statistics parameters.
inform
dictionary
Configure SNMP Informs options
pending
integer
Set number of unacked informs to hold
retries
integer
Set retry count for informs
timeout
integer
Set timeout for informs
interfaces
list / elements=dictionary
Enter the SNMP interface configuration commands.
index_persistent
boolean
    Choices:
  • no
  • yes
Configure ifIndex attributes Persistency across system reloads.
name
string
Name of interface.
notification_linkupdown_disable
boolean
    Choices:
  • no
  • yes
Disable linkUp and linkDown notification.
ipv4
dictionary
Mark the dscp/precedence bit for ipv4 packets.
dscp
string
Set IP DSCP (DiffServ CodePoint).Please refer vendor document for valid entries.
precedence
string
Set precedence Please refer vendor document for valid entries.
ipv6
dictionary
Mark the dscp/precedence bit for ipv4 packets.
dscp
string
Set IP DSCP (DiffServ CodePoint).Please refer vendor document for valid entries.
precedence
string
Set precedence Please refer vendor document for valid entries.
location
string
The sysLocation string.
logging_threshold_oid_processing
integer
Configure threshold to start logging slow OID requests processing.
logging_threshold_pdu_processing
integer
Configure threshold to start logging slow PDU requests processing.
mib_bulkstat_max_procmem_size
integer
per process memory limit in kilo bytes
mib_bulkstat_transfer_ids
list / elements=dictionary
mib bulkstat transfer ids.
buffer_size
integer
Bulkstat data file maximum size.
enable
boolean
    Choices:
  • no
  • yes
Start Data Collection for this Configuration
format_schemaASCI
boolean
    Choices:
  • no
  • yes
format
name
string
mib transfer-id name.
retain
integer
Retention period in Min.
retry
integer
Number of Retries.
schema
string
Schema that contains objects to be collected.
transfer_interval
integer
transfer-interval
mib_object_lists
list / elements=string
mib object lists
mib_schema
list / elements=dictionary
mib schema
name
string
mib schema name.
object_list
string
Name of an object List.
poll_interval
integer
Periodicity for polling of objects in this schema in Min.
mroutemib_send_all_vrf
boolean
    Choices:
  • no
  • yes
Configurations related to IPMROUTE-MIcisco-support.
notification_log_mib
dictionary
notification log mib.
default
boolean
    Choices:
  • no
  • yes
To create a default log
disable
boolean
    Choices:
  • no
  • yes
disable, to disable the logging in default log.
GlobalSize
integer
GlobalSize, max number of notifications that can be logged in all logs.
size
integer
size, The max number of notifications that this log (default) can hold.
oid_poll_stats
boolean
    Choices:
  • no
  • yes
Enable OID poll stats oper CLI
overload_control
dictionary
Set overload-control params for handling incoming messages in critical processing mode.
overload_drop_time
integer
Overload drop time (in seconds) for incoming queue (default 1 sec).
overload_throttle_rate
integer
Overload throttle rate for incoming queue (default 500 msec)
packetsize
integer
Largest SNMP packet size.
queue_length
integer
Queue length (default 100).
targets
list / elements=dictionary
targets
host
string
Specify host name.
name
string
Name of the target list.
vrf
string
Specify VRF name.
throttle_time
integer
Set throttle time for handling incoming messages.
timeouts
dictionary
SNMP timeouts
duplicate
integer
Duplicate request feature timeout
inQdrop
integer
incoming queue drop feature.
pdu_stats
integer
SNMP pdu statistics end to end.
subagent
integer
Sub-Agent Request timeout.
threshold
integer
threshold incoming queue drop feature.
trap
dictionary
MIB trap configurations.
authentication_vrf_disable
boolean
    Choices:
  • no
  • yes
Disable authentication traps for packets on a vrf.
link_ietf
boolean
    Choices:
  • no
  • yes
Link up/down trap configuratio.
throttle_time
integer
Set throttle time for handling more traps.
trap_source
string
Assign an interface for the source address of all traps
trap_timeout
integer
Set timeout for TRAP message retransmissions
traps
dictionary
Enable traps to all configured recipients.
addrpool
dictionary
Enable SNMP Address Pool traps.
high
boolean
    Choices:
  • no
  • yes
Enable SNMP Address Pool High Threshold trap.
low
boolean
    Choices:
  • no
  • yes
Enable SNMP Address Pool Low Threshold trap.
bfd
boolean
    Choices:
  • no
  • yes
Enable BFD traps.
bgp
dictionary
Enable Bgp traps.
cbgp2
boolean
    Choices:
  • no
  • yes
Enable CISCO-BGP4-MIB v2 traps.
updown
boolean
    Choices:
  • no
  • yes
Enable CISCO-BGP4-MIB v2 up/down traps.
bridgemib
boolean
    Choices:
  • no
  • yes
Enable SNMP Trap for Bridge MIB.
bulkstat_collection
boolean
    Choices:
  • no
  • yes
Enable Data-Collection-MIB Collection notifications.
bulkstat_transfer
boolean
    Choices:
  • no
  • yes
Enable Data-Collection-MIB Trnasfer notifications.
cisco_entity_ext
boolean
    Choices:
  • no
  • yes
Enable SNMP entity traps
config
boolean
    Choices:
  • no
  • yes
Enable SNMP config traps.
copy_complete
boolean
    Choices:
  • no
  • yes
Enable CISCO-CONFIG-COPY-MIB ccCopyCompletion traps.
diameter
dictionary
Enable SNMP diameter traps.
peerdown
boolean
    Choices:
  • no
  • yes
Enable peer connection down notification.
peerup
boolean
    Choices:
  • no
  • yes
Enable peer connection up notification.
permanentfail
boolean
    Choices:
  • no
  • yes
Enable permanent failure notification.
protocolerror
boolean
    Choices:
  • no
  • yes
Enable protocol error notifications
transientfail
boolean
    Choices:
  • no
  • yes
Enable transient failure notification.
entity
boolean
    Choices:
  • no
  • yes
Enable SNMP entity traps.
entity_redundancy
dictionary
Enable SNMP CISCO-ENTITY-REDUNDANCY-MIB traps.
all
boolean
    Choices:
  • no
  • yes
Enable all CISCO-ENTITY-REDUNDANCY-MIB traps
status
boolean
    Choices:
  • no
  • yes
Enable status change traps
switchover
boolean
    Choices:
  • no
  • yes
Enable switchover traps.
entity_state
dictionary
Enable SNMP entity-state traps.
operstatus
boolean
    Choices:
  • no
  • yes
Enable entity oper status enable notification.
switchover
boolean
    Choices:
  • no
  • yes
Enable entity state switchover notifications
flash
dictionary
Enable flash-mib traps.
insertion
boolean
    Choices:
  • no
  • yes
Enable ciscoFlashDeviceInsertedNotif.
removal
boolean
    Choices:
  • no
  • yes
Enable ciscoFlashDeviceRemovedNotif.
fru_ctrl
boolean
    Choices:
  • no
  • yes
Enable SNMP entity FRU control traps.
hsrp
boolean
    Choices:
  • no
  • yes
Enable SNMP hsrp traps.
ipsec
dictionary
Enable SNMP IPSec traps.
start
boolean
    Choices:
  • no
  • yes
Enable SNMP IPsec Tunnel Start trap.
stop
boolean
    Choices:
  • no
  • yes
Enable SNMP IPsec Tunnel Stop trap.
ipsla
boolean
    Choices:
  • no
  • yes
Enable SNMP hipsla traps.
isakmp
dictionary
Enable SNMP isakmp traps.
start
boolean
    Choices:
  • no
  • yes
Enable SNMP isakmp Tunnel Start trap.
stop
boolean
    Choices:
  • no
  • yes
Enable SNMP isakmp Tunnel Stop trap.
isis
dictionary
Enable isis traps. If set to enabled , all the traps are set.
adjacency_change
boolean
    Choices:
  • no
  • yes
adjacency-change
all
boolean
    Choices:
  • no
  • yes
anable all is-is traps.
area_mismatch
boolean
    Choices:
  • no
  • yes
area-mismatch
attempt_to_exceed_max_sequence
boolean
    Choices:
  • no
  • yes
attempt-to-exceed-max-sequence
authentication_failure
boolean
    Choices:
  • no
  • yes
authentication-failure.
authentication_type_failure
boolean
    Choices:
  • no
  • yes
authentication-type-failure.
corrupted_lsp_detected
boolean
    Choices:
  • no
  • yes
isisCorruptedLSPDetected
database_overload
boolean
    Choices:
  • no
  • yes
database-overload
id_len_mismatch
boolean
    Choices:
  • no
  • yes
isisIDLenMismatch
lsp_error_detected
boolean
    Choices:
  • no
  • yes
lsp-error-detected.
lsp_too_large_to_propagate
boolean
    Choices:
  • no
  • yes
lsp-too-large-to-propagate
manual_address_drops
boolean
    Choices:
  • no
  • yes
manual_address_drops
max_area_addresses_mismatch
boolean
    Choices:
  • no
  • yes
max_area_addresses_mismatch
orig_lsp_buff_size_mismatch
boolean
    Choices:
  • no
  • yes
orig-lsp-buff-size-mismatch
own_lsp_purge
boolean
    Choices:
  • no
  • yes
own-lsp-purge
protocols_supported_mismatch
boolean
    Choices:
  • no
  • yes
protocols-supported-mismatch
rejected_adjacency
boolean
    Choices:
  • no
  • yes
rejected-adjacency
sequence_number_skip
boolean
    Choices:
  • no
  • yes
sequence-number-skip.
version_skew
boolean
    Choices:
  • no
  • yes
version-skew
l2tun
dictionary
Enable L2TUN traps.
pseudowire_status
boolean
    Choices:
  • no
  • yes
Enable L2TUN pseudowire status traps.
sessions
boolean
    Choices:
  • no
  • yes
Enable L2TUN sessions traps.
tunnel_down
boolean
    Choices:
  • no
  • yes
Enable L2TUN tunnel DOWN traps.
tunnel_up
boolean
    Choices:
  • no
  • yes
Enable L2TUN tunnel UP traps.
l2vpn
dictionary
Enable L2VPN traps.
all
boolean
    Choices:
  • no
  • yes
Enable L2VPN ALL traps.
cisco
boolean
    Choices:
  • no
  • yes
Enable L2VPN CISCO traps.
vc_down
boolean
    Choices:
  • no
  • yes
Enable L2VPN VC DOWN traps.
vc_up
boolean
    Choices:
  • no
  • yes
Enable L2VPN VC UP traps.
msdp_peer_state_change
boolean
    Choices:
  • no
  • yes
Enable SNMP MSDP traps
ntp
boolean
    Choices:
  • no
  • yes
Enable SNMP Cisco Ntp traps.
ospf
dictionary
Enable Ospf traps. If set to enabled , all the traps are set.
errors
dictionary
error
authentication_failure
boolean
    Choices:
  • no
  • yes
authentication-failure.
bad_packet
boolean
    Choices:
  • no
  • yes
bad-packet
config_error
boolean
    Choices:
  • no
  • yes
config-error
virt_authentication_failure
boolean
    Choices:
  • no
  • yes
virt-authentication-failure
virt_bad_packet
boolean
    Choices:
  • no
  • yes
virt-bad-packet
virt_config_error
boolean
    Choices:
  • no
  • yes
virt_config_error
lsa
dictionary
lsa
lsa_maxage
boolean
    Choices:
  • no
  • yes
lsa-maxage
lsa_originate
boolean
    Choices:
  • no
  • yes
lsa-originate
retransmit
dictionary
retransmit
packets
boolean
    Choices:
  • no
  • yes
packets
virt_packets
boolean
    Choices:
  • no
  • yes
virt-packets
state_change
dictionary
state-change.
if_state_change
boolean
    Choices:
  • no
  • yes
if-state-change
neighbor_state_change
boolean
    Choices:
  • no
  • yes
neighbor-state-change
virtif_state_change
boolean
    Choices:
  • no
  • yes
virtif-state-change
virtneighbor_state_change
boolean
    Choices:
  • no
  • yes
virtneighbor-state-change
ospfv3
dictionary
Enable Ospfv3 traps. If set to enabled , all the traps are set.
errors
dictionary
error
bad_packet
boolean
    Choices:
  • no
  • yes
bad-packet
config_error
boolean
    Choices:
  • no
  • yes
config-error
virt_bad_packet
boolean
    Choices:
  • no
  • yes
virt-bad-packet
virt_config_error
boolean
    Choices:
  • no
  • yes
virt_config_error
state_change
dictionary
state-change.
if_state_change
boolean
    Choices:
  • no
  • yes
if-state-change
neighbor_state_change
boolean
    Choices:
  • no
  • yes
neighbor-state-change
nssa_state_change
boolean
    Choices:
  • no
  • yes
nssa-state-change
restart_helper_status_change
boolean
    Choices:
  • no
  • yes
restart-helper-status-change
restart_status_change
boolean
    Choices:
  • no
  • yes
restart-status-change
restart_virtual_helper_status_change
boolean
    Choices:
  • no
  • yes
restart-virtual-helper-status-change
virtif_state_change
boolean
    Choices:
  • no
  • yes
virtif-state-change
virtneighbor_state_change
boolean
    Choices:
  • no
  • yes
virtneighbor-state-change
pim
dictionary
Enable Pim traps. If set to enabled , all the traps are set.
interface_state_change
boolean
    Choices:
  • no
  • yes
interface-state-change .
invalid_message_received
boolean
    Choices:
  • no
  • yes
invalid-message-received
neighbor_change
boolean
    Choices:
  • no
  • yes
neighbor-change.
rp_mapping_change
boolean
    Choices:
  • no
  • yes
rp-mapping-change.
power
boolean
    Choices:
  • no
  • yes
Enable SNMP entity power traps.
rf
boolean
    Choices:
  • no
  • yes
Enable SNMP RF-MIB traps.
rsvp
dictionary
Enable rsvp traps. If set to enabled , all the traps are set.
all
boolean
    Choices:
  • no
  • yes
enable all traps.
lost_flow
boolean
    Choices:
  • no
  • yes
lost-flow
new_flow
boolean
    Choices:
  • no
  • yes
new-flow
selective_vrf_download_role_change
boolean
    Choices:
  • no
  • yes
Enable selective VRF download traps.
sensor
boolean
    Choices:
  • no
  • yes
Enable SNMP entity sensor traps
snmp
dictionary
Enable snmp traps. If set to enabled , all the traps are set.
authentication
boolean
    Choices:
  • no
  • yes
authentication
coldstart
boolean
    Choices:
  • no
  • yes
coldstart.
linkdown
boolean
    Choices:
  • no
  • yes
link-down
linkup
boolean
    Choices:
  • no
  • yes
link-up
warmstart
boolean
    Choices:
  • no
  • yes
warmstart.
subscriber
dictionary
Subscriber notification commands.
session_agg_access_interface
boolean
    Choices:
  • no
  • yes
Subscriber notification at access interface level
session_agg_node
boolean
    Choices:
  • no
  • yes
Subscriber notification at node level
syslog
boolean
    Choices:
  • no
  • yes
syslog
system
boolean
    Choices:
  • no
  • yes
Enable SNMP SYSTEMMIB-MIB traps.
vpls
dictionary
Enable VPLS traps
all
boolean
    Choices:
  • no
  • yes
Enable all VPLS traps.
full_clear
boolean
    Choices:
  • no
  • yes
Enable VPLS Full Clear traps.
full_raise
boolean
    Choices:
  • no
  • yes
Enable VPLS Full Raise traps.
status
boolean
    Choices:
  • no
  • yes
Enable VPLS Status traps
vrrp_events
boolean
    Choices:
  • no
  • yes
vrrp
users
list / elements=dictionary
SNMP user configuration.
acl_v4
string
Ipv4 Type of Access-list

aliases: Ipv4_acl
acl_v6
string
Ipv6 Type of Access-list

aliases: Ipv6_acl
group
string
SNMP group for the user.
SDROwner
boolean
    Choices:
  • no
  • yes
SDR Owner permissions for MIB Objects.
SystemOwner
boolean
    Choices:
  • no
  • yes
System Owner permissions for MIB objects.
user
string
SNMP user name
v4_acl
string
V4 Access-list name
version
string
    Choices:
  • v1
  • v2c
  • v3
snmp security version
vrfs
list / elements=dictionary
Specify the VRF in which the source address is used
context
list / elements=string
Configure the source interface for SNMP notifications
hosts
list / elements=dictionary
Notification destinations
community
string
community string.
host
string
Hostname or IP address of SNMP notification host.
informs
boolean
    Choices:
  • no
  • yes
Use SNMP inform messages.
traps
boolean
    Choices:
  • no
  • yes
Use SNMP trap messages
udp_port
integer
UDP destination port for notification messages.
version
string
    Choices:
  • 1
  • 2c
  • 3
Notification message SNMP version.
vrf
string
vrf name.
running_config
string
This option is used only with state parsed.
The value of this option should be the output received from the IOSXR device by executing the command show running-config snmp-server.
The state parsed reads the configuration from running_config option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the parsed key within the result.
state
string
    Choices:
  • deleted
  • merged ←
  • overridden
  • replaced
  • gathered
  • rendered
  • parsed
The state the configuration should be left in.
The states replaced and overridden have identical behaviour for this module.
Please refer to examples for more details.

Note

  • Tested against Cisco Iosxr 7.0.2
  • This module works with connection network_cli.
# Using state: merged
# Before state:
# -------------
# RP/0/RP0/CPU0:test2#show running-config snmp-server
# --------------------- EMPTY -----------------
# Merged play:
# ------------

- name: Merge the provided configuration with the existing running configuration
  cisco.iosxr.iosxr_snmp_server:
    config:
      vrfs:
        - hosts:
            - community: test1
              host: 1.1.1.1
              traps: true
          vrf: vrf1
      users:
        - Ipv4_acl: test1
          Ipv6_acl: test2
          group: test2
          user: u1
          version: v1
      timeouts:
        duplicate: 0
        inQdrop: 0
      trap:
        throttle_time: 12
      targets:
        - host: 1.1.1.2
          name: test
      ifmib:
        internal_cache_max_duration: 4
      inform:
        retries: 7
      chassis_id: test2
      packetsize: 490
      queue_length: 2
      throttle_time: 60
      trap_source: GigabitEthernet0/0/0/2
      trap_timeout: 3
      context:
        - c1
        - c2
      contact: t1
      correlator:
        buffer_size: 1024
      communities:
        - name: test2
          ro: true
          sdrowner: true
          acl_v4: test
          acl_v6: test1
      community_maps:
        - name: cm1
          context: c1
          target_list: t1
          security_name: s1
      drop:
        report_IPv4: test1
        unknown_user: true
      ipv6:
        precedence: routine
      ipv4:
        dscp: af11
      location: test1
      logging_threshold_oid_processing: 1
      logging_threshold_pdu_processing: 1
      mib_bulkstat_max_procmem_size: 101
      mroutemib_send_all_vrf: true
      overload_control:
        overload_drop_time: 4
        overload_throttle_rate: 6
      notification_log_mib:
        GlobalSize: 5
        size: 5
      traps:
        hsrp: true
        ipsla: true
        ipsec:
          start: true
          stop: true
        bridgemib: true
        bulkstat_collection: true
        cisco_entity_ext: true
        config: true
        copy_complete: true
        addrpool:
          high: true
          low: true
        bfd: true
        bgp:
          cbgp2: true
        l2tun:
          sessions: true
          tunnel_down: true
          tunnel_up: true
        l2vpn:
          all: true
          vc_down: true
          vc_up: true
        msdp_peer_state_change: true

#
# Commands Fired:
# ------------
# "commands": [
#         "snmp-server chassis-id test2",
#         "snmp-server correlator buffer-size 1024",
#         "snmp-server contact t1",
#         "snmp-server ipv4 dscp af11",
#         "snmp-server ipv6 precedence routine",
#         "snmp-server location test1",
#         "snmp-server logging threshold oid-processing 1",
#         "snmp-server logging threshold pdu-processing 1",
#         "snmp-server mib bulkstat max-procmem-size 101",
#         "snmp-server mroutemib send-all-vrf",
#         "snmp-server overload-control 4 6",
#         "snmp-server packetsize 490",
#         "snmp-server queue-length 2",
#         "snmp-server throttle-time 60",
#         "snmp-server trap-source GigabitEthernet0/0/0/2",
#         "snmp-server trap-timeout 3",
#         "snmp-server drop report acl IPv4 test1",
#         "snmp-server drop unknown-user",
#         "snmp-server ifmib internal cache max-duration 4",
#         "snmp-server inform retries 7",
#         "snmp-server notification-log-mib size 5",
#         "snmp-server notification-log-mib GlobalSize 5",
#         "snmp-server trap throttle-time 12",
#         "snmp-server timeouts inQdrop 0",
#         "snmp-server timeouts duplicate 0",
#         "snmp-server traps addrpool low",
#         "snmp-server traps addrpool high",
#         "snmp-server traps bfd",
#         "snmp-server traps bgp cbgp2",
#         "snmp-server traps bulkstat collection",
#         "snmp-server traps bridgemib",
#         "snmp-server traps copy-complete",
#         "snmp-server traps cisco-entity-ext",
#         "snmp-server traps config",
#         "snmp-server traps hsrp",
#         "snmp-server traps ipsla",
#         "snmp-server traps ipsec tunnel start",
#         "snmp-server traps ipsec tunnel stop",
#         "snmp-server traps l2tun sessions",
#         "snmp-server traps l2tun tunnel-up",
#         "snmp-server traps l2tun tunnel-down",
#         "snmp-server traps l2vpn all",
#         "snmp-server traps l2vpn vc-up",
#         "snmp-server traps l2vpn vc-down",
#         "snmp-server traps msdp peer-state-change",
#         "snmp-server community test2 RO SDROwner IPv4 test IPv6 test1",
#         "snmp-server community-map cm1 context c1 security-name s1 target-list t1",
#         "snmp-server context c1",
#         "snmp-server context c2",
#         "snmp-server user u1 test2 v1 IPv4 test1 IPv6 test2",
#         "snmp-server target list test2 vrf vrf2",
#         "snmp-server target list test host 1.1.1.2",
#         "snmp-server vrf vrf1",
#         "host 1.1.1.1 traps test1"
#
#     ],
# After state:
# ------------
# RP/0/RP0/CPU0:test2#show running-config snmp-server
# Mon Nov 29 12:49:29.521 UTC
# snmp-server vrf vrf1
#  host 1.1.1.1 traps test1
# !
# snmp-server drop report acl IPv4 test1
# snmp-server drop unknown-user
# snmp-server ipv4 dscp af11
# snmp-server ipv6 precedence routine
# snmp-server user u1 test2 v1 IPv4 test1 IPv6 test2
# snmp-server community test2 RO SDROwner IPv4 test IPv6 test1
# snmp-server queue-length 2
# snmp-server trap-timeout 3
# snmp-server trap throttle-time 12
# snmp-server traps bfd
# snmp-server traps bgp cbgp2
# snmp-server traps copy-complete
# snmp-server traps hsrp
# snmp-server traps ipsla
# snmp-server traps msdp peer-state-change
# snmp-server traps ipsec tunnel stop
# snmp-server traps ipsec tunnel start
# snmp-server traps config
# snmp-server traps l2tun sessions
# snmp-server traps l2tun tunnel-up
# snmp-server traps l2tun tunnel-down
# snmp-server traps bulkstat collection
# snmp-server traps l2vpn all
# snmp-server traps l2vpn vc-up
# snmp-server traps l2vpn vc-down
# snmp-server traps bridgemib
# snmp-server traps addrpool low
# snmp-server traps addrpool high
# snmp-server traps cisco-entity-ext
# snmp-server chassis-id test2
# snmp-server contact t1
# snmp-server location test1
# snmp-server target list test host 1.1.1.2
# snmp-server target list test2 vrf vrf2
# snmp-server context c1
# snmp-server context c2
# snmp-server logging threshold oid-processing 1
# snmp-server logging threshold pdu-processing 1
# snmp-server mib bulkstat max-procmem-size 101
# snmp-server timeouts duplicate 0
# snmp-server timeouts inQdrop 0
# snmp-server packetsize 490
# snmp-server correlator buffer-size 1024
# snmp-server trap-source GigabitEthernet0/0/0/2
# snmp-server throttle-time 60
# snmp-server community-map cm1 context c1 security-name s1 target-list t1
# snmp-server inform retries 7
# snmp-server overload-control 4 6
# snmp-server ifmib internal cache max-duration 4
# snmp-server mroutemib send-all-vrf
# snmp-server notification-log-mib size 5
# snmp-server notification-log-mib GlobalSize 5
#
#
# Using state: deleted
# Before state:
# -------------
# RP/0/RP0/CPU0:test2#show running-config snmp-server
# Mon Nov 29 12:49:29.521 UTC
# snmp-server vrf vrf1
#  host 1.1.1.1 traps test1
# !
# snmp-server drop report acl IPv4 test1
# snmp-server drop unknown-user
# snmp-server ipv4 dscp af11
# snmp-server ipv6 precedence routine
# snmp-server user u1 test2 v1 IPv4 test1 IPv6 test2
# snmp-server community test2 RO SDROwner IPv4 test IPv6 test1
# snmp-server queue-length 2
# snmp-server trap-timeout 3
# snmp-server trap throttle-time 12
# snmp-server traps bfd
# snmp-server traps bgp cbgp2
# snmp-server traps copy-complete
# snmp-server traps hsrp
# snmp-server traps ipsla
# snmp-server traps msdp peer-state-change
# snmp-server traps ipsec tunnel stop
# snmp-server traps ipsec tunnel start
# snmp-server traps config
# snmp-server traps l2tun sessions
# snmp-server traps l2tun tunnel-up
# snmp-server traps l2tun tunnel-down
# snmp-server traps bulkstat collection
# snmp-server traps l2vpn all
# snmp-server traps l2vpn vc-up
# snmp-server traps l2vpn vc-down
# snmp-server traps bridgemib
# snmp-server traps addrpool low
# snmp-server traps addrpool high
# snmp-server traps cisco-entity-ext
# snmp-server chassis-id test2
# snmp-server contact t1
# snmp-server location test1
# snmp-server target list test host 1.1.1.2
# snmp-server target list test2 vrf vrf2
# snmp-server context c1
# snmp-server context c2
# snmp-server logging threshold oid-processing 1
# snmp-server logging threshold pdu-processing 1
# snmp-server mib bulkstat max-procmem-size 101
# snmp-server timeouts duplicate 0
# snmp-server timeouts inQdrop 0
# snmp-server packetsize 490
# snmp-server correlator buffer-size 1024
# snmp-server trap-source GigabitEthernet0/0/0/2
# snmp-server throttle-time 60
# snmp-server community-map cm1 context c1 security-name s1 target-list t1
# snmp-server inform retries 7
# snmp-server overload-control 4 6
# snmp-server ifmib internal cache max-duration 4
# snmp-server mroutemib send-all-vrf
# snmp-server notification-log-mib size 5
# snmp-server notification-log-mib GlobalSize 5
# Deleted play:
# -------------
- name: Remove all existing configuration
  cisco.iosxr.iosxr_snmp_server:
    state: deleted
# Commands Fired:
# ---------------
# "commands": [
#        "no snmp-server chassis-id test2",
#         "no snmp-server correlator buffer-size 1024",
#         "no snmp-server contact t1",
#         "no snmp-server ipv4 dscp af11",
#         "no snmp-server ipv6 precedence routine",
#         "no snmp-server location test1",
#         "no snmp-server logging threshold oid-processing 1",
#         "no snmp-server logging threshold pdu-processing 1",
#         "no snmp-server mib bulkstat max-procmem-size 101",
#         "no snmp-server mroutemib send-all-vrf",
#         "no snmp-server overload-control 4 6",
#         "no snmp-server packetsize 490",
#         "no snmp-server queue-length 2",
#         "no snmp-server throttle-time 60",
#         "no snmp-server trap-source GigabitEthernet0/0/0/2",
#         "no snmp-server trap-timeout 3",
#         "no snmp-server drop report acl IPv4 test1",
#         "no snmp-server drop unknown-user",
#         "no snmp-server ifmib internal cache max-duration 4",
#         "no snmp-server inform retries 7",
#         "no snmp-server notification-log-mib size 5",
#         "no snmp-server notification-log-mib GlobalSize 5",
#         "no snmp-server trap throttle-time 12",
#         "no snmp-server timeouts inQdrop 0",
#         "no snmp-server timeouts duplicate 0",
#         "no snmp-server traps addrpool low",
#         "no snmp-server traps addrpool high",
#         "no snmp-server traps bfd",
#         "no snmp-server traps bgp cbgp2",
#         "no snmp-server traps bulkstat collection",
#         "no snmp-server traps bridgemib",
#         "no snmp-server traps copy-complete",
#         "no snmp-server traps cisco-entity-ext",
#         "no snmp-server traps config",
#         "no snmp-server traps hsrp",
#         "no snmp-server traps ipsla",
#         "no snmp-server traps ipsec tunnel start",
#         "no snmp-server traps ipsec tunnel stop",
#         "no snmp-server traps l2tun sessions",
#         "no snmp-server traps l2tun tunnel-up",
#         "no snmp-server traps l2tun tunnel-down",
#         "no snmp-server traps l2vpn all",
#         "no snmp-server traps l2vpn vc-up",
#         "no snmp-server traps l2vpn vc-down",
#         "no snmp-server traps msdp peer-state-change",
#         "no snmp-server community test2 RO SDROwner IPv4 test IPv6 test1",
#         "no snmp-server community-map cm1 context c1 security-name s1 target-list t1",
#         "no snmp-server context c1",
#         "no snmp-server context c2",
#         "no snmp-server user u1 test2 v1 IPv4 test1 IPv6 test2",
#         "no snmp-server target list test host 1.1.1.2",
#         "no snmp-server target list test2 vrf vrf2",
#         "no snmp-server vrf vrf1"
#     ],
# After state:
# ------------
# RP/0/0/CPU0:10#show running-config ntp
# --------------------- EMPTY -----------------
# Using state: overridden
# Before state:
# -------------
# RP/0/0/CPU0:10#show running-config snmp-server
# snmp-server vrf vrf1
#  host 1.1.1.1 traps test1
# !
# snmp-server drop report acl IPv4 test1
# snmp-server drop unknown-user
# snmp-server ipv4 dscp af11
# snmp-server ipv6 precedence routine
# snmp-server user u1 test2 v1 IPv4 test1 IPv6 test2
# snmp-server community test2 RO SDROwner IPv4 test IPv6 test1
# snmp-server queue-length 2
# snmp-server trap-timeout 3
# snmp-server trap throttle-time 12
# snmp-server traps bfd
# snmp-server traps bgp cbgp2
# snmp-server traps copy-complete
# snmp-server traps hsrp
# snmp-server traps ipsla
# snmp-server traps msdp peer-state-change
# snmp-server traps ipsec tunnel stop
# snmp-server traps ipsec tunnel start
# snmp-server traps config
# snmp-server traps l2tun sessions
# snmp-server traps l2tun tunnel-up
# snmp-server traps l2tun tunnel-down
# snmp-server traps bulkstat collection
# snmp-server traps l2vpn all
# snmp-server traps l2vpn vc-up
# snmp-server traps l2vpn vc-down
# snmp-server traps bridgemib
# snmp-server traps addrpool low
# snmp-server traps addrpool high
# snmp-server traps cisco-entity-ext
# snmp-server chassis-id test2
# snmp-server contact t1
# snmp-server location test1
# snmp-server target list test host 1.1.1.2
# snmp-server target list test2 vrf vrf2
# snmp-server context c1
# snmp-server context c2
# snmp-server logging threshold oid-processing 1
# snmp-server logging threshold pdu-processing 1
# snmp-server mib bulkstat max-procmem-size 101
# snmp-server timeouts duplicate 0
# snmp-server timeouts inQdrop 0
# snmp-server packetsize 490
# snmp-server correlator buffer-size 1024
# snmp-server trap-source GigabitEthernet0/0/0/2
# snmp-server throttle-time 60
# snmp-server community-map cm1 context c1 security-name s1 target-list t1
# snmp-server inform retries 7
# snmp-server overload-control 4 6
# snmp-server ifmib internal cache max-duration 4
# snmp-server mroutemib send-all-vrf
# snmp-server notification-log-mib size 5
# snmp-server notification-log-mib GlobalSize 5
# Overridden play:
# ----------------
- name: Override Snmp-server configuration with provided configuration
  cisco.iosxr.iosxr_snmp_server:
    config:
      timeouts:
        duplicate: 0
        inQdrop: 0
      trap:
        throttle_time: 13
      targets:
        - host: 1.1.1.2
          name: test
      ifmib:
        internal_cache_max_duration: 5
      inform:
        retries: 7
      chassis_id: test
      packetsize: 491
      queue_length: 2
      throttle_time: 60
      trap_source: GigabitEthernet0/0/0/2
      trap_timeout: 3
      context:
        - c1
        - c2
      contact: t1
      correlator:
        buffer_size: 1025
      communities:
        - name: test1
          ro: true
          sdrowner: true
          acl_v4: test
          acl_v6: test1
      community_maps:
        - name: cm2
          context: c1
          target_list: t1
          security_name: s1
      drop:
        report_IPv4: test2
        unknown_user: true
      ipv6:
        precedence: routine
      ipv4:
        dscp: af11
      location: test1
      logging_threshold_oid_processing: 2
      logging_threshold_pdu_processing: 2
      mib_bulkstat_max_procmem_size: 101
      mroutemib_send_all_vrf: true
      overload_control:
        overload_drop_time: 4
        overload_throttle_rate: 6
      notification_log_mib:
        GlobalSize: 5
        size: 5
      traps:
        hsrp: true
        ipsla: true
        ipsec:
          start: true
          stop: true
        bridgemib: true
        bulkstat_collection: true
        cisco_entity_ext: true
        config: true
        copy_complete: true
        l2vpn:
          all: true
          vc_down: true
          vc_up: true
        msdp_peer_state_change: true
    state: overridden

# Commands Fired:
# ---------------
# "commands": [
#        "no snmp-server traps addrpool low",
#         "no snmp-server traps addrpool high",
#         "no snmp-server traps bfd",
#         "no snmp-server traps bgp cbgp2",
#         "no snmp-server traps l2tun sessions",
#         "no snmp-server traps l2tun tunnel-up",
#         "no snmp-server traps l2tun tunnel-down",
#         "no snmp-server community test2 RO SDROwner IPv4 test IPv6 test1",
#         "no snmp-server community-map cm1 context c1 security-name s1 target-list t1",
#         "no snmp-server user u1 test2 v1 IPv4 test1 IPv6 test2",
#         "no snmp-server vrf vrf1",
#         "snmp-server chassis-id test",
#         "snmp-server correlator buffer-size 1025",
#         "snmp-server logging threshold oid-processing 2",
#         "snmp-server logging threshold pdu-processing 2",
#         "snmp-server packetsize 491",
#         "snmp-server drop report acl IPv4 test2",
#         "snmp-server ifmib internal cache max-duration 5",
#         "snmp-server trap throttle-time 13",
#         "snmp-server community test1 RO SDROwner IPv4 test IPv6 test1",
#         "snmp-server community-map cm2 context c1 security-name s1 target-list t1"
#     ],
# After state:
# ------------
# RP/0/RP0/CPU0:test2#show running-config snmp-server
# Mon Nov 29 12:57:34.182 UTC
# snmp-server drop report acl IPv4 test2
# snmp-server drop unknown-user
# snmp-server ipv4 dscp af11
# snmp-server ipv6 precedence routine
# snmp-server community test1 RO SDROwner IPv4 test IPv6 test1
# snmp-server queue-length 2
# snmp-server trap-timeout 3
# snmp-server trap throttle-time 13
# snmp-server traps copy-complete
# snmp-server traps hsrp
# snmp-server traps ipsla
# snmp-server traps msdp peer-state-change
# snmp-server traps ipsec tunnel stop
# snmp-server traps ipsec tunnel start
# snmp-server traps config
# snmp-server traps bulkstat collection
# snmp-server traps l2vpn all
# snmp-server traps l2vpn vc-up
# snmp-server traps l2vpn vc-down
# snmp-server traps bridgemib
# snmp-server traps cisco-entity-ext
# snmp-server chassis-id test
# snmp-server contact t1
# snmp-server location test1
# snmp-server target list test host 1.1.1.2
# snmp-server target list test2 vrf vrf2
# snmp-server context c1
# snmp-server context c2
# snmp-server logging threshold oid-processing 2
# snmp-server logging threshold pdu-processing 2
# snmp-server mib bulkstat max-procmem-size 101
# snmp-server timeouts duplicate 0
# snmp-server timeouts inQdrop 0
# snmp-server packetsize 491
# snmp-server correlator buffer-size 1025
# snmp-server trap-source GigabitEthernet0/0/0/2
# snmp-server throttle-time 60
# snmp-server community-map cm2 context c1 security-name s1 target-list t1
# snmp-server inform retries 7
# snmp-server overload-control 4 6
# snmp-server ifmib internal cache max-duration 5
# snmp-server mroutemib send-all-vrf
# snmp-server notification-log-mib size 5
# snmp-server notification-log-mib GlobalSize 5
#
# Using state: replaced
# Before state:
# -------------
# RP/0/0/CPU0:10#show running-config snmp-server
# snmp-server vrf vrf1
#  host 1.1.1.1 traps test1
# !
# snmp-server drop report acl IPv4 test1
# snmp-server drop unknown-user
# snmp-server ipv4 dscp af11
# snmp-server ipv6 precedence routine
# snmp-server user u1 test2 v1 IPv4 test1 IPv6 test2
# snmp-server community test2 RO SDROwner IPv4 test IPv6 test1
# snmp-server queue-length 2
# snmp-server trap-timeout 3
# snmp-server trap throttle-time 12
# snmp-server traps bfd
# snmp-server traps bgp cbgp2
# snmp-server traps copy-complete
# snmp-server traps hsrp
# snmp-server traps ipsla
# snmp-server traps msdp peer-state-change
# snmp-server traps ipsec tunnel stop
# snmp-server traps ipsec tunnel start
# snmp-server traps config
# snmp-server traps l2tun sessions
# snmp-server traps l2tun tunnel-up
# snmp-server traps l2tun tunnel-down
# snmp-server traps bulkstat collection
# snmp-server traps l2vpn all
# snmp-server traps l2vpn vc-up
# snmp-server traps l2vpn vc-down
# snmp-server traps bridgemib
# snmp-server traps addrpool low
# snmp-server traps addrpool high
# snmp-server traps cisco-entity-ext
# snmp-server chassis-id test2
# snmp-server contact t1
# snmp-server location test1
# snmp-server target list test host 1.1.1.2
# snmp-server target list test2 vrf vrf2
# snmp-server context c1
# snmp-server context c2
# snmp-server logging threshold oid-processing 1
# snmp-server logging threshold pdu-processing 1
# snmp-server mib bulkstat max-procmem-size 101
# snmp-server timeouts duplicate 0
# snmp-server timeouts inQdrop 0
# snmp-server packetsize 490
# snmp-server correlator buffer-size 1024
# snmp-server trap-source GigabitEthernet0/0/0/2
# snmp-server throttle-time 60
# snmp-server community-map cm1 context c1 security-name s1 target-list t1
# snmp-server inform retries 7
# snmp-server overload-control 4 6
# snmp-server ifmib internal cache max-duration 4
# snmp-server mroutemib send-all-vrf
# snmp-server notification-log-mib size 5
# snmp-server notification-log-mib GlobalSize 5
#
#
# Replaced play:
# ----------------
- name: Replace Snmp-server configuration with provided configuration
  cisco.iosxr.iosxr_snmp_server:
    state: replaced
    config:
      timeouts:
        duplicate: 0
        inQdrop: 0
      trap:
        throttle_time: 13
      targets:
        - host: 1.1.1.2
          name: test
      ifmib:
        internal_cache_max_duration: 5
      inform:
        retries: 7
      chassis_id: test
      packetsize: 491
      queue_length: 2
      throttle_time: 60
      trap_source: GigabitEthernet0/0/0/2
      trap_timeout: 3
      context:
        - c1
        - c2
      contact: t1
      correlator:
        buffer_size: 1025
      communities:
        - name: test1
          ro: true
          sdrowner: true
          acl_v4: test
          acl_v6: test1
      community_maps:
        - name: cm2
          context: c1
          target_list: t1
          security_name: s1
      drop:
        report_IPv4: test2
        unknown_user: true
      ipv6:
        precedence: routine
      ipv4:
        dscp: af11
      location: test1
      logging_threshold_oid_processing: 2
      logging_threshold_pdu_processing: 2
      mib_bulkstat_max_procmem_size: 101
      mroutemib_send_all_vrf: true
      overload_control:
        overload_drop_time: 4
        overload_throttle_rate: 6
      notification_log_mib:
        GlobalSize: 5
        size: 5
      traps:
        hsrp: true
        ipsla: true
        ipsec:
          start: true
          stop: true
        bridgemib: true
        bulkstat_collection: true
        cisco_entity_ext: true
        config: true
        copy_complete: true
        l2vpn:
          all: true
          vc_down: true
          vc_up: true
        msdp_peer_state_change: true

#
# Commands Fired:
# ---------------
# "commands": [
#         "no snmp-server traps addrpool low",
#         "no snmp-server traps addrpool high",
#         "no snmp-server traps bfd",
#         "no snmp-server traps bgp cbgp2",
#         "no snmp-server traps l2tun sessions",
#         "no snmp-server traps l2tun tunnel-up",
#         "no snmp-server traps l2tun tunnel-down",
#         "no snmp-server community test2 RO SDROwner IPv4 test IPv6 test1",
#         "no snmp-server community-map cm1 context c1 security-name s1 target-list t1",
#         "no snmp-server user u1 test2 v1 IPv4 test1 IPv6 test2",
#         "no snmp-server vrf vrf1",
#         "snmp-server chassis-id test",
#         "snmp-server correlator buffer-size 1025",
#         "snmp-server logging threshold oid-processing 2",
#         "snmp-server logging threshold pdu-processing 2",
#         "snmp-server packetsize 491",
#         "snmp-server drop report acl IPv4 test2",
#         "snmp-server ifmib internal cache max-duration 5",
#         "snmp-server trap throttle-time 13",
#         "snmp-server community test1 RO SDROwner IPv4 test IPv6 test1",
#         "snmp-server community-map cm2 context c1 security-name s1 target-list t1"
#     ],
# After state:
# ------------
# RP/0/RP0/CPU0:ios#show running-config snmp-server
# Mon Sep 13 10:38:22.690 UTC
# RP/0/0/CPU0:10#show running-config snmp-server
# snmp-server vrf vrf1
#  host 1.1.1.1 traps test1
# !
# snmp-server drop report acl IPv4 test1
# snmp-server drop unknown-user
# snmp-server ipv4 dscp af11
# snmp-server ipv6 precedence routine
# snmp-server user u1 test2 v1 IPv4 test1 IPv6 test2
# snmp-server community test2 RO SDROwner IPv4 test IPv6 test1
# snmp-server queue-length 2
# snmp-server trap-timeout 3
# snmp-server trap throttle-time 12
# snmp-server traps bfd
# snmp-server traps bgp cbgp2
# snmp-server traps copy-complete
# snmp-server traps hsrp
# snmp-server traps ipsla
# snmp-server traps msdp peer-state-change
# snmp-server traps ipsec tunnel stop
# snmp-server traps ipsec tunnel start
# snmp-server traps config
# snmp-server traps l2tun sessions
# snmp-server traps l2tun tunnel-up
# snmp-server traps l2tun tunnel-down
# snmp-server traps bulkstat collection
# snmp-server traps l2vpn all
# snmp-server traps l2vpn vc-up
# snmp-server traps l2vpn vc-down
# snmp-server traps bridgemib
# snmp-server traps addrpool low
# snmp-server traps addrpool high
# snmp-server traps cisco-entity-ext
# snmp-server chassis-id test2
# snmp-server contact t1
# snmp-server location test1
# snmp-server target list test host 1.1.1.2
# snmp-server target list test2 vrf vrf2
# snmp-server context c1
# snmp-server context c2
# snmp-server logging threshold oid-processing 1
# snmp-server logging threshold pdu-processing 1
# snmp-server mib bulkstat max-procmem-size 101
# snmp-server timeouts duplicate 0
# snmp-server timeouts inQdrop 0
# snmp-server packetsize 490
# snmp-server correlator buffer-size 1024
# snmp-server trap-source GigabitEthernet0/0/0/2
# snmp-server throttle-time 60
# snmp-server community-map cm1 context c1 security-name s1 target-list t1
# snmp-server inform retries 7
# snmp-server overload-control 4 6
# snmp-server ifmib internal cache max-duration 4
# snmp-server mroutemib send-all-vrf
# snmp-server notification-log-mib size 5
# snmp-server notification-log-mib GlobalSize 5
#
#
# Using state: gathered
# Before state:
# -------------
# RP/0/RP0/CPU0:test2#show running-config snmp-server
# Mon Nov 29 12:49:29.521 UTC
# snmp-server vrf vrf1
#  host 1.1.1.1 traps test1
# !
# snmp-server drop report acl IPv4 test1
# snmp-server drop unknown-user
# snmp-server ipv4 dscp af11
# snmp-server ipv6 precedence routine
# snmp-server user u1 test2 v1 IPv4 test1 IPv6 test2
# snmp-server community test2 RO SDROwner IPv4 test IPv6 test1
# snmp-server queue-length 2
# snmp-server trap-timeout 3
# snmp-server trap throttle-time 12
# snmp-server traps bfd
# snmp-server traps bgp cbgp2
# snmp-server traps copy-complete
# snmp-server traps hsrp
# snmp-server traps ipsla
# snmp-server traps msdp peer-state-change
# snmp-server traps ipsec tunnel stop
# snmp-server traps ipsec tunnel start
# snmp-server traps config
# snmp-server traps l2tun sessions
# snmp-server traps l2tun tunnel-up
# snmp-server traps l2tun tunnel-down
# snmp-server traps bulkstat collection
# snmp-server traps l2vpn all
# snmp-server traps l2vpn vc-up
# snmp-server traps l2vpn vc-down
# snmp-server traps bridgemib
# snmp-server traps addrpool low
# snmp-server traps addrpool high
# snmp-server traps cisco-entity-ext
# snmp-server chassis-id test2
# snmp-server contact t1
# snmp-server location test1
# snmp-server target list test host 1.1.1.2
# snmp-server target list test2 vrf vrf2
# snmp-server context c1
# snmp-server context c2
# snmp-server logging threshold oid-processing 1
# snmp-server logging threshold pdu-processing 1
# snmp-server mib bulkstat max-procmem-size 101
# snmp-server timeouts duplicate 0
# snmp-server timeouts inQdrop 0
# snmp-server packetsize 490
# snmp-server correlator buffer-size 1024
# snmp-server trap-source GigabitEthernet0/0/0/2
# snmp-server throttle-time 60
# snmp-server community-map cm1 context c1 security-name s1 target-list t1
# snmp-server inform retries 7
# snmp-server overload-control 4 6
# snmp-server ifmib internal cache max-duration 4
# snmp-server mroutemib send-all-vrf
# snmp-server notification-log-mib size 5
# snmp-server notification-log-mib GlobalSize 5
# Gathered play:
# --------------
- name: Gather listed snmp server
  cisco.iosxr.iosxr_snmp_server:
    state: gathered
# Module Execution Result:
# ------------------------
# "gathered": {
#         "chassis_id": "test2",
#         "communities": [
#             {
#                 "acl_v4": "test",
#                 "acl_v6": "test1",
#                 "name": "test2",
#                 "ro": true,
#                 "sdrowner": true
#             }
#         ],
#         "community_maps": [
#             {
#                 "context": "c1",
#                 "name": "cm1",
#                 "security_name": "s1",
#                 "target_list": "t1"
#             }
#         ],
#         "contact": "t1",
#         "context": [
#             "c1",
#             "c2"
#         ],
#         "correlator": {
#             "buffer_size": 1024
#         },
#         "drop": {
#             "report_IPv4": "test1",
#             "unknown_user": true
#         },
#         "ifmib": {
#             "internal_cache_max_duration": 4
#         },
#         "inform": {
#             "retries": 7
#         },
#         "ipv4": {
#             "dscp": "af11"
#         },
#         "ipv6": {
#             "precedence": "routine"
#         },
#         "location": "test1",
#         "logging_threshold_oid_processing": 1,
#         "logging_threshold_pdu_processing": 1,
#         "mib_bulkstat_max_procmem_size": 101,
#         "mroutemib_send_all_vrf": true,
#         "notification_log_mib": {
#             "GlobalSize": 5,
#             "size": 5
#         },
#         "overload_control": {
#             "overload_drop_time": 4,
#             "overload_throttle_rate": 6
#         },
#         "packetsize": 490,
#         "queue_length": 2,
#         "targets": [
#             {
#                 "host": "1.1.1.2",
#                 "name": "test"
#             },
#             {
#                 "name": "test2",
#                 "vrf": "vrf2"
#             }
#         ],
#         "throttle_time": 60,
#         "timeouts": {
#             "duplicate": 0,
#             "inQdrop": 0
#         },
#         "trap": {
#             "throttle_time": 12
#         },
#         "trap_source": "GigabitEthernet0/0/0/2",
#         "trap_timeout": 3,
#         "traps": {
#             "addrpool": {
#                 "high": true,
#                 "low": true
#             },
#             "bfd": true,
#             "bgp": {
#                 "cbgp2": true
#             },
#             "bridgemib": true,
#             "bulkstat_collection": true,
#             "cisco_entity_ext": true,
#             "config": true,
#             "copy_complete": true,
#             "hsrp": true,
#             "ipsec": {
#                 "start": true,
#                 "stop": true
#             },
#             "ipsla": true,
#             "l2tun": {
#                 "sessions": true,
#                 "tunnel_down": true,
#                 "tunnel_up": true
#             },
#             "l2vpn": {
#                 "all": true,
#                 "vc_down": true,
#                 "vc_up": true
#             },
#             "msdp_peer_state_change": true
#         },
#         "users": [
#             {
#                 "Ipv4_acl": "test1",
#                 "Ipv6_acl": "test2",
#                 "group": "test2",
#                 "user": "u1",
#                 "version": "v1"
#             }
#         ],
#         "vrfs": [
#             {
#                 "hosts": [
#                     {
#                         "community": "test1",
#                         "host": "1.1.1.1",
#                         "traps": true
#                     }
#                 ],
#                 "vrf": "vrf1"
#             }
#         ]
#     }
#
#
# Using state: rendered
# Rendered play:
# --------------
- name: >-
    Render platform specific configuration lines with state rendered (without
    connecting to the device)
  cisco.iosxr.iosxr_snmp_server:
    state: rendered
    config:
      vrfs:
        - hosts:
            - community: test1
              host: 1.1.1.1
              traps: true
          vrf: vrf1
      users:
        - Ipv4_acl: test1
          Ipv6_acl: test2
          group: test2
          user: u1
          version: v1
      timeouts:
        duplicate: 0
        inQdrop: 0
      trap:
        throttle_time: 12
      targets:
        - host: 1.1.1.2
          name: test
      ifmib:
        internal_cache_max_duration: 4
      inform:
        retries: 7
      chassis_id: test2
      packetsize: 490
      queue_length: 2
      throttle_time: 60
      trap_source: GigabitEthernet0/0/0/2
      trap_timeout: 3
      context:
        - c1
        - c2
      contact: t1
      correlator:
        buffer_size: 1024
      communities:
        - name: test2
          ro: true
          sdrowner: true
          acl_v4: test
          acl_v6: test1
      community_maps:
        - name: cm1
          context: c1
          target_list: t1
          security_name: s1
      drop:
        report_IPv4: test1
        unknown_user: true
      ipv6:
        precedence: routine
      ipv4:
        dscp: af11
      location: test1
      logging_threshold_oid_processing: 1
      logging_threshold_pdu_processing: 1
      mib_bulkstat_max_procmem_size: 101
      mroutemib_send_all_vrf: true
      overload_control:
        overload_drop_time: 4
        overload_throttle_rate: 6
      notification_log_mib:
        GlobalSize: 5
        size: 5
      traps:
        hsrp: true
        ipsla: true
        ipsec:
          start: true
          stop: true
        bridgemib: true
        bulkstat_collection: true
        cisco_entity_ext: true
        config: true
        copy_complete: true
        addrpool:
          high: true
          low: true
        bfd: true
        bgp:
          cbgp2: true
        l2tun:
          sessions: true
          tunnel_down: true
          tunnel_up: true
        l2vpn:
          all: true
          vc_down: true
          vc_up: true
        msdp_peer_state_change: true
  register: result

# Module Execution Result:
# ------------------------
# "rendered": [
#         "snmp-server chassis-id test2",
#         "snmp-server correlator buffer-size 1024",
#         "snmp-server contact t1",
#         "snmp-server ipv4 dscp af11",
#         "snmp-server ipv6 precedence routine",
#         "snmp-server location test1",
#         "snmp-server logging threshold oid-processing 1",
#         "snmp-server logging threshold pdu-processing 1",
#         "snmp-server mib bulkstat max-procmem-size 101",
#         "snmp-server mroutemib send-all-vrf",
#         "snmp-server overload-control 4 6",
#         "snmp-server packetsize 490",
#         "snmp-server queue-length 2",
#         "snmp-server throttle-time 60",
#         "snmp-server trap-source GigabitEthernet0/0/0/2",
#         "snmp-server trap-timeout 3",
#         "snmp-server drop report acl IPv4 test1",
#         "snmp-server drop unknown-user",
#         "snmp-server ifmib internal cache max-duration 4",
#         "snmp-server inform retries 7",
#         "snmp-server notification-log-mib size 5",
#         "snmp-server notification-log-mib GlobalSize 5",
#         "snmp-server trap throttle-time 12",
#         "snmp-server timeouts inQdrop 0",
#         "snmp-server timeouts duplicate 0",
#         "snmp-server traps addrpool low",
#         "snmp-server traps addrpool high",
#         "snmp-server traps bfd",
#         "snmp-server traps bgp cbgp2",
#         "snmp-server traps bulkstat collection",
#         "snmp-server traps bridgemib",
#         "snmp-server traps copy-complete",
#         "snmp-server traps cisco-entity-ext",
#         "snmp-server traps config",
#         "snmp-server traps hsrp",
#         "snmp-server traps ipsla",
#         "snmp-server traps ipsec tunnel start",
#         "snmp-server traps ipsec tunnel stop",
#         "snmp-server traps l2tun sessions",
#         "snmp-server traps l2tun tunnel-up",
#         "snmp-server traps l2tun tunnel-down",
#         "snmp-server traps l2vpn all",
#         "snmp-server traps l2vpn vc-up",
#         "snmp-server traps l2vpn vc-down",
#         "snmp-server traps msdp peer-state-change",
#         "snmp-server community test2 RO SDROwner IPv4 test IPv6 test1",
#         "snmp-server community-map cm1 context c1 security-name s1 target-list t1",
#         "snmp-server context c1",
#         "snmp-server context c2",
#         "snmp-server user u1 test2 v1 IPv4 test1 IPv6 test2",
#         "snmp-server target list test2 vrf vrf2",
#         "snmp-server target list test host 1.1.1.2",
#         "snmp-server vrf vrf1",
#         "host 1.1.1.1 traps test1"
#     ],
# Using state: parsed
# File: parsed.cfg
# ----------------
# snmp-server vrf vrf1
#  host 1.1.1.1 traps test1
# !
# snmp-server drop report acl IPv4 test1
# snmp-server drop unknown-user
# snmp-server ipv4 dscp af11
# snmp-server ipv6 precedence routine
# snmp-server user u1 test2 v1 IPv4 test1 IPv6 test2
# snmp-server community test2 RO SDROwner IPv4 test IPv6 test1
# snmp-server queue-length 2
# snmp-server trap-timeout 3
# snmp-server trap throttle-time 12
# snmp-server traps bfd
# snmp-server traps bgp cbgp2
# snmp-server traps copy-complete
# snmp-server traps hsrp
# snmp-server traps ipsla
# snmp-server traps msdp peer-state-change
# snmp-server traps ipsec tunnel stop
# snmp-server traps ipsec tunnel start
# snmp-server traps config
# snmp-server traps l2tun sessions
# snmp-server traps l2tun tunnel-up
# snmp-server traps l2tun tunnel-down
# snmp-server traps bulkstat collection
# snmp-server traps l2vpn all
# snmp-server traps l2vpn vc-up
# snmp-server traps l2vpn vc-down
# snmp-server traps bridgemib
# snmp-server traps addrpool low
# snmp-server traps addrpool high
# snmp-server traps cisco-entity-ext
# snmp-server chassis-id test2
# snmp-server contact t1
# snmp-server location test1
# snmp-server target list test host 1.1.1.2
# snmp-server target list test2 vrf vrf2
# snmp-server context c1
# snmp-server context c2
# snmp-server logging threshold oid-processing 1
# snmp-server logging threshold pdu-processing 1
# snmp-server mib bulkstat max-procmem-size 101
# snmp-server timeouts duplicate 0
# snmp-server timeouts inQdrop 0
# snmp-server packetsize 490
# snmp-server correlator buffer-size 1024
# snmp-server trap-source GigabitEthernet0/0/0/2
# snmp-server throttle-time 60
# snmp-server community-map cm1 context c1 security-name s1 target-list t1
# snmp-server inform retries 7
# snmp-server overload-control 4 6
# snmp-server ifmib internal cache max-duration 4
# snmp-server mroutemib send-all-vrf
# snmp-server notification-log-mib size 5
# snmp-server notification-log-mib GlobalSize 5
# ------------
- name: Parse the provided configuration with the existing running configuration
  cisco.iosxr.iosxr_snmp_server:
    running_config: "{{ lookup('file', 'parsed.cfg') }}"
    state: parsed
# Module Execution Result:
# ------------------------
# "parsed":{
#         "chassis_id": "test2",
#         "communities": [
#             {
#                 "acl_v4": "test",
#                 "acl_v6": "test1",
#                 "name": "test2",
#                 "ro": true,
#                 "sdrowner": true
#             }
#         ],
#         "community_maps": [
#             {
#                 "context": "c1",
#                 "name": "cm1",
#                 "security_name": "s1",
#                 "target_list": "t1"
#             }
#         ],
#         "contact": "t1",
#         "context": [
#             "c1",
#             "c2"
#         ],
#         "correlator": {
#             "buffer_size": 1024
#         },
#         "drop": {
#             "report_IPv4": "test1",
#             "unknown_user": true
#         },
#         "ifmib": {
#             "internal_cache_max_duration": 4
#         },
#         "inform": {
#             "retries": 7
#         },
#         "ipv4": {
#             "dscp": "af11"
#         },
#         "ipv6": {
#             "precedence": "routine"
#         },
#         "location": "test1",
#         "logging_threshold_oid_processing": 1,
#         "logging_threshold_pdu_processing": 1,
#         "mib_bulkstat_max_procmem_size": 101,
#         "mroutemib_send_all_vrf": true,
#         "notification_log_mib": {
#             "GlobalSize": 5,
#             "size": 5
#         },
#         "overload_control": {
#             "overload_drop_time": 4,
#             "overload_throttle_rate": 6
#         },
#         "packetsize": 490,
#         "queue_length": 2,
#         "targets": [
#             {
#                 "host": "1.1.1.2",
#                 "name": "test"
#             },
#             {
#                 "name": "test2",
#                 "vrf": "vrf2"
#             }
#         ],
#         "throttle_time": 60,
#         "timeouts": {
#             "duplicate": 0,
#             "inQdrop": 0
#         },
#         "trap": {
#             "throttle_time": 12
#         },
#         "trap_source": "GigabitEthernet0/0/0/2",
#         "trap_timeout": 3,
#         "traps": {
#             "addrpool": {
#                 "high": true,
#                 "low": true
#             },
#             "bfd": true,
#             "bgp": {
#                 "cbgp2": true
#             },
#             "bridgemib": true,
#             "bulkstat_collection": true,
#             "cisco_entity_ext": true,
#             "config": true,
#             "copy_complete": true,
#             "hsrp": true,
#             "ipsec": {
#                 "start": true,
#                 "stop": true
#             },
#             "ipsla": true,
#             "l2tun": {
#                 "sessions": true,
#                 "tunnel_down": true,
#                 "tunnel_up": true
#             },
#             "l2vpn": {
#                 "all": true,
#                 "vc_down": true,
#                 "vc_up": true
#             },
#             "msdp_peer_state_change": true
#         },
#         "users": [
#             {
#                 "Ipv4_acl": "test1",
#                 "Ipv6_acl": "test2",
#                 "group": "test2",
#                 "user": "u1",
#                 "version": "v1"
#             }
#         ],
#         "vrfs": [
#             {
#                 "hosts": [
#                     {
#                         "community": "test1",
#                         "host": "1.1.1.1",
#                         "traps": true
#                     }
#                 ],
#                 "vrf": "vrf1"
#             }
#         ]
#     }

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
after
dictionary
when changed
The resulting configuration after module execution.

Sample:
This output will always be in the same format as the module argspec.
before
dictionary
when state is merged, replaced, overridden, deleted or purged
The configuration prior to the module execution.

Sample:
This output will always be in the same format as the module argspec.
commands
list
when state is merged, replaced, overridden, deleted or purged
The set of commands pushed to the remote device.

Sample:
['sample command 1', 'sample command 2', 'sample command 3']
gathered
list
when state is gathered
Facts about the network resource gathered from the remote device as structured data.

Sample:
This output will always be in the same format as the module argspec.
parsed
list
when state is parsed
The device native config provided in running_config option parsed into structured data as per module argspec.

Sample:
This output will always be in the same format as the module argspec.
rendered
list
when state is rendered
The provided configuration in the task rendered in device-native format (offline).

Sample:
['sample command 1', 'sample command 2', 'sample command 3']


Authors

  • Ashwini Mhatre (@amhatre)