cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3635
Views
5
Helpful
18
Replies

Using moquery to find EPG's that lack a specific Domain

AukeyPeach
Level 1
Level 1

Hi all,

 

I need to audit our env and I need to complete a search and have it return all Tenants and EPG's that have lack a specific domain, this is so we can find out where we need to update them.

 

The moquery I'm running at the moment is:

 

moquery -c fvRsDomAtt -f 'fv.RsDomAtt.dn*"epg-EPG" and fv.RsDomAtt.tDn!="uni/phys-PHY-CORE"' | grep "^tDn\|^dn"

 

In plain english:

 

Search for all Domains where the associated distinguished name is appended with epg-EPG and does NOT have PHY-CORE as a domain - The Append is no longer necessary moving forward.

 

This is fine, and for the most part it got me 99% of the way.

 

However it's not quite what I need because I've checked a few EPG's that are not appended with "EPG" and some of them lack the PHY-CORE domain that I need them to have.

 

So what I'm trying to do now is search for all EPG's that do NOT have the PHY-CORE domain associated with them.

 

Problem is, the way the query seems to operate, it's returning essentially every single EPG, but removing the entries for the PHY-CORE - So for example an EPG might have 3 Domains - Domain-1, Domain-2 and PHY-CORE

 

Running the following will display those EPG's with PHY-CORE omitted - What I want to find are EPG's that do NOT have PHY-CORE domain at all.

 

moquery -c fvRsDomAtt -f fv.RsDomAtt.tDn!="uni/phys-PHY-CORE"'

 

I thought perhaps an XOR operator would do the trick but sadly it didn't return anything, so this isn't what I'm after I assume.

 

Thank you!

18 Replies 18

Happy you guys found a solution - however, just because I'm curious: Isn't my initial command reporting the same result? It's doing more or less the same as Sergiu's commands...? Or did I miss something? 

Hehe, I just looked over your post, and indeed is pretty much the same logic (but with different class used to get the not-desired epgs), and all in a single command ^_^

 

 

 

 

Wait!
I could have done this all in 1 command!? D'oh!
What was the command do you think?

My apologies, I mistakenly put the wrong class that I was querying and have cleared up - Just incase anyone searching google will find this at some point.

 

The correct class is fvRsDomAtt

Review Cisco Networking for a $25 gift card

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