02-28-2024 08:44 AM
Hi Guys,
I am gathering some info from one ACI Fabric, my end goal is to get the moqueries with grep filters to list out all the ip's configure on the l3outs. Rather it the routed interface or svi. Need Help
03-06-2024 08:47 AM
Hi
moquery -c l3extRsPathL3OutAtt -x rsp-subtree=full | grep addr | grep -v TC | awk '{print $3}' | sort | uniq
HTH
03-28-2024 02:38 PM
Hi @danial.tahir19911 ,
It seems to me that @Marcel Zehnder 's answer is correct - although I'll offer a refinement below, but first:
If your question has been answered, it is a great idea to mark the question as being answered. This helps:
I found @Marcel Zehnder suggestion gave me more than I needed:
admin@apic1:~> moquery -c l3extRsPathL3OutAtt -x rsp-subtree=full | grep addr | grep -v TC | awk '{print $3}' | sort | uniq
10.101.1.201/24
10.102.1.201/24
10.103.1.201/24
10.10.4.2/25
10.1.11.1/24
10.1.11.2
10.2.1.1/24
The 10.1.11.2 address is the address of a BGP peer that gets included in the output of moquery -c l3extRsPathL3OutAtt -x rsp-subtree=full
# bgp.PeerP
addr : 10.1.11.2
On closer inspection, I'm not quite sure why the -x rsp-subtree=full was included. I could only find IPs configured on the l3Outs under l3ext.RsPathL3OutAtt.addr
So my solution was to just simplify the moquery command to.
admin@apic1:~> moquery -c l3extRsPathL3OutAtt | grep addr | sort | uniq | awk '{print $3}'
10.101.1.201/24
10.102.1.201/24
10.103.1.201/24
10.10.4.2/25
10.1.11.1/24
10.2.1.1/24
But I actually found it more useful (for my purposes) to also include the VLAN used on each IP, (and I didn't care about sort order anyway - and I don't have any duplicates) so I modified it to
admin@apic1:~> moquery -c l3extRsPathL3OutAtt | egrep "addr |encap " | awk '{print $3}'
10.10.4.2/25
vlan-204
10.1.11.1/24
vlan-414
10.2.1.1/24
vlan-416
10.101.1.201/24
vlan-1411
10.102.1.201/24
vlan-1421
10.103.1.201/24
vlan-1431
I know you asked for an moquery command, but I'm beginning to find that icurl is a better option, especially when combined with the power of the JSON query app - jq. I think the following is more useful and elegant than the moquery solution,
admin@apic1:~> icurl http://localhost/api/node/class/l3extRsPathL3OutAtt.json | jq '.imdata[].l3extRsPathL3OutAtt.attributes |.addr, .encap' % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 7087 100 7087 0 0 276k 0 --:--:-- --:--:-- --:--:-- 276k "10.10.4.2/25" "vlan-204" "10.1.11.1/24" "vlan-414" "10.2.1.1/24" "vlan-416" "10.101.1.201/24" "vlan-1411" "10.102.1.201/24" "vlan-1421" "10.103.1.201/24" "vlan-1431"
Using jq, you can get really fancy
admin@apic1:~> icurl http://localhost/api/node/class/l3extRsPathL3OutAtt.json | jq '.imdata[].l3extRsPathL3OutAtt.attributes | {IP_addr: .addr, VLAN: .encap}' % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 5426 100 5426 0 0 240k 0 --:--:-- --:--:-- --:--:-- 240k { "IP_addr": "10.10.4.2/25", "VLAN": "vlan-204" } { "IP_addr": "10.1.11.1/24", "VLAN": "vlan-414" } { "IP_addr": "10.2.1.1/24", "VLAN": "vlan-416" } { "IP_addr": "10.101.1.201/24", "VLAN": "vlan-1411" } { "IP_addr": "10.102.1.201/24", "VLAN": "vlan-1421" } { "IP_addr": "10.103.1.201/24", "VLAN": "vlan-1431" }
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