- List<String> serviceName = null;
- if (input.getUuid() != null) {
- try {
- serviceName = getNameFromUuid(input.getUuid(), "Service");
- } catch (ExecutionException e) {
- LOG.error("Service {} to be deleted not found in the DataStore", e.getMessage());
- return RpcResultBuilder.<DeleteConnectivityServiceOutput>failed()
- .withError(ErrorType.RPC, "Failed to delete Service").buildFuture();
- } catch (NoSuchElementException e) {
- LOG.error("Service {} to be deleted not found in the DataStore", e.getMessage());
- return RpcResultBuilder.<DeleteConnectivityServiceOutput>failed()
- .withError(ErrorType.RPC, "Failed to delete Service").buildFuture();
- }
- LOG.debug("The service {}, of name {} has been found in the DS", input.getUuid().toString(), serviceName);
- try {
- Uuid serviceUuid = input.getUuid();
- this.tapiContext.deleteConnectivityService(serviceUuid);
- ListenableFuture<RpcResult<ServiceDeleteOutput>> output = rpcService.getRpc(ServiceDelete.class)
- .invoke(new ServiceDeleteInputBuilder()
- .setServiceDeleteReqInfo(
- new ServiceDeleteReqInfoBuilder().setServiceName(input.getUuid().getValue())
- .setTailRetention(ServiceDeleteReqInfo.TailRetention.No).build())
- .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("request-1")
- .setNotificationUrl("notification url").setRequestSystemId("appname")
- .setRpcAction(RpcActions.ServiceDelete).build())
- .build());
- RpcResult<ServiceDeleteOutput> rpcResult = output.get();
- if (!rpcResult.getResult().getConfigurationResponseCommon().getResponseCode()
- .equals(ResponseCodes.RESPONSE_FAILED)) {
- LOG.info("Service is being deleted and devices are being rolled back");
- return RpcResultBuilder.success(new DeleteConnectivityServiceOutputBuilder().build()).buildFuture();
- }
+ if (input.getUuid() == null) {
+ return RpcResultBuilder.<DeleteConnectivityServiceOutput>failed()
+ .withError(ErrorType.RPC, "Failed to delete Service, service uuid in input is null")
+ .buildFuture();
+ }
+ Uuid serviceUuid = input.getUuid();
+ List<String> serviceName;
+ try {
+ serviceName = getNameFromUuid(serviceUuid, "Service");
+ } catch (ExecutionException | NoSuchElementException e) {
+ LOG.error("Service {} to be deleted not found in the DataStore", serviceUuid, e);
+ return RpcResultBuilder.<DeleteConnectivityServiceOutput>failed()
+ .withError(ErrorType.RPC, "Failed to delete Service")
+ .buildFuture();
+ }
+ LOG.debug("The service {}, of name {} has been found in the DS", serviceUuid, serviceName);
+ try {
+ this.tapiContext.deleteConnectivityService(serviceUuid);
+ RpcResult<ServiceDeleteOutput> rpcResult =
+ rpcService.getRpc(ServiceDelete.class)
+ .invoke(new ServiceDeleteInputBuilder()
+ .setServiceDeleteReqInfo(new ServiceDeleteReqInfoBuilder()
+ .setServiceName(input.getUuid().getValue())
+ .setTailRetention(ServiceDeleteReqInfo.TailRetention.No)
+ .build())
+ .setSdncRequestHeader(new SdncRequestHeaderBuilder()
+ .setRequestId("request-1")
+ .setNotificationUrl("notification url")
+ .setRequestSystemId("appname")
+ .setRpcAction(RpcActions.ServiceDelete)
+ .build())
+ .build())
+ .get();
+ if (rpcResult.getResult().getConfigurationResponseCommon().getResponseCode()
+ .equals(ResponseCodes.RESPONSE_FAILED)) {