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;
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.yang.gen.v1.urn.opendaylight.echo.service.rev150305.SalEchoService;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.echo.service.rev150305.SendEchoInput;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.echo.service.rev150305.SendEchoOutput;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoInputBuilder;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
19 import org.opendaylight.yangtools.yang.common.RpcResult;
21 public final class SalEchoServiceImpl extends AbstractSimpleService<SendEchoInput, SendEchoOutput> implements SalEchoService {
22 public SalEchoServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
23 super(requestContextStack, deviceContext, SendEchoOutput.class);
27 public Future<RpcResult<SendEchoOutput>> sendEcho(final SendEchoInput sendEchoInput) {
28 return handleServiceCall(sendEchoInput);
32 protected OfHeader buildRequest(final Xid xid, final SendEchoInput input) {
33 final EchoInputBuilder echoInputOFJavaBuilder = new EchoInputBuilder();
34 echoInputOFJavaBuilder.setVersion(getVersion());
35 echoInputOFJavaBuilder.setXid(xid.getValue());
36 echoInputOFJavaBuilder.setData(input.getData());
37 return echoInputOFJavaBuilder.build();