Modify spectrum assignment management in PCE
[transportpce.git] / servicehandler / src / main / java / org / opendaylight / transportpce / servicehandler / impl / ServicehandlerImpl.java
index 15c90048cfbed7a22a0e01959765baeb63c70a4d..07b1bcd73513315bd15fbee79af93bd172600574 100644 (file)
@@ -30,7 +30,7 @@ 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.opendaylight.transportpce.pce.rev210701.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;
@@ -178,17 +178,6 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService {
                     input, ResponseCodes.FINAL_ACK_YES,
                     validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
         }
-        PublishNotificationService nbiNotification = new PublishNotificationServiceBuilder()
-                .setServiceName(input.getServiceName())
-                .setServiceAEnd(new ServiceAEndBuilder(input.getServiceAEnd()).build())
-                .setServiceZEnd(new ServiceZEndBuilder(input.getServiceZEnd()).build())
-                .setCommonId(input.getCommonId()).setConnectionType(input.getConnectionType())
-                .setResponseFailed("")
-                .setMessage("ServiceCreate request received ...")
-                .setOperationalState(State.OutOfService)
-                .setTopic(topic)
-                .build();
-        sendNbiNotification(nbiNotification);
         this.pceListenerImpl.setInput(new ServiceInput(input));
         this.pceListenerImpl.setServiceReconfigure(false);
         this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
@@ -199,12 +188,15 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService {
         PathComputationRequestOutput output = this.pceServiceWrapper.performPCE(input, true);
         if (output == null) {
             LOG.warn(SERVICE_CREATE_MSG, LogMessages.ABORT_PCE_FAILED);
-            nbiNotification = new PublishNotificationServiceBuilder(nbiNotification)
+            sendNbiNotification(new PublishNotificationServiceBuilder()
+                    .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)
-                    .build();
-            sendNbiNotification(nbiNotification);
+                    .build());
             return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
                     LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
         }
@@ -245,17 +237,6 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService {
                     LogMessages.serviceNotInDS(serviceName), ResponseCodes.RESPONSE_FAILED);
         }
         service = serviceOpt.get();
-        PublishNotificationService nbiNotification = new PublishNotificationServiceBuilder()
-                .setServiceName(service.getServiceName())
-                .setServiceAEnd(new ServiceAEndBuilder(service.getServiceAEnd()).build())
-                .setServiceZEnd(new ServiceZEndBuilder(service.getServiceZEnd()).build())
-                .setCommonId(service.getCommonId()).setConnectionType(service.getConnectionType())
-                .setMessage("ServiceDelete request received ...")
-                .setOperationalState(State.OutOfService)
-                .setResponseFailed("")
-                .setTopic(topic)
-                .build();
-        sendNbiNotification(nbiNotification);
         LOG.debug("serviceDelete: Service '{}' found in datastore", serviceName);
         this.pceListenerImpl.setInput(new ServiceInput(input));
         this.pceListenerImpl.setServiceReconfigure(false);
@@ -272,12 +253,15 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService {
 
         if (output == null) {
             LOG.error(SERVICE_DELETE_MSG, LogMessages.RENDERER_DELETE_FAILED);
-            nbiNotification = new PublishNotificationServiceBuilder(nbiNotification)
-                    .setMessage("ServiceCreate request failed ...")
-                    .setOperationalState(State.OutOfService)
-                    .setResponseFailed(LogMessages.ABORT_PCE_FAILED)
-                    .build();
-            sendNbiNotification(nbiNotification);
+            sendNbiNotification(new PublishNotificationServiceBuilder()
+                    .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)
+                    .build());
             return ModelMappingUtils.createDeleteServiceReply(
                     input, ResponseCodes.FINAL_ACK_YES,
                     LogMessages.RENDERER_DELETE_FAILED, ResponseCodes.RESPONSE_FAILED);