DataCrate created unnecessary code and in light of newest OFJ changes became obsolete.
All we need to have when handling rpc call is request context.
Change-Id: Iff565c48af6634c9000a2b09057997b81cbb062b
Signed-off-by: Martin Bobak <mbobak@cisco.com>
return primaryConnectionAdapter;
}
- /**
- * @param connectionID connection identifier
- * @param function data sender
- * @param <T> rpc result backend type
- * @param <F> final rpc backend type
- * @return
- */
- public <T, F> ListenableFuture<RpcResult<T>> handleServiceCall(final BigInteger connectionID,
- final Function<DataCrate<T>, ListenableFuture<RpcResult<F>>> function) {
- DataCrateBuilder<T> dataCrateBuilder = DataCrateBuilder.<T>builder();
- return handleServiceCall(function, dataCrateBuilder);
- }
-
- public <T, F> ListenableFuture<RpcResult<T>> handleServiceCall(final Function<DataCrate<T>, ListenableFuture<RpcResult<F>>> function) {
- DataCrateBuilder<T> dataCrateBuilder = DataCrateBuilder.<T>builder();
- return handleServiceCall(function, dataCrateBuilder);
- }
/**
* @param <T>
* @param <F>
* @param function
- * @param dataCrateBuilder predefined data
* @return
*/
- public final <T, F> ListenableFuture<RpcResult<T>> handleServiceCall(final Function<DataCrate<T>, ListenableFuture<RpcResult<F>>> function,
- final DataCrateBuilder<T> dataCrateBuilder) {
+ public final <T, F> ListenableFuture<RpcResult<T>> handleServiceCall(final Function<RequestContext<T>, ListenableFuture<RpcResult<F>>> function) {
LOG.trace("Handling general service call");
final RequestContext<T> requestContext = createRequestContext();
}
final Xid xid = new Xid(reservedXid);
requestContext.setXid(xid);
- DataCrate<T> dataCrate = dataCrateBuilder.setRequestContext(requestContext)
- .build();
final ListenableFuture<RpcResult<F>> resultFromOFLib;
LOG.trace("Hooking xid {} to device context - precaution.", requestContext.getXid().getValue());
deviceContext.hookRequestCtx(xid, requestContext);
messageSpy.spyMessage(requestContext.getClass(), MessageSpy.STATISTIC_GROUP.TO_SWITCH_READY_FOR_SUBMIT);
- function.apply(dataCrate);
+ function.apply(requestContext);
return requestContext.getFuture();
+++ /dev/null
-/**
- * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.openflowplugin.impl.services;
-
-import java.math.BigInteger;
-import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInputBuilder;
-
-public final class DataCrate<T> {
- private final BigInteger iDConnection;
- private final RequestContext<T> requestContext;
- private final FlowModInputBuilder flowModInputBuilder;
-
- public DataCrate(final DataCrateBuilder<T> builder) {
- iDConnection = builder.iDConnection;
- flowModInputBuilder = builder.flowModInputBuilder;
- requestContext = builder.requestContext;
- }
-
- public FlowModInputBuilder getFlowModInputBuilder() {
- return flowModInputBuilder;
- }
-
- public BigInteger getiDConnection() {
- return iDConnection;
- }
-
- public RequestContext<T> getRequestContext() {
- return requestContext;
- }
-}
+++ /dev/null
-/**
- * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.openflowplugin.impl.services;
-
-import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
-import java.math.BigInteger;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInputBuilder;
-
-public class DataCrateBuilder<T> {
- BigInteger iDConnection;
- RequestContext<T> requestContext;
- FlowModInputBuilder flowModInputBuilder;
-
- public DataCrateBuilder() {
- }
-
- public DataCrateBuilder<T> setFlowModInputBuilder(final FlowModInputBuilder flowModInputBuilder) {
- this.flowModInputBuilder = flowModInputBuilder;
- return this;
- }
-
- public DataCrateBuilder<T> setiDConnection(final BigInteger iDConnection) {
- this.iDConnection = iDConnection;
- return this;
- }
-
- public DataCrateBuilder<T> setRequestContext(final RequestContext<T> requestContext) {
- this.requestContext = requestContext;
- return this;
- }
-
- public static <T> DataCrateBuilder<T> builder() {
- return new DataCrateBuilder<>();
- }
-
- public DataCrate<T> build() {
- return new DataCrate<>(this);
- }
-
-
-
-}
import java.util.concurrent.Future;
import org.opendaylight.openflowjava.protocol.api.connection.OutboundQueue;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
+import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy;
public Future<RpcResult<Void>> transmitPacket(final TransmitPacketInput input) {
getMessageSpy().spyMessage(input.getImplementedInterface(), MessageSpy.STATISTIC_GROUP.TO_SWITCH_ENTERED);
- return handleServiceCall(new Function<DataCrate<Void>, ListenableFuture<RpcResult<Void>>>() {
+ return handleServiceCall(new Function<RequestContext<Void>, ListenableFuture<RpcResult<Void>>>() {
@Override
- public ListenableFuture<RpcResult<Void>> apply(final DataCrate<Void> data) {
- final Xid xid = data.getRequestContext().getXid();
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<Void> requestContext) {
+ final Xid xid = requestContext.getXid();
final PacketOutInput message = PacketOutConvertor.toPacketOutInput(input, getVersion(), xid.getValue(),
getDatapathId());
import java.util.concurrent.Future;
import org.opendaylight.openflowjava.protocol.api.connection.OutboundQueue;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
+import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.registry.flow.DeviceFlowRegistry;
import org.opendaylight.openflowplugin.api.openflow.registry.flow.FlowDescriptor;
@Override
public Future<RpcResult<RemoveFlowOutput>> removeFlow(final RemoveFlowInput input) {
LOG.trace("Calling remove flow for flow with ID ={}.", input.getFlowRef());
- return this.<RemoveFlowOutput, Void>handleServiceCall(new Function<DataCrate<RemoveFlowOutput>, ListenableFuture<RpcResult<Void>>>() {
+ return this.<RemoveFlowOutput, Void>handleServiceCall(new Function<RequestContext<RemoveFlowOutput>, ListenableFuture<RpcResult<Void>>>() {
@Override
- public ListenableFuture<RpcResult<Void>> apply(final DataCrate<RemoveFlowOutput> data) {
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<RemoveFlowOutput> requestContext) {
final FlowModInputBuilder ofFlowModInput = FlowConvertor.toFlowModInput(input, getVersion(),
getDatapathId());
- final ListenableFuture<RpcResult<Void>> future = createResultForFlowMod(data, ofFlowModInput);
+ final ListenableFuture<RpcResult<Void>> future = createResultForFlowMod(requestContext, ofFlowModInput);
Futures.addCallback(future, new FutureCallback() {
@Override
public void onSuccess(final Object o) {
final List<ListenableFuture<RpcResult<T>>> partialFutures = new ArrayList<>();
- for (FlowModInputBuilder flowModInputBuilder : ofFlowModInputs) {
- DataCrateBuilder<T> dataCrateBuilder = DataCrateBuilder.<T>builder().setFlowModInputBuilder(flowModInputBuilder);
+ for (final FlowModInputBuilder flowModInputBuilder : ofFlowModInputs) {
ListenableFuture<RpcResult<T>> partialFuture = handleServiceCall(
- new Function<DataCrate<T>, ListenableFuture<RpcResult<Void>>>() {
+ new Function<RequestContext<T>, ListenableFuture<RpcResult<Void>>>() {
@Override
- public ListenableFuture<RpcResult<Void>> apply(final DataCrate<T> data) {
- return createResultForFlowMod(data);
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<T> requestContext) {
+ return createResultForFlowMod(requestContext, flowModInputBuilder);
}
- },
- dataCrateBuilder
- );
+ });
partialFutures.add(partialFuture);
}
return finalFuture;
}
- protected <T> ListenableFuture<RpcResult<Void>> createResultForFlowMod(final DataCrate<T> data) {
- return createResultForFlowMod(data, data.getFlowModInputBuilder());
- }
-
- protected <T> ListenableFuture<RpcResult<Void>> createResultForFlowMod(final DataCrate<T> data, final FlowModInputBuilder flowModInputBuilder) {
+ protected <T> ListenableFuture<RpcResult<Void>> createResultForFlowMod(final RequestContext<T> requestContext, final FlowModInputBuilder flowModInputBuilder) {
final OutboundQueue outboundQueue = getDeviceContext().getPrimaryConnectionContext().getOutboundQueueProvider();
- final long xid = data.getRequestContext().getXid().getValue();
+ final long xid = requestContext.getXid().getValue();
flowModInputBuilder.setXid(xid);
final FlowModInput flowModInput = flowModInputBuilder.build();
outboundQueue.commitEntry(xid, flowModInput, new FutureCallback<OfHeader>() {
@Override
public void onSuccess(final OfHeader ofHeader) {
- RequestContextUtil.closeRequstContext(data.getRequestContext());
- getDeviceContext().unhookRequestCtx(data.getRequestContext().getXid());
+ RequestContextUtil.closeRequstContext(requestContext);
+ getDeviceContext().unhookRequestCtx(requestContext.getXid());
getMessageSpy().spyMessage(FlowModInput.class, MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMIT_SUCCESS);
settableFuture.set(RpcResultBuilder.<Void>success().build());
@Override
public void onFailure(final Throwable throwable) {
RpcResultBuilder rpcResultBuilder = RpcResultBuilder.<Void>failed().withError(ErrorType.APPLICATION, throwable.getMessage(), throwable);
- RequestContextUtil.closeRequstContext(data.getRequestContext());
- getDeviceContext().unhookRequestCtx(data.getRequestContext().getXid());
+ RequestContextUtil.closeRequstContext(requestContext);
+ getDeviceContext().unhookRequestCtx(requestContext.getXid());
settableFuture.set(rpcResultBuilder.build());
}
});
package org.opendaylight.openflowplugin.impl.services;
import com.google.common.base.Function;
+import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.JdkFutureAdapters;
import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.SettableFuture;
import java.util.concurrent.Future;
+import org.opendaylight.openflowjava.protocol.api.connection.OutboundQueue;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
+import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.Group;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GroupModInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
+import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
public class SalGroupServiceImpl extends CommonService implements SalGroupService {
@Override
public Future<RpcResult<AddGroupOutput>> addGroup(final AddGroupInput input) {
getDeviceContext().getDeviceGroupRegistry().store(input.getGroupId());
- return this.<AddGroupOutput, Void>handleServiceCall(getPrimaryConnection(),
- new Function<DataCrate<AddGroupOutput>, ListenableFuture<RpcResult<Void>>>() {
-
+ return this.<AddGroupOutput, Void>handleServiceCall(new Function<RequestContext<AddGroupOutput>, ListenableFuture<RpcResult<Void>>>() {
@Override
- public ListenableFuture<RpcResult<Void>> apply(final DataCrate<AddGroupOutput> data) {
- return convertAndSend(input, data);
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<AddGroupOutput> requestContext) {
+ return convertAndSend(input, requestContext);
}
});
}
@Override
public Future<RpcResult<UpdateGroupOutput>> updateGroup(final UpdateGroupInput input) {
- return this.<UpdateGroupOutput, Void>handleServiceCall(getPrimaryConnection(),
- new Function<DataCrate<UpdateGroupOutput>, ListenableFuture<RpcResult<Void>>>() {
+ return this.<UpdateGroupOutput, Void>handleServiceCall(new Function<RequestContext<UpdateGroupOutput>, ListenableFuture<RpcResult<Void>>>() {
@Override
- public ListenableFuture<RpcResult<Void>> apply(final DataCrate<UpdateGroupOutput> data) {
- return convertAndSend(input.getUpdatedGroup(), data);
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<UpdateGroupOutput> requestContext) {
+ return convertAndSend(input.getUpdatedGroup(), requestContext);
}
});
}
@Override
public Future<RpcResult<RemoveGroupOutput>> removeGroup(final RemoveGroupInput input) {
getDeviceContext().getDeviceGroupRegistry().markToBeremoved(input.getGroupId());
- return this.<RemoveGroupOutput, Void>handleServiceCall(getPrimaryConnection(),
- new Function<DataCrate<RemoveGroupOutput>, ListenableFuture<RpcResult<Void>>>() {
+ return this.<RemoveGroupOutput, Void>handleServiceCall(new Function<RequestContext<RemoveGroupOutput>, ListenableFuture<RpcResult<Void>>>() {
@Override
- public ListenableFuture<RpcResult<Void>> apply(final DataCrate<RemoveGroupOutput> data) {
- return convertAndSend(input, data);
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<RemoveGroupOutput> requestContext) {
+ return convertAndSend(input, requestContext);
}
});
}
- <T> ListenableFuture<RpcResult<Void>> convertAndSend(final Group iputGroup, final DataCrate<T> data) {
+ <T> ListenableFuture<RpcResult<Void>> convertAndSend(final Group iputGroup, final RequestContext<T> requestContext) {
+ final OutboundQueue outboundQueue = getDeviceContext().getPrimaryConnectionContext().getOutboundQueueProvider();
getMessageSpy().spyMessage(iputGroup.getImplementedInterface(), MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMIT_SUCCESS);
final GroupModInputBuilder ofGroupModInput = GroupConvertor.toGroupModInput(iputGroup, getVersion(), getDatapathId());
- final Xid xid = data.getRequestContext().getXid();
+ final Xid xid = requestContext.getXid();
ofGroupModInput.setXid(xid.getValue());
- return JdkFutureAdapters.listenInPoolThread(provideConnectionAdapter(data.getiDConnection()).groupMod(ofGroupModInput.build()));
+ final SettableFuture<RpcResult<Void>> settableFuture = SettableFuture.create();
+ outboundQueue.commitEntry(xid.getValue(), ofGroupModInput.build(), new FutureCallback<OfHeader>() {
+ @Override
+ public void onSuccess(final OfHeader ofHeader) {
+ RequestContextUtil.closeRequstContext(requestContext);
+ getDeviceContext().unhookRequestCtx(requestContext.getXid());
+ getMessageSpy().spyMessage(FlowModInput.class, MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMIT_SUCCESS);
+
+ settableFuture.set(RpcResultBuilder.<Void>success().build());
+ }
+
+ @Override
+ public void onFailure(final Throwable throwable) {
+ RpcResultBuilder rpcResultBuilder = RpcResultBuilder.<Void>failed().withError(RpcError.ErrorType.APPLICATION, throwable.getMessage(), throwable);
+ RequestContextUtil.closeRequstContext(requestContext);
+ getDeviceContext().unhookRequestCtx(requestContext.getXid());
+ settableFuture.set(rpcResultBuilder.build());
+ }
+ });
+ return settableFuture;
}
}
package org.opendaylight.openflowplugin.impl.services;
import com.google.common.base.Function;
-import com.google.common.util.concurrent.JdkFutureAdapters;
+import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.SettableFuture;
import java.util.concurrent.Future;
+import org.opendaylight.openflowjava.protocol.api.connection.OutboundQueue;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
+import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.Meter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MeterModInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
+import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
public class SalMeterServiceImpl extends CommonService implements SalMeterService {
@Override
public Future<RpcResult<AddMeterOutput>> addMeter(final AddMeterInput input) {
getDeviceContext().getDeviceMeterRegistry().store(input.getMeterId());
- return this.<AddMeterOutput, Void>handleServiceCall( getPrimaryConnection(),
- new Function<DataCrate<AddMeterOutput>,ListenableFuture<RpcResult<Void>>>() {
- @Override
- public ListenableFuture<RpcResult<Void>> apply(final DataCrate<AddMeterOutput> data) {
- return convertAndSend(input, data);
- }
- });
+ return this.<AddMeterOutput, Void>handleServiceCall(new Function<RequestContext<AddMeterOutput>, ListenableFuture<RpcResult<Void>>>() {
+ @Override
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<AddMeterOutput> requestContext) {
+ return convertAndSend(input, requestContext);
+ }
+ });
}
@Override
public Future<RpcResult<UpdateMeterOutput>> updateMeter(final UpdateMeterInput input) {
- return this.<UpdateMeterOutput, Void>handleServiceCall( getPrimaryConnection(),
- new Function<DataCrate<UpdateMeterOutput>,ListenableFuture<RpcResult<Void>>>() {
- @Override
- public ListenableFuture<RpcResult<Void>> apply(final DataCrate<UpdateMeterOutput> data) {
- return convertAndSend(input.getUpdatedMeter(), data);
- }
- });
+ return this.<UpdateMeterOutput, Void>handleServiceCall(new Function<RequestContext<UpdateMeterOutput>, ListenableFuture<RpcResult<Void>>>() {
+ @Override
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<UpdateMeterOutput> requestContext) {
+ return convertAndSend(input.getUpdatedMeter(), requestContext);
+ }
+ });
}
@Override
public Future<RpcResult<RemoveMeterOutput>> removeMeter(final RemoveMeterInput input) {
getDeviceContext().getDeviceMeterRegistry().markToBeremoved(input.getMeterId());
- return this.<RemoveMeterOutput, Void>handleServiceCall( getPrimaryConnection(),
- new Function<DataCrate<RemoveMeterOutput>,ListenableFuture<RpcResult<Void>>>() {
- @Override
- public ListenableFuture<RpcResult<Void>> apply(final DataCrate<RemoveMeterOutput> data) {
- return convertAndSend(input, data);
- }
- });
+ return this.<RemoveMeterOutput, Void>handleServiceCall(new Function<RequestContext<RemoveMeterOutput>, ListenableFuture<RpcResult<Void>>>() {
+ @Override
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<RemoveMeterOutput> requestContext) {
+ return convertAndSend(input, requestContext);
+ }
+ });
}
- <T> ListenableFuture<RpcResult<Void>> convertAndSend(final Meter iputMeter, final DataCrate<T> data) {
+ <T> ListenableFuture<RpcResult<Void>> convertAndSend(final Meter iputMeter, final RequestContext<T> requestContext) {
getMessageSpy().spyMessage(iputMeter.getImplementedInterface(), MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMIT_SUCCESS);
+ final OutboundQueue outboundQueue = getDeviceContext().getPrimaryConnectionContext().getOutboundQueueProvider();
final MeterModInputBuilder ofMeterModInput = MeterConvertor.toMeterModInput(iputMeter, getVersion());
- final Xid xid = data.getRequestContext().getXid();
+ final Xid xid = requestContext.getXid();
ofMeterModInput.setXid(xid.getValue());
- return JdkFutureAdapters.listenInPoolThread(provideConnectionAdapter(data.getiDConnection()).meterMod(ofMeterModInput.build()));
+ final SettableFuture<RpcResult<Void>> settableFuture = SettableFuture.create();
+ outboundQueue.commitEntry(xid.getValue(), ofMeterModInput.build(), new FutureCallback<OfHeader>() {
+ @Override
+ public void onSuccess(final OfHeader ofHeader) {
+ RequestContextUtil.closeRequstContext(requestContext);
+ getDeviceContext().unhookRequestCtx(requestContext.getXid());
+ getMessageSpy().spyMessage(FlowModInput.class, MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMIT_SUCCESS);
+
+ settableFuture.set(RpcResultBuilder.<Void>success().build());
+ }
+
+ @Override
+ public void onFailure(final Throwable throwable) {
+ RpcResultBuilder rpcResultBuilder = RpcResultBuilder.<Void>failed().withError(RpcError.ErrorType.APPLICATION, throwable.getMessage(), throwable);
+ RequestContextUtil.closeRequstContext(requestContext);
+ getDeviceContext().unhookRequestCtx(requestContext.getXid());
+ settableFuture.set(rpcResultBuilder.build());
+ }
+ });
+ return settableFuture;
}
}
package org.opendaylight.openflowplugin.impl.services;
import com.google.common.base.Function;
-import com.google.common.util.concurrent.JdkFutureAdapters;
+import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.SettableFuture;
import java.util.concurrent.Future;
+import org.opendaylight.openflowjava.protocol.api.connection.OutboundQueue;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
+import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.PortConvertor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.Port;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.SalPortService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortOutput;
+import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
public class SalPortServiceImpl extends CommonService implements SalPortService {
@Override
public Future<RpcResult<UpdatePortOutput>> updatePort(final UpdatePortInput input) {
- return this.<UpdatePortOutput, Void> handleServiceCall(new Function<DataCrate<UpdatePortOutput>, ListenableFuture<RpcResult<Void>>>() {
+ return this.<UpdatePortOutput, Void>handleServiceCall(new Function<RequestContext<UpdatePortOutput>, ListenableFuture<RpcResult<Void>>>() {
+ @Override
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<UpdatePortOutput> requestContext) {
+ getMessageSpy().spyMessage(input.getImplementedInterface(), MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMIT_SUCCESS);
+
+ final Port inputPort = input.getUpdatedPort().getPort().getPort().get(0);
+ final PortModInput ofPortModInput = PortConvertor.toPortModInput(inputPort, getVersion());
+ final PortModInputBuilder mdInput = new PortModInputBuilder(ofPortModInput);
+ final Xid xid = requestContext.getXid();
+ final OutboundQueue outboundQueue = getDeviceContext().getPrimaryConnectionContext().getOutboundQueueProvider();
+
+ mdInput.setXid(xid.getValue());
+ final SettableFuture<RpcResult<Void>> settableFuture = SettableFuture.create();
+ outboundQueue.commitEntry(xid.getValue(), mdInput.build(), new FutureCallback<OfHeader>() {
+ @Override
+ public void onSuccess(final OfHeader ofHeader) {
+ RequestContextUtil.closeRequstContext(requestContext);
+ getDeviceContext().unhookRequestCtx(requestContext.getXid());
+ getMessageSpy().spyMessage(FlowModInput.class, MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMIT_SUCCESS);
+
+ settableFuture.set(RpcResultBuilder.<Void>success().build());
+ }
+
@Override
- public ListenableFuture<RpcResult<Void>> apply(final DataCrate<UpdatePortOutput> data) {
- getMessageSpy().spyMessage(input.getImplementedInterface(), MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMIT_SUCCESS);
-
- final Port inputPort = input.getUpdatedPort().getPort().getPort().get(0);
- final PortModInput ofPortModInput = PortConvertor.toPortModInput(inputPort, getVersion());
- final PortModInputBuilder mdInput = new PortModInputBuilder(ofPortModInput);
- final Xid xid = data.getRequestContext().getXid();
- mdInput.setXid(xid.getValue());
- return JdkFutureAdapters.listenInPoolThread(provideConnectionAdapter(data.getiDConnection()).portMod(mdInput.build()));
+ public void onFailure(final Throwable throwable) {
+ RpcResultBuilder rpcResultBuilder = RpcResultBuilder.<Void>failed().withError(RpcError.ErrorType.APPLICATION, throwable.getMessage(), throwable);
+ RequestContextUtil.closeRequstContext(requestContext);
+ getDeviceContext().unhookRequestCtx(requestContext.getXid());
+ settableFuture.set(rpcResultBuilder.build());
}
});
+ return settableFuture;
+ }
+ });
}
}
import java.util.List;
import java.util.concurrent.Future;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.openflowjava.protocol.api.connection.OutboundQueue;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
+import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
+import org.opendaylight.openflowplugin.api.openflow.device.handlers.MultiMsgCollector;
import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.TableFeaturesConvertor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.TableFeaturesReplyConvertor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.MultipartReplyBody;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyTableFeaturesCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table.features._case.MultipartReplyTableFeatures;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeaturesKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
@Override
public Future<RpcResult<UpdateTableOutput>> updateTable(final UpdateTableInput input) {
class FunctionImpl implements
- Function<DataCrate<List<MultipartReply>>, ListenableFuture<RpcResult<List<MultipartReply>>>> {
+ Function<RequestContext<List<MultipartReply>>, ListenableFuture<RpcResult<Void>>> {
@Override
- public ListenableFuture<RpcResult<List<MultipartReply>>> apply(final DataCrate<List<MultipartReply>> data) {
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<List<MultipartReply>> requestContext) {
getMessageSpy().spyMessage(input.getImplementedInterface(),
MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMIT_SUCCESS);
caseBuilder.setMultipartRequestTableFeatures(requestBuilder.build());
// Set request body to main multipart request
- final Xid xid = data.getRequestContext().getXid();
+ final Xid xid = requestContext.getXid();
getDeviceContext().getMultiMsgCollector().registerMultipartXid(xid.getValue());
final MultipartRequestInputBuilder mprInput = createMultipartHeader(MultipartType.OFPMPTABLEFEATURES,
xid.getValue());
mprInput.setMultipartRequestBody(caseBuilder.build());
+ final OutboundQueue outboundQueue = getDeviceContext().getPrimaryConnectionContext().getOutboundQueueProvider();
+
+ final SettableFuture<RpcResult<Void>> settableFuture = SettableFuture.create();
+ final MultiMsgCollector multiMsgCollector = getDeviceContext().getMultiMsgCollector();
+ multiMsgCollector.registerMultipartXid(xid.getValue());
+
+ outboundQueue.commitEntry(xid.getValue(), mprInput.build(), new FutureCallback<OfHeader>() {
+ @Override
+ public void onSuccess(final OfHeader ofHeader) {
+ if (ofHeader instanceof MultipartReply) {
+ MultipartReply multipartReply = (MultipartReply) ofHeader;
+ multiMsgCollector.addMultipartMsg(multipartReply);
+ } else {
+ if (null != ofHeader) {
+ LOG.info("Unexpected response type received {}.", ofHeader.getClass());
+ } else {
+ LOG.info("Response received is null.");
+ }
+ }
+ getMessageSpy().spyMessage(FlowModInput.class, MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMIT_SUCCESS);
+ settableFuture.set(RpcResultBuilder.<Void>success().build());
+ }
- final Future<RpcResult<Void>> resultFromOFLib = getPrimaryConnectionAdapter()
- .multipartRequest(mprInput.build());
- final ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters
- .listenInPoolThread(resultFromOFLib);
-
- return result;
+ @Override
+ public void onFailure(final Throwable throwable) {
+ RpcResultBuilder rpcResultBuilder = RpcResultBuilder.<Void>failed().withError(RpcError.ErrorType.APPLICATION, throwable.getMessage(), throwable);
+ RequestContextUtil.closeRequstContext(requestContext);
+ getDeviceContext().unhookRequestCtx(requestContext.getXid());
+ settableFuture.set(rpcResultBuilder.build());
+ }
+ });
+ return settableFuture;
}
}
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
import org.opendaylight.openflowplugin.api.openflow.md.core.TranslatorKey;
import org.opendaylight.openflowplugin.impl.services.CommonService;
-import org.opendaylight.openflowplugin.impl.services.DataCrate;
import org.opendaylight.openflowplugin.impl.services.OFJResult2RequestCtxFuture;
import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchReactor;
return this.<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput, Void>handleServiceCall(
- new Function<DataCrate<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>, ListenableFuture<RpcResult<Void>>>() {
+ new Function<RequestContext<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>, ListenableFuture<RpcResult<Void>>>() {
@Override
- public ListenableFuture<RpcResult<Void>> apply(final DataCrate<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput> data) {
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput> requestContext) {
// Create multipart request body for fetch all the group stats
final MultipartRequestAggregateCaseBuilder multipartRequestAggregateCaseBuilder = new MultipartRequestAggregateCaseBuilder();
// Set request body to main multipart request
multipartRequestAggregateCaseBuilder.setMultipartRequestAggregate(mprAggregateRequestBuilder
.build());
- final Xid xid = data.getRequestContext().getXid();
+ final Xid xid = requestContext.getXid();
final MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(
MultipartType.OFPMPAGGREGATE, xid.getValue(), version);
ListenableFuture<RpcResult<List<MultipartReply>>> rpcResultListenableFuture = handleServiceCall(
- new Function<DataCrate<List<MultipartReply>>, ListenableFuture<RpcResult<Void>>>() {
+ new Function<RequestContext<List<MultipartReply>>, ListenableFuture<RpcResult<Void>>>() {
@Override
- public ListenableFuture<RpcResult<Void>> apply(final DataCrate<List<MultipartReply>> data) {
- final Xid xid = data.getRequestContext().getXid();
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<List<MultipartReply>> requestContext) {
+ final Xid xid = requestContext.getXid();
final DeviceContext deviceContext = getDeviceContext();
deviceContext.getMultiMsgCollector().registerMultipartXid(xid.getValue());
final MultipartRequestAggregateCaseBuilder multipartRequestAggregateCaseBuilder = new MultipartRequestAggregateCaseBuilder();
public Future<RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> getAllFlowStatisticsFromFlowTable(
final GetAllFlowStatisticsFromFlowTableInput input) {
- return this.<GetAllFlowStatisticsFromFlowTableOutput, Void>handleServiceCall(new Function<DataCrate<GetAllFlowStatisticsFromFlowTableOutput>, ListenableFuture<RpcResult<Void>>>() {
+ return this.<GetAllFlowStatisticsFromFlowTableOutput, Void>handleServiceCall(new Function<RequestContext<GetAllFlowStatisticsFromFlowTableOutput>, ListenableFuture<RpcResult<Void>>>() {
- @Override
- public ListenableFuture<RpcResult<Void>> apply(final DataCrate<GetAllFlowStatisticsFromFlowTableOutput> data) {
+ @Override
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<GetAllFlowStatisticsFromFlowTableOutput> requestContext) {
- final MultipartRequestFlowBuilder mprFlowRequestBuilder = new MultipartRequestFlowBuilder();
- mprFlowRequestBuilder.setTableId(input.getTableId().getValue());
- mprFlowRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
- mprFlowRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
- mprFlowRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
- mprFlowRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
+ final MultipartRequestFlowBuilder mprFlowRequestBuilder = new MultipartRequestFlowBuilder();
+ mprFlowRequestBuilder.setTableId(input.getTableId().getValue());
+ mprFlowRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
+ mprFlowRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
+ mprFlowRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
+ mprFlowRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
- final short version = getVersion();
- FlowCreatorUtil.setWildcardedFlowMatch(version, mprFlowRequestBuilder);
+ final short version = getVersion();
+ FlowCreatorUtil.setWildcardedFlowMatch(version, mprFlowRequestBuilder);
- final MultipartRequestFlowCaseBuilder multipartRequestFlowCaseBuilder = new MultipartRequestFlowCaseBuilder();
- multipartRequestFlowCaseBuilder.setMultipartRequestFlow(mprFlowRequestBuilder.build());
+ final MultipartRequestFlowCaseBuilder multipartRequestFlowCaseBuilder = new MultipartRequestFlowCaseBuilder();
+ multipartRequestFlowCaseBuilder.setMultipartRequestFlow(mprFlowRequestBuilder.build());
- final Xid xid = data.getRequestContext().getXid();
- final MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(
- MultipartType.OFPMPFLOW, xid.getValue(), version);
+ final Xid xid = requestContext.getXid();
+ final MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(
+ MultipartType.OFPMPFLOW, xid.getValue(), version);
- mprInput.setMultipartRequestBody(multipartRequestFlowCaseBuilder.build());
- final Future<RpcResult<Void>> resultFromOFLib = getDeviceContext().getPrimaryConnectionContext()
- .getConnectionAdapter().multipartRequest(mprInput.build());
- return JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
- }
- });
+ mprInput.setMultipartRequestBody(multipartRequestFlowCaseBuilder.build());
+ final Future<RpcResult<Void>> resultFromOFLib = getDeviceContext().getPrimaryConnectionContext()
+ .getConnectionAdapter().multipartRequest(mprInput.build());
+ return JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+ }
+ });
}
@Override
final GetAllFlowsStatisticsFromAllFlowTablesInput input) {
- return this.<GetAllFlowsStatisticsFromAllFlowTablesOutput, Void>handleServiceCall(new Function<DataCrate<GetAllFlowsStatisticsFromAllFlowTablesOutput>, ListenableFuture<RpcResult<Void>>>() {
-
- @Override
- public ListenableFuture<RpcResult<Void>> apply(final DataCrate<GetAllFlowsStatisticsFromAllFlowTablesOutput> data) {
-
- final MultipartRequestFlowCaseBuilder multipartRequestFlowCaseBuilder = new MultipartRequestFlowCaseBuilder();
- final MultipartRequestFlowBuilder mprFlowRequestBuilder = new MultipartRequestFlowBuilder();
- mprFlowRequestBuilder.setTableId(OFConstants.OFPTT_ALL);
- mprFlowRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
- mprFlowRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
- mprFlowRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
- mprFlowRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
- final short version = getVersion();
- FlowCreatorUtil.setWildcardedFlowMatch(version, mprFlowRequestBuilder);
-
- final Xid xid = data.getRequestContext().getXid();
- final MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(
- MultipartType.OFPMPFLOW, xid.getValue(), version);
+ return this.<GetAllFlowsStatisticsFromAllFlowTablesOutput, Void>handleServiceCall(new Function<RequestContext<GetAllFlowsStatisticsFromAllFlowTablesOutput>, ListenableFuture<RpcResult<Void>>>() {
- multipartRequestFlowCaseBuilder.setMultipartRequestFlow(mprFlowRequestBuilder.build());
- mprInput.setMultipartRequestBody(multipartRequestFlowCaseBuilder.build());
- final Future<RpcResult<Void>> resultFromOFLib = getDeviceContext().getPrimaryConnectionContext()
- .getConnectionAdapter().multipartRequest(mprInput.build());
- return JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
- }
- });
+ @Override
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<GetAllFlowsStatisticsFromAllFlowTablesOutput> requestContext) {
+
+ final MultipartRequestFlowCaseBuilder multipartRequestFlowCaseBuilder = new MultipartRequestFlowCaseBuilder();
+ final MultipartRequestFlowBuilder mprFlowRequestBuilder = new MultipartRequestFlowBuilder();
+ mprFlowRequestBuilder.setTableId(OFConstants.OFPTT_ALL);
+ mprFlowRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
+ mprFlowRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
+ mprFlowRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
+ mprFlowRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
+ final short version = getVersion();
+ FlowCreatorUtil.setWildcardedFlowMatch(version, mprFlowRequestBuilder);
+
+ final Xid xid = requestContext.getXid();
+ final MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(
+ MultipartType.OFPMPFLOW, xid.getValue(), version);
+
+ multipartRequestFlowCaseBuilder.setMultipartRequestFlow(mprFlowRequestBuilder.build());
+ mprInput.setMultipartRequestBody(multipartRequestFlowCaseBuilder.build());
+ final Future<RpcResult<Void>> resultFromOFLib = getDeviceContext().getPrimaryConnectionContext()
+ .getConnectionAdapter().multipartRequest(mprInput.build());
+ return JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+ }
+ });
}
@Override
final GetFlowStatisticsFromFlowTableInput input) {
- return this.<GetFlowStatisticsFromFlowTableOutput, Void>handleServiceCall(new Function<DataCrate<GetFlowStatisticsFromFlowTableOutput>, ListenableFuture<RpcResult<Void>>>() {
+ return this.<GetFlowStatisticsFromFlowTableOutput, Void>handleServiceCall(new Function<RequestContext<GetFlowStatisticsFromFlowTableOutput>, ListenableFuture<RpcResult<Void>>>() {
- @Override
- public ListenableFuture<RpcResult<Void>> apply(final DataCrate<GetFlowStatisticsFromFlowTableOutput> data) {
-
- final MultipartRequestFlowCaseBuilder multipartRequestFlowCaseBuilder = new MultipartRequestFlowCaseBuilder();
- final MultipartRequestFlowBuilder mprFlowRequestBuilder = new MultipartRequestFlowBuilder();
- mprFlowRequestBuilder.setTableId(input.getTableId());
+ @Override
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<GetFlowStatisticsFromFlowTableOutput> requestContext) {
- if (input.getOutPort() != null) {
- mprFlowRequestBuilder.setOutPort(input.getOutPort().longValue());
- } else {
- mprFlowRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
- }
+ final MultipartRequestFlowCaseBuilder multipartRequestFlowCaseBuilder = new MultipartRequestFlowCaseBuilder();
+ final MultipartRequestFlowBuilder mprFlowRequestBuilder = new MultipartRequestFlowBuilder();
+ mprFlowRequestBuilder.setTableId(input.getTableId());
- if (input.getOutGroup() != null) {
- mprFlowRequestBuilder.setOutGroup(input.getOutGroup());
- } else {
- mprFlowRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
- }
+ if (input.getOutPort() != null) {
+ mprFlowRequestBuilder.setOutPort(input.getOutPort().longValue());
+ } else {
+ mprFlowRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
+ }
- if (input.getCookie() != null) {
- mprFlowRequestBuilder.setCookie(input.getCookie().getValue());
- } else {
- mprFlowRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
- }
+ if (input.getOutGroup() != null) {
+ mprFlowRequestBuilder.setOutGroup(input.getOutGroup());
+ } else {
+ mprFlowRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
+ }
- if (input.getCookieMask() != null) {
- mprFlowRequestBuilder.setCookieMask(input.getCookieMask().getValue());
- } else {
- mprFlowRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
- }
+ if (input.getCookie() != null) {
+ mprFlowRequestBuilder.setCookie(input.getCookie().getValue());
+ } else {
+ mprFlowRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
+ }
- // convert and inject match
- final short version = getVersion();
- final DeviceContext deviceContext = getDeviceContext();
- MatchReactor.getInstance().convert(input.getMatch(), version, mprFlowRequestBuilder,
- deviceContext.getPrimaryConnectionContext().getFeatures().getDatapathId());
+ if (input.getCookieMask() != null) {
+ mprFlowRequestBuilder.setCookieMask(input.getCookieMask().getValue());
+ } else {
+ mprFlowRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
+ }
- // Set request body to main multipart request
- final Xid xid = data.getRequestContext().getXid();
- multipartRequestFlowCaseBuilder.setMultipartRequestFlow(mprFlowRequestBuilder.build());
- final MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(
- MultipartType.OFPMPFLOW, xid.getValue(), version);
- mprInput.setMultipartRequestBody(multipartRequestFlowCaseBuilder.build());
- final Future<RpcResult<Void>> resultFromOFLib = deviceContext.getPrimaryConnectionContext()
- .getConnectionAdapter().multipartRequest(mprInput.build());
- return JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
- }
- });
+ // convert and inject match
+ final short version = getVersion();
+ final DeviceContext deviceContext = getDeviceContext();
+ MatchReactor.getInstance().convert(input.getMatch(), version, mprFlowRequestBuilder,
+ deviceContext.getPrimaryConnectionContext().getFeatures().getDatapathId());
+
+ // Set request body to main multipart request
+ final Xid xid = requestContext.getXid();
+ multipartRequestFlowCaseBuilder.setMultipartRequestFlow(mprFlowRequestBuilder.build());
+ final MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(
+ MultipartType.OFPMPFLOW, xid.getValue(), version);
+ mprInput.setMultipartRequestBody(multipartRequestFlowCaseBuilder.build());
+ final Future<RpcResult<Void>> resultFromOFLib = deviceContext.getPrimaryConnectionContext()
+ .getConnectionAdapter().multipartRequest(mprInput.build());
+ return JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+ }
+ });
}
private <T> void convertRpcResultToRequestFuture(final RequestContext<T> requestContext,
import com.google.common.util.concurrent.ListenableFuture;
import java.util.concurrent.Future;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
+import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
import org.opendaylight.openflowplugin.impl.services.CommonService;
-import org.opendaylight.openflowplugin.impl.services.DataCrate;
import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsOutput;
final GetFlowTablesStatisticsInput input) {
- return this.<GetFlowTablesStatisticsOutput, Void>handleServiceCall(new Function<DataCrate<GetFlowTablesStatisticsOutput>, ListenableFuture<RpcResult<Void>>>() {
+ return this.<GetFlowTablesStatisticsOutput, Void>handleServiceCall(new Function<RequestContext<GetFlowTablesStatisticsOutput>, ListenableFuture<RpcResult<Void>>>() {
- @Override
- public ListenableFuture<RpcResult<Void>> apply(final DataCrate<GetFlowTablesStatisticsOutput> data) {
+ @Override
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<GetFlowTablesStatisticsOutput> requestContext) {
- // Create multipart request body for fetch all the group stats
- final MultipartRequestTableCaseBuilder multipartRequestTableCaseBuilder = new MultipartRequestTableCaseBuilder();
- final MultipartRequestTableBuilder multipartRequestTableBuilder = new MultipartRequestTableBuilder();
- multipartRequestTableBuilder.setEmpty(true);
- multipartRequestTableCaseBuilder.setMultipartRequestTable(multipartRequestTableBuilder.build());
+ // Create multipart request body for fetch all the group stats
+ final MultipartRequestTableCaseBuilder multipartRequestTableCaseBuilder = new MultipartRequestTableCaseBuilder();
+ final MultipartRequestTableBuilder multipartRequestTableBuilder = new MultipartRequestTableBuilder();
+ multipartRequestTableBuilder.setEmpty(true);
+ multipartRequestTableCaseBuilder.setMultipartRequestTable(multipartRequestTableBuilder.build());
- // Set request body to main multipart request
- final Xid xid = data.getRequestContext().getXid();
- final MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(
- MultipartType.OFPMPFLOW, xid.getValue(), getVersion());
+ // Set request body to main multipart request
+ final Xid xid = requestContext.getXid();
+ final MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(
+ MultipartType.OFPMPFLOW, xid.getValue(), getVersion());
- mprInput.setMultipartRequestBody(multipartRequestTableCaseBuilder.build());
- final Future<RpcResult<Void>> resultFromOFLib = getDeviceContext().getPrimaryConnectionContext()
- .getConnectionAdapter().multipartRequest(mprInput.build());
+ mprInput.setMultipartRequestBody(multipartRequestTableCaseBuilder.build());
+ final Future<RpcResult<Void>> resultFromOFLib = getDeviceContext().getPrimaryConnectionContext()
+ .getConnectionAdapter().multipartRequest(mprInput.build());
- return JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
- }
- });
+ return JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+ }
+ });
}
}
import java.util.concurrent.Future;
import org.opendaylight.openflowjava.protocol.api.util.BinContent;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
+import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
import org.opendaylight.openflowplugin.impl.services.CommonService;
-import org.opendaylight.openflowplugin.impl.services.DataCrate;
import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsOutput;
public Future<RpcResult<GetAllGroupStatisticsOutput>> getAllGroupStatistics(final GetAllGroupStatisticsInput input) {
- return this.<GetAllGroupStatisticsOutput, Void>handleServiceCall(new Function<DataCrate<GetAllGroupStatisticsOutput>, ListenableFuture<RpcResult<Void>>>() {
+ return this.<GetAllGroupStatisticsOutput, Void>handleServiceCall(new Function<RequestContext<GetAllGroupStatisticsOutput>, ListenableFuture<RpcResult<Void>>>() {
@Override
- public ListenableFuture<RpcResult<Void>> apply(final DataCrate<GetAllGroupStatisticsOutput> data) {
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<GetAllGroupStatisticsOutput> requestContext) {
final MultipartRequestGroupCaseBuilder caseBuilder = new MultipartRequestGroupCaseBuilder();
final MultipartRequestGroupBuilder mprGroupBuild = new MultipartRequestGroupBuilder();
caseBuilder.setMultipartRequestGroup(mprGroupBuild.build());
// Create multipart request header
- final Xid xid = data.getRequestContext().getXid();
+ final Xid xid = requestContext.getXid();
final MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(
MultipartType.OFPMPGROUP, xid.getValue(), getVersion());
@Override
public Future<RpcResult<GetGroupDescriptionOutput>> getGroupDescription(final GetGroupDescriptionInput input) {
return this.<GetGroupDescriptionOutput, Void>handleServiceCall(
- new Function<DataCrate<GetGroupDescriptionOutput>, ListenableFuture<RpcResult<Void>>>() {
+ new Function<RequestContext<GetGroupDescriptionOutput>, ListenableFuture<RpcResult<Void>>>() {
@Override
- public ListenableFuture<RpcResult<Void>> apply(final DataCrate<GetGroupDescriptionOutput> data) {
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<GetGroupDescriptionOutput> requestContext) {
final MultipartRequestGroupDescCaseBuilder mprGroupDescCaseBuild = new MultipartRequestGroupDescCaseBuilder();
- final Xid xid = data.getRequestContext().getXid();
+ final Xid xid = requestContext.getXid();
final MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(
MultipartType.OFPMPGROUPDESC, xid.getValue(), getVersion());
mprInput.setMultipartRequestBody(mprGroupDescCaseBuild.build());
@Override
public Future<RpcResult<GetGroupFeaturesOutput>> getGroupFeatures(final GetGroupFeaturesInput input) {
return this.<GetGroupFeaturesOutput, Void>handleServiceCall(
- new Function<DataCrate<GetGroupFeaturesOutput>, ListenableFuture<RpcResult<Void>>>() {
+ new Function<RequestContext<GetGroupFeaturesOutput>, ListenableFuture<RpcResult<Void>>>() {
@Override
- public ListenableFuture<RpcResult<Void>> apply(final DataCrate<GetGroupFeaturesOutput> data) {
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<GetGroupFeaturesOutput> requestContext) {
final MultipartRequestGroupFeaturesCaseBuilder mprGroupFeaturesBuild = new MultipartRequestGroupFeaturesCaseBuilder();
- final Xid xid = data.getRequestContext().getXid();
+ final Xid xid = requestContext.getXid();
final MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(
MultipartType.OFPMPGROUPFEATURES, xid.getValue(), getVersion());
mprInput.setMultipartRequestBody(mprGroupFeaturesBuild.build());
@Override
public Future<RpcResult<GetGroupStatisticsOutput>> getGroupStatistics(final GetGroupStatisticsInput input) {
return this.<GetGroupStatisticsOutput, Void>handleServiceCall(
- new Function<DataCrate<GetGroupStatisticsOutput>, ListenableFuture<RpcResult<Void>>>() {
+ new Function<RequestContext<GetGroupStatisticsOutput>, ListenableFuture<RpcResult<Void>>>() {
@Override
- public ListenableFuture<RpcResult<Void>> apply(final DataCrate<GetGroupStatisticsOutput> data) {
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<GetGroupStatisticsOutput> requestContext) {
final MultipartRequestGroupCaseBuilder caseBuilder = new MultipartRequestGroupCaseBuilder();
final MultipartRequestGroupBuilder mprGroupBuild = new MultipartRequestGroupBuilder();
mprGroupBuild.setGroupId(new GroupId(input.getGroupId().getValue()));
caseBuilder.setMultipartRequestGroup(mprGroupBuild.build());
- final Xid xid = data.getRequestContext().getXid();
+ final Xid xid = requestContext.getXid();
final MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(
MultipartType.OFPMPGROUP, xid.getValue(), getVersion());
import java.util.concurrent.Future;
import org.opendaylight.openflowjava.protocol.api.util.BinContent;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
+import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
import org.opendaylight.openflowplugin.impl.services.CommonService;
-import org.opendaylight.openflowplugin.impl.services.DataCrate;
import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsOutput;
public Future<RpcResult<GetAllMeterConfigStatisticsOutput>> getAllMeterConfigStatistics(
final GetAllMeterConfigStatisticsInput input) {
return this
- .<GetAllMeterConfigStatisticsOutput, Void>handleServiceCall(new Function<DataCrate<GetAllMeterConfigStatisticsOutput>, ListenableFuture<RpcResult<Void>>>() {
+ .<GetAllMeterConfigStatisticsOutput, Void>handleServiceCall(new Function<RequestContext<GetAllMeterConfigStatisticsOutput>, ListenableFuture<RpcResult<Void>>>() {
@Override
- public ListenableFuture<RpcResult<Void>> apply(final DataCrate<GetAllMeterConfigStatisticsOutput> data) {
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<GetAllMeterConfigStatisticsOutput> requestContext) {
MultipartRequestMeterConfigCaseBuilder caseBuilder =
new MultipartRequestMeterConfigCaseBuilder();
.types.rev130731.Meter.OFPMALL.getIntValue())));
caseBuilder.setMultipartRequestMeterConfig(mprMeterConfigBuild.build());
- final Xid xid = data.getRequestContext().getXid();
+ final Xid xid = requestContext.getXid();
MultipartRequestInputBuilder mprInput = RequestInputUtils
.createMultipartHeader(MultipartType.OFPMPMETERCONFIG, xid.getValue(), getVersion());
mprInput.setMultipartRequestBody(caseBuilder.build());
public Future<RpcResult<GetAllMeterStatisticsOutput>> getAllMeterStatistics(final GetAllMeterStatisticsInput input) {
return this.<GetAllMeterStatisticsOutput, Void>handleServiceCall(
- new Function<DataCrate<GetAllMeterStatisticsOutput>, ListenableFuture<RpcResult<Void>>>() {
+ new Function<RequestContext<GetAllMeterStatisticsOutput>, ListenableFuture<RpcResult<Void>>>() {
@Override
- public ListenableFuture<RpcResult<Void>> apply(final DataCrate<GetAllMeterStatisticsOutput> data) {
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<GetAllMeterStatisticsOutput> requestContext) {
MultipartRequestMeterCaseBuilder caseBuilder =
new MultipartRequestMeterCaseBuilder();
.types.rev130731.Meter.OFPMALL.getIntValue())));
caseBuilder.setMultipartRequestMeter(mprMeterBuild.build());
- final Xid xid = data.getRequestContext().getXid();
+ final Xid xid = requestContext.getXid();
MultipartRequestInputBuilder mprInput = RequestInputUtils
.createMultipartHeader(MultipartType.OFPMPMETER, xid.getValue(), getVersion());
mprInput.setMultipartRequestBody(caseBuilder.build());
@Override
public Future<RpcResult<GetMeterFeaturesOutput>> getMeterFeatures(final GetMeterFeaturesInput input) {
return this.<GetMeterFeaturesOutput, Void>handleServiceCall(
- new Function<DataCrate<GetMeterFeaturesOutput>, ListenableFuture<RpcResult<Void>>>() {
+ new Function<RequestContext<GetMeterFeaturesOutput>, ListenableFuture<RpcResult<Void>>>() {
@Override
- public ListenableFuture<RpcResult<Void>> apply(final DataCrate<GetMeterFeaturesOutput> data) {
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<GetMeterFeaturesOutput> requestContext) {
MultipartRequestMeterFeaturesCaseBuilder mprMeterFeaturesBuild =
new MultipartRequestMeterFeaturesCaseBuilder();
- final Xid xid = data.getRequestContext().getXid();
+ final Xid xid = requestContext.getXid();
MultipartRequestInputBuilder mprInput =
RequestInputUtils.createMultipartHeader(MultipartType.OFPMPMETERFEATURES, xid.getValue(), getVersion());
mprInput.setMultipartRequestBody(mprMeterFeaturesBuild.build());
@Override
public Future<RpcResult<GetMeterStatisticsOutput>> getMeterStatistics(final GetMeterStatisticsInput input) {
return this.<GetMeterStatisticsOutput, Void>handleServiceCall(
- new Function<DataCrate<GetMeterStatisticsOutput>, ListenableFuture<RpcResult<Void>>>() {
+ new Function<RequestContext<GetMeterStatisticsOutput>, ListenableFuture<RpcResult<Void>>>() {
@Override
- public ListenableFuture<RpcResult<Void>> apply(final DataCrate<GetMeterStatisticsOutput> data) {
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<GetMeterStatisticsOutput> requestContext) {
MultipartRequestMeterCaseBuilder caseBuilder =
new MultipartRequestMeterCaseBuilder();
MultipartRequestMeterBuilder mprMeterBuild =
mprMeterBuild.setMeterId(new MeterId(input.getMeterId().getValue()));
caseBuilder.setMultipartRequestMeter(mprMeterBuild.build());
- final Xid xid = data.getRequestContext().getXid();
+ final Xid xid = requestContext.getXid();
MultipartRequestInputBuilder mprInput =
RequestInputUtils.createMultipartHeader(MultipartType.OFPMPMETER, xid.getValue(), getVersion());
mprInput.setMultipartRequestBody(caseBuilder.build());
import java.util.concurrent.Future;
import org.opendaylight.openflowplugin.api.OFConstants;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
+import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
import org.opendaylight.openflowplugin.impl.services.CommonService;
-import org.opendaylight.openflowplugin.impl.services.DataCrate;
import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
final GetAllNodeConnectorsStatisticsInput input) {
return this
.<GetAllNodeConnectorsStatisticsOutput, Void>handleServiceCall(
- new Function<DataCrate<GetAllNodeConnectorsStatisticsOutput>, ListenableFuture<RpcResult<Void>>>() {
+ new Function<RequestContext<GetAllNodeConnectorsStatisticsOutput>, ListenableFuture<RpcResult<Void>>>() {
@Override
- public ListenableFuture<RpcResult<Void>> apply(final DataCrate<GetAllNodeConnectorsStatisticsOutput> data) {
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<GetAllNodeConnectorsStatisticsOutput> requestContext) {
MultipartRequestPortStatsCaseBuilder caseBuilder =
new MultipartRequestPortStatsCaseBuilder();
mprPortStatsBuilder.setPortNo(OFConstants.OFPP_ANY);
caseBuilder.setMultipartRequestPortStats(mprPortStatsBuilder.build());
- final Xid xid = data.getRequestContext().getXid();
+ final Xid xid = requestContext.getXid();
MultipartRequestInputBuilder mprInput = RequestInputUtils
.createMultipartHeader(MultipartType.OFPMPPORTSTATS, xid.getValue(), getVersion());
mprInput.setMultipartRequestBody(caseBuilder.build());
final GetNodeConnectorStatisticsInput input) {
return this
.<GetNodeConnectorStatisticsOutput, Void>handleServiceCall(
- new Function<DataCrate<GetNodeConnectorStatisticsOutput>, ListenableFuture<RpcResult<Void>>>() {
+ new Function<RequestContext<GetNodeConnectorStatisticsOutput>, ListenableFuture<RpcResult<Void>>>() {
@Override
- public ListenableFuture<RpcResult<Void>> apply(final DataCrate<GetNodeConnectorStatisticsOutput> data) {
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<GetNodeConnectorStatisticsOutput> requestContext) {
MultipartRequestPortStatsCaseBuilder caseBuilder =
new MultipartRequestPortStatsCaseBuilder();
input.getNodeConnectorId()));
caseBuilder.setMultipartRequestPortStats(mprPortStatsBuilder.build());
- final Xid xid = data.getRequestContext().getXid();
+ final Xid xid = requestContext.getXid();
MultipartRequestInputBuilder mprInput = RequestInputUtils
.createMultipartHeader(MultipartType.OFPMPPORTSTATS, xid.getValue(), version);
mprInput.setMultipartRequestBody(caseBuilder.build());
import java.util.concurrent.Future;
import org.opendaylight.openflowplugin.api.OFConstants;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
+import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
import org.opendaylight.openflowplugin.impl.services.CommonService;
-import org.opendaylight.openflowplugin.impl.services.DataCrate;
import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
public Future<RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>> getAllQueuesStatisticsFromAllPorts(
final GetAllQueuesStatisticsFromAllPortsInput input) {
return this.<GetAllQueuesStatisticsFromAllPortsOutput, Void>handleServiceCall(
- new Function<DataCrate<GetAllQueuesStatisticsFromAllPortsOutput>, ListenableFuture<RpcResult<Void>>>() {
+ new Function<RequestContext<GetAllQueuesStatisticsFromAllPortsOutput>, ListenableFuture<RpcResult<Void>>>() {
@Override
- public ListenableFuture<RpcResult<Void>> apply(final DataCrate<GetAllQueuesStatisticsFromAllPortsOutput> data) {
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<GetAllQueuesStatisticsFromAllPortsOutput> requestContext) {
MultipartRequestQueueCaseBuilder caseBuilder = new MultipartRequestQueueCaseBuilder();
caseBuilder.setMultipartRequestQueue(mprQueueBuilder.build());
// Set request body to main multipart request
- final Xid xid = data.getRequestContext().getXid();
+ final Xid xid = requestContext.getXid();
MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(
MultipartType.OFPMPQUEUE, xid.getValue(), getVersion());
mprInput.setMultipartRequestBody(caseBuilder.build());
public Future<RpcResult<GetAllQueuesStatisticsFromGivenPortOutput>> getAllQueuesStatisticsFromGivenPort(
final GetAllQueuesStatisticsFromGivenPortInput input) {
return this.<GetAllQueuesStatisticsFromGivenPortOutput, Void>handleServiceCall(
- new Function<DataCrate<GetAllQueuesStatisticsFromGivenPortOutput>, ListenableFuture<RpcResult<Void>>>() {
+ new Function<RequestContext<GetAllQueuesStatisticsFromGivenPortOutput>, ListenableFuture<RpcResult<Void>>>() {
@Override
- public ListenableFuture<RpcResult<Void>> apply(final DataCrate<GetAllQueuesStatisticsFromGivenPortOutput> data) {
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<GetAllQueuesStatisticsFromGivenPortOutput> requestContext) {
MultipartRequestQueueCaseBuilder caseBuilder = new MultipartRequestQueueCaseBuilder();
MultipartRequestQueueBuilder mprQueueBuilder = new MultipartRequestQueueBuilder();
caseBuilder.setMultipartRequestQueue(mprQueueBuilder.build());
// Set request body to main multipart request
- final Xid xid = data.getRequestContext().getXid();
+ final Xid xid = requestContext.getXid();
MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(
MultipartType.OFPMPQUEUE, xid.getValue(), version);
mprInput.setMultipartRequestBody(caseBuilder.build());
public Future<RpcResult<GetQueueStatisticsFromGivenPortOutput>> getQueueStatisticsFromGivenPort(
final GetQueueStatisticsFromGivenPortInput input) {
return this.<GetQueueStatisticsFromGivenPortOutput, Void>handleServiceCall(
- new Function<DataCrate<GetQueueStatisticsFromGivenPortOutput>, ListenableFuture<RpcResult<Void>>>() {
+ new Function<RequestContext<GetQueueStatisticsFromGivenPortOutput>, ListenableFuture<RpcResult<Void>>>() {
@Override
- public ListenableFuture<RpcResult<Void>> apply(final DataCrate<GetQueueStatisticsFromGivenPortOutput> data) {
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<GetQueueStatisticsFromGivenPortOutput> requestContext) {
MultipartRequestQueueCaseBuilder caseBuilder = new MultipartRequestQueueCaseBuilder();
MultipartRequestQueueBuilder mprQueueBuilder = new MultipartRequestQueueBuilder();
caseBuilder.setMultipartRequestQueue(mprQueueBuilder.build());
// Set request body to main multipart request
- final Xid xid = data.getRequestContext().getXid();
+ final Xid xid = requestContext.getXid();
MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(
MultipartType.OFPMPQUEUE, xid.getValue(), version);
mprInput.setMultipartRequestBody(caseBuilder.build());
import java.util.concurrent.Future;
import org.opendaylight.openflowjava.protocol.api.connection.OutboundQueue;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
+import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
import org.opendaylight.openflowplugin.api.openflow.device.handlers.MultiMsgCollector;
import org.opendaylight.openflowplugin.impl.common.MultipartRequestInputFactory;
import org.opendaylight.openflowplugin.impl.services.CommonService;
-import org.opendaylight.openflowplugin.impl.services.DataCrate;
import org.opendaylight.openflowplugin.impl.services.RequestContextUtil;
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;
public Future<RpcResult<List<MultipartReply>>> getStatisticsOfType(final MultipartType type) {
- return handleServiceCall(new Function<DataCrate<List<MultipartReply>>, ListenableFuture<RpcResult<Void>>>() {
+ return handleServiceCall(new Function<RequestContext<List<MultipartReply>>, ListenableFuture<RpcResult<Void>>>() {
@Override
- public ListenableFuture<RpcResult<Void>> apply(final DataCrate<List<MultipartReply>> data) {
- final Xid xid = data.getRequestContext().getXid();
+ public ListenableFuture<RpcResult<Void>> apply(final RequestContext<List<MultipartReply>> requestContext) {
+ final Xid xid = requestContext.getXid();
final DeviceContext deviceContext = getDeviceContext();
final MultiMsgCollector multiMsgCollector = deviceContext.getMultiMsgCollector();
@Override
public void onFailure(final Throwable throwable) {
RpcResultBuilder rpcResultBuilder = RpcResultBuilder.<Void>failed().withError(RpcError.ErrorType.APPLICATION, throwable.getMessage());
- getDeviceContext().unhookRequestCtx(data.getRequestContext().getXid());
- RequestContextUtil.closeRequstContext(data.getRequestContext());
+ getDeviceContext().unhookRequestCtx(requestContext.getXid());
+ RequestContextUtil.closeRequstContext(requestContext);
settableFuture.set(rpcResultBuilder.build());
}