IOSXR - show processes cpu parser
See original GitHub issueHello Team,
I am facing difficulties with “show processes cpu”, it seems like broken in a special case NoneType
when key is missing from text
, I feel like it is here in parser/iosxr/show_processes.py
# ---- node0_RP0_CPU0 ----
p1 = re.compile(r'^----\s+(?P<location>\S+)\s+----$')
my script is:
#test.py
import yaml
from genie import testbed
DUT = 'P-9001-1'
#load testbed file, iosxr configured in testbed.yaml
testbed = testbed.load('testbed.yaml')
device = testbed.devices[DUT]
text = """
Wed Jun 2 14:19:28.883 UTC
---- node0_RP0_CPU0 ----
CPU utilization for one minute: 2%; five minutes: 2%; fifteen minutes: 2%
PID 1Min 5Min 15Min Process
1 0% 0% 0% kernel
8195 0% 0% 0% dllmgr
"""
i = device.parse('show processes cpu', output=text)
import pprint
pprint.pprint(i)
If we delete ---- node0_RP0_CPU0 ----
in above test.py
it produces:
Traceback (most recent call last):
File "test.py", line 25, in <module>
i = device.parse('show processes cpu', output=text)
File "src/genie/conf/base/device.py", line 524, in genie.conf.base.device.Device.parse
File "src/genie/conf/base/device.py", line 557, in genie.conf.base.device.Device._get_parser_output
File "src/genie/metaparser/_metaparser.py", line 272, in genie.metaparser._metaparser.MetaParser.parse
File "/home/cisco/cxta/workspace/genieparser/src/genie/libs/parser/iosxr/show_processes.py", line 454, in cli
ret_dict['location'][location].update(
KeyError: 'location'
In the absence of any other value in the text
it does not produce error.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
ASR9000/XR: Monitoring CPU and memory - Cisco Community
Monitoring Areas. Blocked Processes and Process States. To see which processes are in blocked state, issue the command 'show processes blocked'.
Read more >Advanced ASR 9000 - Operation and Troubleshooting
Use Telemetry or SNMP to check on power population and status ... Cisco IOS XR Software, Version 5.3.3[Default] ... Kernel and distributed processes....
Read more >Releases · networktocode/ntc-templates - GitHub
TextFSM templates for parsing show commands of network devices - Releases ... That1guy15 cisco xr show process cpu by @GGabriele in #109; Cisco...
Read more >- IOS-XR Troubleshooting and Diagnostics
IOS -XR Hardware and Diagnostics. ... Top 10 processes by CPU usage, by default this command refreshes every 1 seconds for 5 iterations....
Read more >pyATS series - Parsing like a pro - xrdocs
Parsing a CLI output from a device. In the first use case, we saw how we can get a simple CLI output (...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
you are welcome
No problem. Due to scheduling we’ll remove @domachad, and we’ll get @akhosrav to work on this instead.
We’ll put a link to the PR here so you can both see the process 😃