X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fforwardingrulesmanager%2Fapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fforwardingrulesmanager%2FFlowEntryInstall.java;h=ebb5a7bb2457125d8c3c27ea795a820377354eef;hp=dfe331ad5f8b0443a3c9c819130d6a5be434392a;hb=432ddf481f3bb6c297b1353f76a797fc9ef0e454;hpb=69bbdbb02e3f4755b95fa62b9a3610a3a11c9724 diff --git a/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/FlowEntryInstall.java b/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/FlowEntryInstall.java index dfe331ad5f..ebb5a7bb24 100644 --- a/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/FlowEntryInstall.java +++ b/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/FlowEntryInstall.java @@ -8,8 +8,8 @@ package org.opendaylight.controller.forwardingrulesmanager; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.HashCodeBuilder; +import java.io.Serializable; + import org.opendaylight.controller.sal.core.ContainerFlow; import org.opendaylight.controller.sal.core.Node; @@ -19,33 +19,58 @@ import org.opendaylight.controller.sal.core.Node; * install, the container flow with which that entry had to be merged and the * resultant merged flow entry, which is the one that was eventually installed * on the network node - * + * * Note: If the container flow is null, the install entry will be a clone of the * original entry - * */ -public class FlowEntryInstall { - private FlowEntry original; - private ContainerFlow cFlow; - private FlowEntry install; +public class FlowEntryInstall implements Serializable { + private static final long serialVersionUID = 1L; + private final FlowEntry original; + private final ContainerFlow cFlow; + private final FlowEntry install; + transient private long requestId; // async request id transient private boolean deletePending; public FlowEntryInstall(FlowEntry original, ContainerFlow cFlow) { this.original = original; this.cFlow = cFlow; - this.install = (cFlow == null) ? original.clone() : original - .mergeWith(cFlow); + this.install = (cFlow == null) ? original.clone() : original.mergeWith(cFlow); deletePending = false; + requestId = 0; } + /* + * Given FlowEntryInstall is used as key for FRM map which contains the + * software view of installed entries, having its hashcode tied to the one + * of the installed FlowEntry which takes into account the fields which + * uniquely identify a flow from switch point of view: node, match and + * priority. + */ @Override public int hashCode() { - return HashCodeBuilder.reflectionHashCode(this); + return install.hashCode(); } @Override public boolean equals(Object obj) { - return EqualsBuilder.reflectionEquals(this, obj); + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + FlowEntryInstall other = (FlowEntryInstall) obj; + if (install == null) { + if (other.install != null) { + return false; + } + } else if (!install.equals(other.install)) { + return false; + } + return true; } public String getFlowName() { @@ -84,9 +109,26 @@ public class FlowEntryInstall { this.deletePending = true; } + public void setRequestId(long rid) { + this.requestId = rid; + } + + public long getRequestId() { + return requestId; + } + + /** + * Returns whether this entry is the result of an internal generated static + * flow + * + * @return true if internal generated static flow, false otherwise + */ + public boolean isInternal() { + return original.isInternal(); + } + @Override public String toString() { - return "[Install = " + install + " Original: " + original + " cFlow: " - + cFlow + "]"; + return "[Install = " + install + " Original = " + original + " cFlow = " + cFlow + " rid = " + requestId + "]"; } }