2 * Copyright © 2024 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
8 package org.opendaylight.transportpce.renderer.rpcs;
10 import static java.util.Objects.requireNonNull;
12 import com.google.common.util.concurrent.ListenableFuture;
13 import java.util.concurrent.ExecutionException;
14 import org.opendaylight.transportpce.renderer.ModelMappingUtils;
15 import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
16 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDelete;
17 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteInput;
18 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteOutput;
19 import org.opendaylight.yangtools.yang.common.RpcResult;
20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory;
24 public class ServiceDeleteImpl implements ServiceDelete {
25 private static final Logger LOG = LoggerFactory.getLogger(ServiceDeleteImpl.class);
26 private final RendererServiceOperations rendererServiceOperations;
28 public ServiceDeleteImpl(final RendererServiceOperations rendererServiceOperations) {
29 this.rendererServiceOperations = requireNonNull(rendererServiceOperations);
33 public ListenableFuture<RpcResult<ServiceDeleteOutput>> invoke(ServiceDeleteInput input) {
34 String serviceName = input.getServiceName();
35 LOG.info("Calling RPC service delete request {}", serviceName);
36 ServiceDeleteOutput output = null;
38 output = this.rendererServiceOperations.serviceDelete(input, null).get();
39 } catch (InterruptedException | ExecutionException e) {
40 LOG.error("RPC service delete failed !", e);
41 Thread.currentThread().interrupt();
43 return ModelMappingUtils.createServiceDeleteRpcResponse(output);