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.api.openflow.device.Xid;
14 import org.opendaylight.openflowplugin.impl.services.AbstractSimpleService;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.module.config.rev141015.NodeConfigService;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.module.config.rev141015.SetConfigInput;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.module.config.rev141015.SetConfigOutput;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.SwitchConfigFlag;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetConfigInputBuilder;
21 import org.opendaylight.yangtools.yang.common.RpcResult;
23 public final class NodeConfigServiceImpl extends AbstractSimpleService<SetConfigInput, SetConfigOutput>
24 implements NodeConfigService {
25 public NodeConfigServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
26 super(requestContextStack, deviceContext, SetConfigOutput.class);
30 public ListenableFuture<RpcResult<SetConfigOutput>> setConfig(final SetConfigInput input) {
31 return handleServiceCall(input);
35 protected OfHeader buildRequest(final Xid xid, final SetConfigInput input) {
36 SetConfigInputBuilder builder = new SetConfigInputBuilder();
37 SwitchConfigFlag flag = SwitchConfigFlag.valueOf(input.getFlag());
39 builder.setXid(xid.getValue());
40 builder.setFlags(flag);
41 builder.setMissSendLen(input.getMissSearchLength());
42 builder.setVersion(getVersion());
43 return builder.build();