cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
801
Views
0
Helpful
0
Replies

tailf-query nested foreach

tsiemers1
Spotlight
Spotlight

Using the tailf-query call and was wondering if it is possible to perform a nested foreach query. For example with cisco-ios ned I want to grab all the interface descriptions, but in the same query foreach over all the subinterface descriptions as well.

 

Config:

 

interface GigabitEthernet0/0/1
 description parent description topmost
 !
 service instance 1 ethernet
   description evc description 1
 !
 service instance 20 ethernet
   description evc description 20
 !
 service instance 30 ethernet
   description evc description 30
 !
end

I have a call that will work fine to loop over the Gig interfaces and pull topmost description:

{
"immediate-query": {
"foreach": "/devices/device[name='LAB920']/config/ios:interface/GigabitEthernet",
"select": [
{
"label": "int_name",
"expression": "name",
"result-type": ["string"]
},
{
"label": "top_description",
"expression": "description",
"result-type": ["string"]
}
],
"sort-by": ["name"],
"limit": 1000,
"offset": 1
}
}

Is it possible to add in the same query a nested foreach statement that will grab things like the service instance description as well?

 

Thanks

0 Replies 0