-
Notifications
You must be signed in to change notification settings - Fork 171
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
textfsm Cannot recognize '-' #125
Comments
@tuobi555 If you haven't yet, it would be advisable to temporarily trim down your regex past the What platform and device is this output from? |
|
Hello @tuobi555 💡 Rather than parse a mountain of output with a single template, it would be better to create a template per command. (And some of the work may already exist over at ntc-templates [hyperlink below].) From your screenshots I figure you are intending to parse "environmental" related items (Fans, etc). This appears to be the Your template
Regarding the template, instead of two lists, why not capture multiple dictionaries of the two pairs {device, device_state}? Your raw CLI output
A template for How's this sound? 😀 Example on the list vs dictionary:
Versus
|
Teaser
|
@mjbear |
@tuobi555 Ah, I was thinking you might have been using a library such as Paramiko/Netmiko to connect to the device and pull output which you were then parsing with TextFSM. It may be necessary to "anchor" the regexes to make them more rigid -- loose regexes can match in situations where you don't want them to. Combining the structured output (from TextFSM) into a single object or output file wouldn't be too difficult. Does the
|
AS02.log |
Hello @tuobi555 💡 Retrieving one large blob/string of commands from a device and parsing it with a single template is asking for difficulty. You should retrieve and parse command output individually (one command at a time) to simplify your problem. ❓ How are you retrieving your command output? ❗ There are some syntactically incorrect commands given the output saying ❓ It doesn't make sense to parse both the output of ❗ Wow, this is around 116 commands in one blob (cs01), which is when I stopped compiling my list below.
(Here's my [partial] guess in alphabetical order based on the "cs01" raw output you shared and Huawei command reference.)
💡 In case you end up having any interest in ntc-templates, here's some information: |
@tuobi555 (The example in Huawei's |
@tuobi555 Do you have output for the command |
@mjbear "Of course, that's fine. Initially, I just wanted to use this method to help me monitor the status of the equipment. As long as the requirements are met, it doesn't matter. Additionally, for the CE series devices, if you want to view the device's own serial number, the command should be 'display esn'. For other series, the commands might be 'display device manufacture-info' or 'display elabel slot slot-id', where 'slot-id' is the slot number of the corresponding device." |
@tuobi555 I don't have access to any Huawei VRP devices. I'm trying to help you so that's why I need you to provide output. Please provide output for If you like, I can look at your long template file but you'll need to share it. |
@mjbear "The information I provided earlier was all the data I had collected. If there is no output for 'esn' in it, then there's nothing more that can be done. I also cannot casually take log files from my workplace. Thank you for your enthusiastic help. Of course, you can also share the command parsing templates that have already been made, so that more people can enjoy the convenience." |
@tuobi555 The template I created covers three |
textfsm 1.1.3
textfsm Cannot recognize '-'
If changed to \ W, it can be recognized, but it also recognizes many erroneous information
The text was updated successfully, but these errors were encountered: