Iterator<NeutronSubnetIPAllocationPool> i = allocationPools.iterator();
while (i.hasNext()) {
NeutronSubnetIPAllocationPool pool = i.next();
- if (ipVersion == IPV4_VERSION) {
- if (pool.contains(gatewayIP)) {
- return true;
- }
+ if (ipVersion == IPV4_VERSION && pool.contains(gatewayIP)) {
+ return true;
}
- if (ipVersion == IPV6_VERSION) {
- if (pool.containsV6(gatewayIP)) {
- return true;
- }
+ if (ipVersion == IPV6_VERSION && pool.containsV6(gatewayIP)) {
+ return true;
}
}
return false;
ans = pool.getPoolStart();
}
else {
- if (ipVersion == IPV4_VERSION) {
- if (NeutronSubnetIPAllocationPool.convert(pool.getPoolStart()) <
+ if (ipVersion == IPV4_VERSION &&
+ NeutronSubnetIPAllocationPool.convert(pool.getPoolStart()) <
NeutronSubnetIPAllocationPool.convert(ans)) {
- ans = pool.getPoolStart();
- }
+ ans = pool.getPoolStart();
}
- if (ipVersion == IPV6_VERSION) {
- if (NeutronSubnetIPAllocationPool.convertV6(pool.getPoolStart()).compareTo(NeutronSubnetIPAllocationPool.convertV6(ans)) < 0) {
- ans = pool.getPoolStart();
- }
+ if (ipVersion == IPV6_VERSION &&
+ NeutronSubnetIPAllocationPool.convertV6(pool.getPoolStart()).compareTo(NeutronSubnetIPAllocationPool.convertV6(ans)) < 0) {
+ ans = pool.getPoolStart();
}
}
}
}
for (Neutron_IPs test_fixedIP : test.getFixedIPs()) {
for (Neutron_IPs check_fixedIP : check.getFixedIPs()) {
- if (test_fixedIP.getSubnetUUID().equals(check_fixedIP.getSubnetUUID())) {
- if (test_fixedIP.getIpAddress().equals(check_fixedIP.getIpAddress())) {
- throw new ResourceConflictException("IP address already allocated");
- }
+ if (test_fixedIP.getSubnetUUID().equals(check_fixedIP.getSubnetUUID()) &&
+ (test_fixedIP.getIpAddress().equals(check_fixedIP.getIpAddress()))) {
+ throw new ResourceConflictException("IP address already allocated");
}
}
}
while (portIterator.hasNext()) {
NeutronPort port = portIterator.next();
List<Neutron_IPs> fixedIPs = port.getFixedIPs();
- if (fixedIPs.size() == 1) {
- if (subnet.getGatewayIP().equals(fixedIPs.get(0).getIpAddress())) {
- return port;
- }
+ if (fixedIPs.size() == 1 && subnet.getGatewayIP().equals(fixedIPs.get(0).getIpAddress())) {
+ return port;
}
}
return null;