2 * Copyright (c) 2016 Pantheon Technologies s.r.o. 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
9 package org.opendaylight.openflowplugin.impl.services.sal;
11 import com.google.common.util.concurrent.ListenableFuture;
12 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
13 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
14 import org.opendaylight.openflowplugin.extension.api.core.extension.ExtensionConverterProvider;
15 import org.opendaylight.openflowplugin.impl.services.multilayer.MultiLayerExperimenterMultipartService;
16 import org.opendaylight.openflowplugin.impl.services.singlelayer.SingleLayerExperimenterMultipartService;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.mp.message.service.rev151020.SalExperimenterMpMessageService;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.mp.message.service.rev151020.SendExperimenterMpRequestInput;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.mp.message.service.rev151020.SendExperimenterMpRequestOutput;
20 import org.opendaylight.yangtools.yang.common.RpcResult;
22 public class SalExperimenterMpMessageServiceImpl implements SalExperimenterMpMessageService {
23 private final MultiLayerExperimenterMultipartService multiLayerService;
24 private final SingleLayerExperimenterMultipartService singleLayerService;
26 public SalExperimenterMpMessageServiceImpl(final RequestContextStack requestContextStack,
27 final DeviceContext deviceContext,
28 final ExtensionConverterProvider extensionConverterProvider) {
29 this.singleLayerService = new SingleLayerExperimenterMultipartService(requestContextStack, deviceContext,
30 extensionConverterProvider);
31 this.multiLayerService = new MultiLayerExperimenterMultipartService(requestContextStack, deviceContext,
32 extensionConverterProvider);
36 public ListenableFuture<RpcResult<SendExperimenterMpRequestOutput>>
37 sendExperimenterMpRequest(SendExperimenterMpRequestInput input) {
38 return singleLayerService.canUseSingleLayerSerialization()
39 ? singleLayerService.handleAndReply(input)
40 : multiLayerService.handleAndReply(input);