cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
455
Views
3
Helpful
2
Replies

How to get EPG's, VRF's, L3Out uplinks, and Leafs

petersmiddy
Level 1
Level 1

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!

1 Accepted Solution

Accepted Solutions

RedNectar
VIP
VIP

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
Click to expand to see my sample output
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.

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.

View solution in original post

2 Replies 2

RedNectar
VIP
VIP

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
Click to expand to see my sample output
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.

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.

petersmiddy
Level 1
Level 1

@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.

Review Cisco Networking for a $25 gift card

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