- return ModelMappingUtils.createDeleteServiceReply(input, ResponseCodes.FINAL_ACK_YES,
- "Service delete was successful!", ResponseCodes.RESPONSE_OK);
- }
-
- @Override
- public ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> serviceFeasibilityCheck(
- ServiceFeasibilityCheckInput input) {
- throw new UnsupportedOperationException("Not implemented yet");
- }
-
- @Override
- public ListenableFuture<RpcResult<ServiceReconfigureOutput>> serviceReconfigure(ServiceReconfigureInput input) {
- throw new UnsupportedOperationException("Not implemented yet");
- }
-
- @Override
- public ListenableFuture<RpcResult<ServiceRestorationOutput>> serviceRestoration(ServiceRestorationInput input) {
- throw new UnsupportedOperationException("Not implemented yet");
- }
-
- @Override
- public ListenableFuture<RpcResult<EquipmentNotificationOutput>>
- equipmentNotification(EquipmentNotificationInput input) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public ListenableFuture<RpcResult<ServiceRerouteConfirmOutput>>
- serviceRerouteConfirm(ServiceRerouteConfirmInput input) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public ListenableFuture<RpcResult<ServiceRerouteOutput>> serviceReroute(ServiceRerouteInput input) {
- LOG.info("RPC service reroute received");
- String message = "";
- try {
- Optional<Services> servicesObject = this.serviceDataStoreOperations.getService(input.getServiceName());
- if (servicesObject.isPresent()) {
- ServiceDeleteInputBuilder deleteInputBldr = new ServiceDeleteInputBuilder();
- DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
- OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
- DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime));
- deleteInputBldr.setServiceDeleteReqInfo(new ServiceDeleteReqInfoBuilder()
- .setServiceName(input.getServiceName()).setDueDate(datetime)
- .setTailRetention(TailRetention.No).build());
- SdncRequestHeaderBuilder sdncBuilder = new SdncRequestHeaderBuilder();
- sdncBuilder.setNotificationUrl(servicesObject.get().getSdncRequestHeader().getNotificationUrl());
- sdncBuilder.setRequestId(servicesObject.get().getSdncRequestHeader().getRequestId());
- sdncBuilder.setRequestSystemId(servicesObject.get().getSdncRequestHeader().getRequestSystemId());
- sdncBuilder.setRpcAction(RpcActions.ServiceDelete);
- deleteInputBldr.setSdncRequestHeader(sdncBuilder.build());
- // Calling delete service
- ServiceDeleteOutput serviceDeleteOutput = serviceDelete(deleteInputBldr.build()).get().getResult();
- // Calling create request now
- if (!ResponseCodes.RESPONSE_OK
- .equals(serviceDeleteOutput.getConfigurationResponseCommon().getResponseCode())) {
- message = "Service delete failed!";
- return ModelMappingUtils.createRerouteServiceReply(input, ResponseCodes.FINAL_ACK_YES,
- message, RpcStatus.Failed);
- }
- ServiceCreateInputBuilder serviceCreateBldr = new ServiceCreateInputBuilder();
- serviceCreateBldr.setServiceName(input.getServiceName() + 2);
- serviceCreateBldr.setCommonId(servicesObject.get().getCommonId());
- serviceCreateBldr.setConnectionType(servicesObject.get().getConnectionType());
- serviceCreateBldr.setCustomer(servicesObject.get().getCustomer());
- serviceCreateBldr.setCustomerContact(servicesObject.get().getCustomerContact());
- serviceCreateBldr.setDueDate(servicesObject.get().getDueDate());
- serviceCreateBldr.setEndDate(servicesObject.get().getEndDate());
- serviceCreateBldr.setHardConstraints(servicesObject.get().getHardConstraints());
- serviceCreateBldr.setNcCode(servicesObject.get().getNcCode());
- serviceCreateBldr.setNciCode(servicesObject.get().getNciCode());
- serviceCreateBldr.setOperatorContact(servicesObject.get().getOperatorContact());
- serviceCreateBldr.setSdncRequestHeader(servicesObject.get().getSdncRequestHeader());
- serviceCreateBldr.setSecondaryNciCode(servicesObject.get().getSecondaryNciCode());
- ServiceAEndBuilder serviceAendBuilder = new ServiceAEndBuilder(servicesObject.get().getServiceAEnd());
- serviceCreateBldr.setServiceAEnd(serviceAendBuilder.build());
- ServiceZEndBuilder serviceZendBuilder = new ServiceZEndBuilder(servicesObject.get().getServiceZEnd());
- serviceCreateBldr.setServiceZEnd(serviceZendBuilder.build());
- serviceCreateBldr.setSoftConstraints(servicesObject.get().getSoftConstraints());
- ServiceCreateOutput serviceCreateOutput = serviceCreate(serviceCreateBldr.build()).get().getResult();
- if (!ResponseCodes.RESPONSE_OK
- .equals(serviceCreateOutput.getConfigurationResponseCommon().getResponseCode())) {
- message = "Service create failed!";
- return ModelMappingUtils.createRerouteServiceReply(input, ResponseCodes.FINAL_ACK_YES,
- message, RpcStatus.Failed);
- }
- ServiceRerouteOutputBuilder output = new ServiceRerouteOutputBuilder()
- .setHardConstraints(null).setSoftConstraints(null).setStatus(
- org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.RpcStatus.Successful)
- .setStatusMessage("Service reroute successfully !");
- return RpcResultBuilder.success(output).buildFuture();
- } else {
- LOG.error("Service '{}' is not present", input.getServiceName());
- message = "Service '" + input.getServiceName() + "' is not present";
- }
- } catch (InterruptedException | ExecutionException e) {
- LOG.info("Exception caught" , e);