- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2022 11:33 AM - edited 03-01-2022 11:36 AM
Hi Everyone,
I am currently working on a small project in which i have to delete alot of unused static ports. Now as i was going about i was wondering how i would know which port is being used and which isnt.. so i figured out that i could moquery fvRsCepToPathEp. This shows me which mac address lives on which switch/interface and thus i could filter on leaf/port and get a list of all the unused ports (of course there is the silent host to keep in the back of your mind). So i found out this command helps:
apic1# moquery -c fvRsCEpToPathEp | grep dn | grep paths-108/extpaths-105/
dn : uni/tn-datacenter1/ap-clinical1/epg-tst-app/cep-00:50:50:B1:11:E9/rscEpToPathEp-[topology/pod-2/paths-108/extpaths-105/pathep-[eth1/9]]
...
So this works and shows me a big list of all the ports having a mac to port binding. Now i wanted to simply filter on the list, say "show me port 1/12" so i could check if there is a mac living on that interface or not. Sounds simple but for some reason it doesnt work..
apic1# moquery -c fvRsCEpToPathEp | grep dn | grep paths-108/extpaths-105/pathep-[eth1/9]]
zsh: no matches found: paths-108/extpaths-105/pathep-[eth1/9]]
It works all the way up to pathep- and everything after that it simple states that there are no matches to be found. Note that in the output above you can clearly see that the apic has found a line matching it, yet filtering on it gives no match return?
Can anyone help me out?
Thanks in advance.
Solved! Go to Solution.
- Labels:
-
Cisco ACI
-
Software Defined Networks
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2022 11:42 PM - edited 03-02-2022 06:22 AM
Try to escape the "[" character. It's a special one for grep. Try something like this:
Edit: also usage of fgrep is required
fgrep paths-108/extpaths-105/pathep-\[eth1/9\]
Stay safe,
Sergiu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2022 11:42 PM - edited 03-02-2022 06:22 AM
Try to escape the "[" character. It's a special one for grep. Try something like this:
Edit: also usage of fgrep is required
fgrep paths-108/extpaths-105/pathep-\[eth1/9\]
Stay safe,
Sergiu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2022 03:54 AM - edited 03-02-2022 04:02 AM
Hi Sergiu,
Thanks for the reply. Sadley when i try to escape the [ the output returns nothing:
apic1# moquery -c fvRsCEpToPathEp | grep dn | grep paths-108/extpaths-105/pathep-\[eth1/8\]
apic1#
Edit: i got it working now using your suggestion of escaping the special charachter plus fgrep:
apic1# moquery -c fvRsCEpToPathEp | grep dn | fgrep paths-108/extpaths-105/pathep-\[eth1/8\]
dn : uni/tn-datacenter1/ap-dra/epg-prd-app/cep-00:50:56:c3:52:64/rscEpToPathEp-[topology/pod-1/paths-108/extpaths-105/pathep-[eth1/8]]
dn : uni/tn-datacenter1/ap-horizon/epg-prd-app/cep-00:50:16:13:c7:30/rscEpToPathEp-[topology/pod-1/paths-108/extpaths-105/pathep-[eth1/8]]
Thanks alot for the help!
Kind reagrds.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2022 06:21 AM
Happy to hear it helped you to find the resolution. I will update my original post to be visible with the complete solution.
Take care,
Sergiu
