02-15-2023 05:30 PM
Greetings community, I would like to know if there is a Moquery-type command or Python script that can deliver VPCs that are not in use.
It already uses the functionality of the acitoolkit Lint but it does not deliver this object.
02-17-2023 05:28 AM
What do you mean by "not in use". Are you looking for configured VPCs, but nothing physically connected?, Configured and connecteed but no EPGs mapped? etc.
Robert
02-17-2023 07:44 AM
HI Robert
What I need to see are the VPC policy-groups that do not have associated physical interfaces (interface-selector), also the VPCs that do not have associated EPGs
Andres
02-17-2023 10:59 AM - edited 02-17-2023 11:02 AM
While I don't have cycles to create a script for you, this is something you should be able to figure out. Best way would be a python script (no single API call will accomplish this). I can point you in the right direction to get started.
Step1. Get a list of all objects of class 'infraAccBndlGrp' and pull them into an array/list
Step2. Using the list as input, run a loop using the following query for each Policy Group (infraAccBndleGrp) object in the list
Ex.
'/api/node/mo/uni/infra/funcprof/[infraAccBndlGrp_Array_Item].json?query-target=children&target-subtree-class=relnFrom'
Step3. Use some logic to determine if that PolicyGrp is in use. If the returned objects = '0' then this is an orphaned object which you can then delete. Else, if the returned Obects is >0, its being referenced (in use)
Here's a sample postman API call to grab all VPC Policy Groups from the fabric. You'd just need the dn property from each returned object.
Here's a postman API call to look for any relations to a specific AccBndlGrp object which happens to have no relations (orphaned
Here's a postman API call to look for any relations to a specific AccBndlGrp object which happens to be in use (has 2 relations):
If anyone else has a pre-made script or another method to accomplish this hopefully they'll share it. If not, this shouldn't be too hard to figure out.
Hope this helps,
Robert
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