Previous Topic: Check for STP on Backend NetworkNext Topic: Command One-Liners for Various Tasks


Clean Up Orphaned IPs On BFC

If you remove a network range or delete a grid from the BFC but the IPs still show as "In Use" this script is designed to clean them up on a 3.5 BFC. If you can verify it works with 3.1 (if this issue even exists in 3.1) please update this post.

I have attached a script that includes the cleanup for the "orphaned grid ip pools" issue Savvis saw previously as well as the cleanup for this issue where we hang on to IP allocations when the customer reduces application IP ranges on their grid(s).

I would suggest putting in the BFC's /home/bfcadmin directory and make it executable (at least by bfcadmin). Then, you can execute the script like:

su - bfcadmin -c "./cleanup_ip_pools show" (or simply execute the script while logged into the bfcadmin account like "./cleanup_ip_pools show") 

his will show you any pools that are in need of cleanup or print a few lines when there are no pools needing cleanup.

To actually do the cleanup, run:

su - bfcadmin -c "./cleanup_ip_pools cleanup" 

This will also list out the pools needing cleanup and then will show some output as it is cleaning up each pool.

Here's some sample runs on a local test node (where I actually had the script in /tmp and ran as root):

[root@heehaw-misty-ctrl1 tmp]# su - bfcadmin -c "$(pwd)/cleanup_ip_pools show" 
NO ORPHANED GRID POOLS 
APPLICATION IP POOLS WITH INVALID ALLOCATIONS: 
Application IP Pool... 
IP Pool ID: (1732) bbc/applogic_app_ip_subpool 
Total Pool Ranges: [{"10.11.4.4","10.11.7.254"}] 
Reserved IP Ranges: [{"10.11.4.4","10.11.4.254"}] 
Unreserved IP Ranges: [{"10.11.4.255","10.11.7.254"}] 
Allocation Pools: [1624] 
IP Allocations: [{"10.11.4.255","10.11.4.255"}] 
Application IP Pool... 
IP Pool ID: (1762) bbc/applogic_app_ip_subpool 
Total Pool Ranges: [{"10.11.8.2","10.11.11.254"}] 
Reserved IP Ranges: [{"10.11.8.2","10.11.8.255"}] 
Unreserved IP Ranges: [{"10.11.9.0","10.11.11.254"}] 
Allocation Pools: [1624] 
IP Allocations: [{"10.11.9.0","10.11.11.254"}] 
[root@heehaw-misty-ctrl1 tmp]# su - bfcadmin -c "$(pwd)/cleanup_ip_pools cleanup" 
NO ORPHANED GRID POOLS 
APPLICATION IP POOLS WITH INVALID ALLOCATIONS: 
Application IP Pool... 
IP Pool ID: (1732) bbc/applogic_app_ip_subpool 
Total Pool Ranges: [{"10.11.4.4","10.11.7.254"}] 
Reserved IP Ranges: [{"10.11.4.4","10.11.4.254"}] 
Unreserved IP Ranges: [{"10.11.4.255","10.11.7.254"}] 
Allocation Pools: [1624] 
IP Allocations: [{"10.11.4.255","10.11.4.255"}] 
Cleaning up application IP pool: 1732 ... Done 
Application IP Pool... 
IP Pool ID: (1762) bbc/applogic_app_ip_subpool 
Total Pool Ranges: [{"10.11.8.2","10.11.11.254"}] 
Reserved IP Ranges: [{"10.11.8.2","10.11.8.255"}] 
Unreserved IP Ranges: [{"10.11.9.0","10.11.11.254"}] 
Allocation Pools: [1624] 
IP Allocations: [{"10.11.9.0","10.11.11.254"}] 
Cleaning up application IP pool: 1762 ... Done 
[root@heehaw-misty-ctrl1 tmp]# su - bfcadmin -c "$(pwd)/cleanup_ip_pools show" 
NO ORPHANED GRID POOLS 
NO APPLICATION IP POOLS WITH INVALID ALLOCATIONS 
[root@heehaw-misty-ctrl1 tmp]# su - bfcadmin -c "$(pwd)/cleanup_ip_pools cleanup" 
NO ORPHANED GRID POOLS 
NO APPLICATION IP POOLS WITH INVALID ALLOCATIONS 
[root@heehaw-misty-ctrl1 tmp]#

Script: cleanup_ip_pools