Skip to content

Commit

Permalink
Add IOS show users template (#1475)
Browse files Browse the repository at this point in the history
Co-authored-by: pskliarenko <“[email protected]”>
Co-authored-by: Jacob McGill <[email protected]>
  • Loading branch information
3 people authored Jul 22, 2024
1 parent 6cd1f02 commit edc31a2
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ntc_templates/templates/cisco_ios_show_users.textfsm
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Value LINE ((\*\s+)?\d+\s+(con|aux|tty|vty)\s+\d+)
Value USER (\S+)
Value HOSTS (\S+)
Value IDLE (\S+)
Value LOCATION (\S+)

Start
^\s*Line\s+User\s+Host\(s\)\s+Idle\s+Location\s*$$ -> UsersTable
^\s*$$
^. -> Error

UsersTable
^\s*${LINE}(?:\s+${USER})?(?:\s+${HOSTS})?\s+${IDLE}(?:\s+${LOCATION})?\s*$$ -> Record
^\s*Interface\s+User\s+Mode\s+Idle\s+Peer\s+Address\s*$$
^\s*$$
^. -> Error
1 change: 1 addition & 0 deletions ntc_templates/templates/index
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ cisco_ios_show_ip_cef.textfsm, .*, cisco_ios, sh[[ow]] ip ce[[f]](?: vrf? \S+)?\
cisco_ios_show_tacacs.textfsm, .*, cisco_ios, sh[[ow]] tacacs
cisco_ios_show_clock.textfsm, .*, cisco_ios, sh[[ow]] clo[[ck]]
cisco_ios_show_dmvpn.textfsm, .*, cisco_ios, sh[[ow]] dm[[vpn]]
cisco_ios_show_users.textfsm, .*, cisco_ios, sh[[ow]] users(?: (?:a[[ll]]))?
cisco_ios_show_vlans.textfsm, .*, cisco_ios, sh[[ow]] vlans
cisco_ios_traceroute.textfsm, .*, cisco_ios, tr[[aceroute]]
cisco_ios_show_boot.textfsm, .*, cisco_ios, sh[[ow]] boot
Expand Down
4 changes: 4 additions & 0 deletions tests/cisco_ios/show_users/cisco_ios_show_users.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Line User Host(s) Idle Location
* 10 vty 0 arm idle 00:00:00 1.2.3.4

Interface User Mode Idle Peer Address
7 changes: 7 additions & 0 deletions tests/cisco_ios/show_users/cisco_ios_show_users.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
parsed_sample:
- hosts: "idle"
idle: "00:00:00"
line: "* 10 vty 0"
location: "1.2.3.4"
user: "arm"
8 changes: 8 additions & 0 deletions tests/cisco_ios/show_users/cisco_ios_show_users_all.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Line User Host(s) Idle Location
0 con 0 00:00:00
1 aux 0 00:00:00
* 10 vty 0 arm idle 00:00:00 1.2.3.4
11 vty 1 00:00:00
12 vty 2 00:00:00

Interface User Mode Idle Peer Address
27 changes: 27 additions & 0 deletions tests/cisco_ios/show_users/cisco_ios_show_users_all.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
parsed_sample:
- hosts: ""
idle: "00:00:00"
line: "0 con 0"
location: ""
user: ""
- hosts: ""
idle: "00:00:00"
line: "1 aux 0"
location: ""
user: ""
- hosts: "idle"
idle: "00:00:00"
line: "* 10 vty 0"
location: "1.2.3.4"
user: "arm"
- hosts: ""
idle: "00:00:00"
line: "11 vty 1"
location: ""
user: ""
- hosts: ""
idle: "00:00:00"
line: "12 vty 2"
location: ""
user: ""

0 comments on commit edc31a2

Please sign in to comment.