From d52ac65c958f6bb2aa4ce58c1d1faaa514434a7b Mon Sep 17 00:00:00 2001 From: tbotnz Date: Fri, 9 Jul 2021 02:56:05 +0000 Subject: [PATCH 1/2] improve-traps --- show_run.ttp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/show_run.ttp b/show_run.ttp index da68307..f930b96 100644 --- a/show_run.ttp +++ b/show_run.ttp @@ -127,13 +127,12 @@ enable password {{ password }} snmp-server community {{community | _start_ }} {{mode}} snmp-server host {{trap_host | _start_ }} {{community}} snmp-server trap-source {{trap_source}} - -snmp-server enable traps {{ traps | re(".+") | split(' ') }} + +snmp-server enable traps {{ traps_name | re(".+")}} snmp-server host {{trap_host | _start_ }} version 2c {{community}} - logging facility {{facility}} logging source-interface {{source_interface}} @@ -306,7 +305,7 @@ policy-map {{ policy_map | re(".+") | record(vrf) }} class-map match-{{match_type}} {{class_name}} - match {{type}} {{ value | | re(".+") | unrange(rangechar='-', joinchar=' ' ) | split(' ') }} + match {{type}} {{ value | re(".+") | unrange(rangechar='-', joinchar=' ' ) | split(' ') }} From 3e6615309a82f4f33d41ae208436723cec05d028 Mon Sep 17 00:00:00 2001 From: tbotnz Date: Fri, 9 Jul 2021 02:56:23 +0000 Subject: [PATCH 2/2] improve-traps --- example-result.json | 136 ++++++++------------------------------------ 1 file changed, 24 insertions(+), 112 deletions(-) diff --git a/example-result.json b/example-result.json index 00a07ec..009a6e0 100644 --- a/example-result.json +++ b/example-result.json @@ -1105,118 +1105,30 @@ { "community": "test", "mode": "RO", - "enabled_traps": [ - { - "traps": [ - "snmp authentication linkdown linkup coldstart warmstart" - ] - }, - { - "traps": [ - "ospf state-change if-state-change neighbor-state-change" - ] - }, - { - "traps": [ - "bgp state-changes all" - ] - }, - { - "traps": [ - "config-copy" - ] - }, - { - "traps": [ - "config" - ] - }, - { - "traps": [ - "isis state-change" - ] - }, - { - "traps": [ - "ipsla" - ] - }, - { - "traps": [ - "ether-oam" - ] - }, - { - "traps": [ - "memory bufferpeak" - ] - }, - { - "traps": [ - "entity-state" - ] - }, - { - "traps": [ - "entity" - ] - }, - { - "traps": [ - "cpu threshold" - ] - }, - { - "traps": [ - "rep" - ] - }, - { - "traps": [ - "entity-sensor" - ] - }, - { - "traps": [ - "resource-policy" - ] - }, - { - "traps": [ - "flash insertion" - ] - }, - { - "traps": [ - "flash removal" - ] - }, - { - "traps": [ - "mpls ldp session-up session-down" - ] - }, - { - "traps": [ - "pw vc" - ] - }, - { - "traps": [ - "bulkstat collection transfer" - ] - }, - { - "traps": [ - "mac-notification" - ] - }, - { - "traps": [ - "transceiver all" - ] - } - ] + "enabled_traps": { + "snmp authentication linkdown linkup coldstart warmstart": {}, + "ospf state-change if-state-change neighbor-state-change": {}, + "bgp state-changes all": {}, + "config-copy": {}, + "config": {}, + "isis state-change": {}, + "ipsla": {}, + "ether-oam": {}, + "memory bufferpeak": {}, + "entity-state": {}, + "entity": {}, + "cpu threshold": {}, + "rep": {}, + "entity-sensor": {}, + "resource-policy": {}, + "flash insertion": {}, + "flash removal": {}, + "mpls ldp session-up session-down": {}, + "pw vc": {}, + "bulkstat collection transfer": {}, + "mac-notification": {}, + "transceiver all": {} + } } ], "line": [