cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

993
Views
5
Helpful
6
Replies
AD84407
Beginner

REST call/moquery equivalent for all properties.

Dear reader,

Hope you are doing well.

I am looking for a moquery equivalent for the below selected options(refer the image) in the APIC.

I tried target-subtree-class=children and rsp-subtree=full. I am getting operational data(EP data, etc...) included in this. I don't these. I only need the configurable MOs

I tried to capture the query using the APIC inspector but I was unsuccessful. 

apic.png

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi

 

For a specific DN:

GET /api/mo/<DN>.json?rsp-subtree=full&rsp-prop-include=config-only

 

For a class:

GET /api/class/<CLASS>.json?rsp-subtree=full&rsp-prop-include=config-only

 

Examples:

GET /api/mo/uni/tn-xxx/ap-xxx-AP/epg-VLAN999-EPG.json?rsp-subtree=full&rsp-prop-include=config-only

GET /api/class/fvAEPg.json?rsp-subtree=full&rsp-prop-include=config-only

 

HTH

Marcel

 

View solution in original post

6 REPLIES 6
Claudia de Luna
Enthusiast

Hi @AD84407 

 

I suspect you have already seen @RedNectar's excellent write up on moquery and so you know that those controls are found 

in these two -x options

  -x [OPTIONS [OPTIONS ...]], --options [OPTIONS [OPTIONS ...]]
                        Extra options to the query

From Chirs' write up:

Filter Type Syntax Description

query‑target{self | children | subtree}Define the scope of a query
rsp‑subtree{no | children | full}Specifies child object level included in the response

 

For MO Class queries that works well and you can see that a query for all fvAEPg class objects returns 5 (two default and three I have configured) as expected.

 

 apic1# moquery -c fvAEPg -x rsp-subtree=full | grep '^name\s*:' 
name : ave-ctrl
name : default
name : Web
name : App
name : DB
apic1#

apic1# moquery -c fvAEPg -x rsp-subtree=full -o xml | more <?xml version="1.0" ?> <imdata totalCount="5"> <fvAEPg annotation="" childAction="" configIssues="" configSt="applied" descr= "" dn="uni/tn-infra/ap-ave-ctrl/epg-ave-ctrl" exceptionTag="" extMngdBy="" flood OnEncap="disabled" fwdCtrl="" hasMcastSource="no" isAttrBasedEPg="no" isSharedSr vMsiteEPg="no" lcOwn="local" matchT="AtleastOne" modTs="2020-05-08T23:00:37.305+ 00:00" monPolDn="uni/tn-common/monepg-default" name="ave-ctrl" nameAlias="" pcEn fPref="unenforced" pcTag="32771" prefGrMemb="exclude" prio="unspecified" rn="epg -ave-ctrl" scope="2818048" shutdown="no" status="modified" triggerSt="triggerabl e" txId="5764607523034234882" uid="0"> <fvRsCustQosPol annotation="" childAction="" dn="uni/tn-infra/ap-ave-ctrl/ep g-ave-ctrl/rscustQosPol" extMngdBy="" forceResolve="yes" lcOwn="local" modTs="20 20-05-08T22:59:36.705+00:00" monPolDn="uni/tn-common/monepg-default" rType="mo" rn="rscustQosPol" state="formed" stateQual="default-target" status="" tCl="qosCu stomPol" tContextDn="" tDn="uni/tn-common/qoscustom-default" tRn="qoscustom-defa ult" tType="name" tnQosCustomPolName="" uid="0"/> <fvRsBd annotation="" childAction="" dn="uni/tn-infra/ap-ave-ctrl/epg-ave-ct rl/rsbd" extMngdBy="" forceResolve="yes" lcOwn="local" modTs="2020-05-08T22:59:3 6.705+00:00" monPolDn="uni/tn-common/monepg-default" rType="mo" rn="rsbd" state= "formed" stateQual="none" status="modified" tCl="fvBD" tContextDn="" tDn="uni/tn -infra/BD-ave-ctrl" tRn="BD-ave-ctrl" tType="name" tnFvBDName="ave-ctrl" uid="0" > <fvSubnetBDDefCont bddefDn="uni/bd-[uni/tn-infra/BD-ave-ctrl]-isSvc-no" ch ildAction="deleteNonPresent" dn="uni/tn-infra/ap-ave-ctrl/epg-ave-ctrl/rsbd/subn etBddefDn-[uni/bd-[uni/tn-infra/BD-ave-ctrl]-isSvc-no]" lcOwn="local" modTs="202 0-05-08T22:59:34.213+00:00" monPolDn="" name="" nameAlias="" rn="subnetBddefDn-[ uni/bd-[uni/tn-infra/BD-ave-ctrl]-isSvc-no]" status=""/> </fvRsBd> </fvAEPg> <fvAEPg annotation="" childAction="" configIssues="" configSt="applied" descr= "" dn="uni/tn-infra/ap-access/epg-default" exceptionTag="" extMngdBy="" floodOnE ncap="disabled" fwdCtrl="" hasMcastSource="no" isAttrBasedEPg="no" isSharedSrvMs iteEPg="no" lcOwn="local" matchT="AtleastOne" modTs="2020-05-08T23:00:36.863+00: 00" monPolDn="uni/tn-common/monepg-default" name="default" nameAlias="" pcEnfPre f="unenforced" pcTag="49154" prefGrMemb="exclude" prio="unspecified" rn="epg-def ault" scope="16777199" shutdown="no" status="modified" triggerSt="triggerable" t xId="5764607523034234882" uid="0"> <fvRsBd annotation="" childAction="" dn="uni/tn-infra/ap-access/epg-default/ rsbd" extMngdBy="" forceResolve="yes" lcOwn="local" modTs="2020-05-08T22:59:36.7 05+00:00" monPolDn="uni/tn-common/monepg-default" rType="mo" rn="rsbd" state="fo rmed" stateQual="none" status="modified" tCl="fvBD" tContextDn="" tDn="uni/tn-in fra/BD-default" tRn="BD-default" tType="name" tnFvBDName="default" uid="0"> <fvSubnetBDDefCont bddefDn="uni/bd-[uni/tn-infra/BD-default]-isSvc-no" chi ldAction="deleteNonPresent" dn="uni/tn-infra/ap-access/epg-default/rsbd/subnetBd defDn-[uni/bd-[uni/tn-infra/BD-default]-isSvc-no]" lcOwn="local" modTs="2020-05- 08T22:59:34.213+00:00" monPolDn="" name="" nameAlias="" rn="subnetBddefDn-[uni/b d-[uni/tn-infra/BD-default]-isSvc-no]" status=""/> --More--

