VMware Networking Community
Czernobog
Expert
Expert

NSX 4.x - API query to return deleted entities (vms), return groups with no effective members

I think I saw something like this is the past, in the UI or API documentation, but could not find it now.

Is there a way to search for deleted objects using a REST query on the nsx manager? Or even better, list security groups, that have no effective members? What I want to return by API is basically this:

Czernobog_0-1695712928994.png

In the past I would use the "Get effective VMs for the Group" query to get the effective members of a group, but this query is deprecated.

The reason I need this is, that I suspect a lot of groups have no members anymore, and those empty groups are assigned to firewall rule, which in turn have no reason to exist anymore.

The group object returned by a API query does not list the virtual machine member as deleted. The only way to see if a group still has members is to run /policy/api/v1/infra/domains/{domain-id}/groups/{group-id}/members/{member-type}, but this would have to be run fo every possible member type separately.

It would be great to have a method that looks from top to bottom (policy - rule - group) if the firewall policy is still valid, that is, if it is not applied to empty security groups.

Reply
0 Kudos
0 Replies