/** * This method determines if this allocation pool contains the * input IPv4 address * * @param inputString * IPv4 address in dotted decimal format * @return a boolean on whether the pool contains the address or not */ public boolean contains(String inputString) { long inputIP = convert(inputString); long startIP = convert(poolStart); long endIP = convert(poolEnd); return (inputIP >= startIP && inputIP <= endIP); }
public String getLowAddr() { String ans = null; for (NeutronSubnetIPAllocationPool pool : allocationPools) { if (ans == null) { ans = pool.getPoolStart(); } else { if (ipVersion == IPV4_VERSION && NeutronSubnetIPAllocationPool.convert(pool.getPoolStart()) < NeutronSubnetIPAllocationPool.convert(ans)) { ans = pool.getPoolStart(); } if (ipVersion == IPV6_VERSION && NeutronSubnetIPAllocationPool.convertV6(pool.getPoolStart()).compareTo( NeutronSubnetIPAllocationPool.convertV6(ans)) < 0) { ans = pool.getPoolStart(); } } } return ans; }
public List<NeutronSubnetIPAllocationPool> splitPool(String ipAddress) { List<NeutronSubnetIPAllocationPool> ans = new ArrayList<>(); long gIP = NeutronSubnetIPAllocationPool.convert(ipAddress); long sIP = NeutronSubnetIPAllocationPool.convert(poolStart); long eIP = NeutronSubnetIPAllocationPool.convert(poolEnd); long i; NeutronSubnetIPAllocationPool p = new NeutronSubnetIPAllocationPool();