2 * Copyright © 2017 Orange, 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
10 package org.opendaylight.transportpce.servicehandler.stub;
12 import com.google.common.util.concurrent.ListenableFuture;
13 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceDeleteInput;
14 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceDeleteOutput;
15 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceDeleteOutputBuilder;
16 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceImplementationRequestInput;
17 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceImplementationRequestOutput;
18 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceImplementationRequestOutputBuilder;
19 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.configuration.response.common.ConfigurationResponseCommonBuilder;
20 import org.opendaylight.yangtools.yang.common.RpcResult;
21 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
22 import org.slf4j.Logger;
23 import org.slf4j.LoggerFactory;
28 * Class to implement StubrendererService.
29 * @author Martial Coulibaly ( martial.coulibaly@gfi.com ) on behalf of Orange
32 public final class StubrendererImpl {
34 private static final Logger LOG = LoggerFactory.getLogger(StubrendererImpl.class);
35 /** check service sdnc-request-header compliancy. */
37 private StubrendererImpl() {
42 public static ListenableFuture<RpcResult<ServiceDeleteOutput>> serviceDelete(ServiceDeleteInput input) {
43 LOG.info("ServiceDelete request ...");
45 String responseCode = null;
47 LOG.info("Wait for 1s til beginning the Renderer serviceDelete request");
48 Thread.sleep(1000); //sleep for 1s
49 } catch (InterruptedException e) {
50 message = "deleting service failed !";
51 LOG.error("deleting service failed !", e);
54 ConfigurationResponseCommonBuilder configurationResponseCommon = new ConfigurationResponseCommonBuilder()
55 .setAckFinalIndicator("yes")
56 .setRequestId(input.getServiceHandlerHeader().getRequestId())
57 .setResponseCode(responseCode)
58 .setResponseMessage(message);
59 ServiceDeleteOutput output = new ServiceDeleteOutputBuilder()
60 .setConfigurationResponseCommon(configurationResponseCommon.build())
62 return RpcResultBuilder.success(output).buildFuture();
65 public static ListenableFuture<RpcResult<ServiceImplementationRequestOutput>>
66 serviceImplementation(ServiceImplementationRequestInput input) {
67 LOG.info("serviceImplementation request ...");
69 String responseCode = null;
71 LOG.info("Wait for 1s til beginning the Renderer serviceDelete request");
72 Thread.sleep(1000); //sleep for 1s
73 } catch (InterruptedException e) {
74 message = "implementing service failed !";
78 ConfigurationResponseCommonBuilder configurationResponseCommon = new ConfigurationResponseCommonBuilder()
79 .setAckFinalIndicator("yes")
80 .setRequestId(input.getServiceHandlerHeader().getRequestId())
81 .setResponseCode(responseCode)
82 .setResponseMessage(message);
83 ServiceImplementationRequestOutput output = new ServiceImplementationRequestOutputBuilder()
84 .setConfigurationResponseCommon(configurationResponseCommon.build())
86 return RpcResultBuilder.success(output).buildFuture();