Skip to content

Commit

Permalink
added template for cisco xr : "admin show environment fan" ,"admin sh…
Browse files Browse the repository at this point in the history
…ow vm" and "show version" (#264)

* added template for cisco xr : admin show environment fan

* Added template for cisco xr: admin show vm command

* added template for cisco xr: show version command

* Update templates to use more generic '\S+'
  • Loading branch information
jmcgill298 committed Oct 14, 2018
1 parent 4548610 commit 9105925
Show file tree
Hide file tree
Showing 10 changed files with 432 additions and 0 deletions.
39 changes: 39 additions & 0 deletions templates/cisco_xr_admin_show_environment_fan.template
@@ -0,0 +1,39 @@
Value MODULE (\S+)
Value TYPE (\S+)
Value List FAN_SPEED (\d+)

Start
^.+UTC
^=+
^\s+Fan\s+speed\s+\(rpm\)\s*$$
^Location\s+FRU\s+Type.+FAN_\d
^\s+FAN_.+$$
^-+ -> FM
^\s*$$
^.* -> Error "LINE NOT FOUND"

FM
^${MODULE}\s+${TYPE}\s+${FAN_SPEED}\s*$$ -> Record
^${MODULE}\s+${TYPE}\s+${FAN_SPEED} -> Continue
^${MODULE}\s+${TYPE}\s+\d+\s+${FAN_SPEED}\s*$$ -> Record
^${MODULE}\s+${TYPE}\s+\d+\s+${FAN_SPEED} -> Continue
^${MODULE}\s+${TYPE}\s+(?:\d+\s+){2}${FAN_SPEED}\s*$$ -> Record
^${MODULE}\s+${TYPE}\s+(?:\d+\s+){2}${FAN_SPEED} -> Continue
^${MODULE}\s+${TYPE}\s+(?:\d+\s+){3}${FAN_SPEED}\s*$$ -> Record
^${MODULE}\s+${TYPE}\s+(?:\d+\s+){3}${FAN_SPEED} -> Continue
^${MODULE}\s+${TYPE}\s+(?:\d+\s+){4}${FAN_SPEED}\s*$$ -> Record
^${MODULE}\s+${TYPE}\s+(?:\d+\s+){4}${FAN_SPEED} -> Continue
^${MODULE}\s+${TYPE}\s+(?:\d+\s+){5}${FAN_SPEED}
^\s+${FAN_SPEED}\s*$$ -> Record
^\s+${FAN_SPEED} -> Continue
^\s+\d+\s+${FAN_SPEED}\s*$$ -> Record
^\s+\d+\s+${FAN_SPEED} -> Continue
^(?:\s+\d+\s+){2}${FAN_SPEED}\s*$$ -> Record
^(?:\s+\d+\s+){2}${FAN_SPEED} -> Continue
^(?:\s+\d+\s+){3}${FAN_SPEED}\s*$$ -> Record
^(?:\s+\d+\s+){3}${FAN_SPEED} -> Continue
^(?:\s+\d+\s+){4}${FAN_SPEED}\s*$$ -> Record
^(?:\s+\d+\s+){4}${FAN_SPEED} -> Continue
^(?:\s+\d+\s+){5}${FAN_SPEED} -> Record
^\s*$$
^.* -> Error "LINE NOT FOUND"
21 changes: 21 additions & 0 deletions templates/cisco_xr_admin_show_vm.template
@@ -0,0 +1,21 @@
Value Filldown LOCATION (\S+)
Value ID (\S+)
Value Required STATUS (\S+)
Value Required IP_ADDR (\S+)
Value HB_SENT (\S+)
Value HB_RECV (\S+)

Start
^.+UTC
^Location:\s${LOCATION}
^Id\s+Status\s+IP\sAddress\s+HB\sSent/Recv
^-+ -> Loc
^\s+$$
^$$
^.* -> Error "LINE NOT FOUND"

Loc
^${ID}\s+${STATUS}\s+${IP_ADDR}\s+${HB_SENT}\/${HB_RECV} -> Record
^\s+$$
^$$ -> Start
^.* -> Error "LINE NOT FOUND"
28 changes: 28 additions & 0 deletions templates/cisco_xr_show_version.template
@@ -0,0 +1,28 @@
Value VERSION (\S+)
Value UPTIME (.+)
Value LOCATION (\S+)
Value HARDWARE (\S+)
Value BUILD_HOST (\S+)

Start
^.+UTC
^Cisco.+Software.+Version.+
^Copyright\s\(c\).+
^Build\s+Information: -> Build_Info
^[Cc]isco\s${HARDWARE}\s.+
^System\suptime\sis\s${UPTIME} -> Record
^\s+$$
^$$
^.* -> Error "Line not found"

