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