From 8cdcf819afa856f5a20bf4141949a51ded33dbf2 Mon Sep 17 00:00:00 2001 From: Guillaume MBali Date: Mon, 17 Apr 2023 15:43:28 +0200 Subject: [PATCH 1/2] Cisco adding acl number recovery in snmp community template --- .../templates/cisco_ios_show_snmp_community.textfsm | 3 ++- .../show_snmp_community/cisco_ios_show_snmp_community.raw | 5 +++++ .../show_snmp_community/cisco_ios_show_snmp_community.yml | 8 ++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ntc_templates/templates/cisco_ios_show_snmp_community.textfsm b/ntc_templates/templates/cisco_ios_show_snmp_community.textfsm index f2155d170f..f2f1e2b6e3 100644 --- a/ntc_templates/templates/cisco_ios_show_snmp_community.textfsm +++ b/ntc_templates/templates/cisco_ios_show_snmp_community.textfsm @@ -2,12 +2,13 @@ Value NAME (\S+) Value INDEX (\S+) Value SECURITY_NAME (\S+) Value STORAGE_TYPE (\S+) +Value ACCESS_LIST_NUMBER (\S+) Start ^Community\s+name:\s+${NAME}.* ^Community\sIndex:\s+${INDEX} ^Community\sSecurityName:\s+${SECURITY_NAME} - ^storage-type:\s${STORAGE_TYPE} -> Record + ^storage-type:\s${STORAGE_TYPE}\s+active(\s+access-list:\s${ACCESS_LIST_NUMBER})? -> Record # Capture time-stamp if vty line has command time-stamping turned on ^Load\s+for\s+ ^Time\s+source\s+is diff --git a/tests/cisco_ios/show_snmp_community/cisco_ios_show_snmp_community.raw b/tests/cisco_ios/show_snmp_community/cisco_ios_show_snmp_community.raw index 7cd5420810..7df0c1cda9 100644 --- a/tests/cisco_ios/show_snmp_community/cisco_ios_show_snmp_community.raw +++ b/tests/cisco_ios/show_snmp_community/cisco_ios_show_snmp_community.raw @@ -15,3 +15,8 @@ Community Index: cisco2 Community SecurityName: private storage-type: nonvolatile active + +Community name: Monitoring +Community Index: cisco1 +Community SecurityName: Monitoring +storage-type: nonvolatile active access-list: 33 diff --git a/tests/cisco_ios/show_snmp_community/cisco_ios_show_snmp_community.yml b/tests/cisco_ios/show_snmp_community/cisco_ios_show_snmp_community.yml index 1d07e30bb6..8adbae77ca 100644 --- a/tests/cisco_ios/show_snmp_community/cisco_ios_show_snmp_community.yml +++ b/tests/cisco_ios/show_snmp_community/cisco_ios_show_snmp_community.yml @@ -4,11 +4,19 @@ parsed_sample: index: "cisco0" security_name: "ILMI" storage_type: "read-only" + access_list_number: "" - name: "public" index: "cisco1" security_name: "public" storage_type: "nonvolatile" + access_list_number: "" - name: "private" index: "cisco2" security_name: "private" storage_type: "nonvolatile" + access_list_number: "" + - name: "Monitoring" + index: "cisco1" + security_name: "Monitoring" + storage_type: "nonvolatile" + access_list_number: "33" From 9f1268a7f9805707926dd24219d087d76729dd4b Mon Sep 17 00:00:00 2001 From: Jacob Date: Fri, 19 Jul 2024 18:47:27 -0400 Subject: [PATCH 2/2] Update template per current standards --- .../templates/cisco_ios_show_snmp_community.textfsm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ntc_templates/templates/cisco_ios_show_snmp_community.textfsm b/ntc_templates/templates/cisco_ios_show_snmp_community.textfsm index f2f1e2b6e3..bc1c11e9fd 100644 --- a/ntc_templates/templates/cisco_ios_show_snmp_community.textfsm +++ b/ntc_templates/templates/cisco_ios_show_snmp_community.textfsm @@ -5,10 +5,13 @@ Value STORAGE_TYPE (\S+) Value ACCESS_LIST_NUMBER (\S+) Start - ^Community\s+name:\s+${NAME}.* + ^Community\s+name: -> Continue.Record + ^Community\s+name:\s+${NAME}\s*$$ ^Community\sIndex:\s+${INDEX} ^Community\sSecurityName:\s+${SECURITY_NAME} - ^storage-type:\s${STORAGE_TYPE}\s+active(\s+access-list:\s${ACCESS_LIST_NUMBER})? -> Record + ^storage-type:\s${STORAGE_TYPE}\s+active(\s+access-list:\s${ACCESS_LIST_NUMBER})? # Capture time-stamp if vty line has command time-stamping turned on ^Load\s+for\s+ ^Time\s+source\s+is + ^\s*$$ + ^. -> Error