06-29-2024 05:45 PM - edited 06-29-2024 05:46 PM
We use a network-centric design. My end goal is to get an idea of how many VLANs (EPG's) & VRF's, as well as how many L3Out uplinks (routed interfaces and SVI's) there are in an existing Tenant.
For the L3Out uplinks I think I just need the tDN under the l3extRsPathL3OutAtt objects, which will give me the leaf number.
Any help is greatly appreciated. Thanks!
Solved! Go to Solution.
06-29-2024 10:40 PM
Hi @petersmiddy ,
I'm not sure if you want to count VLANs or EPGs or VRFs. However, the following set of commands (shamelessly stolen from this blog) might give you some direction. [Disclosure: The aforementioned blog is my blog]
apic1# bash
admin@apic1:-> for VRF in $(icurl -s "http://localhost/api/node/class/fvCtx.json"| jq -r .imdata[].fvCtx.attributes.dn) do echo EPGs for Tenant $(echo ${VRF}|cut -d'/' -f2 | cut -b 4-) VRF $(echo ${VRF}|cut -d'/' -f3|cut -b 5-) for BD in $(icurl -s "http://localhost/api/node/mo/${VRF}.json?query-target=children&target-subtree-class=fvRtCtx"| jq -r '.imdata[].fvRtCtx.attributes | (.dn|capture("rtctx-\\[(?<B>.*)]").B)') do icurl -s "http://localhost/api/node/mo/${BD}.json?query-target=children&target-subtree-class=fvRtBd"| jq '.imdata[].fvRtBd.attributes| ("AP/EPG: \(.tDn| capture("'"/ap-(?<A>.*)/epg-"'").A)\/\(.tDn| capture("'"/epg-(?<E>.*)"'").E)")' done done
EPGs for Tenant common VRF copy
EPGs for Tenant infra VRF overlay-1
"AP/EPG: access/default"
EPGs for Tenant infra VRF ave-ctrl
"AP/EPG: ave-ctrl/ave-ctrl"
EPGs for Tenant common VRF default
EPGs for Tenant mgmt VRF oob
EPGs for Tenant mgmt VRF inb
EPGs for Tenant common VRF SharedServices_VRF
"AP/EPG: SharedServices_AP/SharedServices_EPG"
EPGs for Tenant T09 VRF Production_VRF
"AP/EPG: 2Tier_AP/AppServers_EPG"
"AP/EPG: 2Tier_AP/WebServers_EPG"
EPGs for Tenant T10 VRF Production_VRF
"AP/EPG: 2Tier_AP/AppServers_EPG"
"AP/EPG: 2Tier_AP/WebServers_EPG"
EPGs for Tenant Tenant04 VRF Production_VRF
"AP/EPG: 2Tier_AP/AppServers_EPG"
"AP/EPG: 2Tier_AP/WebServers_EPG"
EPGs for Tenant Tenant02 VRF Production_VRF
"AP/EPG: 2Tier_AP/AppServers_EPG"
"AP/EPG: 2Tier_AP/WebServers_EPG"
EPGs for Tenant Tenant03 VRF Production_VRF
"AP/EPG: 2Tier_AP/AppServers_EPG"
"AP/EPG: 2Tier_AP/WebServers_EPG"
EPGs for Tenant Tenant07 VRF Production_VRF
"AP/EPG: 2Tier_AP/AppSERVER_EPG"
"AP/EPG: 2Tier_AP/WebSERVER_EPG"
EPGs for Tenant Tenant08 VRF Production_VRF
"AP/EPG: 2Tier_AP/AppServers_EPG"
"AP/EPG: 2Tier_AP/WebServers_EPG"
EPGs for Tenant Tenant06 VRF Production_VRF
Pretty boring output on my system which is the remnant of a class that ran last week, hence so much repetition.
Anyway - if this is NOT what you are looking for, you may find your answer in the link I surreptitiously snuck in earlier. Or come back with more detail.
And as you said, the l3extRsPathL3OutAtt
should give you all the info you need for L3Outs.
06-29-2024 10:40 PM
Hi @petersmiddy ,
I'm not sure if you want to count VLANs or EPGs or VRFs. However, the following set of commands (shamelessly stolen from this blog) might give you some direction. [Disclosure: The aforementioned blog is my blog]
apic1# bash
admin@apic1:-> for VRF in $(icurl -s "http://localhost/api/node/class/fvCtx.json"| jq -r .imdata[].fvCtx.attributes.dn) do echo EPGs for Tenant $(echo ${VRF}|cut -d'/' -f2 | cut -b 4-) VRF $(echo ${VRF}|cut -d'/' -f3|cut -b 5-) for BD in $(icurl -s "http://localhost/api/node/mo/${VRF}.json?query-target=children&target-subtree-class=fvRtCtx"| jq -r '.imdata[].fvRtCtx.attributes | (.dn|capture("rtctx-\\[(?<B>.*)]").B)') do icurl -s "http://localhost/api/node/mo/${BD}.json?query-target=children&target-subtree-class=fvRtBd"| jq '.imdata[].fvRtBd.attributes| ("AP/EPG: \(.tDn| capture("'"/ap-(?<A>.*)/epg-"'").A)\/\(.tDn| capture("'"/epg-(?<E>.*)"'").E)")' done done
EPGs for Tenant common VRF copy
EPGs for Tenant infra VRF overlay-1
"AP/EPG: access/default"
EPGs for Tenant infra VRF ave-ctrl
"AP/EPG: ave-ctrl/ave-ctrl"
EPGs for Tenant common VRF default
EPGs for Tenant mgmt VRF oob
EPGs for Tenant mgmt VRF inb
EPGs for Tenant common VRF SharedServices_VRF
"AP/EPG: SharedServices_AP/SharedServices_EPG"
EPGs for Tenant T09 VRF Production_VRF
"AP/EPG: 2Tier_AP/AppServers_EPG"
"AP/EPG: 2Tier_AP/WebServers_EPG"
EPGs for Tenant T10 VRF Production_VRF
"AP/EPG: 2Tier_AP/AppServers_EPG"
"AP/EPG: 2Tier_AP/WebServers_EPG"
EPGs for Tenant Tenant04 VRF Production_VRF
"AP/EPG: 2Tier_AP/AppServers_EPG"
"AP/EPG: 2Tier_AP/WebServers_EPG"
EPGs for Tenant Tenant02 VRF Production_VRF
"AP/EPG: 2Tier_AP/AppServers_EPG"
"AP/EPG: 2Tier_AP/WebServers_EPG"
EPGs for Tenant Tenant03 VRF Production_VRF
"AP/EPG: 2Tier_AP/AppServers_EPG"
"AP/EPG: 2Tier_AP/WebServers_EPG"
EPGs for Tenant Tenant07 VRF Production_VRF
"AP/EPG: 2Tier_AP/AppSERVER_EPG"
"AP/EPG: 2Tier_AP/WebSERVER_EPG"
EPGs for Tenant Tenant08 VRF Production_VRF
"AP/EPG: 2Tier_AP/AppServers_EPG"
"AP/EPG: 2Tier_AP/WebServers_EPG"
EPGs for Tenant Tenant06 VRF Production_VRF
Pretty boring output on my system which is the remnant of a class that ran last week, hence so much repetition.
Anyway - if this is NOT what you are looking for, you may find your answer in the link I surreptitiously snuck in earlier. Or come back with more detail.
And as you said, the l3extRsPathL3OutAtt
should give you all the info you need for L3Outs.
06-30-2024 06:34 AM
@RedNectar - Thank you so much for the prompt response! I was getting no output at first, but then read more of your blog, and figured out I need to do an icurl -ks , I am getting exactly what I was after. I'm going to compile this information, and then work on the L3Out stuff. Again, thank you for the quick and accurate assistance with this.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide