Merge "Add missing bundle converters"
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / statistics / services / FlowsInTableService.java
index c9f04eed90c78072f354ef0bc060a4f31fca8799..db676154cfd8cf846f7331f0537e6e377592ac49 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.openflowplugin.impl.statistics.services;
 
 import java.util.List;
+import java.util.Optional;
 import java.util.concurrent.atomic.AtomicLong;
 import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
@@ -18,7 +19,8 @@ import org.opendaylight.openflowplugin.impl.services.util.ServiceException;
 import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.AbstractCompatibleStatService;
 import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.FlowStatisticsToNotificationTransformer;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchReactor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchInjector;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdate;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableOutput;
@@ -35,6 +37,7 @@ public final class FlowsInTableService extends AbstractCompatibleStatService<Get
         GetFlowStatisticsFromFlowTableOutput, FlowsStatisticsUpdate> {
 
     private final ConvertorExecutor convertorExecutor;
+    private final VersionConvertorData data;
 
     public FlowsInTableService(final RequestContextStack requestContextStack,
                                final DeviceContext deviceContext,
@@ -42,6 +45,7 @@ public final class FlowsInTableService extends AbstractCompatibleStatService<Get
                                ConvertorExecutor convertorExecutor) {
         super(requestContextStack, deviceContext, compatibilityXidSeed);
         this.convertorExecutor = convertorExecutor;
+        this.data = new VersionConvertorData(getVersion());
     }
 
     @Override
@@ -81,13 +85,13 @@ public final class FlowsInTableService extends AbstractCompatibleStatService<Get
         }
 
         // convert and inject match
-        final short version = getVersion();
-        MatchReactor.getInstance().convert(input.getMatch(), version, mprFlowRequestBuilder, convertorExecutor);
+        final Optional<Object> conversionMatch = convertorExecutor.convert(input.getMatch(), data);
+        MatchInjector.inject(conversionMatch, mprFlowRequestBuilder, data.getVersion());
 
         // Set request body to main multipart request
         multipartRequestFlowCaseBuilder.setMultipartRequestFlow(mprFlowRequestBuilder.build());
         final MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(
-                MultipartType.OFPMPFLOW, xid.getValue(), version);
+                MultipartType.OFPMPFLOW, xid.getValue(), getVersion());
         mprInput.setMultipartRequestBody(multipartRequestFlowCaseBuilder.build());
 
         return mprInput.build();