Skip to content

Commit

Permalink
Cisco ios show snmp group (networktocode#1183)
Browse files Browse the repository at this point in the history
* Added new template and tests.

* Created cisco_ios_show_snmp_group.textfsm template.

Co-authored-by: Nicholas Nelson - 10105570 <[email protected]>
  • Loading branch information
nsnelson402 and Nicholas Nelson - 10105570 authored Aug 22, 2022
1 parent ef21911 commit a475a84
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### What's Changed
* New template: cisco_ios_show_ip_eigrp_interfaces_detail.textfsm by @nsnelson402
* New template: cisco_ios_show_snmp_group.textfsm by @nsnelson402

## [3.0.0](https://github.com/networktocode/ntc-templates/tree/3.0.0) (2021-10-28)

Expand Down
22 changes: 22 additions & 0 deletions ntc_templates/templates/cisco_ios_show_snmp_group.textfsm
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Value Required GROUPNAME (\S+)
Value SECURITY_MODEL ([\s\S]+?)
Value CONTEXTNAME ([\s\S]+?)
Value STORAGE_TYPE (\S+)
Value READVIEW ([\s\S]+?)
Value WRITEVIEW ([\s\S]+?)
Value NOTIFYVIEW ([\s\S]+?)
Value ROW_STATUS ([\s\S]+?)
Value ACCESS_LIST (\S+)

Start
^\s*groupname:\s*\S+\s+security\s+model:\s*[\s\S]+\s*$$ -> Continue.Record
^\s*groupname:\s*${GROUPNAME}\s+security\s+model:\s*${SECURITY_MODEL}\s*$$
^\s*contextname:\s+${CONTEXTNAME}\s+storage-type:\s+${STORAGE_TYPE}\s*$$
^\s*readview\s*:\s+${READVIEW}\s+writeview:\s+${WRITEVIEW}\s*$$
^\s*notifyview:\s+${NOTIFYVIEW}\s*$$
^\s*row\s+status:\s+${ROW_STATUS}(?:\s+access-list:\s+${ACCESS_LIST})*\s*$$
^\s*$$
# Capture time-stamp if vty line has command time-stamping turned on
^Load\s+for\s+
^Time\s+source\s+is
^. -> Error
1 change: 1 addition & 0 deletions ntc_templates/templates/index
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ cisco_ios_show_isdn_status.textfsm, .*, cisco_ios, sh[[ow]] isd[[n]] st[[atus]]
cisco_ios_show_dhcp_lease.textfsm, .*, cisco_ios, sh[[ow]] dh[[cp]] l[[ease]]
cisco_ios_show_interfaces.textfsm, .*, cisco_ios, sh[[ow]] int[[erfaces]]
cisco_ios_show_redundancy.textfsm, .*, cisco_ios, sh[[ow]] redu[[ndancy]]
cisco_ios_show_snmp_group.textfsm, .*, cisco_ios, sh[[ow]] snm[[p]] g[[roup]]
cisco_ios_show_vrrp_brief.textfsm, .*, cisco_ios, sh[[ow]] vrr[[p]] b[[rief]]
cisco_ios_show_vtp_status.textfsm, .*, cisco_ios, sh[[ow]] vtp stat[[us]]
cisco_ios_show_adjacency.textfsm, .*, cisco_ios, sh[[ow]] ad[[jacency]]
Expand Down
41 changes: 41 additions & 0 deletions tests/cisco_ios/show_snmp_group/cisco_ios_show_snmp_group.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
groupname: GROUP1 security model:v3 priv
contextname: <no context specified> storage-type: nonvolatile
readview : g1readview writeview: <no writeview specified>
notifyview: g1notifyview
row status: active access-list: snmp-acl-name

groupname: ILMI security model:v1
contextname: <no context specified> storage-type: permanent
readview : *ilmi writeview: *ilmi
notifyview: <no notifyview specified>
row status: active

groupname: ILMI security model:v2c
contextname: <no context specified> storage-type: permanent
readview : *ilmi writeview: *ilmi
notifyview: <no notifyview specified>
row status: active

groupname: GROUP2 security model:v1
contextname: <no context specified> storage-type: nonvolatile
readview : v1default writeview: <no writeview specified>
notifyview: <no notifyview specified>
row status: active access-list: snmp-acl-name

groupname: GROUP2 security model:v2c
contextname: <no context specified> storage-type: nonvolatile
readview : v1default writeview: <no writeview specified>
notifyview: <no notifyview specified>
row status: active access-list: snmp-acl-name

groupname: GROUP3 security model:v1
contextname: <no context specified> storage-type: nonvolatile
readview : v1default writeview: <no writeview specified>
notifyview: <no notifyview specified>
row status: active access-list: snmp-acl-name

groupname: GROUP3 security model:v2c
contextname: <no context specified> storage-type: nonvolatile
readview : v1default writeview: <no writeview specified>
notifyview: <no notifyview specified>
row status: active access-list: snmp-acl-name
65 changes: 65 additions & 0 deletions tests/cisco_ios/show_snmp_group/cisco_ios_show_snmp_group.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
parsed_sample:
- groupname: "GROUP1"
security_model: "v3 priv"
contextname: "<no context specified>"
storage_type: "nonvolatile"
readview: "g1readview"
writeview: "<no writeview specified>"
notifyview: "g1notifyview"
row_status: "active"
access_list: "snmp-acl-name"
- groupname: "ILMI"
security_model: "v1"
contextname: "<no context specified>"
storage_type: "permanent"
readview: "*ilmi"
writeview: "*ilmi"
notifyview: "<no notifyview specified>"
row_status: "active"
access_list: ""
- groupname: "ILMI"
security_model: "v2c"
contextname: "<no context specified>"
storage_type: "permanent"
readview: "*ilmi"
writeview: "*ilmi"
notifyview: "<no notifyview specified>"
row_status: "active"
access_list: ""
- groupname: "GROUP2"
security_model: "v1"
contextname: "<no context specified>"
storage_type: "nonvolatile"
readview: "v1default"
writeview: "<no writeview specified>"
notifyview: "<no notifyview specified>"
row_status: "active"
access_list: "snmp-acl-name"
- groupname: "GROUP2"
security_model: "v2c"
contextname: "<no context specified>"
storage_type: "nonvolatile"
readview: "v1default"
writeview: "<no writeview specified>"
notifyview: "<no notifyview specified>"
row_status: "active"
access_list: "snmp-acl-name"
- groupname: "GROUP3"
security_model: "v1"
contextname: "<no context specified>"
storage_type: "nonvolatile"
readview: "v1default"
writeview: "<no writeview specified>"
notifyview: "<no notifyview specified>"
row_status: "active"
access_list: "snmp-acl-name"
- groupname: "GROUP3"
security_model: "v2c"
contextname: "<no context specified>"
storage_type: "nonvolatile"
readview: "v1default"
writeview: "<no writeview specified>"
notifyview: "<no notifyview specified>"
row_status: "active"
access_list: "snmp-acl-name"

0 comments on commit a475a84

Please sign in to comment.