Building parsing templates

Building parsing templates

What is parsing

Parsing deals with extracting interested part of information from the specific group of text.  It can be command output(Command parsing) or from device configuration(Config parsing).

How to access parsing tool

Building -> Templates -> Parsing test


Here we shall go through simple examples of building parsing templates.

Building Parsing template - show ver

In this example we are looking to extract serial number and nvram size from show ver command output of Cisco_IOS nodes.
(1) Paste the command output under Sample command output
(2) Identify the lines we are looking for information
(3) Paste the lines and replace the text we are looking for with variables(words enclosed within <>).  
(4) Parse
(5) See the results under Parsing result the values we are looking for is stored in respective variables.


Building Parsing Template - show cdp neigh detail

In this example we shall extract information from show cdp neigh detail output. 
Information we shall be capturing are 
Remote device name(rem_name), Local port(loc_port), remote port(rem_port) and remote device ip(rem_ip).

(1) Paste the command output of show cdp neigh detail under Sample command output.
(2) Identify the lines of interest
(3) Copy and paste the identified lines in the above column.  Separate the variables and static text.  
(4) Parse
(5) Parsing results are visible.
Notice that use of '%' for variable <rem_name>.  This makes that variable as a key varaiable.
Since there are many cdp neighbors.  Using '%' helps us to fetch specific values of each of the entry.

Creating parsing template

Copy the text derived at step 3 in the above examples and then proceed with below steps.
(1) Build -> Templates -> Templates edit -> (2) Select client type(In this case CMDB) -> (3) Parsing Templates -> (4) New -> (5) Appropriate name to the template -> (6) Template type: command ->(7) Vendor type: Cisco_IOS -> (8)  Save

(1) Click the entry under Revisions -> (2) Paste the text derived from Step 3 of Building templates -> (3) Template status: Production -> (4) Save


Below are various options while using parsing templates:

Capabilities

  • <variable> only parses single words
  • <variable:> parses until it encounters a double space, tab or the end of line
  • <variable:test> parses until it encounters the word “test”, surrounded by whitespace, or the end of line otherwise.
  • <variable:,> parses until it encounters a single character, which doesn't have to be surrounded by whitespaces. (in this case the 'comma')
  • <variable*> will put all text in a single variable
  • [header] + all of the above
  • %keys + all of the above
  • indentation, dealing with multiple levels of indentation.
  • |*| ignoring anything else on the line.

    • Related Articles

    • Parsing values from the commands

      Parsing purpose Parsing deals with extracting interested part of information from the specific text.  The text can be command output(Command parsing) or from device configuration(Config parsing). In this article we are dealing with Command parsing. ...
    • How to use configuration template in Jobs

      Templates overview Templates are used to generate configuration.  In this article we shall learn below topics. How to create template How to use template in Jobs How to create multi-vendor template Templates are accessed as below: (1) Build -> ...
    • Triggering jobs from events through syslog

      Overview We can trigger netyce jobs from syslog messages. The event manager(SEC) can be used to match the syslog message pattern to trigger the suitable job.. The events on the device can be like config change, port/neighbor flap etc. Below is an ...
    • Introduction to Scenarios or Tasks

      What are scenarios/tasks? Scenarios allow you to define the workflow steps as to how you want the communication with the device to be, including all associated processes, notifications and integrations. Like templates, you can build a library of ...
    • How to mitigate Non-Compliance

      The next step after identifying non-compliancy is to mitigate it.  We will be using the Network Automation module to fix the non-compliance configuration.  Below are the things that are needed to fix: Policy name Commands to fix the Non-compliance ...