cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4206
Views
5
Helpful
14
Replies

Exporting ACI End Point Names

johnny.moody
Level 1
Level 1

Hello,

I'm looking for a way to export the names of learned endpoints in a particular EPG. I'm aware of the CLI commands you can run in the APIC that will give list out all the of the learned endpoints of a particular EPG (show epg [EPG name] detail), but it doesn't actually provide the name of the machine. In the APIC GUI, I can see the names of the endpoints by looking going to Operational ---> Client End-Points in the EPG. The names of the virtual machines I'm looking for appear in the End Point column, but I dont see a way to export this. Is this possible? 

14 Replies 14

RedNectar
VIP
VIP

Hi @johnny.moody ,

is

admin@apic1:~> moquery -c fvCEp -x rsp-subtree=children | grep contName

the kind of thing you are looking for?

To include the MAC address of each VM, be a little more expansive with the grep  

admin@apic1:~> moquery -c fvCEp -x rsp-subtree=children | egrep "contName|name "

Note I'm using  egrep  not grep  and the space in "contName|name "  will prevent the nameAlias field showing too.

I'm sure there are more elegant solutions, and @Sergiu Daniluk will probably come up with one! (=challenge for Sergiu)

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.

Robert Burns
Cisco Employee
Cisco Employee

Rather than trying to export this from the CLI, just hit the API with a similar call as the UI uses (hint: Use API Inspector).  Using these remote powers with a tool like Postman you could send something like:
GET: 
https://[APIC_IP]/api/node/mo/uni/tn-[TENANT_NAME]/ap-[AP_NAME]/epg-[EPG_NAME].json?query-target=children&target-subtree-class=fvCEp&rsp-subtree=children&rsp-subtree-class=fvIp
This w
ould give you a json response which you could parse for info of interest such as the "mac", "name", "fvIP", "addr" etc.

If I get time to fiddle with Postman filters more to clean up the API repsonse, I'll update this thread.
Robert

Hi @johnny.moody ,

I guess I was trying to give a more general answer in my first attempt, but @Robert Burns is correct in that if you care to go to the trouble of adding the [TENANT_NAME], the [AP_NAME], and the [EPG_NAME] to the query you can refine the output better.

IN THEORY, you should be able to use the same construction with moquery to get the same result - i.e. if my [TENANT_NAME] is Tenant17, my [AP_NAME] is 2Tier_AP, and my [EPG_NAME] is DBServers_EPG, then I SHOULD be able to do this:

admin@apic1:~> moquery -d uni/tn-Tenant17/ap-2Tier_AP/epg-DBServers_EPG -x "query-target=children target-subtree-class=fvCEp rsp-subtree=children rsp-subtree-class=fvIp"

 to get functionally the same result as the Postman approach.

But alas, moquery (last updated in 2014) has a bug that Cisco has never bothered to fix, as I discovered when I posted this question back in 2020.  It only display ONE of the endpoints when executed

So, IF you want to stick with the CLI, you can use icurl instead to do the same thing - but the output from icurl is without spaces, so you need to also know about jq as well.

