Cisco XR show platform vs admin show platform
Closed this issue · 2 comments
ISSUE TYPE
- Bug Report
TEMPLATE USING
cisco_xr_admin_show_platform.textfsm
Value NODE (\S+)
Value TYPE (\S+)
Value STATE ((\S+(\s\S+)*))
Value CONFIG_STATE (\S+)
Start
^\-+ -> Parse
Parse
^${NODE}\s+${TYPE}\s+${STATE}\s+(${CONFIG_STATE})? -> Record
SAMPLE COMMAND OUTPUT
Tue Nov 16 15:43:18.391 UTC
Location Card Type HW State SW State Config State
----------------------------------------------------------------------------
0/0 R-IOSXRV9000-LC-C OPERATIONAL N/A NSHUT
0/RP0 R-IOSXRV9000-RP-C OPERATIONAL OPERATIONAL NSHUT
SUMMARY
There are two commands on Cisco XR to get the platform info; show platform
and admin show platform
. The template existing on ntc-templates
is for show platform
not admin show platform
, however; the template name indicates it's for admin show platform
show command. Therefore, the parsed output is incorrect.
admin show platform command output
RP/0/RP0/CPU0:R1#admin show platform
Tue Nov 16 15:43:18.391 UTC
Location Card Type HW State SW State Config State
----------------------------------------------------------------------------
0/0 R-IOSXRV9000-LC-C OPERATIONAL N/A NSHUT
0/RP0 R-IOSXRV9000-RP-C OPERATIONAL OPERATIONAL NSHUT
show platform command output
RP/0/RP0/CPU0:R1#show platform
Tue Nov 16 15:42:24.738 UTC
Node Type State Config state
--------------------------------------------------------------------------------
0/0/CPU0 R-IOSXRV9000-LC-C IOS XR RUN NSHUT
0/RP0/CPU0 R-IOSXRV9000-RP-C(Active) IOS XR RUN NSHUT
STEPS TO REPRODUCE
from pprint import pprint
from netmiko import ConnectHandler
device = {
"device_type": "cisco_xr",
"ip": "sandbox-iosxr-1.cisco.com",
"username": "admin",
"password": "C1sco12345",
"fast_cli": False,
}
with ConnectHandler(**device) as conn:
modules = conn.send_command(command_string="admin show platform", use_textfsm=True)
pprint(modules)
EXPECTED RESULTS
An illustration since there is no template that parses this properly just yet.
---
parsed_sample:
- location: "0/0"
card_type: "R-IOSXRV9000-LC-C"
hw_state: "OPERATIONAL"
sw_state: "N/A"
config_state: "NSHUT"
- location: "0/RP0"
card_type: "R-IOSXRV9000-RP-C"
hw_state: "OPERATIONAL"
sw_state: "OPERATIONAL"
config_state: "NSHUT"
[
{
"card_type": "R-IOSXRV9000-LC-C",
"config_state": "NSHUT",
"hw_state": "OPERATIONAL",
"location": "0/0",
"sw_state": "N/A",
},
{
"card_type": "R-IOSXRV9000-RP-C",
"config_state": "NSHUT",
"hw_state": "OPERATIONAL",
"location": "0/RP0",
"sw_state": "OPERATIONAL",
},
]
ACTUAL RESULTS
[
{
"config_state": "N/A",
"node": "0/0",
"state": "OPERATIONAL",
"type": "R-IOSXRV9000-LC-C",
},
{
"config_state": "OPERATIONAL",
"node": "0/RP0",
"state": "OPERATIONAL",
"type": "R-IOSXRV9000-RP-C",
},
]
I guess the solution to this issue is to rename the cisco_xr_admin_show_platform.textfsm
to cisco_xr_show_platform.textfsm
and create a brand new template for cisco_xr_admin_show_platform.textfsm
with the correct output of the revelant show command, if possible.
Thank you
Looks like we may need to update both. There may be differences between versions. So we should add to the admin show version
a second match, similar to the show mac-address-table
command sets to capture it both. And also create a new show platform.