cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3613
Views
1
Helpful
12
Replies

construct API query to find specific IP endpoint

andreaswall
Level 1
Level 1

Hi,

 

I have been trying to figure how to construct an API query which gives me a response including fvAEPg, fvCEp, fvIp and fvRsCEpToPathEp.

I have tried this URI and it kind of gives me the result I want but it is missing fvRsCEpToPathEp:

"api/class/fvAEPg.json?rsp-subtree=full&rsp-subtree-filter=eq(fvIp.addr,\"10.10.10.10\")&rsp-subtree-include=required".

Anyone have any ideas?

Thanks in advance.

2 Accepted Solutions

Accepted Solutions

andreaswall,

    So is your end goal to search on an IP and be able to discern what EPG it is existing under? If so, here is a method that will get you everything except for the fvAEPg mo. However, you can discern the EPG from the DN of the fvCEp:

 

GET https://a.p.i.c/api/class/fvCEp.json?query-target-filter=eq(fvCEp.ip,"10.0.128.70")&rsp-subtree=full

of course this assumes that your fvIp.addr value has been written to fvCEp.ip.

 

I will keep digging to see if what you ask is possible. As a pointer for testing, we also have the following option:

target-subtree-class=fvAEPg,fvCEp,fvIp ,fvRsCEpToPathEp

Although I have yet to get it to respond in the manner you are requesting.

 

-Gabriel

 

 

 

View solution in original post

12 Replies 12

gmonroy
Cisco Employee
Cisco Employee

andreaswall,

    I tried the following api query and did see all 4 classes within the response:

 

GET https://a.p.i.c/api/node/class/fvAEPg.json?rsp-subtree=full

If you run your query without the filter and rsp-subtree-include, are you still not seeing any fvRsCEpToPathEp?

 

-Gabriel

No, then I can see it. It is a child object under fvCEp.

Since fvCEp can contain several fvIp child objects i want to run the query on just fvIp.

But I want the result to contain fvAEPg, fvCEp, fvIp and fvRsCEpToPathEp.

Maybe this is not possible or I do not understand the API correctly.

 

maybe I am confusing things.

It's not that I am not seeing fvRsCEpToPathEp under fvCEp.

If I run my query without "rsp-subtree-include=required" I get all fvAEPg objects. The one which contains my fvIp.addr will have the subtree down to the children included in fvIp. But no other child objects under that particular fvAEPg.

If I run it with rsp-subtree-include=required" the response will be only that fgvAEPg which contains the fvIp.addr I searched for.

Butmy dilemma is that I want the response to either be the entire fvAEPg object in which the fvIp.addr query matches or just the fvAEPG, the fvCEp child and the fvIp, fvRsCEpToPathEp child objects under that.

It's hard to explain but maybe it's clear to someone  :)

 

andreaswall,

    So is your end goal to search on an IP and be able to discern what EPG it is existing under? If so, here is a method that will get you everything except for the fvAEPg mo. However, you can discern the EPG from the DN of the fvCEp:

 

GET https://a.p.i.c/api/class/fvCEp.json?query-target-filter=eq(fvCEp.ip,"10.0.128.70")&rsp-subtree=full

of course this assumes that your fvIp.addr value has been written to fvCEp.ip.

 

I will keep digging to see if what you ask is possible. As a pointer for testing, we also have the following option:

target-subtree-class=fvAEPg,fvCEp,fvIp ,fvRsCEpToPathEp

Although I have yet to get it to respond in the manner you are requesting.

 

-Gabriel

 

 

 

yes, since a fvCEp can contain several fvIp childs I would like to query those.

And yes, I would like to get the whole fvAEPg in which it is contained. Or just the child classes I need.

 

Thanks for your time on this!

I am using this to find out BD, vrf, and epg information for a specific endpoint's IP.  It's taking so long like 50s.  

Is there a way to speed this query up?  I tried to modify the query parameters, etc.  But not working.

 

GET https://a.p.i.c/api/class/fvCEp.json?query-target-filter=eq(fvCEp.ip,"10.0.128.70")&rsp-subtree=full

 

Class "fvCEp" does not have an attribute called "ip". Maybe it did in an earlier version. But not in 5.2(5e) at least.

In my installation this works instead:
api/class/fvCEp.json?rsp-subtree=full&query-target=children&query-target-filter=eq(fvIp.addr,"x.x.x.x")

If your query works but takes long time I have no direct answer to why at the moment. Are you sure that it is the query that takes long time?

Another example of why this post is so relevant

https://community.cisco.com/t5/community-feedback-forum/suggestion-lock-posts-for-comments-after-they-have-been-answered/td-p/4834616

 

RedNectar aka Chris Welsh.
Forum Tips: 1. Paste images inline - don't attach. 2. Always mark helpful and correct answers, it helps others find what they need.

Yes, it's taking a while.  We have APIC version 5.2(5c).

 

pn2020
Level 1
Level 1

So, I just came to realize that api endpoint is 3x faster for another site (we have multi-site, using NDO). That site that responds much faster has less # of MO's (bd/vrf/endpoints, etc) compared to the slower site.

Could the higher # of MO's be the reason of slow response, since APIC now has many more objects to search through to get the required information?

If there is another api endpoint that I can use to get the epg details (BD, app profile, vrf), please share.

I think this is going a bit off topic now. Perhaps you should start a new thread that will be more aligned with your specific problem.

 

 

Save 25% on Day-2 Operations Add-On License