Parsing values from the commands

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.

Parse_cmd syntax/usage

Parse_cmd is the scenario command that is used to perform parsing.
Below arguments to be passed while using Parse_cmd in the scenarios
  • -n <node>: the node in question
  • -r <request>: a request to send to a node, for example "show interface brief"
  • -t <template>: a command parsing template





In this example we would be extracting the serial number and nvram size from the devices.

Building Parsing template

     Refer to the article Building Parsing Templates .  As per the article we have built a parsing template named show_ver

Building the scenario

    Create a new scenario named Parsing_test1 
     (1)Operate -> Scenarios -> (2) New (3) Name:Parsing_test1-> (4) Text:
     <%cmd> = Parse_cmd -n <node> -r "show version" -t show_ver
     log -m "Serial number of the <node> is <serial_no%cmd>"
     log -m "NVRAM size of the <node> is <nvram%cmd>"
     (5) Save
            

Executing the Scenario   

      (1) Operate -> New Jobs -> CMDB/YCE Jobs (based on the type of the node) -> (2) Select the node -> (3) Add list -> (4) Next
            
            
            
    (1) Change the task name to Parse_cmd_test1 -> (2) Save Job as: Give an appropriate name to the Job -> (3) Save -> (4) now -> (5) Schedule
            

 Verifying output

      To verify the output we need to access the job logs.  Open a duplicate or another tab.
      (1) Operate -> Job Status -> Job logs -> (2) Refer to the files on nyeve of the job.
      

 This pop-ups a new page of Job log file.  If we scroll through the <job_id> log file, we can see the serial number and nvram values retrieved from the node using the parsing command.

      



    • Related Articles

    • 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 -> ...
    • 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 supply parameters for the Job

      There are multiple ways we can supply values to the job.  Here we learn couple of ways to do it: Parameters under Scenario Retrieving values from the database Parameters under Scenario To understand this example, we are using a L2 Vlan configuration ...
    • 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 -> ...
    • OS Repository

      Overview OS repository allows us to manage the OS images and other files(license, bootfile) that are used for OS Upgrades. It can be accessed going to (1) Build -> (2) OS Repository GUI Steps to add new image (1) Build -> OS repository -> (2) Create ...