X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fswitchmanager%2Fapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fswitchmanager%2FSubnet.java;h=56df8e26bd094b82bdd8d6ddb89cec4ab249e7a9;hp=f33fa18e299f62b8680389150c916a28efb06254;hb=9212fed678702583f4a555641208cf1c7b45b829;hpb=efa48be30a4054e7cfce114e66c5b5667b1c4a5c diff --git a/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/Subnet.java b/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/Subnet.java index f33fa18e29..56df8e26bd 100644 --- a/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/Subnet.java +++ b/opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/Subnet.java @@ -161,15 +161,11 @@ public class Subnet implements Cloneable, Serializable { } InetAddress thisPrefix = getPrefixForAddress(this.networkAddress); InetAddress otherPrefix = getPrefixForAddress(ip); - if ((thisPrefix == null) || (otherPrefix == null)) { - return false; - } - if (thisPrefix.equals(otherPrefix)) { - return true; - } - else { - return false; + boolean isSubnetOf = true; + if (((thisPrefix == null) || (otherPrefix == null)) || (!thisPrefix.equals(otherPrefix)) ) { + isSubnetOf = false; } + return isSubnetOf; } public short getVlan() { @@ -244,24 +240,11 @@ public class Subnet implements Cloneable, Serializable { if (p == null) { return false; } - if (this.isFlatLayer2()) { - return true; - } - return this.nodeConnectors.contains(p); + return isFlatLayer2() || nodeConnectors.contains(p); } public boolean isMutualExclusive(Subnet otherSubnet) { - if (this.networkAddress.getClass() != otherSubnet.networkAddress - .getClass()) { - return true; - } - if (this.isSubnetOf(otherSubnet.getNetworkAddress())) { - return false; - } - if (otherSubnet.isSubnetOf(this.getNetworkAddress())) { - return false; - } - return true; + return !(isSubnetOf(otherSubnet.getNetworkAddress()) || otherSubnet.isSubnetOf(getNetworkAddress())); } /**