Merge "Added move of branding jar to assembly"
[controller.git] / opendaylight / sal / api / src / main / java / org / opendaylight / controller / sal / core / ContainerFlow.java
index acb3e19f69da6a88a2b8f1a0cda1d2f258b7c70a..468313c164384befcc5f9477f4a5670609d95caf 100644 (file)
@@ -11,14 +11,13 @@ package org.opendaylight.controller.sal.core;
 
 import java.io.Serializable;
 
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
 import org.opendaylight.controller.sal.action.Action;
 import org.opendaylight.controller.sal.action.SetDlType;
 import org.opendaylight.controller.sal.action.SetNwDst;
 import org.opendaylight.controller.sal.action.SetNwSrc;
 import org.opendaylight.controller.sal.action.SetTpDst;
 import org.opendaylight.controller.sal.action.SetTpSrc;
+import org.opendaylight.controller.sal.action.SetVlanId;
 import org.opendaylight.controller.sal.flowprogrammer.Flow;
 import org.opendaylight.controller.sal.match.Match;
 import org.opendaylight.controller.sal.match.MatchType;
@@ -48,12 +47,32 @@ public class ContainerFlow implements Serializable {
 
     @Override
     public int hashCode() {
-        return HashCodeBuilder.reflectionHashCode(this);
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((match == null) ? 0 : match.hashCode());
+        return result;
     }
 
     @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;
+        }
+        ContainerFlow other = (ContainerFlow) obj;
+        if (match == null) {
+            if (other.match != null) {
+                return false;
+            }
+        } else if (!match.equals(other.match)) {
+            return false;
+        }
+        return true;
     }
 
     @Override
@@ -82,6 +101,11 @@ public class ContainerFlow implements Serializable {
         Match actionMatch = new Match();
         for (Action action : flow.getActions()) {
             switch (action.getType()) {
+            case SET_VLAN_ID:
+                actionMatch.setField(MatchType.DL_VLAN,
+                        ((Integer) ((SetVlanId) action).getVlanId())
+                                .shortValue());
+                break;
             case SET_DL_TYPE:
                 actionMatch.setField(MatchType.DL_TYPE,
                         ((Integer) ((SetDlType) action).getDlType())
@@ -114,7 +138,7 @@ public class ContainerFlow implements Serializable {
     /**
      * Returns whether the specified match is allowed
      *
-     * @param match    the match to test
+     * @param match the match to test
      * @return true if the match is allowed, false otherwise
      */
     public boolean allowsMatch(Match target) {