Merge "Add NodeConfiguratorImpl enqueue trace"
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / services / singlelayer / SingleLayerFlowMultipartRequestOnTheFlyCallback.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies s.r.o. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.openflowplugin.impl.services.singlelayer;
10
11 import java.util.List;
12 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
13 import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
14 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier;
15 import org.opendaylight.openflowplugin.impl.datastore.MultipartWriterProvider;
16 import org.opendaylight.openflowplugin.impl.services.AbstractMultipartRequestOnTheFlyCallback;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.multipart.reply.multipart.reply.body.MultipartReplyFlowStats;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartReply;
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.OfHeader;
21
22 public class SingleLayerFlowMultipartRequestOnTheFlyCallback<T extends OfHeader>
23                                                     extends AbstractMultipartRequestOnTheFlyCallback<T> {
24
25     public SingleLayerFlowMultipartRequestOnTheFlyCallback(final RequestContext<List<T>> context,
26                                                            final Class<?> requestType,
27                                                            final DeviceContext deviceContext,
28                                                            final EventIdentifier eventIdentifier,
29                                                            final MultipartWriterProvider statisticsWriterProvider) {
30         super(context, requestType, deviceContext, eventIdentifier, statisticsWriterProvider, null);
31     }
32
33     @Override
34     protected boolean isMultipart(OfHeader result) {
35         return result instanceof MultipartReply
36             && ((MultipartReply) result).getMultipartReplyBody() instanceof MultipartReplyFlowStats;
37     }
38
39     @Override
40     protected boolean isReqMore(T result) {
41         return ((MultipartReply) result).isRequestMore();
42     }
43
44     @Override
45     protected MultipartType getMultipartType() {
46         return MultipartType.OFPMPFLOW;
47     }
48 }