X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fcompatibility%2Fsal-compatibility%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fcompatibility%2Fadsal%2FFlowServiceAdapter.java;h=56c7afb253a5224547f848b40b1b125bd376b553;hp=fd03ea4ca5cc5ddf46df3d8fe5fa2f3c524ac4f1;hb=c46e223995956f1f759c551163c212947c1e2fb7;hpb=f27f2337e171c9f944de55a3ac6650b3b1ec0af2 diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/adsal/FlowServiceAdapter.java b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/adsal/FlowServiceAdapter.java index fd03ea4ca5..56c7afb253 100644 --- a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/adsal/FlowServiceAdapter.java +++ b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/adsal/FlowServiceAdapter.java @@ -1,15 +1,17 @@ +/* + * Copyright (c) 2014 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.controller.sal.compatibility.adsal; import java.math.BigInteger; -import java.util.concurrent.Future; import org.opendaylight.controller.sal.binding.api.NotificationProviderService; -import org.opendaylight.controller.sal.common.util.Futures; -import org.opendaylight.controller.sal.common.util.Rpcs; import org.opendaylight.controller.sal.compatibility.InventoryMapping; -import org.opendaylight.controller.sal.compatibility.NodeMapping; import org.opendaylight.controller.sal.compatibility.ToSalConversionsUtils; -import org.opendaylight.controller.sal.core.ConstructionException; import org.opendaylight.controller.sal.flowprogrammer.Flow; import org.opendaylight.controller.sal.flowprogrammer.IFlowProgrammerListener; import org.opendaylight.controller.sal.flowprogrammer.IFlowProgrammerService; @@ -29,9 +31,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev131103. import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.common.RpcResult; +import org.opendaylight.yangtools.yang.common.RpcResultBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; + public class FlowServiceAdapter implements SalFlowService, IFlowProgrammerListener { private static final Logger LOG = LoggerFactory.getLogger(FlowServiceAdapter.class); @@ -54,9 +60,9 @@ public class FlowServiceAdapter implements SalFlowService, IFlowProgrammerListen } @Override - public Future> addFlow(AddFlowInput input) { + public ListenableFuture> addFlow(AddFlowInput input) { - Flow flow = ToSalConversionsUtils.toFlow(input); + Flow flow = ToSalConversionsUtils.toFlow(input, null); @SuppressWarnings("unchecked") org.opendaylight.controller.sal.core.Node node = InventoryMapping.toAdNode((InstanceIdentifier) input .getNode().getValue()); @@ -64,13 +70,14 @@ public class FlowServiceAdapter implements SalFlowService, IFlowProgrammerListen AddFlowOutputBuilder builder = new AddFlowOutputBuilder(); builder.setTransactionId(new TransactionId(BigInteger.valueOf(status.getRequestId()))); AddFlowOutput rpcResultType = builder.build(); - return Futures.immediateFuture(Rpcs.getRpcResult(status.isSuccess(), rpcResultType, null)); + return Futures.immediateFuture(RpcResultBuilder.status(status.isSuccess()) + .withResult(rpcResultType).build()); } @Override - public Future> removeFlow(RemoveFlowInput input) { + public ListenableFuture> removeFlow(RemoveFlowInput input) { - Flow flow = ToSalConversionsUtils.toFlow(input); + Flow flow = ToSalConversionsUtils.toFlow(input, null); @SuppressWarnings("unchecked") org.opendaylight.controller.sal.core.Node node = InventoryMapping.toAdNode((InstanceIdentifier) input .getNode().getValue()); @@ -78,17 +85,18 @@ public class FlowServiceAdapter implements SalFlowService, IFlowProgrammerListen RemoveFlowOutputBuilder builder = new RemoveFlowOutputBuilder(); builder.setTransactionId(new TransactionId(BigInteger.valueOf(status.getRequestId()))); RemoveFlowOutput rpcResultType = builder.build(); - return Futures.immediateFuture(Rpcs.getRpcResult(status.isSuccess(), rpcResultType, null)); + return Futures.immediateFuture(RpcResultBuilder.status(status.isSuccess()) + .withResult(rpcResultType).build()); } @Override - public Future> updateFlow(UpdateFlowInput input) { + public ListenableFuture> updateFlow(UpdateFlowInput input) { @SuppressWarnings("unchecked") org.opendaylight.controller.sal.core.Node node = InventoryMapping.toAdNode((InstanceIdentifier) input .getNode().getValue()); - Flow originalFlow = ToSalConversionsUtils.toFlow(input.getOriginalFlow()); - Flow updatedFlow = ToSalConversionsUtils.toFlow(input.getUpdatedFlow()); + Flow originalFlow = ToSalConversionsUtils.toFlow(input.getOriginalFlow(), null); + Flow updatedFlow = ToSalConversionsUtils.toFlow(input.getUpdatedFlow(), null); Status status = delegate.modifyFlowAsync(node, originalFlow, updatedFlow); UpdateFlowOutputBuilder builder = new UpdateFlowOutputBuilder(); builder.setTransactionId(new TransactionId(BigInteger.valueOf(status.getRequestId())));