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.services.sal;
10 import com.google.common.util.concurrent.ListenableFuture;
11 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
12 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
13 import org.opendaylight.openflowplugin.impl.datastore.MultipartWriterProvider;
14 import org.opendaylight.openflowplugin.impl.services.multilayer.MultiLayerTableMultipartService;
15 import org.opendaylight.openflowplugin.impl.services.singlelayer.SingleLayerTableMultipartService;
16 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.SalTableService;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInput;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutput;
20 import org.opendaylight.yangtools.yang.common.RpcResult;
22 public final class SalTableServiceImpl implements SalTableService {
24 private final SingleLayerTableMultipartService singleLayerService;
25 private final MultiLayerTableMultipartService multiLayerService;
27 public SalTableServiceImpl(final RequestContextStack requestContextStack,
28 final DeviceContext deviceContext,
29 final ConvertorExecutor convertorExecutor,
30 final MultipartWriterProvider multipartWriterProvider) {
31 singleLayerService = new SingleLayerTableMultipartService(requestContextStack,
33 multipartWriterProvider);
34 multiLayerService = new MultiLayerTableMultipartService(requestContextStack,
37 multipartWriterProvider);
41 public ListenableFuture<RpcResult<UpdateTableOutput>> updateTable(final UpdateTableInput input) {
42 return singleLayerService.canUseSingleLayerSerialization()
43 ? singleLayerService.handleAndReply(input)
44 : multiLayerService.handleAndReply(input);