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

tailf-query nested foreach

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