Merge "ITM: Fix for tunnel ports not getting deleted."
[genius.git] / mdsalutil / mdsalutil-api / src / main / java / org / opendaylight / genius / mdsalutil / MDSALUtil.java
index 06f623d1d0ae6c6ed40f3b5f2974c5c7b6cf41b0..05efdd0644112c112fda4b7ac8a8d28ee935c749 100644 (file)
@@ -21,7 +21,7 @@ import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.vlan.action._case.PopVlanActionBuilder;
@@ -105,7 +105,7 @@ public class MDSALUtil {
     private static final Logger logger = LoggerFactory.getLogger(MDSALUtil.class);
 
     public static FlowEntity buildFlowEntity(BigInteger dpnId, short tableId, String flowId, int priority, String flowName,
-            int idleTimeOut, int hardTimeOut, BigInteger cookie, List<MatchInfo> listMatchInfo,
+            int idleTimeOut, int hardTimeOut, BigInteger cookie, List<? extends MatchInfoBase>  listMatchInfoBase,
             List<InstructionInfo> listInstructionInfo) {
 
         FlowEntity flowEntity = new FlowEntity(dpnId);
@@ -117,7 +117,7 @@ public class MDSALUtil {
         flowEntity.setIdleTimeOut(idleTimeOut);
         flowEntity.setHardTimeOut(hardTimeOut);
         flowEntity.setCookie(cookie);
-        flowEntity.setMatchInfoList(listMatchInfo);
+        flowEntity.setMatchInfoList(listMatchInfoBase);
         flowEntity.setInstructionInfoList(listInstructionInfo);
 
         return flowEntity;
@@ -125,16 +125,16 @@ public class MDSALUtil {
 
     // TODO: CHECK IF THIS IS USED
     public static Flow buildFlow(short tableId, String flowId, int priority, String flowName, int idleTimeOut,
-            int hardTimeOut, BigInteger cookie, List<MatchInfo> listMatchInfo, List<InstructionInfo> listInstructionInfo) {
+            int hardTimeOut, BigInteger cookie, List<? extends MatchInfoBase> listMatchInfoBase, List<InstructionInfo> listInstructionInfo) {
         return MDSALUtil.buildFlow(tableId, flowId, priority, flowName, idleTimeOut, hardTimeOut, cookie,
-                listMatchInfo, listInstructionInfo, true);
+                listMatchInfoBase, listInstructionInfo, true);
     }
 
     public static Flow buildFlow(short tableId, String flowId, int priority, String flowName, int idleTimeOut,
-            int hardTimeOut, BigInteger cookie, List<MatchInfo> listMatchInfo,
+            int hardTimeOut, BigInteger cookie, List<? extends MatchInfoBase>  listMatchInfoBase,
             List<InstructionInfo> listInstructionInfo, boolean isStrict) {
         FlowKey key = new FlowKey(new FlowId(flowId));
-        return new FlowBuilder().setMatch(buildMatches(listMatchInfo)).setKey(key)
+        return new FlowBuilder().setMatch(buildMatches(listMatchInfoBase)).setKey(key)
                 .setPriority(Integer.valueOf(priority)).setInstructions(buildInstructions(listInstructionInfo))
                 .setBarrier(false).setInstallHw(true).setHardTimeout(hardTimeOut).setIdleTimeout(idleTimeOut)
                 .setFlowName(flowName).setTableId(Short.valueOf(tableId)).setStrict(isStrict)
@@ -146,16 +146,16 @@ public class MDSALUtil {
     }
 
     public static Flow buildFlowNew(short tableId, String flowId, int priority, String flowName, int idleTimeOut,
-                                 int hardTimeOut, BigInteger cookie, List<MatchInfo> listMatchInfo, List<Instruction> listInstructionInfo) {
+                                 int hardTimeOut, BigInteger cookie, List<? extends MatchInfoBase>  listMatchInfoBase, List<Instruction> listInstructionInfo) {
         return MDSALUtil.buildFlowNew(tableId, flowId, priority, flowName, idleTimeOut, hardTimeOut, cookie,
-                listMatchInfo, listInstructionInfo, true);
+                listMatchInfoBase, listInstructionInfo, true);
     }
 
     private static Flow buildFlowNew(short tableId, String flowId, int priority, String flowName, int idleTimeOut,
-                                  int hardTimeOut, BigInteger cookie, List<MatchInfo> listMatchInfo,
+                                  int hardTimeOut, BigInteger cookie, List<? extends MatchInfoBase>  listMatchInfoBase,
                                   List<Instruction> listInstructionInfo, boolean isStrict) {
         FlowKey key = new FlowKey(new FlowId(flowId));
-        return new FlowBuilder().setMatch(buildMatches(listMatchInfo)).setKey(key)
+        return new FlowBuilder().setMatch(buildMatches(listMatchInfoBase)).setKey(key)
                 .setPriority(Integer.valueOf(priority)).setInstructions(new InstructionsBuilder().setInstruction(listInstructionInfo).build())
                 .setBarrier(false).setInstallHw(true).setHardTimeout(hardTimeOut).setIdleTimeout(idleTimeOut)
                 .setFlowName(flowName).setTableId(Short.valueOf(tableId)).setStrict(isStrict)
@@ -281,17 +281,17 @@ public class MDSALUtil {
         return EMPTY_Instructions;
     }
 
-    public static Match buildMatches(List<MatchInfo> listMatchInfo) {
-        if (listMatchInfo != null) {
+    public static Match buildMatches(List<? extends MatchInfoBase> listMatchInfoBase) {
+        if (listMatchInfoBase != null) {
             MatchBuilder matchBuilder = new MatchBuilder();
             Map<Class<?>, Object> mapMatchBuilder = new HashMap<Class<?>, Object>();
 
-            for (MatchInfo matchInfo : listMatchInfo) {
-                matchInfo.createInnerMatchBuilder(mapMatchBuilder);
+            for (MatchInfoBase MatchInfoBase : listMatchInfoBase) {
+                MatchInfoBase.createInnerMatchBuilder(mapMatchBuilder);
             }
 
-            for (MatchInfo matchInfo : listMatchInfo) {
-                matchInfo.setMatch(matchBuilder, mapMatchBuilder);
+            for (MatchInfoBase MatchInfoBase : listMatchInfoBase) {
+                MatchInfoBase.setMatch(matchBuilder, mapMatchBuilder);
             }
 
             return matchBuilder.build();