Question

Qapp/Parser run second CLI command with variables/arguments from first CLI output

  • 13 September 2022
  • 4 replies
  • 68 views

Hello,

 

I am trying to create a Qapp that runs a CLI command with arguments/variables based on output of the first CLI command.

 

Requirement:

 

  1. First CLI Command, get all Cisco IP BGP neighbors:
    1. show ip bgp neighbors
    2. one of the key variables, $bgp_neighbors, from the output contains the IP Address of the IP BGP Neighbor
  2. With the Cisco IP BGP Neighbors Table output, run a second CLI Command (Second Canvas) that runs a second CLI Command with a variable/argument $bgp_neighbors:
    1. show ip bgp neighbors $bgp_neighor advertised-route

How can that be accomplished?

Thanks in advance for your help!

 


4 replies

Hi dawal1337,

One way to accomplish this, is to parse the output of "show ip bgp neighbors", store the results in a global table, and then call the table in a new canvas to run each "show ip bgp neighbors <$bgp_neighbor> advertised-route" for each router and its bgp neighbors.

The attached QApp uses this method; please import it and try to run it in your environment.
Screenshot #1 shows the result of this QApp run against 2 bgp routers in a lab environment.
Screenshots #2 and #3 and #4 show key pieces of the QApp that address your general question.

Please let me know if you need any help implementing this, and if it works for you!

Kevin Benner

 

Screenshot #1
Screenshot #2

 

Screenshot #3

 

Screenshot #4

 

Good Morning,

 

Thank you Kevin for your feedback. Your feedback is very detailed, and you included the qapp which I really appreciate! Unfortunately, I cannot use it because it is incompatible with the version I am running (newer). Could you share a snapshot of the Parser for “show ip bgp neighbors <x.x.x.x> advertised-routes, if possible?

I wrote my original Qapp exactly* the way you did, or have showing in the snapshots: I have two Canvas, where second one uses the variable of GDT from the first Canvas; however, I am not getting any data return in the CSVExport.

The only difference between your Qapp and mine is I use CLI Command “show IP bgp summary” in order to retrieve and parse the BGP Neighbors in the first run.

See below attached output I am getting, showing that I am not getting any data back. I have tried a few BGP routers to make sure it wasn’t a fluke.

 

 

 

Any ideas why I am not getting any data back? Thanks again for your help!

 

Here is my Qapp and Parser I use:

 

Hi dawal1337,

  1. I’m sorry to hear that my QApp is incompatible with your system.  What version of NetBrain are you running?
  2. One possible cause of your “The live data of the device and parser does not exist” error, is if you’re running the QApp with baseline data, instead of polling for new data when the QApp is run.  i.e. Since this BGP data isn’t part of a benchmark, the QApp needs to poll for new data to analyze.  See screenshot #5 below, please. 
  3.  Screen #6 below, is parser snapshot that you requested.

I am running version 10.

 

I am pulling “live data at once”, too! That was one of the first things I learned as I was pulling out my hair trying to figure out why my Qapps wouldn’t produce the desired results :0

Reply


Community |  Ideas

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