2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.forwardingrulesmanager;
11 import java.io.Serializable;
13 import org.opendaylight.controller.sal.core.ContainerFlow;
14 import org.opendaylight.controller.sal.core.Node;
17 * The flow database object representing the flow entry to install on the
18 * network node. It contains the original flow entry FRM was requested to
19 * install, the container flow with which that entry had to be merged and the
20 * resultant merged flow entry, which is the one that was eventually installed
23 * Note: If the container flow is null, the install entry will be a clone of the
26 public class FlowEntryInstall implements Serializable {
27 private static final long serialVersionUID = 1L;
28 private final FlowEntry original;
29 private final ContainerFlow cFlow;
30 private final FlowEntry install;
31 transient private long requestId; // async request id
32 transient private boolean deletePending;
34 public FlowEntryInstall(FlowEntry original, ContainerFlow cFlow) {
35 this.original = original;
37 this.install = (cFlow == null) ? original.clone() : original.clone().mergeWith(cFlow);
38 deletePending = false;
43 * Given FlowEntryInstall is used as key for FRM map which contains the
44 * software view of installed entries, having its hashcode tied to the one
45 * of the installed FlowEntry which takes into account the fields which
46 * uniquely identify a flow from switch point of view: node, match and
50 public int hashCode() {
51 return install.hashCode();
55 public boolean equals(Object obj) {
62 if (getClass() != obj.getClass()) {
65 FlowEntryInstall other = (FlowEntryInstall) obj;
66 if (install == null) {
67 if (other.install != null) {
70 } else if (!install.equals(other.install)) {
76 public String getFlowName() {
77 return original.getFlowName();
80 public String getGroupName() {
81 return original.getGroupName();
84 public Node getNode() {
85 return original.getNode();
88 public boolean equalsByNodeAndName(Node node, String flowName) {
89 return original.equalsByNodeAndName(node, flowName);
92 public FlowEntry getOriginal() {
96 public ContainerFlow getContainerFlow() {
100 public FlowEntry getInstall() {
104 public boolean isDeletePending() {
105 return deletePending;
108 public void toBeDeleted() {
109 this.deletePending = true;
112 public void setRequestId(long rid) {
113 this.requestId = rid;
116 public long getRequestId() {
121 * Returns whether this entry is the result of an internal generated static
124 * @return true if internal generated static flow, false otherwise
126 public boolean isInternal() {
127 return original.isInternal();
131 public String toString() {
132 return "[Install = " + install + " Original = " + original + " cFlow = " + cFlow + " rid = " + requestId + "]";