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=fd03ea4ca5cc5ddf46df3d8fe5fa2f3c524ac4f1;hp=ae427455a415344b75d5db2c7d1e1e13049d37d1;hb=refs%2Fchanges%2F14%2F2714%2F6;hpb=400558756c5e1561c5328a608f806ba056b65653 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 ae427455a4..fd03ea4ca5 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,5 +1,6 @@ package org.opendaylight.controller.sal.compatibility.adsal; +import java.math.BigInteger; import java.util.concurrent.Future; import org.opendaylight.controller.sal.binding.api.NotificationProviderService; @@ -14,10 +15,17 @@ import org.opendaylight.controller.sal.flowprogrammer.IFlowProgrammerListener; import org.opendaylight.controller.sal.flowprogrammer.IFlowProgrammerService; import org.opendaylight.controller.sal.utils.Status; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowOutput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemovedBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowOutput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowOutputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowOutput; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowOutputBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev131103.TransactionId; 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; @@ -46,39 +54,46 @@ public class FlowServiceAdapter implements SalFlowService, IFlowProgrammerListen } @Override - public Future> addFlow(AddFlowInput input) { + public Future> addFlow(AddFlowInput input) { Flow flow = ToSalConversionsUtils.toFlow(input); @SuppressWarnings("unchecked") org.opendaylight.controller.sal.core.Node node = InventoryMapping.toAdNode((InstanceIdentifier) input .getNode().getValue()); Status status = delegate.addFlowAsync(node, flow); - Void rpcResultType = null; + 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)); } @Override - public Future> removeFlow(RemoveFlowInput input) { + public Future> removeFlow(RemoveFlowInput input) { Flow flow = ToSalConversionsUtils.toFlow(input); @SuppressWarnings("unchecked") org.opendaylight.controller.sal.core.Node node = InventoryMapping.toAdNode((InstanceIdentifier) input .getNode().getValue()); Status status = delegate.removeFlowAsync(node, flow); - Void rpcResultType = null; + 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)); } @Override - public Future> updateFlow(UpdateFlowInput input) { + public Future> 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()); Status status = delegate.modifyFlowAsync(node, originalFlow, updatedFlow); - Void rpcResultType = null; - return Futures.immediateFuture(Rpcs.getRpcResult(status.isSuccess(), rpcResultType, null)); + UpdateFlowOutputBuilder builder = new UpdateFlowOutputBuilder(); + builder.setTransactionId(new TransactionId(BigInteger.valueOf(status.getRequestId()))); + UpdateFlowOutput rpcResultType = builder.build(); + throw new UnsupportedOperationException("Need to translate AD-SAL status to MD-SAL UpdateFlowOuptut - eaw@cisco.com"); + // return Futures.immediateFuture(Rpcs.getRpcResult(status.isSuccess(), rpcResultType, null)); } }