So back to my example (where, by the way my Tenant17 has two endpoints, one of which is a VM and has a name, the other is a bare metal host so doesn't show a name) this is what I see if I use icurl with the parameters suggested by @Robert Burns 

admin@apic1:~> icurl -s "http://localhost/api/node/mo/uni/tn-Tenant17/ap-2Tier_AP/epg-DBServers_EPG.json?\
query-target=children&target-subtree-class=fvCEp&rsp-subtree=children&rsp-subtree-class=fvIp"

{"totalCount":"2","imdata":[{"fvCEp":{"attributes":{"annotation":"","baseEpgDn":"","bdDn":"uni/tn-Tenant17/BD-App_BD","childAction":"deleteNonPresent","contName":"","dn":"uni/tn-Tenant17/ap-2Tier_AP/epg-DBServers_EPG/cep-00:50:56:B8:04:1B","encap":"vlan-1175","esgUsegDn":"","extMngdBy":"","fabricPathDn":"topology/pod-1/paths-1203/pathep-[eth1/18]","hostingServer":"","id":"0","idepdn":"","lcC":"learned","lcOwn":"local","mac":"00:50:56:B8:04:1B","mcastAddr":"not-applicable","modTs":"2023-03-07T11:22:10.185+11:00","monPolDn":"uni/tn-common/monepg-default","name":"00:50:56:B8:04:1B","nameAlias":"","reportingControllerName":"","status":"","uid":"0","userdom":"all","uuid":"","vmmSrc":"","vrfDn":"uni/tn-Tenant17/ctx-Production_VRF"},"children":[{"fvIp":{"attributes":{"addr":"10.117.11.25","annotation":"","baseEpgDn":"","bdDn":"uni/tn-Tenant17/BD-App_BD","childAction":"deleteNonPresent","createTs":"2023-03-07T11:22:10.380+11:00","debugMACMessage":"","esgUsegDn":"","extMngdBy":"","fabricPathDn":"topology/pod-1/paths-1203/pathep-[eth1/18]","flags":"","lcOwn":"local","modTs":"2023-03-07T11:22:10.185+11:00","monPolDn":"uni/tn-common/monepg-default","rn":"ip-[10.117.11.25]","status":"","uid":"0","userdom":"all","vrfDn":"uni/tn-Tenant17/ctx-Production_VRF"}}}]}},{"fvCEp":{"attributes":{"annotation":"","baseEpgDn":"","bdDn":"uni/tn-Tenant17/BD-App_BD","childAction":"deleteNonPresent","contName":"dbserver1.t17.dns","dn":"uni/tn-Tenant17/ap-2Tier_AP/epg-DBServers_EPG/cep-00:50:56:AC:81:A5","encap":"vlan-1371","esgUsegDn":"","extMngdBy":"","fabricPathDn":"topology/pod-1/paths-1201/extpaths-191/pathep-[eth1/27]","hostingServer":"esxi171.fab1.hl.dns","id":"0","idepdn":"","lcC":"learned,vmm","lcOwn":"local","mac":"00:50:56:AC:81:A5","mcastAddr":"not-applicable","modTs":"2023-03-06T14:30:49.742+11:00","monPolDn":"uni/tn-common/monepg-default","name":"00:50:56:AC:81:A5","nameAlias":"","reportingControllerName":"vca17.fab1.hl.dns","status":"","uid":"0","userdom":"all","uuid":"","vmmSrc":"dvs","vrfDn":"uni/tn-Tenant17/ctx-Production_VRF"},"children":[{"fvIp":{"attributes":{"addr":"10.117.11.21","annotation":"","baseEpgDn":"","bdDn":"uni/tn-Tenant17/BD-App_BD","childAction":"deleteNonPresent","createTs":"2023-03-06T14:30:49.937+11:00","debugMACMessage":"","esgUsegDn":"","extMngdBy":"","fabricPathDn":"topology/pod-1/paths-1201/extpaths-191/pathep-[eth1/27]","flags":"","lcOwn":"local","modTs":"2023-03-06T14:30:49.742+11:00","monPolDn":"uni/tn-common/monepg-default","rn":"ip-[10.117.11.21]","status":"","uid":"0","userdom":"all","vrfDn":"uni/tn-Tenant17/ctx-Production_VRF"}}}]}}]}

Pretty ugly right?  This is where jq comes in.  If I simply feed that output into jq, it will make it much prettier.  But still very long - so long in fact I'll post the output at the end of this post as an appendix.

What's the point?

The point I'm trying to make is that using icurl with jq, you can manipulate the output better than using egrep with moquery.  So to get JUST the names of those endpoints - I change the jq filter to jq '.imdata[].fvCEp.attributes.contName'

admin@apic1:~> icurl -s "http://localhost/api/node/mo/uni/tn-Tenant17/ap-2Tier_AP/epg-DBServers_EPG.json?\
query-target=children&target-subtree-class=fvCEp&rsp-subtree=children&rsp-subtree-class=fvIp" |
jq '.imdata[].fvCEp.attributes.contName'
"" "dbserver1.t17.dns"

And bingo there are my two EP names!


APPENDIX

Output of the icurl command simply filtered through jq

admin@apic1:~> icurl -s "http://localhost/api/node/mo/uni/tn-Tenant17/ap-2Tier_AP/epg-DBServers_EPG.json?\
query-target=children&target-subtree-class=fvCEp&rsp-subtree=children&rsp-subtree-class=fvIp" |
jq
{ "totalCount": "2", "imdata": [ { "fvCEp": { "attributes": { "annotation": "", "baseEpgDn": "", "bdDn": "uni/tn-Tenant17/BD-App_BD", "childAction": "deleteNonPresent", "contName": "", "dn": "uni/tn-Tenant17/ap-2Tier_AP/epg-DBServers_EPG/cep-00:50:56:B8:04:1B", "encap": "vlan-1175", "esgUsegDn": "", "extMngdBy": "", "fabricPathDn": "topology/pod-1/paths-1203/pathep-[eth1/18]", "hostingServer": "", "id": "0", "idepdn": "", "lcC": "learned", "lcOwn": "local", "mac": "00:50:56:B8:04:1B", "mcastAddr": "not-applicable", "modTs": "2023-03-07T11:22:10.185+11:00", "monPolDn": "uni/tn-common/monepg-default", "name": "00:50:56:B8:04:1B", "nameAlias": "", "reportingControllerName": "", "status": "", "uid": "0", "userdom": "all", "uuid": "", "vmmSrc": "", "vrfDn": "uni/tn-Tenant17/ctx-Production_VRF" }, "children": [ { "fvIp": { "attributes": { "addr": "10.117.11.25", "annotation": "", "baseEpgDn": "", "bdDn": "uni/tn-Tenant17/BD-App_BD", "childAction": "deleteNonPresent", "createTs": "2023-03-07T11:22:10.380+11:00", "debugMACMessage": "", "esgUsegDn": "", "extMngdBy": "", "fabricPathDn": "topology/pod-1/paths-1203/pathep-[eth1/18]", "flags": "", "lcOwn": "local", "modTs": "2023-03-07T11:22:10.185+11:00", "monPolDn": "uni/tn-common/monepg-default", "rn": "ip-[10.117.11.25]", "status": "", "uid": "0", "userdom": "all", "vrfDn": "uni/tn-Tenant17/ctx-Production_VRF" } } } ] } }, { "fvCEp": { "attributes": { "annotation": "", "baseEpgDn": "", "bdDn": "uni/tn-Tenant17/BD-App_BD", "childAction": "deleteNonPresent", "contName": "dbserver1.t17.dns", "dn": "uni/tn-Tenant17/ap-2Tier_AP/epg-DBServers_EPG/cep-00:50:56:AC:81:A5", "encap": "vlan-1371", "esgUsegDn": "", "extMngdBy": "", "fabricPathDn": "topology/pod-1/paths-1201/extpaths-191/pathep-[eth1/27]", "hostingServer": "esxi171.fab1.hl.dns", "id": "0", "idepdn": "", "lcC": "learned,vmm", "lcOwn": "local", "mac": "00:50:56:AC:81:A5", "mcastAddr": "not-applicable", "modTs": "2023-03-06T14:30:49.742+11:00", "monPolDn": "uni/tn-common/monepg-default", "name": "00:50:56:AC:81:A5", "nameAlias": "", "reportingControllerName": "vca17.fab1.hl.dns", "status": "", "uid": "0", "userdom": "all", "uuid": "", "vmmSrc": "dvs", "vrfDn": "uni/tn-Tenant17/ctx-Production_VRF" }, "children": [ { "fvIp": { "attributes": { "addr": "10.117.11.21", "annotation": "", "baseEpgDn": "", "bdDn": "uni/tn-Tenant17/BD-App_BD", "childAction": "deleteNonPresent", "createTs": "2023-03-06T14:30:49.937+11:00", "debugMACMessage": "", "esgUsegDn": "", "extMngdBy": "", "fabricPathDn": "topology/pod-1/paths-1201/extpaths-191/pathep-[eth1/27]", "flags": "", "lcOwn": "local", "modTs": "2023-03-06T14:30:49.742+11:00", "monPolDn": "uni/tn-common/monepg-default", "rn": "ip-[10.117.11.21]", "status": "", "uid": "0", "userdom": "all", "vrfDn": "uni/tn-Tenant17/ctx-Production_VRF" } } } ] } } ] }

 

 

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.

Thank you providing this. I ran both versions of your icurl script, but the output value for 'contName' for each VM appears to be blank. When I run the script piped with jq, it works, but all it gives me is a pair double quotations:

johnnymoody_0-1678457162075.png

I went back to the GUI, right-clicked on the endpoint name, and opened it in the Object Store Browser. Confirming what I saw in the bash shell, the 'contName' field for all of these VM's are blank. It's odd because the name does appear in the End Point column under Operational ---> Client End-Points, but it seems to be pulling the information from somewhere else. 

johnnymoody_2-1678457895175.png

johnnymoody_3-1678457929692.png

Could this be happening because this EPG is tied to a VMware VMM Domain? 

 




 

Just a quick reply - it MIGHT be the \ character in the command line - the \ character is followed by <ENTER> when typing the command - it's a linux bash thing that allows you to spread you command over two lines.

Re the VMM thing - contName ONLY gets filled if you have a VMM!

 

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.

I actually thought that might be the case and tried removing it earlier today. Still the same output. 

OK. What's really weird with the screendumps you posted is that the contName field is blank when you open the fvCEp object in the Object Store Browser (aka visore).  The VM in my lab looks like this in the browser:

RedNectar_0-1678484063310.png

The other thing I noticed in your screendumps was that there was no Endpoint Name column.

RedNectar_1-1678484558573.png

Perhaps we are looking for different things!

FYI - it is Saturday here - won't be back at this for about 20+ hrs

 

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.

johnny.moody
Level 1
Level 1

Interesting. I don't have that Endpoint Name option when selecting columns. These are the options I have:

johnnymoody_1-1678486556805.png

The version we're running is 4.2(7q). I'm not sure if yours is newer or older, but that's what I get. 

On the road ATM. I'm using ACI v5.2(7g). It *could* be a rights thing.
Are you logged in as *admin*?
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.

Hi @johnny.moody ,

Back at my desk enjoying a geeky Sunday morning looking at your problem.

First thing first - your last screen dump looks like you right-clicked, rather than actually clicking on the heading

So hopefully, you can sort that problem out.

As for why:

When I run the script piped with jq, it works, but all it gives me is a pair double quotations:

I'm sure that has to be something to do with the way the command was entered - OR the EPG doesn't have VM managed by a VMM Domain.  In cay case, I'll give you a slightly more foolproof way of entering the command later


But back to actually giving you what you want - 

I can see the names of the endpoints by looking going to Operational ---> Client End-Points in the EPG. The names of the virtual machines I'm looking for appear in the End Point column, but I dont see a way to export this. Is this possible? 

And it is possible!

And thanks for throwing me down this rabbit-hole!

But to be honest, it's a rabbit-hole I've been staring at for some time, and never been quite game to jump in, although I've dipped my toe a couple of times with the odd moquery blog and video.

I've been wanting to explore jq for a while, and that is where this is going. I want to find a way to solve this one using icurl piped into jq 

So welcome to my rabbit hole!

Let's begin with the command I used last time - only (as I promised) I'm going to set some variables so you'll be able to copy and paste it more easily.

admin@apic1:~> TN=tn-Tenant17 #Replace tn-Tenant17 with whatever your Tenant is - don't leave out the "tn-" bit
admin@apic1:~> AP=ap-2Tier_AP #Replace ap-2Tier_AP with your Application Profile name - and rember the "ap-" at the start
admin@apic1:~> EPG=epg-DBServers_EPG #And again for the EPG name - replace epg-DBServers_EPG
# The following you can copy and paste as is if you've done the above correctly
admin@apic1:~> URI="http://localhost/api/node/mo/uni/$TN/$AP/$EPG.json" #Just to make it easier to interpret the
# long command later - as is the next line
admin@apic1:~> QUERY="query-target=children&target-subtree-class=fvCEp&rsp-subtree=children&rsp-subtree-class=fvIp"
#Refinement #0 - The following SHOULD produce exactly what my previous post gave you:
admin@apic1:~> icurl -s "$URI?$QUERY"
{"totalCount":"2","imdata":[{"fvCEp":{"attributes":{"annotation":"","baseEpgDn":"","bdDn":"uni/tn-Tenant17/BD-App_BD","childAction":"deleteNonPresent","contName":"","dn":"uni/tn-Tenant17/ap-2Tier_AP/epg-DBServers_EPG/cep-00:50:56:B8:04:1B","encap":"vlan-1175","esgUsegDn":"","extMngdBy":"","fabricPathDn":"topology/pod-1/paths-1203/pathep-[eth1/18]","hostingServer":"","id":"0","idepdn":"","lcC":"learned","lcOwn":"local","mac":"00:50:56:B8:04:1B","mcastAddr":"not-applicable","modTs":"2023-03-07T11:22:10.185+11:00","monPolDn":"uni/tn-common/monepg-default","name":"00:50:56:B8:04:1B","nameAlias":"","reportingControllerName":"","status":"","uid":"0","userdom":"all","uuid":"","vmmSrc":"","vrfDn":"uni/tn-Tenant17/ctx-Production_VRF"},"children":[{"fvIp":{"attributes":{"addr":"10.117.11.25","annotation":"","baseEpgDn":"","bdDn":"uni/tn-Tenant17/BD-App_BD","childAction":"deleteNonPresent","createTs":"2023-03-07T11:22:10.380+11:00","debugMACMessage":"","esgUsegDn":"","extMngdBy":"","fabricPathDn":"topology/pod-1/paths-1203/pathep-[eth1/18]","flags":"","lcOwn":"local","modTs":"2023-03-07T11:22:10.185+11:00","monPolDn":"uni/tn-common/monepg-default","rn":"ip-[10.117.11.25]","status":"","uid":"0","userdom":"all","vrfDn":"uni/tn-Tenant17/ctx-Production_VRF"}}}]}},{"fvCEp":{"attributes":{"annotation":"","baseEpgDn":"","bdDn":"uni/tn-Tenant17/BD-App_BD","childAction":"deleteNonPresent","contName":"dbserver1.t17.dns","dn":"uni/tn-Tenant17/ap-2Tier_AP/epg-DBServers_EPG/cep-00:50:56:AC:81:A5","encap":"vlan-1371","esgUsegDn":"","extMngdBy":"","fabricPathDn":"topology/pod-1/paths-1201/extpaths-191/pathep-[eth1/27]","hostingServer":"esxi171.fab1.hl.dns","id":"0","idepdn":"","lcC":"learned,vmm","lcOwn":"local","mac":"00:50:56:AC:81:A5","mcastAddr":"not-applicable","modTs":"2023-03-06T14:30:49.742+11:00","monPolDn":"uni/tn-common/monepg-default","name":"00:50:56:AC:81:A5","nameAlias":"","reportingControllerName":"vca17.fab1.hl.dns","status":"","uid":"0","userdom":"all","uuid":"","vmmSrc":"dvs","vrfDn":"uni/tn-Tenant17/ctx-Production_VRF"},"children":[{"fvIp":{"attributes":{"addr":"10.117.11.21","annotation":"","baseEpgDn":"","bdDn":"uni/tn-Tenant17/BD-App_BD","childAction":"deleteNonPresent","createTs":"2023-03-06T14:30:49.937+11:00","debugMACMessage":"","esgUsegDn":"","extMngdBy":"","fabricPathDn":"topology/pod-1/paths-1201/extpaths-191/pathep-[eth1/27]","flags":"","lcOwn":"local","modTs":"2023-03-06T14:30:49.742+11:00","monPolDn":"uni/tn-common/monepg-default","rn":"ip-[10.117.11.21]","status":"","uid":"0","userdom":"all","vrfDn":"uni/tn-Tenant17/ctx-Production_VRF"}}}]}}]}
# which gives me the same output as before
#Refinement #1 - I really want to focus on the jq - so just like last time (using the bash variables now)
admin@apic1:~> icurl -s "$URI?$QUERY" | jq '.imdata[].fvCEp.attributes.contName' "" "dbserver1.t17.dns"

OK. So this is where my bunny chase really begins.  I wasn't happy with the above output because

  1. It showed the names of endpoints that weren't VMs, or managed by a VMM manager
  2. It didn't actually label the output 
  3. It showed ONLY the VM names, nothing else

Let's do some more refinements

I can refine the query to just show those elements that have a VM manager (i.e controlled by vCenter - so must be VMs) by adding the following filter:

query-target-filter=ne(fvCEp.reportingControllerName, "")

It's a bit tricky getting the filter in the right place, but here we go.  You'll have to update the QUERY variable so it reads:

#Refinement #2 - Step 1 - edit the QUERY variable
admin@apic1:~> QUERY='query-target=children&target-subtree-class=fvCEp&query-target-filter=ne(fvCEp.reportingControllerName, "")&rsp-subtree=children&rsp-subtree-class=fvIp'
# Step 2 run the same query - since I have ONLY ONE VM in this EPG, I expect to see only one answer
admin@apic1:~> icurl -s "$URI?$QUERY" | jq '.imdata[].fvCEp.attributes.contName'
"dbserver1.t17.dns"

Great. That's fixed issue #1 above 1. It showed the names of endpoints that weren't VMs, or managed by a VMM manager

But how do I squeeze a bit more out of jq to give me some extra information?

Let's start by adding a label to the output.  To do this, I'm going to make jq format the output in JSON format!  Check this out

#Refinement #3 - have jq create a new array
admin@apic1:~> icurl -s "$URI?$QUERY" | jq '[.imdata[] | {VM_Name: .fvCEp.attributes.contName}]' [ { "VM_Name": "dbserver1.t17.dns" } ]

Magnificent - I've now got labels - BUT I had to define the label myself. But I can live with that. Two down, one to go

For the last item on my wishlist - getting more than just the VM name, is just a matter of adding the values I want to pick from the array output of the icurl command and adding them to the array I created for VM_Name above.

#Refinement #3 -Let's extract the VM's IP address, and the name of the vCenter that manages the VMM
admin@apic1:~> icurl -s "$URI?$QUERY" | jq '[.imdata[] | 
{VM_Name: .fvCEp.attributes.contName,
IP: .fvCEp.children[].fvIp.attributes.addr,
vCenter: .fvCEp.attributes.reportingControllerName}]'
[ { "VM_Name": "dbserver1.t17.dns", "IP": "10.117.11.21", "vCenter": "vca17.fab1.hl.dns" } ]

