cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1465
Views
70
Helpful
3
Replies

moquery -c fvRsCEpToPathEp

Ibrahim010
Level 1
Level 1

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.

1 Accepted Solution

Accepted Solutions

Sergiu.Daniluk
VIP Alumni
VIP Alumni

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

View solution in original post

3 Replies 3

Sergiu.Daniluk
VIP Alumni
VIP Alumni

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

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.

 

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

Review Cisco Networking for a $25 gift card

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