2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.openflowplugin.impl.statistics.services;
10 import java.util.concurrent.Future;
11 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
12 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
13 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
14 import org.opendaylight.openflowplugin.impl.services.AbstractSimpleService;
15 import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsInput;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsOutput;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.OpendaylightFlowTableStatisticsService;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableCaseBuilder;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table._case.MultipartRequestTableBuilder;
24 import org.opendaylight.yangtools.yang.common.RpcResult;
26 public final class OpendaylightFlowTableStatisticsServiceImpl extends AbstractSimpleService<GetFlowTablesStatisticsInput, GetFlowTablesStatisticsOutput> implements
27 OpendaylightFlowTableStatisticsService {
29 public OpendaylightFlowTableStatisticsServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
30 super(requestContextStack, deviceContext, GetFlowTablesStatisticsOutput.class);
34 public Future<RpcResult<GetFlowTablesStatisticsOutput>> getFlowTablesStatistics(
35 final GetFlowTablesStatisticsInput input) {
36 return handleServiceCall(input);
40 protected OfHeader buildRequest(final Xid xid, final GetFlowTablesStatisticsInput input) {
41 // Create multipart request body for fetch all the group stats
42 final MultipartRequestTableCaseBuilder multipartRequestTableCaseBuilder = new MultipartRequestTableCaseBuilder();
43 final MultipartRequestTableBuilder multipartRequestTableBuilder = new MultipartRequestTableBuilder();
44 multipartRequestTableBuilder.setEmpty(true);
45 multipartRequestTableCaseBuilder.setMultipartRequestTable(multipartRequestTableBuilder.build());
47 // Set request body to main multipart request
48 final MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(
49 MultipartType.OFPMPFLOW, xid.getValue(), getVersion());
51 mprInput.setMultipartRequestBody(multipartRequestTableCaseBuilder.build());
53 return mprInput.build();