For DNs moquery does NOT return what is expected. Note Total Count = 1 where I was expecting 5.

That may be what you are running into?

In @RedNectar 's article he attributes that to a bug and I have to agree.  

 

If you do this in postman it works as expected.  One of the many reasons I stay away from moquery and work directly with the REST API. 

apic1# moquery -d /uni/tn-POD11_Tenant/ap-Tiered_AppProfile -x rsp-subtree=full -o xml
<?xml version="1.0" ?>
<imdata totalCount="1">
<fvAp annotation="" childAction="" descr="" dn="/uni/tn-POD11_Tenant/ap-Tiered_AppProfile" extMngdBy="" lcOwn="local" modTs="2020-07-23T23:06:27.235+00:00" monPolDn="uni/tn-common/monepg-default" name="Tiered_AppProfile" nameAlias="" ownerKey="" ownerTag="" prio="unspecified" rn="ap-Tiered_AppProfile" status="" uid="15374"/>
</imdata>

apic1#

 

 

 

Hi Claudia,

Thank you for your response. Let me rephrase my requirement.

Let's say I want to download the configuration of a specific EPG. Eg: VLAN999-EPG.
When I download using the GUI, by setting the following options:
Content: Only Configuration
Scope: Subtree

I get the following tags in the xml/json:

fvRsBd

fvRsCustQosPol

fvRsDomAtt

fvRsPathAtt

I looked up the APIC MIM Reference and these are Relations to the class fvAEPg.

But when I run this using the REST-API call /api/node/class/fvAEPg.json?query-target-filter=eq(fvAEPg.dn,"uni/tn-xxx/ap-xxx-AP/epg-VLAN999-EPG")&rsp-subtree=children, I get the following tags in the output

fvAEPg

fvCEp

fvRsCEpToPathEp and its subtags/classes These are contained MOs for the class fvAEPg

fvRsBd

fvRsCustQosPol

fvRsDomAtt

fvRsPathAtt

The fvCEp class shows the EP entries which I don't need. What options should I use so that I get only the configurable classes/tags?

 

To summarise, I need the output to include only the Relations of a particular class and not the Contained MOs.

Hi @AD84407,

 

So you are trying to do an moquery on a dn and I think that is the issue.

 

Here is the Save As result on one of my EPGs:

aci-communiteis-EPGSaveAs2020-08-15_16-37-24.jpg

 

When I execute the moquery on the DN (my EPG in this example is App) with target children which should match the Save As (that UNI in Visore gets me the equivalent) you see you don't really get what you expected (in fact no permutation of query-target and/or rsp-subtree that I tried gets us that) so back to the issue @RedNectar highlighted in his post.

 

apic1# moquery -d /uni/tn-POD11_Tenant/ap-Tiered_AppProfile/epg-App -x query-target=children
Total Objects shown: 1

# fv.RsBd
annotation   :
childAction  :
dn           : /uni/tn-POD11_Tenant/ap-Tiered_AppProfile/rsbd
extMngdBy    :
forceResolve : yes
lcOwn        : local
modTs        : 2020-07-23T23:54:29.933+00:00
monPolDn     : uni/tn-common/monepg-default
rType        : mo
rn           : rsbd
state        : formed
stateQual    : none
status       :
tCl          : fvBD
tContextDn   :
tDn          : uni/tn-POD11_Tenant/BD-POD11_BD
tRn          : BD-POD11_BD
tType        : name
tnFvBDName   : POD11_BD
uid          : 0

apic1#  

In my REST call

http://{{url}}/api/node/mo/uni/tn-POD11_Tenant/ap-Tiered_AppProfile/epg-App.json?query-target=children

 

 I do get the Save as equivalent with the REST call above:
aci-communiteis-EPG-REST-2020-08-15_16-37-24.jpg

I've attached some of the SaveAs output in a text file so you can see what I tried and the results.

 

Bottom Line:  I don't think you will be able to do this via moquery but I do think its doable via REST.

 

 

 

 

Hi @Claudia de Luna,

Do you have any Endpoints available on "/uni/tn-POD11_Tenant/ap-Tiered_AppProfile/epg-App" EPG?

 

Thanks.

Hi

 

For a specific DN:

GET /api/mo/<DN>.json?rsp-subtree=full&rsp-prop-include=config-only

 

For a class:

GET /api/class/<CLASS>.json?rsp-subtree=full&rsp-prop-include=config-only

 

Examples:

GET /api/mo/uni/tn-xxx/ap-xxx-AP/epg-VLAN999-EPG.json?rsp-subtree=full&rsp-prop-include=config-only

GET /api/class/fvAEPg.json?rsp-subtree=full&rsp-prop-include=config-only

 

HTH

Marcel

 

View solution in original post

Content for Community-Ad
This widget could not be displayed.