d502e818e98ddd051b7da54c6841023eb1bcbe58
[transportpce.git] / servicehandler / src / main / java / org / opendaylight / transportpce / servicehandler / impl / ServicehandlerImpl.java
1 /*
2  * Copyright © 2017 Orange, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.transportpce.servicehandler.impl;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11 import java.time.OffsetDateTime;
12 import java.time.ZoneOffset;
13 import java.time.format.DateTimeFormatter;
14 import java.util.Map;
15 import java.util.Optional;
16 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
17 import org.opendaylight.transportpce.common.OperationResult;
18 import org.opendaylight.transportpce.common.ResponseCodes;
19 import org.opendaylight.transportpce.pce.service.PathComputationService;
20 import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
21 import org.opendaylight.transportpce.servicehandler.CatalogInput;
22 import org.opendaylight.transportpce.servicehandler.DowngradeConstraints;
23 import org.opendaylight.transportpce.servicehandler.ModelMappingUtils;
24 import org.opendaylight.transportpce.servicehandler.ServiceInput;
25 import org.opendaylight.transportpce.servicehandler.catalog.CatalogDataStoreOperations;
26 import org.opendaylight.transportpce.servicehandler.catalog.CatalogMapper;
27 import org.opendaylight.transportpce.servicehandler.listeners.NetworkListener;
28 import org.opendaylight.transportpce.servicehandler.listeners.PceListener;
29 import org.opendaylight.transportpce.servicehandler.listeners.RendererListener;
30 import org.opendaylight.transportpce.servicehandler.service.PCEServiceWrapper;
31 import org.opendaylight.transportpce.servicehandler.service.RendererServiceWrapper;
32 import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations;
33 import org.opendaylight.transportpce.servicehandler.validation.CatalogValidation;
34 import org.opendaylight.transportpce.servicehandler.validation.ServiceCreateValidation;
35 import org.opendaylight.transportpce.servicehandler.validation.checks.ComplianceCheckResult;
36 import org.opendaylight.transportpce.servicehandler.validation.checks.ServicehandlerComplianceCheck;
37 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.PathComputationRequestOutput;
38 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.PathComputationRerouteRequestOutput;
39 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.path.computation.reroute.request.input.EndpointsBuilder;
40 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.RpcActions;
41 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.ServiceNotificationTypes;
42 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.configuration.response.common.ConfigurationResponseCommon;
43 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.sdnc.request.header.SdncRequestHeaderBuilder;
44 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State;
45 import org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev230526.operational.mode.catalog.OpenroadmOperationalModes;
46 import org.opendaylight.yang.gen.v1.http.org.openroadm.operational.mode.catalog.rev230526.operational.mode.catalog.SpecificOperationalModes;
47 import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.routing.constraints.HardConstraints;
48 import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev221209.routing.constraints.SoftConstraints;
49 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.AddOpenroadmOperationalModesToCatalogInput;
50 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.AddOpenroadmOperationalModesToCatalogOutput;
51 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.AddSpecificOperationalModesToCatalogInput;
52 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.AddSpecificOperationalModesToCatalogOutput;
53 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.EndTerminalActivationRequestInput;
54 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.EndTerminalActivationRequestOutput;
55 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.EndTerminalDeactivationRequestInput;
56 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.EndTerminalDeactivationRequestOutput;
57 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.EndTerminalPerformanceInfoRequestInput;
58 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.EndTerminalPerformanceInfoRequestOutput;
59 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.EndTerminalPowerControlInput;
60 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.EndTerminalPowerControlOutput;
61 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.EquipmentNotificationInput;
62 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.EquipmentNotificationOutput;
63 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.NetworkReOptimizationInput;
64 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.NetworkReOptimizationOutput;
65 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.OpticalTunnelCreateInput;
66 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.OpticalTunnelCreateOutput;
67 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.OpticalTunnelRequestCancelInput;
68 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.OpticalTunnelRequestCancelOutput;
69 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.OrgOpenroadmServiceService;
70 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceCreateBulkInput;
71 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceCreateBulkOutput;
72 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceCreateComplexResultNotificationRequestInput;
73 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceCreateComplexResultNotificationRequestOutput;
74 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceCreateInput;
75 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceCreateOutput;
76 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceCreateResultNotificationRequestInput;
77 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceCreateResultNotificationRequestOutput;
78 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceDeleteComplexResultNotificationRequestInput;
79 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceDeleteComplexResultNotificationRequestOutput;
80 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceDeleteInput;
81 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceDeleteInputBuilder;
82 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceDeleteOutput;
83 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceDeleteResultNotificationRequestInput;
84 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceDeleteResultNotificationRequestOutput;
85 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceFeasibilityCheckBulkInput;
86 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceFeasibilityCheckBulkOutput;
87 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceFeasibilityCheckInput;
88 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceFeasibilityCheckOutput;
89 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceReconfigureBulkInput;
90 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceReconfigureBulkOutput;
91 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceReconfigureInput;
92 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceReconfigureOutput;
93 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceReconfigureResultNotificationRequestInput;
94 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceReconfigureResultNotificationRequestOutput;
95 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRerouteConfirmInput;
96 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRerouteConfirmOutput;
97 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRerouteConfirmResultNotificationRequestInput;
98 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRerouteConfirmResultNotificationRequestOutput;
99 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRerouteInput;
100 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRerouteOutput;
101 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRestorationInput;
102 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRestorationOutput;
103 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRestorationResultNotificationRequestInput;
104 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRestorationResultNotificationRequestOutput;
105 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceReversionInput;
106 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceReversionOutput;
107 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceReversionResultNotificationRequestInput;
108 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceReversionResultNotificationRequestOutput;
109 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRollInput;
110 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRollOutput;
111 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRollResultNotificationRequestInput;
112 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceRollResultNotificationRequestOutput;
113 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceSrlgGetInput;
114 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.ServiceSrlgGetOutput;
115 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.TempServiceCreateBulkInput;
116 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.TempServiceCreateBulkOutput;
117 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.TempServiceCreateInput;
118 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.TempServiceCreateOutput;
119 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.TempServiceDeleteInput;
120 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.TempServiceDeleteOutput;
121 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.service.delete.input.ServiceDeleteReqInfo.TailRetention;
122 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.service.delete.input.ServiceDeleteReqInfoBuilder;
123 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.service.list.Services;
124 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev230501.path.description.atoz.direction.AToZ;
125 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev230501.path.description.atoz.direction.AToZKey;
126 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev230501.pce.resource.resource.resource.TerminationPoint;
127 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.service.path.list.ServicePaths;
128 import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService;
129 import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessServiceBuilder;
130 import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceAEndBuilder;
131 import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceZEndBuilder;
132 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
133 import org.opendaylight.yangtools.yang.common.RpcResult;
134 import org.osgi.service.component.annotations.Activate;
135 import org.osgi.service.component.annotations.Component;
136 import org.osgi.service.component.annotations.Reference;
137 import org.slf4j.Logger;
138 import org.slf4j.LoggerFactory;
139
140
141 /**
142  * Top level service interface providing main OpenROADM controller services.
143  */
144 @Component
145 public class ServicehandlerImpl implements OrgOpenroadmServiceService {
146     private static final Logger LOG = LoggerFactory.getLogger(ServicehandlerImpl.class);
147     private static final String PUBLISHER = "ServiceHandler";
148     private static final String TEMP_SERVICE_CREATE_MSG = "tempServiceCreate: {}";
149     private static final String TEMP_SERVICE_DELETE_MSG = "tempServiceDelete: {}";
150     private static final String SERVICE_RESTORATION_MSG = "serviceRestoration: {}";
151     private static final String SERVICE_RECONFIGURE_MSG = "serviceReconfigure: {}";
152     private static final String SERVICE_FEASIBILITY_CHECK_MSG = "serviceFeasibilityCheck: {}";
153     private static final String SERVICE_DELETE_MSG = "serviceDelete: {}";
154     private static final String SERVICE_CREATE_MSG = "serviceCreate: {}";
155     private static final String ADD_OR_TO_CATALOG_MSG = "addORToCatalog: {}";
156     private static final String ADD_SPECIFIC_TO_CATALOG_MSG = "addSpecificToCatalog: {}";
157
158     private ServiceDataStoreOperations serviceDataStoreOperations;
159     private PCEServiceWrapper pceServiceWrapper;
160     private RendererServiceWrapper rendererServiceWrapper;
161     private PceListener pceListenerImpl;
162     private RendererListener rendererListenerImpl;
163     private NetworkListener networkModelListenerImpl;
164     private NotificationPublishService notificationPublishService;
165     private CatalogDataStoreOperations catalogDataStoreOperations;
166
167     @Activate
168     public ServicehandlerImpl(@Reference PathComputationService pathComputationService,
169             @Reference RendererServiceOperations rendererServiceOperations,
170             @Reference NotificationPublishService notificationPublishService,
171             @Reference PceListener pceListenerImpl,
172             @Reference RendererListener rendererListenerImpl,
173             @Reference NetworkListener networkModelListenerImpl,
174             @Reference ServiceDataStoreOperations serviceDataStoreOperations,
175             @Reference CatalogDataStoreOperations catalogDataStoreOperations) {
176         this.catalogDataStoreOperations = catalogDataStoreOperations;
177         this.serviceDataStoreOperations = serviceDataStoreOperations;
178         this.notificationPublishService =  notificationPublishService;
179         this.pceServiceWrapper = new PCEServiceWrapper(pathComputationService, notificationPublishService);
180         this.rendererServiceWrapper = new RendererServiceWrapper(rendererServiceOperations, notificationPublishService);
181         this.pceListenerImpl = pceListenerImpl;
182         this.rendererListenerImpl = rendererListenerImpl;
183         this.networkModelListenerImpl = networkModelListenerImpl;
184         LOG.info("ServicehandlerImpl Initiated");
185     }
186
187
188     // This is class is public so that these messages can be accessed from Junit (avoid duplications).
189     public static final class LogMessages {
190
191         public static final String PCE_CALLING;
192         public static final String ABORT_PCE_FAILED;
193         public static final String PCE_FAILED;
194         public static final String ABORT_SERVICE_NON_COMPLIANT;
195         public static final String SERVICE_NON_COMPLIANT;
196         public static final String RENDERER_DELETE_FAILED;
197         public static final String ABORT_VALID_FAILED;
198         public static final String ABORT_OR_TO_CATALOG_FAILED;
199         public static final String ABORT_SPECIFIC_TO_CATALOG_FAILED;
200
201         // Static blocks are generated once and spare memory.
202         static {
203             PCE_CALLING = "Calling PCE";
204             ABORT_PCE_FAILED = "Aborting: PCE calculation failed ";
205             PCE_FAILED = "PCE calculation failed";
206             ABORT_SERVICE_NON_COMPLIANT = "Aborting: non-compliant service ";
207             SERVICE_NON_COMPLIANT = "non-compliant service";
208             RENDERER_DELETE_FAILED = "Renderer service delete failed";
209             ABORT_VALID_FAILED = "Aborting: validation of service create request failed";
210             ABORT_OR_TO_CATALOG_FAILED = "Aborting: validation of add OR to catalog request failed";
211             ABORT_SPECIFIC_TO_CATALOG_FAILED = "Aborting: validation of add Specific to catalog request failed";
212         }
213
214         public static String serviceInDS(String serviceName) {
215             return "Service '" + serviceName + "' already exists in datastore";
216         }
217
218         public static String serviceNotInDS(String serviceName) {
219             return "Service '" + serviceName + "' does not exist in datastore";
220         }
221
222         public static String servicePathNotInDS(String serviceName) {
223             return "Service Path from '" + serviceName + "' does not exist in datastore";
224         }
225
226         public static String serviceInService(String serviceName) {
227             return "Service '" + serviceName + "' is in 'inService' state";
228         }
229
230         private LogMessages() {
231         }
232     }
233
234     @Override
235     public ListenableFuture<RpcResult<ServiceCreateOutput>> serviceCreate(ServiceCreateInput input) {
236         LOG.info("RPC serviceCreate received");
237         // Validation
238         OperationResult validationResult = ServiceCreateValidation.validateServiceCreateRequest(
239                 new ServiceInput(input), RpcActions.ServiceCreate);
240         if (!validationResult.isSuccess()) {
241             LOG.warn(SERVICE_CREATE_MSG, LogMessages.ABORT_VALID_FAILED);
242             return ModelMappingUtils.createCreateServiceReply(
243                     input, ResponseCodes.FINAL_ACK_YES,
244                     validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
245         }
246         //Check any presence of services with the same name
247         String serviceName = input.getServiceName();
248         if (this.serviceDataStoreOperations.getService(serviceName).isPresent()) {
249             LOG.warn(SERVICE_CREATE_MSG, LogMessages.serviceInDS(serviceName));
250             return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
251                     LogMessages.serviceInDS(serviceName), ResponseCodes.RESPONSE_FAILED);
252         }
253         // TODO: Here we also have to check if there is an associated temp-service.
254         // TODO: If there is one, delete it from the temp-service-list??
255         this.pceListenerImpl.setInput(new ServiceInput(input));
256         this.pceListenerImpl.setServiceReconfigure(false);
257         this.pceListenerImpl.setTempService(false);
258         this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
259         this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
260         this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
261         // This ensures that the temp-service boolean is false, especially, when
262         // service-create is initiated after the temp-service-create
263         this.rendererListenerImpl.setTempService(false);
264         this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
265         LOG.debug(SERVICE_CREATE_MSG, LogMessages.PCE_CALLING);
266         PathComputationRequestOutput output = this.pceServiceWrapper.performPCE(input, true);
267         if (output == null) {
268             LOG.warn(SERVICE_CREATE_MSG, LogMessages.ABORT_PCE_FAILED);
269             sendNbiNotification(new PublishNotificationProcessServiceBuilder()
270                     .setServiceName(serviceName)
271                     .setServiceAEnd(new ServiceAEndBuilder(input.getServiceAEnd()).build())
272                     .setServiceZEnd(new ServiceZEndBuilder(input.getServiceZEnd()).build())
273                     .setCommonId(input.getCommonId())
274                     .setConnectionType(input.getConnectionType())
275                     .setResponseFailed(LogMessages.ABORT_PCE_FAILED)
276                     .setMessage("ServiceCreate request failed ...")
277                     .setOperationalState(State.Degraded)
278                     .setPublisherName(PUBLISHER)
279                     .build());
280             return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
281                     LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
282         }
283         LOG.info("RPC serviceCreate in progress...");
284         ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
285         return ModelMappingUtils.createCreateServiceReply(
286                 input, common.getAckFinalIndicator(),
287                 common.getResponseMessage(), common.getResponseCode());
288     }
289
290     @Override
291     public ListenableFuture<RpcResult<ServiceDeleteOutput>> serviceDelete(ServiceDeleteInput input) {
292         String serviceName = input.getServiceDeleteReqInfo().getServiceName();
293         LOG.info("RPC serviceDelete request received for {}", serviceName);
294
295         /*
296          * Upon receipt of service-deleteService RPC, service header and sdnc-request
297          * header compliance are verified.
298          */
299         ComplianceCheckResult serviceHandlerCheckResult =
300             ServicehandlerComplianceCheck.check(
301                 input.getServiceDeleteReqInfo().getServiceName(),
302                 input.getSdncRequestHeader(), null, RpcActions.ServiceDelete, false, true);
303         if (!serviceHandlerCheckResult.hasPassed()) {
304             LOG.warn(SERVICE_DELETE_MSG, LogMessages.ABORT_SERVICE_NON_COMPLIANT);
305             return ModelMappingUtils.createDeleteServiceReply(
306                     input, ResponseCodes.FINAL_ACK_YES,
307                     LogMessages.SERVICE_NON_COMPLIANT, ResponseCodes.RESPONSE_FAILED);
308         }
309
310         //Check presence of service to be deleted
311         Optional<Services> serviceOpt = this.serviceDataStoreOperations.getService(serviceName);
312         Services service;
313         if (serviceOpt.isEmpty()) {
314             LOG.warn(SERVICE_DELETE_MSG, LogMessages.serviceNotInDS(serviceName));
315             return ModelMappingUtils.createDeleteServiceReply(
316                     input, ResponseCodes.FINAL_ACK_YES,
317                     LogMessages.serviceNotInDS(serviceName), ResponseCodes.RESPONSE_FAILED);
318         }
319         service = serviceOpt.orElseThrow();
320         LOG.debug("serviceDelete: Service '{}' found in datastore", serviceName);
321         this.pceListenerImpl.setInput(new ServiceInput(input));
322         this.pceListenerImpl.setServiceReconfigure(false);
323         this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
324         this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
325         this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
326         this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
327         org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteInput
328                 serviceDeleteInput = ModelMappingUtils.createServiceDeleteInput(new ServiceInput(input));
329         org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteOutput output =
330             this.rendererServiceWrapper.performRenderer(
331                 serviceDeleteInput, ServiceNotificationTypes.ServiceDeleteResult, service);
332
333         if (output == null) {
334             LOG.error(SERVICE_DELETE_MSG, LogMessages.RENDERER_DELETE_FAILED);
335             sendNbiNotification(new PublishNotificationProcessServiceBuilder()
336                     .setServiceName(service.getServiceName())
337                     .setServiceAEnd(new ServiceAEndBuilder(service.getServiceAEnd()).build())
338                     .setServiceZEnd(new ServiceZEndBuilder(service.getServiceZEnd()).build())
339                     .setCommonId(service.getCommonId())
340                     .setConnectionType(service.getConnectionType())
341                     .setMessage("ServiceDelete request failed ...")
342                     .setOperationalState(State.InService)
343                     .setResponseFailed(LogMessages.RENDERER_DELETE_FAILED)
344                     .setPublisherName(PUBLISHER)
345                     .build());
346             return ModelMappingUtils.createDeleteServiceReply(
347                     input, ResponseCodes.FINAL_ACK_YES,
348                     LogMessages.RENDERER_DELETE_FAILED, ResponseCodes.RESPONSE_FAILED);
349         }
350
351         LOG.debug("RPC serviceDelete in progress...");
352         ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
353         return ModelMappingUtils.createDeleteServiceReply(
354                 input, common.getAckFinalIndicator(),
355                 common.getResponseMessage(), common.getResponseCode());
356     }
357
358     @Override
359     public ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> serviceFeasibilityCheck(
360             ServiceFeasibilityCheckInput input) {
361         LOG.info("RPC serviceFeasibilityCheck received");
362         // Validation
363         ServiceInput serviceInput = new ServiceInput(input);
364         OperationResult validationResult = ServiceCreateValidation.validateServiceCreateRequest(serviceInput,
365                 RpcActions.ServiceFeasibilityCheck);
366         if (! validationResult.isSuccess()) {
367             LOG.warn(SERVICE_FEASIBILITY_CHECK_MSG, LogMessages.ABORT_VALID_FAILED);
368             return ModelMappingUtils.createCreateServiceReply(
369                     input, ResponseCodes.FINAL_ACK_YES,
370                     validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
371         }
372         this.pceListenerImpl.setInput(new ServiceInput(input));
373         this.pceListenerImpl.setServiceReconfigure(false);
374         this.pceListenerImpl.setServiceFeasiblity(true);
375         this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
376         this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
377         this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
378         this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
379         LOG.debug(SERVICE_FEASIBILITY_CHECK_MSG, LogMessages.PCE_CALLING);
380         PathComputationRequestOutput output = this.pceServiceWrapper.performPCE(input, true);
381         if (output == null) {
382             LOG.warn(SERVICE_FEASIBILITY_CHECK_MSG, LogMessages.ABORT_PCE_FAILED);
383             return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
384                     LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
385         }
386         LOG.info("RPC serviceFeasibilityCheck in progress...");
387         ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
388         return ModelMappingUtils.createCreateServiceReply(
389                 input, common.getAckFinalIndicator(),
390                 common.getResponseMessage(), common.getResponseCode());
391     }
392
393     @Override
394     public ListenableFuture<RpcResult<ServiceReconfigureOutput>> serviceReconfigure(ServiceReconfigureInput input) {
395         String serviceName = input.getServiceName();
396         LOG.info("RPC serviceReconfigure received for {}", serviceName);
397         Optional<Services> servicesObject = this.serviceDataStoreOperations.getService(serviceName);
398         if (servicesObject.isEmpty()) {
399             LOG.warn(SERVICE_RECONFIGURE_MSG, LogMessages.serviceNotInDS(serviceName));
400             return ModelMappingUtils.createCreateServiceReply(
401                 input,
402                 LogMessages.serviceNotInDS(serviceName));
403         }
404         LOG.debug("Service '{}' found in datastore", serviceName);
405         OperationResult validationResult = ServiceCreateValidation
406                 .validateServiceCreateRequest(new ServiceInput(input), RpcActions.ServiceReconfigure);
407         if (!validationResult.isSuccess()) {
408             LOG.warn(SERVICE_RECONFIGURE_MSG, LogMessages.ABORT_VALID_FAILED);
409             return ModelMappingUtils.createCreateServiceReply(
410                     input,
411                     validationResult.getResultMessage());
412         }
413         this.pceListenerImpl.setInput(new ServiceInput(input));
414         this.pceListenerImpl.setServiceReconfigure(true);
415         this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
416         this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
417         this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
418         this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
419         org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
420                 .ServiceDeleteInput serviceDeleteInput =
421                         ModelMappingUtils.createServiceDeleteInput(new ServiceInput(input));
422         org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
423                 .ServiceDeleteOutput output = this.rendererServiceWrapper.performRenderer(serviceDeleteInput,
424                         ServiceNotificationTypes.ServiceDeleteResult, null);
425         if (output == null) {
426             LOG.error(SERVICE_RECONFIGURE_MSG, LogMessages.RENDERER_DELETE_FAILED);
427             return ModelMappingUtils.createCreateServiceReply(
428                     input,
429                     LogMessages.RENDERER_DELETE_FAILED);
430                     //TODO check if RpcStatus.Successful is really expected here
431         }
432         LOG.info("RPC serviceReconfigure in progress...");
433         ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
434         return ModelMappingUtils.createCreateServiceReply(
435                 input,
436                 common.getResponseMessage());
437     }
438
439     @Override
440     public ListenableFuture<RpcResult<ServiceRestorationOutput>> serviceRestoration(ServiceRestorationInput input) {
441         String serviceName = input.getServiceName();
442         LOG.info("RPC serviceRestoration received for {}", serviceName);
443         Optional<Services> servicesObject = this.serviceDataStoreOperations.getService(serviceName);
444
445         if (!servicesObject.isPresent()) {
446             LOG.warn(SERVICE_RESTORATION_MSG, LogMessages.serviceNotInDS(serviceName));
447             return ModelMappingUtils.createRestoreServiceReply(
448                     LogMessages.serviceNotInDS(serviceName));
449         }
450
451         Services service = servicesObject.orElseThrow();
452         State state = service.getOperationalState();
453
454         if (state == State.InService) {
455             LOG.error(SERVICE_RESTORATION_MSG, LogMessages.serviceInService(serviceName));
456             return ModelMappingUtils.createRestoreServiceReply(
457                     LogMessages.serviceInService(serviceName));
458         }
459
460         DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
461         OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
462         DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime));
463         SdncRequestHeaderBuilder sdncBuilder = new SdncRequestHeaderBuilder()
464                 .setNotificationUrl(service.getSdncRequestHeader().getNotificationUrl())
465                 .setRequestId(service.getSdncRequestHeader().getRequestId())
466                 .setRequestSystemId(service.getSdncRequestHeader().getRequestSystemId())
467                 .setRpcAction(RpcActions.ServiceDelete);
468         ServiceDeleteInputBuilder deleteInputBldr = new ServiceDeleteInputBuilder()
469                 .setServiceDeleteReqInfo(new ServiceDeleteReqInfoBuilder()
470                     .setServiceName(serviceName)
471                     .setDueDate(datetime)
472                     .setTailRetention(TailRetention.No).build())
473                 .setSdncRequestHeader(sdncBuilder.build());
474         ServiceInput serviceInput = new ServiceInput(deleteInputBldr.build());
475         serviceInput.setServiceAEnd(service.getServiceAEnd());
476         serviceInput.setServiceZEnd(service.getServiceZEnd());
477         serviceInput.setConnectionType(service.getConnectionType());
478         HardConstraints hardConstraints = service.getHardConstraints();
479         if (hardConstraints == null) {
480             LOG.warn("service '{}' HardConstraints is not set !", serviceName);
481         } else {
482             SoftConstraints softConstraints = service.getSoftConstraints();
483             if (softConstraints == null) {
484                 LOG.warn("service '{}' SoftConstraints is not set !", serviceName);
485                 serviceInput.setSoftConstraints(DowngradeConstraints.convertToSoftConstraints(hardConstraints));
486             } else {
487                 LOG.info("converting hard constraints to soft constraints ...");
488                 serviceInput.setSoftConstraints(
489                         DowngradeConstraints.updateSoftConstraints(hardConstraints, softConstraints));
490             }
491             serviceInput.setHardConstraints(DowngradeConstraints.downgradeHardConstraints(hardConstraints));
492         }
493         this.pceListenerImpl.setInput(serviceInput);
494         this.pceListenerImpl.setServiceReconfigure(true);
495         this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
496         this.rendererListenerImpl.setServiceInput(serviceInput);
497         this.rendererListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
498         this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
499         org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
500             .ServiceDeleteInput serviceDeleteInput = ModelMappingUtils.createServiceDeleteInput(
501                     new ServiceInput(deleteInputBldr.build()));
502         org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
503             .ServiceDeleteOutput output = this.rendererServiceWrapper.performRenderer(serviceDeleteInput,
504                 ServiceNotificationTypes.ServiceDeleteResult, null);
505         if (output == null) {
506             LOG.error(SERVICE_RESTORATION_MSG, LogMessages.RENDERER_DELETE_FAILED);
507             return ModelMappingUtils.createRestoreServiceReply(LogMessages.RENDERER_DELETE_FAILED);
508         }
509         LOG.info("RPC serviceRestore in progress...");
510         ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
511         return ModelMappingUtils.createRestoreServiceReply(common.getResponseMessage());
512
513     }
514
515     @Override
516     public ListenableFuture<RpcResult<EquipmentNotificationOutput>>
517             equipmentNotification(EquipmentNotificationInput input) {
518         // TODO Auto-generated method stub
519         return null;
520     }
521
522     @Override
523     public ListenableFuture<RpcResult<ServiceRerouteConfirmOutput>>
524             serviceRerouteConfirm(ServiceRerouteConfirmInput input) {
525         // TODO Auto-generated method stub
526         return null;
527     }
528
529     @Override
530     public ListenableFuture<RpcResult<ServiceRerouteOutput>> serviceReroute(ServiceRerouteInput input) {
531         String serviceName = input.getServiceName();
532         LOG.info("RPC serviceReroute received for {}", serviceName);
533         Optional<Services> servicesObject = this.serviceDataStoreOperations.getService(serviceName);
534         if (servicesObject.isEmpty()) {
535             LOG.warn("serviceReroute: {}", LogMessages.serviceNotInDS(serviceName));
536             return ModelMappingUtils.createRerouteServiceReply(
537                     input, ResponseCodes.FINAL_ACK_YES,
538                     LogMessages.serviceNotInDS(serviceName),
539                     ResponseCodes.RESPONSE_FAILED);
540         }
541         Services service = servicesObject.orElseThrow();
542         Optional<ServicePaths> servicePathsObject = this.serviceDataStoreOperations.getServicePath(serviceName);
543         if (servicePathsObject.isEmpty()) {
544             LOG.warn("serviceReroute: {}", LogMessages.servicePathNotInDS(serviceName));
545             return ModelMappingUtils.createRerouteServiceReply(
546                     input, ResponseCodes.FINAL_ACK_YES,
547                     LogMessages.servicePathNotInDS(serviceName),
548                     ResponseCodes.RESPONSE_FAILED);
549         }
550         ServicePaths servicePaths = servicePathsObject.orElseThrow();
551         // serviceInput for later use maybe...
552         ServiceInput serviceInput = new ServiceInput(input);
553         serviceInput.setServiceAEnd(service.getServiceAEnd());
554         serviceInput.setServiceZEnd(service.getServiceZEnd());
555         serviceInput.setConnectionType(service.getConnectionType());
556         serviceInput.setCommonId(service.getCommonId());
557         serviceInput.setHardConstraints(service.getHardConstraints());
558         serviceInput.setSoftConstraints(service.getSoftConstraints());
559         serviceInput.setCustomer(service.getCustomer());
560         serviceInput.setCustomerContact(service.getCustomerContact());
561
562         // Get the network xpdr termination points
563         Map<AToZKey, AToZ> mapaToz = servicePaths.getPathDescription().getAToZDirection().getAToZ();
564         String aendtp = ((TerminationPoint) mapaToz.get(new AToZKey(String.valueOf(mapaToz.size() - 3)))
565                 .getResource()
566                 .getResource())
567                 .getTpId();
568         String zendtp = ((TerminationPoint) mapaToz.get(new AToZKey("2"))
569                 .getResource()
570                 .getResource())
571                 .getTpId();
572
573         PathComputationRerouteRequestOutput output = this.pceServiceWrapper.performPCEReroute(
574                 service.getHardConstraints(), service.getSoftConstraints(), input.getSdncRequestHeader(),
575                 service.getServiceAEnd(), service.getServiceZEnd(),
576                 new EndpointsBuilder().setAEndTp(aendtp).setZEndTp(zendtp).build());
577
578         if (output == null) {
579             LOG.error("serviceReroute: {}", LogMessages.PCE_FAILED);
580             return ModelMappingUtils.createRerouteServiceReply(
581                     input, ResponseCodes.FINAL_ACK_YES,
582                     LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
583         }
584         LOG.info("RPC ServiceReroute is done");
585         ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
586         return ModelMappingUtils.createRerouteServiceReply(input, common.getAckFinalIndicator(),
587                 common.getResponseMessage(), common.getResponseCode());
588     }
589
590     @Override
591     public ListenableFuture<RpcResult<ServiceReversionOutput>> serviceReversion(ServiceReversionInput input) {
592         // TODO Auto-generated method stub
593         return null;
594     }
595
596     @Override
597     public ListenableFuture<RpcResult<ServiceRollOutput>> serviceRoll(ServiceRollInput input) {
598         // TODO Auto-generated method stub
599         return null;
600     }
601
602     @Override
603     public ListenableFuture<RpcResult<NetworkReOptimizationOutput>>
604             networkReOptimization(NetworkReOptimizationInput input) {
605         // TODO Auto-generated method stub
606         return null;
607     }
608
609     @Override
610     public ListenableFuture<RpcResult<TempServiceDeleteOutput>> tempServiceDelete(TempServiceDeleteInput input) {
611         String commonId = input.getCommonId();
612         LOG.info("RPC temp serviceDelete request received for {}", commonId);
613
614         /*
615          * Upon receipt of service-deleteService RPC, service header and sdnc-request
616          * header compliance are verified.
617          */
618         LOG.debug("checking Service Compliance ...");
619         ComplianceCheckResult serviceHandlerCheckResult = ServicehandlerComplianceCheck.check(
620                 commonId, null, null, RpcActions.ServiceDelete, false, false
621             );
622         if (!serviceHandlerCheckResult.hasPassed()) {
623             LOG.warn(TEMP_SERVICE_DELETE_MSG, LogMessages.ABORT_SERVICE_NON_COMPLIANT);
624             return ModelMappingUtils.createDeleteServiceReply(
625                     input, ResponseCodes.FINAL_ACK_YES,
626                     LogMessages.SERVICE_NON_COMPLIANT, ResponseCodes.RESPONSE_FAILED);
627         }
628
629         //Check presence of service to be deleted
630         LOG.debug("service common-id '{}' is compliant", commonId);
631         Optional<org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.temp.service.list.Services>
632                 service =
633             this.serviceDataStoreOperations.getTempService(commonId);
634         if (service.isEmpty()) {
635             LOG.error(TEMP_SERVICE_DELETE_MSG, LogMessages.serviceNotInDS(commonId));
636             return ModelMappingUtils.createDeleteServiceReply(
637                     input, ResponseCodes.FINAL_ACK_YES,
638                     LogMessages.serviceNotInDS(commonId), ResponseCodes.RESPONSE_FAILED);
639         }
640
641         LOG.info("Service '{}' present in datastore !", commonId);
642         this.pceListenerImpl.setInput(new ServiceInput(input));
643         this.pceListenerImpl.setServiceReconfigure(false);
644         this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
645         this.rendererListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
646         this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
647         this.rendererListenerImpl.setTempService(true);
648         this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
649         org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteOutput output =
650                 this.rendererServiceWrapper.performRenderer(input, ServiceNotificationTypes.ServiceDeleteResult);
651         if (output == null) {
652             LOG.error(TEMP_SERVICE_DELETE_MSG, LogMessages.RENDERER_DELETE_FAILED);
653             return ModelMappingUtils.createDeleteServiceReply(
654                     input, ResponseCodes.FINAL_ACK_YES,
655                     LogMessages.RENDERER_DELETE_FAILED, ResponseCodes.RESPONSE_FAILED);
656         }
657         LOG.info("RPC tempServiceDelete in progress...");
658         ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
659         return ModelMappingUtils.createDeleteServiceReply(
660                 input, common.getAckFinalIndicator(),
661                 common.getResponseMessage(), common.getResponseCode());
662     }
663
664     @Override
665     public ListenableFuture<RpcResult<TempServiceCreateOutput>> tempServiceCreate(TempServiceCreateInput input) {
666         LOG.info("RPC tempServiceCreate received");
667         // Validation
668         OperationResult validationResult = ServiceCreateValidation.validateServiceCreateRequest(
669                 new ServiceInput(input), RpcActions.TempServiceCreate);
670         if (! validationResult.isSuccess()) {
671             LOG.warn(TEMP_SERVICE_CREATE_MSG, LogMessages.ABORT_VALID_FAILED);
672             return ModelMappingUtils.createCreateServiceReply(
673                     input, ResponseCodes.FINAL_ACK_YES,
674                     validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
675         }
676
677         //Check any presence of temp-service with the same commonId
678         String commonId = input.getCommonId();
679         if (this.serviceDataStoreOperations.getTempService(commonId).isPresent()) {
680             LOG.warn(TEMP_SERVICE_CREATE_MSG, LogMessages.serviceInDS("Temp (" + commonId + ")"));
681             return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
682                     LogMessages.serviceInDS("Temp (" + commonId + ")"), ResponseCodes.RESPONSE_FAILED);
683         }
684
685         // Starting service create operation
686         LOG.debug(TEMP_SERVICE_CREATE_MSG, LogMessages.PCE_CALLING);
687         this.pceListenerImpl.setInput(new ServiceInput(input));
688         this.pceListenerImpl.setServiceReconfigure(false);
689         this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
690         this.pceListenerImpl.setTempService(true);
691         this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
692         this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
693         this.rendererListenerImpl.setTempService(true);
694         this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
695         PathComputationRequestOutput output = this.pceServiceWrapper.performPCE(input, true);
696         if (output == null) {
697             LOG.warn(TEMP_SERVICE_CREATE_MSG, LogMessages.ABORT_PCE_FAILED);
698             return ModelMappingUtils.createCreateServiceReply(
699                     input, ResponseCodes.FINAL_ACK_YES,
700                     LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
701         }
702         LOG.info("RPC tempServiceCreate in progress...");
703         ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
704         return ModelMappingUtils.createCreateServiceReply(
705                 input, common.getAckFinalIndicator(),
706                 common.getResponseMessage(), common.getResponseCode());
707     }
708
709     @Override
710     public ListenableFuture<RpcResult<
711         ServiceDeleteComplexResultNotificationRequestOutput>> serviceDeleteComplexResultNotificationRequest(
712             ServiceDeleteComplexResultNotificationRequestInput input) {
713         // TODO Auto-generated method stub
714         return null;
715     }
716
717     @Override
718     public ListenableFuture<RpcResult<
719         ServiceCreateResultNotificationRequestOutput>> serviceCreateResultNotificationRequest(
720             ServiceCreateResultNotificationRequestInput input) {
721         // TODO Auto-generated method stub
722         return null;
723     }
724
725     @Override
726     public ListenableFuture<RpcResult<
727         ServiceDeleteResultNotificationRequestOutput>> serviceDeleteResultNotificationRequest(
728             ServiceDeleteResultNotificationRequestInput input) {
729         // TODO Auto-generated method stub
730         return null;
731     }
732
733     @Override
734     public ListenableFuture<RpcResult<
735         ServiceCreateComplexResultNotificationRequestOutput>> serviceCreateComplexResultNotificationRequest(
736             ServiceCreateComplexResultNotificationRequestInput input) {
737         // TODO Auto-generated method stub
738         return null;
739     }
740
741     @Override
742     public ListenableFuture<RpcResult<ServiceFeasibilityCheckBulkOutput>> serviceFeasibilityCheckBulk(
743         ServiceFeasibilityCheckBulkInput input) {
744         // TODO Auto-generated method stub
745         return null;
746     }
747
748     /**
749      * Send notification to NBI notification in order to publish message.
750      * @param service PublishNotificationService
751      */
752     private void sendNbiNotification(PublishNotificationProcessService service) {
753         try {
754             notificationPublishService.putNotification(service);
755         } catch (InterruptedException e) {
756             LOG.warn("Cannot send notification to nbi", e);
757             Thread.currentThread().interrupt();
758         }
759     }
760
761
762     @Override
763     public ListenableFuture<RpcResult<ServiceCreateBulkOutput>> serviceCreateBulk(ServiceCreateBulkInput input) {
764         // TODO Auto-generated method stub
765         return null;
766     }
767
768     @Override
769     public ListenableFuture<RpcResult<TempServiceCreateBulkOutput>> tempServiceCreateBulk(
770         TempServiceCreateBulkInput input) {
771         // TODO Auto-generated method stub
772         return null;
773     }
774
775     @Override
776     public ListenableFuture<RpcResult<ServiceRollResultNotificationRequestOutput>> serviceRollResultNotificationRequest(
777         ServiceRollResultNotificationRequestInput input) {
778         // TODO Auto-generated method stub
779         return null;
780     }
781
782     @Override
783     public ListenableFuture<RpcResult<ServiceReconfigureBulkOutput>> serviceReconfigureBulk(
784         ServiceReconfigureBulkInput input) {
785         // TODO Auto-generated method stub
786         return null;
787     }
788
789     @Override
790     public ListenableFuture<RpcResult<ServiceReconfigureResultNotificationRequestOutput>>
791             serviceReconfigureResultNotificationRequest(ServiceReconfigureResultNotificationRequestInput input) {
792         // TODO Auto-generated method stub
793         return null;
794     }
795
796     @Override
797     public ListenableFuture<RpcResult<ServiceRestorationResultNotificationRequestOutput>>
798             serviceRestorationResultNotificationRequest(ServiceRestorationResultNotificationRequestInput input) {
799         // TODO Auto-generated method stub
800         return null;
801     }
802
803     @Override
804     public ListenableFuture<RpcResult<ServiceReversionResultNotificationRequestOutput>>
805             serviceReversionResultNotificationRequest(ServiceReversionResultNotificationRequestInput input) {
806         // TODO Auto-generated method stub
807         return null;
808     }
809
810     @Override
811     public ListenableFuture<RpcResult<ServiceRerouteConfirmResultNotificationRequestOutput>>
812             serviceRerouteConfirmResultNotificationRequest(ServiceRerouteConfirmResultNotificationRequestInput input) {
813         // TODO Auto-generated method stub
814         return null;
815     }
816
817     @Override
818     public ListenableFuture<RpcResult<OpticalTunnelCreateOutput>> opticalTunnelCreate(OpticalTunnelCreateInput input) {
819         // TODO Auto-generated method stub
820         return null;
821     }
822
823     @Override
824     public ListenableFuture<RpcResult<OpticalTunnelRequestCancelOutput>> opticalTunnelRequestCancel(
825             OpticalTunnelRequestCancelInput input) {
826         // TODO Auto-generated method stub
827         return null;
828     }
829
830     @Override
831     /**
832      * Implementation of the RPC to set OR  operational modes in the catalog of the controller.
833      * Semantics of the RPC is such that the information in the input replaces the full content
834      * of the OR operational modes catalog in the config data store. Incremental changes to the
835      * catalog, if required, must be done via individual PUT/POST/DELETE RESTconf APIs.
836      *
837      * @param input AddOpenroadmOperationalModesToCatalogInput to be added to Catalog
838      * @return Result of the request
839      */
840     public ListenableFuture<RpcResult<AddOpenroadmOperationalModesToCatalogOutput>>
841         addOpenroadmOperationalModesToCatalog(AddOpenroadmOperationalModesToCatalogInput input) {
842
843         LOG.info("RPC addOpenroadmOperationalModesToCatalog in progress");
844         LOG.debug(" Input openRoadm {}", input);
845         // Validation
846         OperationResult validationResult = CatalogValidation.validateORCatalogRequest(
847                 new CatalogInput(input), RpcActions.FillCatalogWithOrOperationalModes);
848         if (! validationResult.isSuccess()) {
849             LOG.warn(ADD_OR_TO_CATALOG_MSG, LogMessages.ABORT_OR_TO_CATALOG_FAILED);
850             return ModelMappingUtils.addOpenroadmServiceReply(
851                     input, ResponseCodes.FINAL_ACK_YES,
852                     validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
853         }
854         LOG.info(" Request System Id {} " ,input.getSdncRequestHeader().getRequestSystemId());
855         LOG.info(" Rpc Action {} " ,input.getSdncRequestHeader().getRpcAction());
856
857         OpenroadmOperationalModes objToSave = CatalogMapper.createORModesToSave(input);
858         catalogDataStoreOperations.addOpenroadmOperationalModesToCatalog(objToSave);
859         LOG.info("RPC addOpenroadmOperationalModesToCatalog Completed");
860         return ModelMappingUtils.addOpenroadmServiceReply(input, ResponseCodes.FINAL_ACK_YES,
861                 validationResult.getResultMessage(), ResponseCodes.RESPONSE_OK);
862     }
863
864     @Override
865     /**
866      * Implementation of the RPC to set specific operational modes in the catalog of the controller.
867      * Semantics of the RPC is such that the information in the input replaces the full content
868      * of the specific operational modes catalog in the config data store. Incremental changes to the
869      * catalog, if required, must be done via individual PUT/POST/DELETE RESTconf APIs.
870      *
871      * @param input AddSpecificOperationalModesToCatalogInput to be added to Catalog
872      * @return Result of the request
873      */
874     public ListenableFuture<RpcResult<AddSpecificOperationalModesToCatalogOutput>> addSpecificOperationalModesToCatalog(
875             AddSpecificOperationalModesToCatalogInput input) {
876
877         LOG.info("RPC addSpecificOperationalModesToCatalog in progress");
878         LOG.debug(" Input openSpecificRoadm {}", input);
879         // Validation
880         OperationResult validationResult = CatalogValidation.validateSpecificCatalogRequest(
881                 new CatalogInput(input), RpcActions.FillCatalogWithSpecificOperationalModes);
882         if (! validationResult.isSuccess()) {
883             LOG.warn(ADD_SPECIFIC_TO_CATALOG_MSG, LogMessages.ABORT_SPECIFIC_TO_CATALOG_FAILED);
884             return ModelMappingUtils.addSpecificOpenroadmServiceReply(
885                     input, ResponseCodes.FINAL_ACK_YES,
886                     validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
887         }
888         LOG.info(" Request System Id {} " ,input.getSdncRequestHeader().getRequestSystemId());
889         LOG.info(" Rpc Action {} " ,input.getSdncRequestHeader().getRpcAction());
890
891         SpecificOperationalModes objToSave = CatalogMapper.createSpecificModesToSave(input);
892         catalogDataStoreOperations.addSpecificOperationalModesToCatalog(objToSave);
893         LOG.info("RPC addSpecificOperationalModesToCatalog Completed");
894         return ModelMappingUtils.addSpecificOpenroadmServiceReply(input, ResponseCodes.FINAL_ACK_YES,
895                 validationResult.getResultMessage(), ResponseCodes.RESPONSE_OK);
896     }
897
898     @Override
899     public ListenableFuture<RpcResult<ServiceSrlgGetOutput>> serviceSrlgGet(ServiceSrlgGetInput input) {
900         // TODO Auto-generated method stub
901         return null;
902     }
903
904     @Override
905     public ListenableFuture<RpcResult<EndTerminalPerformanceInfoRequestOutput>> endTerminalPerformanceInfoRequest(
906         EndTerminalPerformanceInfoRequestInput input) {
907         // TODO Auto-generated method stub
908         return null;
909     }
910
911     @Override
912     public ListenableFuture<RpcResult<EndTerminalActivationRequestOutput>> endTerminalActivationRequest(
913         EndTerminalActivationRequestInput input) {
914         // TODO Auto-generated method stub
915         return null;
916     }
917
918     @Override
919     public ListenableFuture<RpcResult<EndTerminalDeactivationRequestOutput>> endTerminalDeactivationRequest(
920         EndTerminalDeactivationRequestInput input) {
921         // TODO Auto-generated method stub
922         return null;
923     }
924
925     @Override
926     public ListenableFuture<RpcResult<EndTerminalPowerControlOutput>> endTerminalPowerControl(
927         EndTerminalPowerControlInput input) {
928         // TODO Auto-generated method stub
929         return null;
930     }
931 }
932