Build_Info
^\s+Built\sBy.+
^\s+Built\sOn.+
^\s+Build\sHost\s+:\s+${BUILD_HOST}
^\s+Workspace\s+:\s\S+
^\s+Version\s+:\s${VERSION}
^\s+Location\s+:\s${LOCATION}
^$$ -> Start
^\s+$$
^$$
^.* -> Error "Line not found"
3 changes: 3 additions & 0 deletions templates/index
Expand Up @@ -210,6 +210,7 @@ cisco_xr_show_controller_fabric_plane_all.template, .*, cisco_xr, sh[[ow]] contr
cisco_xr_show_configuration_commit_list.template, .*, cisco_xr, sh[[ow]] conf[[iguration]] c[[ommit]] l[[ist]]
cisco_xr_show_dhcp_ipv4_proxy_binding.template, .*, cisco_xr, sh[[ow]] dh[[cp]] ipv4 p[[roxy]] b[[inding]]
cisco_xr_show_mpls_ldp_neighbor_brief.template, .*, cisco_xr, sh[[ow]] mp[[ls]] ld[[p]] neigh[[bor]] br[[ief]]
cisco_xr_admin_show_environment_fan.template, .*, cisco_xr, adm[[in]] sh[[ow]] env[[ironment]] f[[an]]
cisco_xr_show_cdp_neighbors_detail.template, .*, cisco_xr, sh[[ow]] c[[dp]] neig[[hbors]] det[[ail]]
cisco_xr_show_redundancy_summary.template, .*, cisco_xr, sh[[ow]] redun[[dancy]] summ[[ary]]
cisco_xr_show_interface_brief.template, .*, cisco_xr, sh[[ow]] int[[erface]] br[[ief]]
Expand All @@ -224,7 +225,9 @@ cisco_xr_show_bfd_sessions.template, .*, cisco_xr, sh[[ow]] bf[[d]] sess[[ions]]
cisco_xr_show_pim_neighbor.template, .*, cisco_xr, sh[[ow]] pi[[m]] neigh[[bor]]
cisco_xr_show_controllers.template, .*, cisco_xr, sh[[ow]] contr[[ollers]] (\S+) phy
cisco_xr_show_interfaces.template, .*, cisco_xr, sh[[ow]] inte[[rfaces]]
cisco_xr_admin_show_vm.template, .*, cisco_xr, adm[[in]] sh[[ow]] vm
cisco_xr_show_ip_route.template, .*, cisco_xr, sh[[ow]] ip ro[[ute]]
cisco_xr_show_version.template, .*, cisco_xr, sh[[ow]] ver[[sion]]

dell_force10_show_vlan_brief.template, .*, dell_force10, sh[[ow]] vl[[an]] br[[ief]]
dell_force10_show_version.template, .*, dell_force10, sh[[ow]] ver[[sion]]
Expand Down
@@ -0,0 +1,41 @@
---
parsed_sample:
- module : '0/FT0'
type : 'NC55-5516-FAN'
fan_speed : ['6192', '3870', '6214', '3859', '6257', '3857', '6420', '4029', '6390', '3938', '6467', '4066']
- module : '0/FT1'
type : 'NC55-5516-FAN'
fan_speed : ['6360', '3970', '6143', '3824', '6033', '3750', '6279', '3859', '6060', '3721', '6375', '3964']
- module : '0/FT2'
type : 'NC55-5516-FAN'
fan_speed : ['6545', '4014', '6474', '3994', '6000', '3752', '6375', '4002', '5921', '3698', '6308', '3915']
- module : '0/PM0'
type : 'NC55-PWR-3KW-AC'
fan_speed : ['8021', '8537']
- module : '0/PM1'
type : 'NC55-PWR-3KW-AC'
fan_speed : ['8064', '8387']
- module : '0/PM2'
type : 'NC55-PWR-3KW-AC'
fan_speed : ['8064', '8473']
- module : '0/PM3'
type : 'NC55-PWR-3KW-AC'
fan_speed : ['7978', '8537']
- module : '0/PM4'
type : 'NC55-PWR-3KW-AC'
fan_speed : ['8064', '8473']
- module : '0/PM5'
type : 'NC55-PWR-3KW-AC'
fan_speed : ['8086', '8451']
- module : '0/PM6'
type : 'NC55-PWR-3KW-AC'
fan_speed : ['8086', '8537']
- module : '0/PM7'
type : 'NC55-PWR-3KW-AC'
fan_speed : ['7978', '8473']
- module : '0/PM8'
type : 'NC55-PWR-3KW-AC'
fan_speed : ['8000', '8516']
- module : '0/PM9'
type : 'NC55-PWR-3KW-AC'
fan_speed : ['8021', '8516']
@@ -0,0 +1,33 @@
Sat Mar 10 14:03:31.155 UTC
===============================================================================
Fan speed (rpm)
Location FRU Type FAN_0 FAN_1 FAN_2 FAN_3 FAN_4 FAN_5
FAN_6 FAN_7 FAN_8 FAN_9 FAN_10 FAN_11
-------------------------------------------------------------------------------
0/FT0 NC55-5516-FAN 6192 3870 6214 3859 6257 3857
6420 4029 6390 3938 6467 4066
0/FT1 NC55-5516-FAN 6360 3970 6143 3824 6033 3750
6279 3859 6060 3721 6375 3964
0/FT2 NC55-5516-FAN 6545 4014 6474 3994 6000 3752
6375 4002 5921 3698 6308 3915

