X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=servicehandler%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Fservicehandler%2Fimpl%2FServicehandlerImpl.java;h=4f1e5c63cc05e6eac6acd9ece60ee51b8a5b3077;hb=9ab0cabbeeddeac5ab2bcfa7cb4a3f79f81a5c88;hp=ce05db6003cd3ef1f6d52b5d4be9dedf77d23e75;hpb=72826480c3a0652614835b0e13b3efce5d3bfc3e;p=transportpce.git diff --git a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerImpl.java b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerImpl.java index ce05db600..4f1e5c63c 100644 --- a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerImpl.java +++ b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerImpl.java @@ -30,56 +30,85 @@ import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOper import org.opendaylight.transportpce.servicehandler.validation.ServiceCreateValidation; import org.opendaylight.transportpce.servicehandler.validation.checks.ComplianceCheckResult; import org.opendaylight.transportpce.servicehandler.validation.checks.ServicehandlerComplianceCheck; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.PathComputationRequestOutput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.RpcActions; -import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.ServiceNotificationTypes; -import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.configuration.response.common.ConfigurationResponseCommon; -import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.sdnc.request.header.SdncRequestHeaderBuilder; -import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev181130.State; -import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev190531.RpcStatus; -import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.routing.constraints.HardConstraints; -import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.routing.constraints.SoftConstraints; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.EquipmentNotificationInput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.EquipmentNotificationOutput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.NetworkReOptimizationInput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.NetworkReOptimizationOutput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.OrgOpenroadmServiceService; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateComplexResultNotificationRequestInput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateComplexResultNotificationRequestOutput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateInput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateOutput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateResultNotificationRequestInput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateResultNotificationRequestOutput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceDeleteComplexResultNotificationRequestInput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceDeleteComplexResultNotificationRequestOutput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceDeleteInput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceDeleteInputBuilder; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceDeleteOutput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceDeleteResultNotificationRequestInput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceDeleteResultNotificationRequestOutput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceFeasibilityCheckBulkInput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceFeasibilityCheckBulkOutput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceFeasibilityCheckInput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceFeasibilityCheckOutput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceReconfigureInput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceReconfigureOutput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRerouteConfirmInput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRerouteConfirmOutput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRerouteInput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRerouteOutput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRestorationInput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRestorationOutput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceReversionInput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceReversionOutput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRollInput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceRollOutput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceCreateInput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceCreateOutput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceDeleteInput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceDeleteOutput; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.delete.input.ServiceDeleteReqInfo.TailRetention; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.delete.input.ServiceDeleteReqInfoBuilder; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.Services; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220615.PathComputationRequestOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.RpcActions; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.ServiceNotificationTypes; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.configuration.response.common.ConfigurationResponseCommon; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.sdnc.request.header.SdncRequestHeaderBuilder; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State; +import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.routing.constraints.HardConstraints; +import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.routing.constraints.SoftConstraints; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.AddOpenroadmOperationalModesToCatalogInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.AddOpenroadmOperationalModesToCatalogOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.AddSpecificOperationalModesToCatalogInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.AddSpecificOperationalModesToCatalogOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.EquipmentNotificationInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.EquipmentNotificationOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.NetworkReOptimizationInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.NetworkReOptimizationOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.OpticalTunnelCreateInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.OpticalTunnelCreateOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.OpticalTunnelRequestCancelInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.OpticalTunnelRequestCancelOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.OrgOpenroadmServiceService; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateBulkInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateBulkOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateComplexResultNotificationRequestInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateComplexResultNotificationRequestOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateResultNotificationRequestInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateResultNotificationRequestOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceDeleteComplexResultNotificationRequestInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceDeleteComplexResultNotificationRequestOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceDeleteInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceDeleteInputBuilder; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceDeleteOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceDeleteResultNotificationRequestInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceDeleteResultNotificationRequestOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceFeasibilityCheckBulkInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceFeasibilityCheckBulkOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceFeasibilityCheckInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceFeasibilityCheckOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceReconfigureBulkInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceReconfigureBulkOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceReconfigureInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceReconfigureOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceReconfigureResultNotificationRequestInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceReconfigureResultNotificationRequestOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRerouteConfirmInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRerouteConfirmOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRerouteConfirmResultNotificationRequestInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRerouteConfirmResultNotificationRequestOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRerouteInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRerouteOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRestorationInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRestorationOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRestorationResultNotificationRequestInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRestorationResultNotificationRequestOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceReversionInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceReversionOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceReversionResultNotificationRequestInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceReversionResultNotificationRequestOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRollInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRollOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRollResultNotificationRequestInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceRollResultNotificationRequestOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceSrlgGetInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceSrlgGetOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.TempServiceCreateBulkInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.TempServiceCreateBulkOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.TempServiceCreateInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.TempServiceCreateOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.TempServiceDeleteInput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.TempServiceDeleteOutput; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.delete.input.ServiceDeleteReqInfo.TailRetention; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.delete.input.ServiceDeleteReqInfoBuilder; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.list.Services; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessServiceBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceAEndBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceZEndBuilder; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; import org.opendaylight.yangtools.yang.common.RpcResult; import org.slf4j.Logger; @@ -91,11 +120,12 @@ import org.slf4j.LoggerFactory; */ public class ServicehandlerImpl implements OrgOpenroadmServiceService { private static final Logger LOG = LoggerFactory.getLogger(ServicehandlerImpl.class); + private static final String PUBLISHER = "ServiceHandler"; private static final String TEMP_SERVICE_CREATE_MSG = "tempServiceCreate: {}"; private static final String TEMP_SERVICE_DELETE_MSG = "tempServiceDelete: {}"; private static final String SERVICE_RESTORATION_MSG = "serviceRestoration: {}"; private static final String SERVICE_RECONFIGURE_MSG = "serviceReconfigure: {}"; - private static final String SERVICE_FEASABILITY_CHECK_MSG = "serviceFeasabilityCheck: {}"; + private static final String SERVICE_FEASIBILITY_CHECK_MSG = "serviceFeasibilityCheck: {}"; private static final String SERVICE_DELETE_MSG = "serviceDelete: {}"; private static final String SERVICE_CREATE_MSG = "serviceCreate: {}"; @@ -106,6 +136,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService { private PceListenerImpl pceListenerImpl; private RendererListenerImpl rendererListenerImpl; private NetworkModelListenerImpl networkModelListenerImpl; + private NotificationPublishService notificationPublishService; //TODO: remove private request fields as they are in global scope @@ -120,6 +151,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService { this.pceListenerImpl = pceListenerImpl; this.rendererListenerImpl = rendererListenerImpl; this.networkModelListenerImpl = networkModelListenerImpl; + this.notificationPublishService = notificationPublishService; } @@ -179,6 +211,17 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService { PathComputationRequestOutput output = this.pceServiceWrapper.performPCE(input, true); if (output == null) { LOG.warn(SERVICE_CREATE_MSG, LogMessages.ABORT_PCE_FAILED); + sendNbiNotification(new PublishNotificationProcessServiceBuilder() + .setServiceName(input.getServiceName()) + .setServiceAEnd(new ServiceAEndBuilder(input.getServiceAEnd()).build()) + .setServiceZEnd(new ServiceZEndBuilder(input.getServiceZEnd()).build()) + .setCommonId(input.getCommonId()) + .setConnectionType(input.getConnectionType()) + .setResponseFailed(LogMessages.ABORT_PCE_FAILED) + .setMessage("ServiceCreate request failed ...") + .setOperationalState(State.Degraded) + .setPublisherName(PUBLISHER) + .build()); return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES, LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED); } @@ -212,7 +255,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService { //Check presence of service to be deleted Optional serviceOpt = this.serviceDataStoreOperations.getService(serviceName); Services service; - if (!serviceOpt.isPresent()) { + if (serviceOpt.isEmpty()) { LOG.warn(SERVICE_DELETE_MSG, LogMessages.serviceNotInDS(serviceName)); return ModelMappingUtils.createDeleteServiceReply( input, ResponseCodes.FINAL_ACK_YES, @@ -226,15 +269,25 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService { this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations); this.rendererListenerImpl.setServiceInput(new ServiceInput(input)); this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations); - org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev201125 - .ServiceDeleteInput serviceDeleteInput = - ModelMappingUtils.createServiceDeleteInput(new ServiceInput(input)); - org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev201125.ServiceDeleteOutput output = + org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteInput + serviceDeleteInput = ModelMappingUtils.createServiceDeleteInput(new ServiceInput(input)); + org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteOutput output = this.rendererServiceWrapper.performRenderer( serviceDeleteInput, ServiceNotificationTypes.ServiceDeleteResult, service); if (output == null) { LOG.error(SERVICE_DELETE_MSG, LogMessages.RENDERER_DELETE_FAILED); + sendNbiNotification(new PublishNotificationProcessServiceBuilder() + .setServiceName(service.getServiceName()) + .setServiceAEnd(new ServiceAEndBuilder(service.getServiceAEnd()).build()) + .setServiceZEnd(new ServiceZEndBuilder(service.getServiceZEnd()).build()) + .setCommonId(service.getCommonId()) + .setConnectionType(service.getConnectionType()) + .setMessage("ServiceDelete request failed ...") + .setOperationalState(State.InService) + .setResponseFailed(LogMessages.RENDERER_DELETE_FAILED) + .setPublisherName(PUBLISHER) + .build()); return ModelMappingUtils.createDeleteServiceReply( input, ResponseCodes.FINAL_ACK_YES, LogMessages.RENDERER_DELETE_FAILED, ResponseCodes.RESPONSE_FAILED); @@ -256,7 +309,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService { OperationResult validationResult = ServiceCreateValidation.validateServiceCreateRequest(serviceInput, RpcActions.ServiceFeasibilityCheck); if (! validationResult.isSuccess()) { - LOG.warn(SERVICE_FEASABILITY_CHECK_MSG, LogMessages.ABORT_VALID_FAILED); + LOG.warn(SERVICE_FEASIBILITY_CHECK_MSG, LogMessages.ABORT_VALID_FAILED); return ModelMappingUtils.createCreateServiceReply( input, ResponseCodes.FINAL_ACK_YES, validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED); @@ -268,10 +321,10 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService { this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations); this.rendererListenerImpl.setServiceInput(new ServiceInput(input)); this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations); - LOG.debug(SERVICE_FEASABILITY_CHECK_MSG, LogMessages.PCE_CALLING); + LOG.debug(SERVICE_FEASIBILITY_CHECK_MSG, LogMessages.PCE_CALLING); PathComputationRequestOutput output = this.pceServiceWrapper.performPCE(input, true); if (output == null) { - LOG.warn(SERVICE_FEASABILITY_CHECK_MSG, LogMessages.ABORT_PCE_FAILED); + LOG.warn(SERVICE_FEASIBILITY_CHECK_MSG, LogMessages.ABORT_PCE_FAILED); return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES, LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED); } @@ -287,11 +340,11 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService { String serviceName = input.getServiceName(); LOG.info("RPC serviceReconfigure received for {}", serviceName); Optional servicesObject = this.serviceDataStoreOperations.getService(serviceName); - if (!servicesObject.isPresent()) { + if (servicesObject.isEmpty()) { LOG.warn(SERVICE_RECONFIGURE_MSG, LogMessages.serviceNotInDS(serviceName)); return ModelMappingUtils.createCreateServiceReply( input, - LogMessages.serviceNotInDS(serviceName), RpcStatus.Failed); + LogMessages.serviceNotInDS(serviceName)); } LOG.debug("Service '{}' found in datastore", serviceName); OperationResult validationResult = ServiceCreateValidation @@ -300,7 +353,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService { LOG.warn(SERVICE_RECONFIGURE_MSG, LogMessages.ABORT_VALID_FAILED); return ModelMappingUtils.createCreateServiceReply( input, - validationResult.getResultMessage(), RpcStatus.Failed); + validationResult.getResultMessage()); } this.pceListenerImpl.setInput(new ServiceInput(input)); this.pceListenerImpl.setServiceReconfigure(true); @@ -308,24 +361,24 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService { this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations); this.rendererListenerImpl.setServiceInput(new ServiceInput(input)); this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations); - org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev201125 + org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915 .ServiceDeleteInput serviceDeleteInput = ModelMappingUtils.createServiceDeleteInput(new ServiceInput(input)); - org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev201125 + org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915 .ServiceDeleteOutput output = this.rendererServiceWrapper.performRenderer(serviceDeleteInput, ServiceNotificationTypes.ServiceDeleteResult, null); if (output == null) { LOG.error(SERVICE_RECONFIGURE_MSG, LogMessages.RENDERER_DELETE_FAILED); return ModelMappingUtils.createCreateServiceReply( input, - LogMessages.RENDERER_DELETE_FAILED, RpcStatus.Successful); + LogMessages.RENDERER_DELETE_FAILED); //TODO check if RpcStatus.Successful is really expected here } LOG.info("RPC serviceReconfigure in progress..."); ConfigurationResponseCommon common = output.getConfigurationResponseCommon(); return ModelMappingUtils.createCreateServiceReply( input, - common.getResponseMessage(), RpcStatus.Successful); + common.getResponseMessage()); } @Override @@ -337,7 +390,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService { if (!servicesObject.isPresent()) { LOG.warn(SERVICE_RESTORATION_MSG, LogMessages.serviceNotInDS(serviceName)); return ModelMappingUtils.createRestoreServiceReply( - LogMessages.serviceNotInDS(serviceName), RpcStatus.Failed); + LogMessages.serviceNotInDS(serviceName)); } Services service = servicesObject.get(); @@ -346,7 +399,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService { if (state == State.InService) { LOG.error(SERVICE_RESTORATION_MSG, LogMessages.serviceInService(serviceName)); return ModelMappingUtils.createRestoreServiceReply( - LogMessages.serviceInService(serviceName), RpcStatus.Failed); + LogMessages.serviceInService(serviceName)); } DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx"); @@ -375,13 +428,12 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService { if (softConstraints == null) { LOG.warn("service '{}' SoftConstraints is not set !", serviceName); serviceInput.setSoftConstraints(DowngradeConstraints.convertToSoftConstraints(hardConstraints)); - serviceInput.setHardConstraints(DowngradeConstraints.downgradeHardConstraints(hardConstraints)); } else { LOG.info("converting hard constraints to soft constraints ..."); serviceInput.setSoftConstraints( DowngradeConstraints.updateSoftConstraints(hardConstraints, softConstraints)); - serviceInput.setHardConstraints(DowngradeConstraints.downgradeHardConstraints(hardConstraints)); } + serviceInput.setHardConstraints(DowngradeConstraints.downgradeHardConstraints(hardConstraints)); } this.pceListenerImpl.setInput(serviceInput); this.pceListenerImpl.setServiceReconfigure(true); @@ -389,21 +441,19 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService { this.rendererListenerImpl.setServiceInput(serviceInput); this.rendererListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations); this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations); - org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev201125 + org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915 .ServiceDeleteInput serviceDeleteInput = ModelMappingUtils.createServiceDeleteInput( new ServiceInput(deleteInputBldr.build())); - org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev201125 + org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915 .ServiceDeleteOutput output = this.rendererServiceWrapper.performRenderer(serviceDeleteInput, ServiceNotificationTypes.ServiceDeleteResult, null); if (output == null) { LOG.error(SERVICE_RESTORATION_MSG, LogMessages.RENDERER_DELETE_FAILED); - return ModelMappingUtils.createRestoreServiceReply( - LogMessages.RENDERER_DELETE_FAILED, RpcStatus.Failed); + return ModelMappingUtils.createRestoreServiceReply(LogMessages.RENDERER_DELETE_FAILED); } LOG.info("RPC serviceRestore in progress..."); ConfigurationResponseCommon common = output.getConfigurationResponseCommon(); - return ModelMappingUtils.createRestoreServiceReply( - common.getResponseMessage(), RpcStatus.Successful); + return ModelMappingUtils.createRestoreServiceReply(common.getResponseMessage()); } @@ -426,11 +476,11 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService { String serviceName = input.getServiceName(); LOG.info("RPC serviceReroute received for {}", serviceName); Optional servicesObject = this.serviceDataStoreOperations.getService(serviceName); - if (!servicesObject.isPresent()) { + if (servicesObject.isEmpty()) { LOG.warn("serviceReroute: {}", LogMessages.serviceNotInDS(serviceName)); return ModelMappingUtils.createRerouteServiceReply( input, ResponseCodes.FINAL_ACK_NO, - LogMessages.serviceNotInDS(serviceName), RpcStatus.Failed); + LogMessages.serviceNotInDS(serviceName)); } Services service = servicesObject.get(); DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx"); @@ -456,23 +506,23 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService { this.rendererListenerImpl.setServiceInput(serviceInput); this.rendererListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations); this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations); - org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev201125 + org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915 .ServiceDeleteInput serviceDeleteInput = ModelMappingUtils.createServiceDeleteInput( new ServiceInput(deleteInputBldr.build())); - org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev201125 + org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915 .ServiceDeleteOutput output = this.rendererServiceWrapper.performRenderer(serviceDeleteInput, ServiceNotificationTypes.ServiceDeleteResult, null); if (output == null) { LOG.error("serviceReroute: {}", LogMessages.RENDERER_DELETE_FAILED); return ModelMappingUtils.createRerouteServiceReply( input, ResponseCodes.FINAL_ACK_YES, - LogMessages.RENDERER_DELETE_FAILED, RpcStatus.Failed); + LogMessages.RENDERER_DELETE_FAILED); } LOG.info("RPC ServiceReroute in progress..."); ConfigurationResponseCommon common = output.getConfigurationResponseCommon(); return ModelMappingUtils.createRerouteServiceReply( input, common.getAckFinalIndicator(), - common.getResponseMessage(), RpcStatus.Successful); + common.getResponseMessage()); } @Override @@ -501,7 +551,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService { /* * Upon receipt of service-deleteService RPC, service header and sdnc-request - * header compliancy are verified. + * header compliance are verified. */ LOG.debug("checking Service Compliance ..."); ComplianceCheckResult serviceHandlerCheckResult = ServicehandlerComplianceCheck.check( @@ -516,10 +566,10 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService { //Check presence of service to be deleted LOG.debug("service common-id '{}' is compliant", commonId); - Optional + Optional service = this.serviceDataStoreOperations.getTempService(commonId); - if (!service.isPresent()) { + if (service.isEmpty()) { LOG.error(TEMP_SERVICE_DELETE_MSG, LogMessages.serviceNotInDS(commonId)); return ModelMappingUtils.createDeleteServiceReply( input, ResponseCodes.FINAL_ACK_YES, @@ -534,7 +584,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService { this.rendererListenerImpl.setServiceInput(new ServiceInput(input)); this.rendererListenerImpl.setTempService(true); this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations); - org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev201125.ServiceDeleteOutput output = + org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteOutput output = this.rendererServiceWrapper.performRenderer(input, ServiceNotificationTypes.ServiceDeleteResult); if (output == null) { LOG.error(TEMP_SERVICE_DELETE_MSG, LogMessages.RENDERER_DELETE_FAILED); @@ -625,4 +675,105 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService { return null; } + /** + * Send notification to NBI notification in order to publish message. + * @param service PublishNotificationService + */ + private void sendNbiNotification(PublishNotificationProcessService service) { + try { + notificationPublishService.putNotification(service); + } catch (InterruptedException e) { + LOG.warn("Cannot send notification to nbi", e); + Thread.currentThread().interrupt(); + } + } + + + @Override + public ListenableFuture> serviceCreateBulk(ServiceCreateBulkInput input) { + // TODO Auto-generated method stub + return null; + } + + @Override + public ListenableFuture> tempServiceCreateBulk( + TempServiceCreateBulkInput input) { + // TODO Auto-generated method stub + return null; + } + + @Override + public ListenableFuture> serviceRollResultNotificationRequest( + ServiceRollResultNotificationRequestInput input) { + // TODO Auto-generated method stub + return null; + } + + @Override + public ListenableFuture> serviceReconfigureBulk( + ServiceReconfigureBulkInput input) { + // TODO Auto-generated method stub + return null; + } + + @Override + public ListenableFuture> + serviceReconfigureResultNotificationRequest(ServiceReconfigureResultNotificationRequestInput input) { + // TODO Auto-generated method stub + return null; + } + + @Override + public ListenableFuture> + serviceRestorationResultNotificationRequest(ServiceRestorationResultNotificationRequestInput input) { + // TODO Auto-generated method stub + return null; + } + + @Override + public ListenableFuture> + serviceReversionResultNotificationRequest(ServiceReversionResultNotificationRequestInput input) { + // TODO Auto-generated method stub + return null; + } + + @Override + public ListenableFuture> + serviceRerouteConfirmResultNotificationRequest(ServiceRerouteConfirmResultNotificationRequestInput input) { + // TODO Auto-generated method stub + return null; + } + + @Override + public ListenableFuture> opticalTunnelCreate(OpticalTunnelCreateInput input) { + // TODO Auto-generated method stub + return null; + } + + @Override + public ListenableFuture> opticalTunnelRequestCancel( + OpticalTunnelRequestCancelInput input) { + // TODO Auto-generated method stub + return null; + } + + @Override + public ListenableFuture> + addOpenroadmOperationalModesToCatalog(AddOpenroadmOperationalModesToCatalogInput input) { + // TODO Auto-generated method stub + return null; + } + + @Override + public ListenableFuture> addSpecificOperationalModesToCatalog( + AddSpecificOperationalModesToCatalogInput input) { + // TODO Auto-generated method stub + return null; + } + + @Override + public ListenableFuture> serviceSrlgGet(ServiceSrlgGetInput input) { + // TODO Auto-generated method stub + return null; + } }