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

find switch profile through moquery

rocky2024
Level 1
Level 1

Hello All,

 

How are you ?

 

Please guide me how to find switch profile through moquery in CLI

 

I am finding difficulty to find switch profile with reference of EPG static bindings. 

 

Regards,

Sourabh

10 Replies 10

Manuel Velasco
Cisco Employee
Cisco Employee

Is your  end goal  to find a moquery to the class of the switch profiles defined in your ACI?

 

If that is the case you can use;

 

moquery -c infraNodeP

 

 

Hello Manuel,
for example if there are some static bindings under EPG called "EPG-Cisco-Community-2000" then i want to search switch profile without going through GUI in fabric - Access-policy - search switch profile through switch id

i am trying to find moquery command to find switch profile based on EPG or vlan

Thanks a lot for your time.

regards

There is not a one moquery that would give you that information. You might be able to get this information with a series of moqueries. 

Hello Manuel,

 

ohh ok. 

 

by any chance, can i get any URL to see all moqueries with defined function of each moquery ? 

 

i will study moquery and will try to get required details.

 

Thanks a lot!!!

Regards,

 

Hi rocky1,

 

I personally use api for this. To find the switch profile used for certain static bindings you need three api calls. The classes can ofc be used for the moquery's as well.

 

This api call shows you the switch profile and interface poicy group used by the access port selectors:

 

{{protocol}}://{{apic}}/api/class/infraHPortS.json?query-target=children

 

Output will be something like:

 

{
"infraPortBlk": {
"attributes": {
"childAction": "",
"descr": "",
"dn": "uni/infra/accportprof-ilp_individual_153/hports-aps_2-typ-range/portblk-block2",
"fromCard": "1",
"fromPort": "2",
"lcOwn": "local",
"modTs": "2017-08-15T08:12:18.342+01:00",
"monPolDn": "uni/fabric/monfab-default",
"name": "block2",
"nameAlias": "",
"status": "",
"toCard": "1",
"toPort": "2",
"uid": "15374"
}
}
},
{
"infraRsAccBaseGrp": {
"attributes": {
"childAction": "",
"dn": "uni/infra/accportprof-ilp_individual_153/hports-aps_2-typ-range/rsaccBaseGrp",
"fexId": "101",
"forceResolve": "yes",
"lcOwn": "local",
"modTs": "2017-08-15T08:12:18.342+01:00",
"monPolDn": "uni/fabric/monfab-default",
"rType": "mo",
"state": "formed",
"stateQual": "none",
"status": "",
"tCl": "infraAccPortGrp",
"tDn": "uni/infra/funcprof/accportgrp-ilpg_apicmgmt",
"tType": "mo",
"uid": "15374"
}
}
}

 

The next api call shows you the same information, but this time from a policy group persective:

 

{{protocol}}://{{apic}}/api/class/infraAccPortGrp.json?query-target=children&query-target=subtree

 

{
"infraRtAccBaseGrp": {
"attributes": {
"childAction": "",
"dn": "uni/infra/funcprof/accportgrp-ilpg_apicmgmt/rtaccBaseGrp-[uni/infra/accportprof-ilp_individual_153/hports-aps_2-typ-range]",
"lcOwn": "local",
"modTs": "2017-08-15T08:12:18.342+01:00",
"status": "",
"tCl": "infraHPortS",
"tDn": "uni/infra/accportprof-ilp_individual_153/hports-aps_2-typ-range"
}
}
}

 

Hope this helps.

 

Regards,

 

Sebastiaan

Hello Sebastiaan,

Thanks dear. but i am not much aware of this. however i will read about API and will check on this further.

Thanks a lot for your time.

Regards,

Hi Sebas,

 

in my team, no one is aware of API

 

I request you to please guide me to use below API step by step please :)

 

regards,

rocky1,

    Please refer to the following documentation for some tools that may be helpful for getting familiar with the API:

https://www.cisco.com/c/en/us/td/docs/switches/datacenter/aci/apic/sw/1-x/api/rest/b_APIC_RESTful_API_User_Guide/using_tools_for_api_development_and_testing.pdf

 

Personally, I am fond of using the API Inspector when I am trying to figure out what calls are being made via the advanced GUI.

 

After getting the call or class in question, the Managed Object browser (visore) is a very useful minimal tool to understand the query a bit deeper, as well as see what available attributes exist, and there is a button to easily query for all children (or the parent) of the object you queried against.

 

-Gabriel

Thanks dear. i will read about API and will check on this further.

Thanks a lot for your time.

Regards,

kthned
Level 3
Level 3
https://{apic_IP}/api/node/class/infraNodeP.json

Try above, and all the switch profile name under 'name' field

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