Question

Qapp Output to Report or Filtered Table

  • 25 May 2023
  • 6 replies
  • 98 views

Hello all.  Just wanted to post here to see if this is even possible.  I have a Qapp that creates a CSV file with specific fields.  The purpose is to create a filtered table or report that shows all of our network switches and the amount of unused interfaces.  The CSV just has all the raw data.  I would still need to create some logic that says interface status is either “down” or “administratively down”, the last input is over a year or never, and the media type is one of many options (example:  10/100/1000BaseTX) as I want to exclude fiber interfaces.  For each row in the CSV, I want to just count these.  Then, ideally, the report would simply show 2 columns.

Column 1              Column 2

Switch 1 Name        Number of Unused Ports

Switch 2 Name        Number of Unused Ports

Does anyone know if this can be accomplished within NetBrain or would I just need to utilize something external and work with the raw CSV data?

Thanks.


6 replies

Userlevel 4
Badge +1

Hi @aours 

I am sure you can do that in NB, just add a Python script and work with Regex and count.

Maybe easier: work on a precise command that will give you the result directly, something like this (depending on hardware):
  show interfaces status | count | inc notcon|disabl
  Number of lines which match regexp = 159

then use the Qapp to recognize the number variable and in the output you can then put it into a CSV file with your text.

Userlevel 3

Hi Aours,

Once you go into canvas and convert the CLI output into table, use sub-Table option to filter out the unwanted fields.

  • Once you convert the CLI output into table, then use the “single table operator” and then use “Sub Table”.
  •  

  • Then click on Sub Table, Advanced to filter out the unwanted fields.
  • Once you click on “Advanced”, new window will pop-up. Define the condition in new window to remove the unwanted fields.

     

    NOTE: This Advanced option will remove the lines with matching condition - here define the condition that you want to filter

  •  

  • Below is the final table after you removing the unwanted rows based on the condition defined in Advanced section.
  •  

  • Then convert the Table2 into GDT table and then export it via CSV as below SS.
  • Please Let me know if you have any question, I’m ready to help.

 

Regards,

Kranthi Kumar

Userlevel 3

Hi Aours,

This can also be achieved using Network Intent (No Code Automation) and Intent has capability to generate the CSV report too with simple steps as below

  • Collect all the required variables and filter down based on your requirement as below 
  • Once, we collect all the unused port, we can “GetTableRowCount” function to get the count of all the interfaces

  • Then, we can create a diagnosis to generate the CSV output and below is the sample CSV output file,

  • The above output is for single device. In NetBrain we can “Network Intent cluster” to replicate the above logic to all devices and generate a single CSV with all the unused ports for all devices.

Hope this is helpful. Please let me know if you have any questions.

Regards,

Kranthi Kumar

@Carsten.Schmidt 

Thank you for your response.

I’m just learning Python (and NB for that matter).  Not sure how to implement it within NB.  


I don’t think I can do the IOS command counter since I need to see the “Last input” out of the “show interfaces” command.  That’s where the NB parser is nice.  

 

I was able to use Python externally using NB output to pull together a CSV that I can use.  I’ll post it here once I get it cleaned up.  Also, since I’m just learning Python, the coding is not the most efficient.

@Kranthi 

Thanks for your response.

 

I used your advice to trim down the CSV I get out of NB.  I then use that with Python that I pulled together externally.  Looking good so far.  Still a work in progress.

 

I am interested in the Intent, but I just don’t understand it.  I poked around a bit but just couldn't do it.  I guess that’s why NB has a “University”.  The tool is powerful yet complicated.  Eliminates a lot of regular users like me in generating useful automation.

Userlevel 3

Hi Aours,

Network Intent is very easy and No-code way to develop any automation. All you need is some training and practice.

 

Regards,

Kranthi Kumar
 

Reply


Community |  Ideas

Facebook |  Instagram |  Youtube |  Twitter |  LinkedIn
Privacy & Security Statement  |  Terms & Conditions |  Impressum  |  UK Modern Slavery Statement