Skip to content

Commit

Permalink
ios_snmp_server: Update the module to take in count a lot of missing …
Browse files Browse the repository at this point in the history
…traps
  • Loading branch information
earendilfr committed May 26, 2023
1 parent ee4a40c commit d632fe0
Show file tree
Hide file tree
Showing 7 changed files with 2,785 additions and 695 deletions.
4 changes: 4 additions & 0 deletions changelogs/fragments/ios_snmp_server_changes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
minor_changes:
- ios_snmp_server - Update the module to manage correctly a lot of traps not take in count
- ios_snmp_server - Fixe an issue with cbgp2 to take in count correctly for bgp traps
445 changes: 405 additions & 40 deletions plugins/module_utils/network/ios/argspec/snmp_server/snmp_server.py

Large diffs are not rendered by default.

117 changes: 84 additions & 33 deletions plugins/module_utils/network/ios/config/snmp_server/snmp_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,74 +75,124 @@ def __init__(self, module):
"password_policy",
"users",
"views",
#"traps.power_ethernet.group",
]
self.complex_parsers = [
"traps.aaa_server",
"traps.auth_framework",
"traps.bfd",
"traps.bgp",
#"traps.bgp",
#"traps.bgp.cbgp2",
"traps.bridge",
"traps.bulkstat",
"traps.call_home",
"traps.casa",
"traps.cef",
"traps.cnpd",
"traps.config",
"traps.config_copy",
"traps.config_ctid",
"traps.cpu",
"traps.dhcp",
"traps.dlsw",
"traps.eigrp",
"traps.entity",
"traps.energywise",
"traps.entity",
"traps.entity_diag",
"traps.entity_perf",
"traps.entity_state",
"traps.envmon",
"traps.errdisable",
"traps.ether_oam",
"traps.ethernet.cfm.alarm",
"traps.ethernet.cfm.cc",
"traps.ethernet.cfm.crosscheck",
"traps.ethernet.evc",
"traps.event_manager",
"traps.flash",
"traps.flex_links",
"traps.firewall",
"traps.flowmon",
"traps.frame_relay",
"traps.frame_relay.subif",
"traps.fru_ctrl",
"traps.hsrp",
"traps.ipsla",
"traps.isis",
"traps.msdp",
"traps.mvpn",
"traps.mpls_vpn",
"traps.pki",
"traps.pw_vc",
"traps.rsvp",
"traps.syslog",
"traps.transceiver_all",
"traps.tty",
"traps.vrrp",
"traps.vrfmib",
"traps.ipmulticast",
"traps.ike.policy.add",
"traps.ike.policy.delete",
"traps.ike.tunnel.start",
"traps.ike.tunnel.stop",
"traps.ipmulticast",
"traps.ipsec.cryptomap.add",
"traps.ipsec.cryptomap.delete",
"traps.ipsec.cryptomap.attach",
"traps.ipsec.cryptomap.delete",
"traps.ipsec.cryptomap.detach",
"traps.ipsec.too_many_sas",
"traps.ipsec.tunnel.start",
"traps.ipsec.tunnel.stop",
"traps.ipsec.too_many_sas",
"traps.ipsla",
"traps.isis",
"traps.l2tc",
"traps.l2tun.pseudowire_status",
"traps.l2tun.session",
"traps.lisp",
"traps.license",
"traps.local_auth",
"traps.mac_notification",
"traps.memory",
"traps.mpls.fast_reroute",
"traps.mpls.ldp",
"traps.mpls.rfc.ldp",
"traps.mpls.rfc.traffic_eng",
"traps.mpls.rfc.vpn",
"traps.mpls.traffic_eng",
"traps.mpls.vpn",
"traps.msdp",
"traps.mvpn",
"traps.nhrp.nhc",
"traps.nhrp.nhp",
"traps.nhrp.nhs",
"traps.nhrp.quota_exceeded",
"traps.ospf.cisco_specific.error",
"traps.ospf.cisco_specific.retransmit",
"traps.ospf.cisco_specific.lsa",
"traps.ospf.cisco_specific.retransmit",
"traps.ospf.cisco_specific.state_change.nssa_trans_change",
"traps.ospf.cisco_specific.state_change.shamlink.interface",
"traps.ospf.cisco_specific.state_change.shamlink.neighbor",
"traps.ospf.error",
"traps.ospf.retransmit",
"traps.ospf.lsa",
"traps.ospf.retransmit",
"traps.ospf.state_change",
"traps.l2tun.pseudowire_status",
"traps.l2tun.session",
"traps.cpu",
"traps.firewall",
"traps.ospfv3.errors",
"traps.ospfv3.rate_limit",
"traps.ospfv3.state_change",
"traps.pim",
"traps.pki",
"traps.port_security",
"traps.power_ethernet",
"traps.pw_vc",
"traps.rep",
"traps.rsvp",
"traps.rf",
"traps.smart_license",
"traps.snmp",
"traps.frame_relay",
"traps.frame_relay.subif",
"traps.cef",
"traps.dlsw",
"traps.ethernet.evc",
"traps.ethernet.cfm.alarm",
"traps.ethernet.cfm.cc",
"traps.ethernet.cfm.crosscheck",
"traps.stackwise",
"traps.stpx",
"traps.syslog",
"traps.transceiver_all",
"traps.trustsec",
"traps.trustsec_interface",
"traps.trustsec_policy",
"traps.trustsec_server",
"traps.trustsec_sxp",
"traps.tty",
"traps.udld",
"traps.vlan_membership",
"traps.vlancreate",
"traps.vlandelete",
"traps.vrfmib",
"traps.vrrp",
"traps.vswitch",
"traps.vtp",
]

def execute_module(self):
Expand Down Expand Up @@ -242,7 +292,8 @@ def _snmp_list_to_dict(self, data):
tmp_data[k]["protocol"] = tmp
elif k == "groups":
tmp_data[k] = {
str(i[p_key.get(k)] + i.get("version_option", "")): i for i in tmp_data[k]
str(i[p_key.get(k)] + i.get("version_option", "") + i.get("context", "")): i
for i in tmp_data[k]
}
elif k == "views":
tmp_data[k] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(self, module, subspec="config", options="options"):
self.argument_spec = Snmp_serverArgs.argument_spec

def get_snmp_data(self, connection):
return connection.get("show running-config | section ^snmp-server")
return connection.get("show running-config | section ^snmp")

def sort_list_dicts(self, objs):
p_key = {
Expand Down
Loading

0 comments on commit d632fe0

Please sign in to comment.