/** * 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 containsV6(String inputString) { BigInteger inputIP = convertV6(inputString); BigInteger startIP = convertV6(poolStart); BigInteger endIP = convertV6(poolEnd); return (inputIP.compareTo(startIP) >= 0 && inputIP.compareTo(endIP) <= 0); }
public List<NeutronSubnetIPAllocationPool> splitPoolV6(String ipAddress) { List<NeutronSubnetIPAllocationPool> ans = new ArrayList<>(); BigInteger gIP = NeutronSubnetIPAllocationPool.convertV6(ipAddress); BigInteger sIP = NeutronSubnetIPAllocationPool.convertV6(poolStart); BigInteger eIP = NeutronSubnetIPAllocationPool.convertV6(poolEnd); if (gIP.compareTo(sIP) == 0 && gIP.compareTo(eIP) < 0) { NeutronSubnetIPAllocationPool p = new NeutronSubnetIPAllocationPool();
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; }
BigInteger lowAddress_bi = NeutronSubnetIPAllocationPool.convertV6(parts[0]); String lowAddress = NeutronSubnetIPAllocationPool.bigIntegerToIP(lowAddress_bi.add(BigInteger.ONE)); BigInteger mask = BigInteger.ONE.shiftLeft(length).subtract(BigInteger.ONE);