0/PM0 NC55-PWR-3KW-AC 8021 8537

0/PM1 NC55-PWR-3KW-AC 8064 8387

0/PM2 NC55-PWR-3KW-AC 8064 8473

0/PM3 NC55-PWR-3KW-AC 7978 8537

0/PM4 NC55-PWR-3KW-AC 8064 8473

0/PM5 NC55-PWR-3KW-AC 8086 8451

0/PM6 NC55-PWR-3KW-AC 8086 8537

0/PM7 NC55-PWR-3KW-AC 7978 8473

0/PM8 NC55-PWR-3KW-AC 8000 8516

0/PM9 NC55-PWR-3KW-AC 8021 8516

163 changes: 163 additions & 0 deletions tests/cisco_xr/admin_show_vm/cisco_xr_admin_show_vm.parsed
@@ -0,0 +1,163 @@
---

parsed_sample:


- id : 'sysadmin'
location : '0/0'
hb_sent : 'NA'
hb_recv : 'NA'
ip_addr : '192.0.4.1'
status : 'running'


- id : 'default-sdr'
location : '0/0'
hb_sent : '293478'
hb_recv : '293478'
ip_addr : '192.0.4.3'
status : 'running'


- id : 'sysadmin'
location : '0/1'
hb_sent : 'NA'
hb_recv : 'NA'
ip_addr : '192.0.8.1'
status : 'running'


- id : 'default-sdr'
location : '0/1'
hb_sent : '293478'
hb_recv : '293478'
ip_addr : '192.0.8.3'
status : 'running'


- id : 'sysadmin'
location : '0/2'
hb_sent : 'NA'
hb_recv : 'NA'
ip_addr : '192.0.12.1'
status : 'running'


- id : 'default-sdr'
location : '0/2'
hb_sent : '293478'
hb_recv : '293478'
ip_addr : '192.0.12.3'
status : 'running'


- id : 'sysadmin'
location : '0/3'
hb_sent : 'NA'
hb_recv : 'NA'
ip_addr : '192.0.16.1'
status : 'running'


- id : 'default-sdr'
location : '0/3'
hb_sent : '293478'
hb_recv : '293478'
ip_addr : '192.0.16.3'
status : 'running'


- id : 'sysadmin'
location : '0/4'
hb_sent : 'NA'
hb_recv : 'NA'
ip_addr : '192.0.20.1'
status : 'running'


- id : 'default-sdr'
location : '0/4'
hb_sent : '293478'
hb_recv : '293478'
ip_addr : '192.0.20.3'
status : 'running'


- id : 'sysadmin'
location : '0/FC0'
hb_sent : 'NA'
hb_recv : 'NA'
ip_addr : '192.0.84.1'
status : 'running'


- id : 'sysadmin'
location : '0/FC1'
hb_sent : 'NA'
hb_recv : 'NA'
ip_addr : '192.0.88.1'
status : 'running'


- id : 'sysadmin'
location : '0/FC2'
hb_sent : 'NA'
hb_recv : 'NA'
ip_addr : '192.0.92.1'
status : 'running'


- id : 'sysadmin'
location : '0/FC3'
hb_sent : 'NA'
hb_recv : 'NA'
ip_addr : '192.0.96.1'
status : 'running'


- id : 'sysadmin'
location : '0/FC4'
hb_sent : 'NA'
hb_recv : 'NA'
ip_addr : '192.0.100.1'
status : 'running'


- id : 'sysadmin'
location : '0/FC5'
hb_sent : 'NA'
hb_recv : 'NA'
ip_addr : '192.0.104.1'
status : 'running'


- id : 'sysadmin'
location : '0/RP0'
hb_sent : 'NA'
hb_recv : 'NA'
ip_addr : '192.0.108.1'
status : 'running'


- id : 'default-sdr'
location : '0/RP0'
hb_sent : '5869560'
hb_recv : '5869560'
ip_addr : '192.0.108.4'
status : 'running'


- id : 'sysadmin'
location : '0/SC0'
hb_sent : 'NA'
hb_recv : 'NA'
ip_addr : '192.0.116.1'
status : 'running'


- id : 'sysadmin'
location : '0/SC1'
hb_sent : 'NA'
hb_recv : 'NA'
ip_addr : '192.0.120.1'
status : 'running'

0 comments on commit 9105925

Please sign in to comment.