Reply

Delete all records when deleting a network

[ Edited ]
Authority
Posts: 53
1821     0

Is there a easy/fast way to delete all records related to a network when deleting the network itself?

 

When we close a site, we need to cleanup all related IPAM data. So containers, networks, DHCP scopes and all records + discovered data. This all works as expected for the networks and DHCP scopes when deleting a container. But all records and discovered data remain.

 

The only way to do a cleanup I found was fetching all IPs from all networks for that site where the status is USED and then delete every single IP one by one which also cleans out all PTR, A and host records. Because we assigning /18 subnets to a site, this leaves us with about 8191 (=50% of 16382) IPs to delete which takes ages to complete.

 

I would expect this to be an option when deleting a network, instead of having to do such things manually...

Re: Delete all records when deleting a network

MRichard Community Manager
Community Manager
Posts: 101
1821     0

Hello,

 

DNS data belongs to the DNS zone, and would not automatically be remove from the DHCP network when the DHCP network is removed.

 

Caution should be used, because some records (such as host objects) may contain addresses in this network and other networks not being deleted.

 

You could script this by searching for all addresses within a network, which will also return any records associated with each address:

 

curl -k -u admin:infoblox -X GET 'https://192.168.1.2/wapi/v1.2/ipv4address' -d 'network=172.16.16.0/24'

 

When that list is returned, you would then loop throught each IP address and remove any appropriate records.

Re: Delete all records when deleting a network

Authority
Posts: 53
1821     0

Well, what you describe is the way I do it now. But as indicated, that very slow.

 

I was wondering if there is a better way. Because, from an IPAM point of view, if you delete a subnet, all related things should go away. The way it works now leaves you with a lot of potentially stale records.

Highlighted

Re: Delete all records when deleting a network

aziule
Techie
Posts: 8
1821     0

Facing the same issue here, and I agree that it's not very convenient...

 

One solution is to find every host belonging to the network you want to delete and send a `/request` query with `"method": "DELETE"` and a `"_ref"` pointing at each host you want to delete. Still it will require to make multiple queries to the API for what should be a simple deletion, in addition to ask for some data processing before creating the request body, but it looks like it's the best we could do

Showing results for 
Search instead for 
Do you mean 

Recommended for You