To wrap up then, I've decided to power on a 2nd VM in the same EPG/Portgroup, just to make the output a bit more meaty.  This final example is exactly the same as the previous one, but shows one more server:

#Refinement #4 - power on another VM to add interest to the output.
admin@apic1:~> icurl -s "$URI?$QUERY" | jq '[.imdata[] |
{VM_Name: .fvCEp.attributes.contName,
IP: .fvCEp.children[].fvIp.attributes.addr,
vCenter: .fvCEp.attributes.reportingControllerName}]'


[ { "VM_Name": "dbserver1.t17.dns", "IP": "10.117.11.21", "vCenter": "vca17.fab1.hl.dns" }, { "VM_Name": "dbserver2.t17.dns", "IP": "10.117.11.22", "vCenter": "vca17.fab1.hl.dns" } ]

There are ways you can turn this output into .csv - but that's a topic for another lazy Sunday.

 

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.

Sorry for the delay in replying, it's been quite a week.

So first, thank you for all of your help thus far. You've definitively helped me gain a better understanding of how all of this works on the back-end of ACI. As far as the columns go, I didnt actually right-click in my above images; those are really all of the options I have when left-clicking on the down arrow in any of those columns. I'm wondering if that's something that was introduced in a later version, or that our setup is somehow fundamentally different from yours. Because of that, I'm not sure if I'm going to be able to pull the information with your method.

