X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=inline;f=openflowplugin-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fopenflowplugin%2Fimpl%2Fservices%2FMultipartRequestOnTheFlyCallback.java;h=9b1c0e729158ba831b4fe13ce4dcd379f13501fe;hb=9f8a5a168696e279ae49ed79efe4590abc49b9ba;hp=c00d092f96273335af1233e70141f3213a3a2ce5;hpb=52f1d136aff5568e9d9607e6a61e4ec128c962aa;p=openflowplugin.git diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/MultipartRequestOnTheFlyCallback.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/MultipartRequestOnTheFlyCallback.java index c00d092f96..9b1c0e7291 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/MultipartRequestOnTheFlyCallback.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/MultipartRequestOnTheFlyCallback.java @@ -12,8 +12,7 @@ import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import java.util.Collections; import java.util.List; - -import org.opendaylight.openflowplugin.api.openflow.device.DeviceState; +import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo; import org.opendaylight.openflowplugin.api.openflow.device.RequestContext; import org.opendaylight.openflowplugin.api.openflow.device.TxFacade; import org.opendaylight.openflowplugin.api.openflow.registry.flow.DeviceFlowRegistry; @@ -22,6 +21,7 @@ import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.Messa import org.opendaylight.openflowplugin.impl.statistics.SinglePurposeMultipartReplyTranslator; import org.opendaylight.openflowplugin.impl.statistics.StatisticsGatheringUtils; import org.opendaylight.openflowplugin.impl.statistics.ofpspecific.EventsTimeCounter; +import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdate; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply; @@ -35,8 +35,8 @@ import org.slf4j.LoggerFactory; final class MultipartRequestOnTheFlyCallback extends AbstractRequestCallback> { private static final Logger LOG = LoggerFactory.getLogger(MultipartRequestOnTheFlyCallback.class); - private static final SinglePurposeMultipartReplyTranslator MULTIPART_REPLY_TRANSLATOR = new SinglePurposeMultipartReplyTranslator(); - private final DeviceState deviceState; + private final SinglePurposeMultipartReplyTranslator multipartReplyTranslator; + private final DeviceInfo deviceInfo; private final DeviceFlowRegistry registry; private boolean virgin = true; private boolean finished = false; @@ -48,17 +48,20 @@ final class MultipartRequestOnTheFlyCallback extends AbstractRequestCallback requestType, final MessageSpy messageSpy, final EventIdentifier eventIdentifier, - final DeviceState deviceState, + final DeviceInfo deviceInfo, final DeviceFlowRegistry registry, - final TxFacade txFacade) { + final TxFacade txFacade, + final ConvertorExecutor convertorExecutor) { super(context, requestType, messageSpy, eventIdentifier); - this.deviceState = deviceState; + this.deviceInfo = deviceInfo; this.registry = registry; this.txFacade = txFacade; + multipartReplyTranslator = new SinglePurposeMultipartReplyTranslator(convertorExecutor); + //TODO: this is focused on flow stats only - need more general approach if used for more than flow stats - doneEventIdentifier = new EventIdentifier(MultipartType.OFPMPFLOW.name(), deviceState.getNodeId().toString()); + doneEventIdentifier = new EventIdentifier(MultipartType.OFPMPFLOW.name(), deviceInfo.getNodeId().toString()); } public EventIdentifier getDoneEventIdentifier() { @@ -89,14 +92,14 @@ final class MultipartRequestOnTheFlyCallback extends AbstractRequestCallback multipartDataList = MULTIPART_REPLY_TRANSLATOR.translate( - deviceState.getFeatures().getDatapathId(), deviceState.getFeatures().getVersion(), singleReply); + final List multipartDataList = multipartReplyTranslator.translate( + deviceInfo.getDatapathId(), deviceInfo.getVersion(), singleReply); final Iterable allMultipartData = multipartDataList; //TODO: following part is focused on flow stats only - need more general approach if used for more than flow stats ListenableFuture future; if (virgin) { - future = StatisticsGatheringUtils.deleteAllKnownFlows(deviceState, registry, txFacade); + future = StatisticsGatheringUtils.deleteAllKnownFlows(deviceInfo, registry, txFacade); virgin = false; } else { future = Futures.immediateFuture(null); @@ -107,7 +110,7 @@ final class MultipartRequestOnTheFlyCallback extends AbstractRequestCallback) allMultipartData, - deviceState, registry, txFacade); + deviceInfo, registry, txFacade); if (!multipartReply.getFlags().isOFPMPFREQMORE()) { endCollecting(); @@ -123,8 +126,8 @@ final class MultipartRequestOnTheFlyCallback extends AbstractRequestCallback> rpcResult = RpcResultBuilder.success(Collections.emptyList()).build(); spyMessage(MessageSpy.STATISTIC_GROUP.FROM_SWITCH_TRANSLATE_OUT_SUCCESS); - setResult(rpcResult); txFacade.submitTransaction(); + setResult(rpcResult); finished = true; } }