Create empty match only once
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / translator / FlowRemovedV10Translator.java
index b09b8fe13564d5388239f11dd3332ed5ee2d51f6..e5904310c5288618b29f0a8529834a91d5391fd0 100644 (file)
@@ -8,7 +8,7 @@
 
 package org.opendaylight.openflowplugin.impl.translator;
 
-import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
+import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
 import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchConvertorImpl;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
@@ -19,8 +19,20 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
  */
 public class FlowRemovedV10Translator extends FlowRemovedTranslator {
 
-    protected MatchBuilder translateMatch(FlowRemoved flowRemoved, DeviceContext deviceContext) {
+    @Override
+    protected MatchBuilder translateMatch(FlowRemoved flowRemoved, DeviceInfo deviceInfo) {
         return MatchConvertorImpl.fromOFMatchV10ToSALMatch(flowRemoved.getMatchV10(),
-                deviceContext.getDeviceState().getFeatures().getDatapathId(), OpenflowVersion.OF10);
+                deviceInfo.getDatapathId(), OpenflowVersion.OF10);
+    }
+
+    /**
+     * Always returns zero because OF10 FLOW_REMOVED doesn't contain table ID.
+     *
+     * @param flowRemoved  FLOW_REMOVED message.
+     * @return  Zero.
+     */
+    @Override
+    protected Short translateTableId(FlowRemoved flowRemoved) {
+        return Short.valueOf((short)0);
     }
 }