When I run the moquery with no filters, it gives me all of the output, but in none of that output is the name of any of our VM's. Seems like they fixed/added that somewhere between 4.2 and 5.2. 

johnnymoody_0-1678966916569.png

Same thing for the icurl script. The "contName" field for every endpoint is blank, and the actual name of the VMs aren't present anywhere else in any of the output. 

Back to the columns. I also have the 4.2(7I) APIC simulator running on a server I have at home, and I see the exact same options in the columns in that GUI as I do in our production network. Because, you cant actually connect any hosts to the simulator (If you know if a way, please please share lol), I cant say if the "contName" field populates the VM name of an attached VM.

All in all, it seems buggy to me. I'm going to open a TAC case to see what they can tell me. 

 

Hi @johnny.moody ,

Ah - I forgot that v4 gives the Endpoint Name value under the Name column - so on v4.2(7r) you see only these column options

RedNectar_0-1679013794338.png

But - as you observed, even in 4.2(7r) the fvCEp class objects have an attribute of contName

Unfortunately the v4.2(7r) system I have access to does NOT have any VMM Domains and is a production system, so I can't play with it.

Maybe we should be taking a different approach.  Does this give you anything like what you want?

apic1# moquery -c compVm | grep -w name

or if you like the icurl approach

admin@apic1:~> icurl -s 'http://localhost/api/class/compVm.json?' | jq .imdata[]

