Search in sources :

Example 66 with MultipartReply

use of org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartReply in project openflowplugin by opendaylight.

the class MultipartReplyTranslatorUtilTest method translateMeter.

@Test
public void translateMeter() {
    final MultipartReply multipartReply = buildReply(MultipartType.OFPMPMETER, new MultipartReplyMeterCaseBuilder().setMultipartReplyMeter(new MultipartReplyMeterBuilder().build()).build());
    dummyAssertReply(multipartReply);
}
Also used : MultipartReply(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply) MultipartReplyMeterBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.meter._case.MultipartReplyMeterBuilder) MultipartReplyMeterCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyMeterCaseBuilder) Test(org.junit.Test)

Example 67 with MultipartReply

use of org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartReply in project openflowplugin by opendaylight.

the class MultipartReplyTranslatorUtilTest method translateGroupFeatures.

@Test
public void translateGroupFeatures() {
    final MultipartReply multipartReply = buildReply(MultipartType.OFPMPGROUPFEATURES, new MultipartReplyGroupFeaturesCaseBuilder().setMultipartReplyGroupFeatures(new MultipartReplyGroupFeaturesBuilder().setTypes(new GroupTypes(true, false, false, false)).setCapabilities(new GroupCapabilities(false, true, true, false)).setActionsBitmap(Collections.singletonList(new ActionType(true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false))).build()).build());
    dummyAssertReply(multipartReply);
}
Also used : MultipartReplyGroupFeaturesCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupFeaturesCaseBuilder) GroupTypes(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupTypes) GroupCapabilities(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupCapabilities) ActionType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionType) MultipartReply(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply) MultipartReplyGroupFeaturesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.features._case.MultipartReplyGroupFeaturesBuilder) Test(org.junit.Test)

Example 68 with MultipartReply

use of org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartReply in project openflowplugin by opendaylight.

the class MultipartReplyTranslatorUtilTest method translatePortStats.

@Test
public void translatePortStats() {
    final MultipartReply multipartReply = buildReply(MultipartType.OFPMPPORTSTATS, new MultipartReplyPortStatsCaseBuilder().setMultipartReplyPortStats(new MultipartReplyPortStatsBuilder().setPortStats(Collections.singletonList(new PortStatsBuilder().build())).build()).build());
    dummyAssertReply(multipartReply);
}
Also used : MultipartReplyPortStatsCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyPortStatsCaseBuilder) MultipartReplyPortStatsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.MultipartReplyPortStatsBuilder) PortStatsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.multipart.reply.port.stats.PortStatsBuilder) MultipartReplyPortStatsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.MultipartReplyPortStatsBuilder) MultipartReply(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply) Test(org.junit.Test)

Example 69 with MultipartReply

use of org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartReply in project openflowplugin by opendaylight.

the class MultipartReplyTranslatorUtilTest method translateGroupDesc.

@Test
public void translateGroupDesc() {
    final MultipartReply multipartReply = buildReply(MultipartType.OFPMPGROUPDESC, new MultipartReplyGroupDescCaseBuilder().setMultipartReplyGroupDesc(new MultipartReplyGroupDescBuilder().build()).build());
    dummyAssertReply(multipartReply);
}
Also used : MultipartReply(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply) MultipartReplyGroupDescCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupDescCaseBuilder) MultipartReplyGroupDescBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.MultipartReplyGroupDescBuilder) Test(org.junit.Test)

Example 70 with MultipartReply

use of org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartReply in project openflowplugin by opendaylight.

the class MultiLayerTableMultipartService method handleAndReply.

@Override
public Future<RpcResult<UpdateTableOutput>> handleAndReply(UpdateTableInput input) {
    final ListenableFuture<RpcResult<List<MultipartReply>>> multipartFuture = handleServiceCall(input);
    final SettableFuture<RpcResult<UpdateTableOutput>> finalFuture = SettableFuture.create();
    class CallBackImpl implements FutureCallback<RpcResult<List<MultipartReply>>> {

        @Override
        @SuppressWarnings("checkstyle:IllegalCatch")
        public void onSuccess(@Nonnull final RpcResult<List<MultipartReply>> result) {
            if (result.isSuccessful()) {
                final List<MultipartReply> multipartReplies = result.getResult();
                if (multipartReplies.isEmpty()) {
                    LOG.debug("Multipart reply to table features request shouldn't be empty list.");
                    finalFuture.set(RpcResultBuilder.<UpdateTableOutput>failed().withError(ErrorType.RPC, "Multipart reply list is empty.").build());
                } else {
                    final Long xid = multipartReplies.get(0).getXid();
                    LOG.debug("OnSuccess, rpc result successful," + " multipart response for rpc update-table with xid {} obtained.", xid);
                    final UpdateTableOutputBuilder updateTableOutputBuilder = new UpdateTableOutputBuilder();
                    updateTableOutputBuilder.setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
                    finalFuture.set(RpcResultBuilder.success(updateTableOutputBuilder.build()).build());
                    try {
                        storeStatistics(convertToSalTableFeatures(multipartReplies));
                    } catch (Exception e) {
                        LOG.warn("Not able to write to operational datastore: {}", e.getMessage());
                    }
                }
            } else {
                LOG.debug("OnSuccess, rpc result unsuccessful," + " multipart response for rpc update-table was unsuccessful.");
                finalFuture.set(RpcResultBuilder.<UpdateTableOutput>failed().withRpcErrors(result.getErrors()).build());
            }
        }

        @Override
        public void onFailure(final Throwable throwable) {
            LOG.error("Failure multipart response for table features request. Exception: {}", throwable);
            finalFuture.set(RpcResultBuilder.<UpdateTableOutput>failed().withError(ErrorType.RPC, "Future error", throwable).build());
        }
    }
    Futures.addCallback(multipartFuture, new CallBackImpl(), MoreExecutors.directExecutor());
    return finalFuture;
}
Also used : Nonnull(javax.annotation.Nonnull) MultipartReply(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) ServiceException(org.opendaylight.openflowplugin.impl.services.util.ServiceException) TransactionId(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId) ArrayList(java.util.ArrayList) List(java.util.List) UpdateTableOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutputBuilder) FutureCallback(com.google.common.util.concurrent.FutureCallback)

Aggregations

MultipartReply (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply)52 Test (org.junit.Test)29 ArrayList (java.util.ArrayList)25 List (java.util.List)25 Counter32 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32)13 MultipartType (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType)11 Counter64 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter64)10 FlowAndStatisticsMapList (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList)10 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)7 NodeConnectorId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)6 DurationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.duration.DurationBuilder)6 MultipartReply (org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartReply)6 MultipartReplyBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartReplyBuilder)6 ConvertorManager (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManager)5 QueueId (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.queue.rev130925.QueueId)5 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)5 TranslatorKey (org.opendaylight.openflowplugin.api.openflow.md.core.TranslatorKey)4 VersionConvertorData (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData)4 MultipartReplyFlowCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlowCase)4 MultipartReplyMeterCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyMeterCase)4