-/**
+/*
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
import com.google.common.util.concurrent.SettableFuture;
import java.util.ArrayList;
import java.util.List;
-import java.util.Objects;
-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.RequestContextStack;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowOutput;
}
@Override
- public Future<RpcResult<AddFlowOutput>> addFlow(final AddFlowInput input) {
+ public ListenableFuture<RpcResult<AddFlowOutput>> addFlow(final AddFlowInput input) {
final FlowRegistryKey flowRegistryKey =
FlowRegistryKeyFactory.create(deviceContext.getDeviceInfo().getVersion(), input);
final ListenableFuture<RpcResult<AddFlowOutput>> future;
}
@Override
- public Future<RpcResult<RemoveFlowOutput>> removeFlow(final RemoveFlowInput input) {
+ public ListenableFuture<RpcResult<RemoveFlowOutput>> removeFlow(final RemoveFlowInput input) {
final ListenableFuture<RpcResult<RemoveFlowOutput>> future;
if (flowRemoveMessage.canUseSingleLayerSerialization()) {
}
@Override
- public Future<RpcResult<UpdateFlowOutput>> updateFlow(final UpdateFlowInput input) {
+ public ListenableFuture<RpcResult<UpdateFlowOutput>> updateFlow(final UpdateFlowInput input) {
final UpdatedFlow updated = input.getUpdatedFlow();
final OriginalFlow original = input.getOriginalFlow();
if (rpcResult.isSuccessful()) {
final FlowDescriptor flowDescriptor;
- if (Objects.nonNull(input.getFlowRef())) {
- final FlowId flowId = input.getFlowRef().getValue().firstKeyOf(Flow.class, FlowKey.class).getId();
+ if (input.getFlowRef() != null) {
+ final FlowId flowId = input.getFlowRef().getValue().firstKeyOf(Flow.class).getId();
flowDescriptor = FlowDescriptorFactory.create(input.getTableId(), flowId);
deviceContext.getDeviceFlowRegistry().storeDescriptor(flowRegistryKey, flowDescriptor);
} else {
@Override
public void onFailure(final Throwable throwable) {
- LOG.warn("Service call for adding flow={} failed, reason: {}", input, throwable);
+ LOG.warn("Service call for adding flow={} failed", input, throwable);
}
}
@Override
public void onFailure(final Throwable throwable) {
- LOG.warn("Service call for removing flow={} failed, reason: {}", input, throwable);
+ LOG.warn("Service call for removing flow={} failed", input, throwable);
}
}
FlowRegistryKeyFactory.create(deviceContext.getDeviceInfo().getVersion(), updated);
final FlowDescriptor origFlowDescriptor = deviceFlowRegistry.retrieveDescriptor(origFlowRegistryKey);
- final boolean isUpdate = Objects.nonNull(origFlowDescriptor);
+ final boolean isUpdate = origFlowDescriptor != null;
final FlowDescriptor updatedFlowDescriptor;
- if (Objects.nonNull(input.getFlowRef())) {
+ if (input.getFlowRef() != null) {
updatedFlowDescriptor =
FlowDescriptorFactory.create(updated.getTableId(),
input.getFlowRef().getValue().firstKeyOf(Flow.class).getId());
@Override
public void onFailure(final Throwable throwable) {
- LOG.warn("Service call for updating flow={} failed, reason: {}", input, throwable);
+ LOG.warn("Service call for updating flow={} failed", input, throwable);
}
}
}