or even fancier:

admin@apic1:~> icurl -s 'http://localhost/api/class/compVm.json?' | jq '[.imdata[] | {VM_Name: .compVm.attributes.name}]'

 

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.

Let me apologize again for the huge delay. TAC finally got back to me and advised what we already knew; that in version 4.2 the 'contName' field simply isn't populated. So doing it the way you initially showed me isn't going to work on the version we're running, which is a little bit of a bummer.

The 'moquery -c compVm | grep -w name' does work for pulling the VM names, but right now I can only seem to find a way to have it pull all of them and not just the names of VM's from a certain EPG. Looking at the unfiltered output, it seems to be pulling that info from VMware. I dont see any of the Tennant, App Profile, or EPG information; so perhaps it's not possible? 

Hi @johnny.moody ,

Bummer! The contName  field is useless in v4.2.

So. Back to the drawing board. Again, I don't have any VMs on my 4.2 system, so I can't test, but carrying on from before, how about trying this - replacing the Tenant, AP and EPG names with yours

admin@apic1:~> icurl -s 'http://localhost/api/node/mo/uni/tn-YourTenant/ap-YourAppProfile/epg-YourEPG.json?query-target=children&target-subtree-class=fvCEp&rsp-subtree=full&rsp-subtree-class=fvIp,fvRsToVm,fvRsVm,fvRsHyper,fvRsCEpToPathEp,fvPrimaryEncap' | jq .imdata[]

and see if you can find the VM names in amongst that.  If you can, be sure to come back and let me know which field reveals the VM name.

And if that doesn't work, try this variation (which I gleaned from the API inspector in v4.2 - the version above is from 5.2(7f))

admin@apic1:~> icurl -s 'http://localhost/api/node/mo/uni/tn-YourTenant/ap-YourAppProfile/epg-YourEPG.json?query-target=children&target-subtree-class=fvCEp&rsp-subtree=children&rsp-subtree-class=fvRsToVm,fvRsVm,fvRsHyper,fvRsCEpToPathEp,fvIp,fvPrimaryEncap' | jq .imdata[]

I think the only difference between the two is that one specifies rsp-subtree=full and the other rsp-subtree=children 

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.

Review Cisco Networking for a $25 gift card

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