Reply
Highlighted
Accepted Solution

Is there a Perl API call for clearing unmanaged addresses?

Guru
Posts: 61
5478     0

I need to shrink a subnet using SplitNetwork.  I only want the first half of the original subnet for now, but it is creating the second subnet due to finding unmanaged addresses in it.  Is there an API call to clear out the unmanaged addresses prior to spliting it up?

 

Re: Is there a Perl API call for clearing unmanaged addresses?

Adviser
Posts: 213
5479     0
You could let it create the 2nd subnet as well and then just delete it. That way you’ll be sure to only clear the unmanaged data that applies to that second subnet and not accidentally clear anything else.

Re: Is there a Perl API call for clearing unmanaged addresses?

Guru
Posts: 61
5479     0

I found a way to clear out the data, posted below.  In my case, I didn't really care about the unmanaged data at all, so removing was the best option.

 

 

The below code assumes you have already have found the subnet you are looking for and stored it in $subnet.

 

 

                my @used = $session->get(
                        object => "Infoblox::IPAM::Address",
                        network => $subnet->network(),
                        status => "used",
                );  
                foreach my $addr (@used){
                        if ($addr->types() eq 'UNMANAGED'){
                                printf ("Found Unmanaged Address %s.  Removing.\n", $addr->ip_address());
                                $session->remove($addr)
                                        or die("Unmanaged address unable to be removed: ",
                                        $session->status_code() . ":" . $session->status_detail());
                        }else{
                                next;
                        }   
                }   
Showing results for 
Search instead for 
Do you mean 

Recommended for You

Demo: Infoblox IPAM plug-in integration with OpenStack Newton