Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CiscoIOS 'show users' template + test #1475

Merged
merged 3 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -326,6 +326,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: ""
Loading