0051deb332a2aa6a8fef6a0e1de85c520ee6567e
[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.setTempService(false);
324         this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
325         this.rendererListenerImpl.setTempService(false);
326         this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
327         this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
328         this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
329         org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteInput
330                 serviceDeleteInput = ModelMappingUtils.createServiceDeleteInput(new ServiceInput(input));
331         org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteOutput output =
332             this.rendererServiceWrapper.performRenderer(
333                 serviceDeleteInput, ServiceNotificationTypes.ServiceDeleteResult, service);
334
335         if (output == null) {
336             LOG.error(SERVICE_DELETE_MSG, LogMessages.RENDERER_DELETE_FAILED);
337             sendNbiNotification(new PublishNotificationProcessServiceBuilder()
338                     .setServiceName(service.getServiceName())
339                     .setServiceAEnd(new ServiceAEndBuilder(service.getServiceAEnd()).build())
340                     .setServiceZEnd(new ServiceZEndBuilder(service.getServiceZEnd()).build())
341                     .setCommonId(service.getCommonId())
342                     .setConnectionType(service.getConnectionType())
343                     .setMessage("ServiceDelete request failed ...")
344                     .setOperationalState(State.InService)
345                     .setResponseFailed(LogMessages.RENDERER_DELETE_FAILED)
346                     .setPublisherName(PUBLISHER)
347                     .build());
348             return ModelMappingUtils.createDeleteServiceReply(
349                     input, ResponseCodes.FINAL_ACK_YES,
350                     LogMessages.RENDERER_DELETE_FAILED, ResponseCodes.RESPONSE_FAILED);
351         }
352
353         LOG.debug("RPC serviceDelete in progress...");
354         ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
355         return ModelMappingUtils.createDeleteServiceReply(
356                 input, common.getAckFinalIndicator(),
357                 common.getResponseMessage(), common.getResponseCode());
358     }
359
360     @Override
361     public ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> serviceFeasibilityCheck(
362             ServiceFeasibilityCheckInput input) {
363         LOG.info("RPC serviceFeasibilityCheck received");
364         // Validation
365         ServiceInput serviceInput = new ServiceInput(input);
366         OperationResult validationResult = ServiceCreateValidation.validateServiceCreateRequest(serviceInput,
367                 RpcActions.ServiceFeasibilityCheck);
368         if (! validationResult.isSuccess()) {
369             LOG.warn(SERVICE_FEASIBILITY_CHECK_MSG, LogMessages.ABORT_VALID_FAILED);
370             return ModelMappingUtils.createCreateServiceReply(
371                     input, ResponseCodes.FINAL_ACK_YES,
372                     validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
373         }
374         this.pceListenerImpl.setInput(new ServiceInput(input));
375         this.pceListenerImpl.setServiceReconfigure(false);
376         this.pceListenerImpl.setServiceFeasiblity(true);
377         this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
378         this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
379         this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
380         this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
381         LOG.debug(SERVICE_FEASIBILITY_CHECK_MSG, LogMessages.PCE_CALLING);
382         PathComputationRequestOutput output = this.pceServiceWrapper.performPCE(input, true);
383         if (output == null) {
384             LOG.warn(SERVICE_FEASIBILITY_CHECK_MSG, LogMessages.ABORT_PCE_FAILED);
385             return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
386                     LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
387         }
388         LOG.info("RPC serviceFeasibilityCheck in progress...");
389         ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
390         return ModelMappingUtils.createCreateServiceReply(
391                 input, common.getAckFinalIndicator(),
392                 common.getResponseMessage(), common.getResponseCode());
393     }
394
395     @Override
396     public ListenableFuture<RpcResult<ServiceReconfigureOutput>> serviceReconfigure(ServiceReconfigureInput input) {
397         String serviceName = input.getServiceName();
398         LOG.info("RPC serviceReconfigure received for {}", serviceName);
399         Optional<Services> servicesObject = this.serviceDataStoreOperations.getService(serviceName);
400         if (servicesObject.isEmpty()) {
401             LOG.warn(SERVICE_RECONFIGURE_MSG, LogMessages.serviceNotInDS(serviceName));
402             return ModelMappingUtils.createCreateServiceReply(
403                 input,
404                 LogMessages.serviceNotInDS(serviceName));
405         }
406         LOG.debug("Service '{}' found in datastore", serviceName);
407         OperationResult validationResult = ServiceCreateValidation
408                 .validateServiceCreateRequest(new ServiceInput(input), RpcActions.ServiceReconfigure);
409         if (!validationResult.isSuccess()) {
410             LOG.warn(SERVICE_RECONFIGURE_MSG, LogMessages.ABORT_VALID_FAILED);
411             return ModelMappingUtils.createCreateServiceReply(
412                     input,
413                     validationResult.getResultMessage());
414         }
415         this.pceListenerImpl.setInput(new ServiceInput(input));
416         this.pceListenerImpl.setServiceReconfigure(true);
417         this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
418         this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
419         this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
420         this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
421         org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
422                 .ServiceDeleteInput serviceDeleteInput =
423                         ModelMappingUtils.createServiceDeleteInput(new ServiceInput(input));
424         org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
425                 .ServiceDeleteOutput output = this.rendererServiceWrapper.performRenderer(serviceDeleteInput,
426                         ServiceNotificationTypes.ServiceDeleteResult, null);
427         if (output == null) {
428             LOG.error(SERVICE_RECONFIGURE_MSG, LogMessages.RENDERER_DELETE_FAILED);
429             return ModelMappingUtils.createCreateServiceReply(
430                     input,
431                     LogMessages.RENDERER_DELETE_FAILED);
432                     //TODO check if RpcStatus.Successful is really expected here
433         }
434         LOG.info("RPC serviceReconfigure in progress...");
435         ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
436         return ModelMappingUtils.createCreateServiceReply(
437                 input,
438                 common.getResponseMessage());
439     }
440
441     @Override
442     public ListenableFuture<RpcResult<ServiceRestorationOutput>> serviceRestoration(ServiceRestorationInput input) {
443         String serviceName = input.getServiceName();
444         LOG.info("RPC serviceRestoration received for {}", serviceName);
445         Optional<Services> servicesObject = this.serviceDataStoreOperations.getService(serviceName);
446
447         if (!servicesObject.isPresent()) {
448             LOG.warn(SERVICE_RESTORATION_MSG, LogMessages.serviceNotInDS(serviceName));
449             return ModelMappingUtils.createRestoreServiceReply(
450                     LogMessages.serviceNotInDS(serviceName));
451         }
452
453         Services service = servicesObject.orElseThrow();
454         State state = service.getOperationalState();
455
456         if (state == State.InService) {
457             LOG.error(SERVICE_RESTORATION_MSG, LogMessages.serviceInService(serviceName));
458             return ModelMappingUtils.createRestoreServiceReply(
459                     LogMessages.serviceInService(serviceName));
460         }
461
462         DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
463         OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
464         DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime));
465         SdncRequestHeaderBuilder sdncBuilder = new SdncRequestHeaderBuilder()
466                 .setNotificationUrl(service.getSdncRequestHeader().getNotificationUrl())
467                 .setRequestId(service.getSdncRequestHeader().getRequestId())
468                 .setRequestSystemId(service.getSdncRequestHeader().getRequestSystemId())
469                 .setRpcAction(RpcActions.ServiceDelete);
470         ServiceDeleteInputBuilder deleteInputBldr = new ServiceDeleteInputBuilder()
471                 .setServiceDeleteReqInfo(new ServiceDeleteReqInfoBuilder()
472                     .setServiceName(serviceName)
473                     .setDueDate(datetime)
474                     .setTailRetention(TailRetention.No).build())
475                 .setSdncRequestHeader(sdncBuilder.build());
476         ServiceInput serviceInput = new ServiceInput(deleteInputBldr.build());
477         serviceInput.setServiceAEnd(service.getServiceAEnd());
478         serviceInput.setServiceZEnd(service.getServiceZEnd());
479         serviceInput.setConnectionType(service.getConnectionType());
480         HardConstraints hardConstraints = service.getHardConstraints();
481         if (hardConstraints == null) {
482             LOG.warn("service '{}' HardConstraints is not set !", serviceName);
483         } else {
484             SoftConstraints softConstraints = service.getSoftConstraints();
485             if (softConstraints == null) {
486                 LOG.warn("service '{}' SoftConstraints is not set !", serviceName);
487                 serviceInput.setSoftConstraints(DowngradeConstraints.convertToSoftConstraints(hardConstraints));
488             } else {
489                 LOG.info("converting hard constraints to soft constraints ...");
490                 serviceInput.setSoftConstraints(
491                         DowngradeConstraints.updateSoftConstraints(hardConstraints, softConstraints));
492             }
493             serviceInput.setHardConstraints(DowngradeConstraints.downgradeHardConstraints(hardConstraints));
494         }
495         this.pceListenerImpl.setInput(serviceInput);
496         this.pceListenerImpl.setServiceReconfigure(true);
497         this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
498         this.rendererListenerImpl.setServiceInput(serviceInput);
499         this.rendererListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
500         this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
501         org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
502             .ServiceDeleteInput serviceDeleteInput = ModelMappingUtils.createServiceDeleteInput(
503                     new ServiceInput(deleteInputBldr.build()));
504         org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
505             .ServiceDeleteOutput output = this.rendererServiceWrapper.performRenderer(serviceDeleteInput,
506                 ServiceNotificationTypes.ServiceDeleteResult, null);
507         if (output == null) {
508             LOG.error(SERVICE_RESTORATION_MSG, LogMessages.RENDERER_DELETE_FAILED);
509             return ModelMappingUtils.createRestoreServiceReply(LogMessages.RENDERER_DELETE_FAILED);
510         }
511         LOG.info("RPC serviceRestore in progress...");
512         ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
513         return ModelMappingUtils.createRestoreServiceReply(common.getResponseMessage());
514
515     }
516
517     @Override
518     public ListenableFuture<RpcResult<EquipmentNotificationOutput>>
519             equipmentNotification(EquipmentNotificationInput input) {
520         // TODO Auto-generated method stub
521         return null;
522     }
523
524     @Override
525     public ListenableFuture<RpcResult<ServiceRerouteConfirmOutput>>
526             serviceRerouteConfirm(ServiceRerouteConfirmInput input) {
527         // TODO Auto-generated method stub
528         return null;
529     }
530
531     @Override
532     public ListenableFuture<RpcResult<ServiceRerouteOutput>> serviceReroute(ServiceRerouteInput input) {
533         String serviceName = input.getServiceName();
534         LOG.info("RPC serviceReroute received for {}", serviceName);
535         Optional<Services> servicesObject = this.serviceDataStoreOperations.getService(serviceName);
536         if (servicesObject.isEmpty()) {
537             LOG.warn("serviceReroute: {}", LogMessages.serviceNotInDS(serviceName));
538             return ModelMappingUtils.createRerouteServiceReply(
539                     input, ResponseCodes.FINAL_ACK_YES,
540                     LogMessages.serviceNotInDS(serviceName),
541                     ResponseCodes.RESPONSE_FAILED);
542         }
543         Services service = servicesObject.orElseThrow();
544         Optional<ServicePaths> servicePathsObject = this.serviceDataStoreOperations.getServicePath(serviceName);
545         if (servicePathsObject.isEmpty()) {
546             LOG.warn("serviceReroute: {}", LogMessages.servicePathNotInDS(serviceName));
547             return ModelMappingUtils.createRerouteServiceReply(
548                     input, ResponseCodes.FINAL_ACK_YES,
549                     LogMessages.servicePathNotInDS(serviceName),
550                     ResponseCodes.RESPONSE_FAILED);
551         }
552         ServicePaths servicePaths = servicePathsObject.orElseThrow();
553         // serviceInput for later use maybe...
554         ServiceInput serviceInput = new ServiceInput(input);
555         serviceInput.setServiceAEnd(service.getServiceAEnd());
556         serviceInput.setServiceZEnd(service.getServiceZEnd());
557         serviceInput.setConnectionType(service.getConnectionType());
558         serviceInput.setCommonId(service.getCommonId());
559         serviceInput.setHardConstraints(service.getHardConstraints());
560         serviceInput.setSoftConstraints(service.getSoftConstraints());
561         serviceInput.setCustomer(service.getCustomer());
562         serviceInput.setCustomerContact(service.getCustomerContact());
563
564         // Get the network xpdr termination points
565         Map<AToZKey, AToZ> mapaToz = servicePaths.getPathDescription().getAToZDirection().getAToZ();
566         String aendtp = ((TerminationPoint) mapaToz.get(new AToZKey(String.valueOf(mapaToz.size() - 3)))
567                 .getResource()
568                 .getResource())
569                 .getTpId();
570         String zendtp = ((TerminationPoint) mapaToz.get(new AToZKey("2"))
571                 .getResource()
572                 .getResource())
573                 .getTpId();
574
575         PathComputationRerouteRequestOutput output = this.pceServiceWrapper.performPCEReroute(
576                 service.getHardConstraints(), service.getSoftConstraints(), input.getSdncRequestHeader(),
577                 service.getServiceAEnd(), service.getServiceZEnd(),
578                 new EndpointsBuilder().setAEndTp(aendtp).setZEndTp(zendtp).build());
579
580         if (output == null) {
581             LOG.error("serviceReroute: {}", LogMessages.PCE_FAILED);
582             return ModelMappingUtils.createRerouteServiceReply(
583                     input, ResponseCodes.FINAL_ACK_YES,
584                     LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
585         }
586         LOG.info("RPC ServiceReroute is done");
587         ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
588         return ModelMappingUtils.createRerouteServiceReply(input, common.getAckFinalIndicator(),
589                 common.getResponseMessage(), common.getResponseCode());
590     }
591
592     @Override
593     public ListenableFuture<RpcResult<ServiceReversionOutput>> serviceReversion(ServiceReversionInput input) {
594         // TODO Auto-generated method stub
595         return null;
596     }
597
598     @Override
599     public ListenableFuture<RpcResult<ServiceRollOutput>> serviceRoll(ServiceRollInput input) {
600         // TODO Auto-generated method stub
601         return null;
602     }
603
604     @Override
605     public ListenableFuture<RpcResult<NetworkReOptimizationOutput>>
606             networkReOptimization(NetworkReOptimizationInput input) {
607         // TODO Auto-generated method stub
608         return null;
609     }
610
611     @Override
612     public ListenableFuture<RpcResult<TempServiceDeleteOutput>> tempServiceDelete(TempServiceDeleteInput input) {
613         String commonId = input.getCommonId();
614         LOG.info("RPC temp serviceDelete request received for {}", commonId);
615
616         /*
617          * Upon receipt of service-deleteService RPC, service header and sdnc-request
618          * header compliance are verified.
619          */
620         LOG.debug("checking Service Compliance ...");
621         ComplianceCheckResult serviceHandlerCheckResult = ServicehandlerComplianceCheck.check(
622                 commonId, null, null, RpcActions.ServiceDelete, false, false
623             );
624         if (!serviceHandlerCheckResult.hasPassed()) {
625             LOG.warn(TEMP_SERVICE_DELETE_MSG, LogMessages.ABORT_SERVICE_NON_COMPLIANT);
626             return ModelMappingUtils.createDeleteServiceReply(
627                     input, ResponseCodes.FINAL_ACK_YES,
628                     LogMessages.SERVICE_NON_COMPLIANT, ResponseCodes.RESPONSE_FAILED);
629         }
630
631         //Check presence of service to be deleted
632         LOG.debug("service common-id '{}' is compliant", commonId);
633         Optional<org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526.temp.service.list.Services>
634                 serviceOpt =
635             this.serviceDataStoreOperations.getTempService(commonId);
636         if (serviceOpt.isEmpty()) {
637             LOG.error(TEMP_SERVICE_DELETE_MSG, LogMessages.serviceNotInDS(commonId));
638             return ModelMappingUtils.createDeleteServiceReply(
639                     input, ResponseCodes.FINAL_ACK_YES,
640                     LogMessages.serviceNotInDS(commonId), ResponseCodes.RESPONSE_FAILED);
641         }
642         LOG.info("Service '{}' present in datastore !", commonId);
643         this.pceListenerImpl.setInput(new ServiceInput(input));
644         this.pceListenerImpl.setServiceReconfigure(false);
645         this.pceListenerImpl.setTempService(true);
646         this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
647         this.rendererListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
648         this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
649         this.rendererListenerImpl.setTempService(true);
650         this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
651         org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev230526
652                 .temp.service.list.Services service = serviceOpt.orElseThrow();
653         org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteOutput output =
654                 this.rendererServiceWrapper.performRenderer(input, ServiceNotificationTypes.ServiceDeleteResult,
655                         service);
656         if (output == null) {
657             LOG.error(TEMP_SERVICE_DELETE_MSG, LogMessages.RENDERER_DELETE_FAILED);
658             return ModelMappingUtils.createDeleteServiceReply(
659                     input, ResponseCodes.FINAL_ACK_YES,
660                     LogMessages.RENDERER_DELETE_FAILED, ResponseCodes.RESPONSE_FAILED);
661         }
662         LOG.info("RPC tempServiceDelete in progress...");
663         ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
664         return ModelMappingUtils.createDeleteServiceReply(
665                 input, common.getAckFinalIndicator(),
666                 common.getResponseMessage(), common.getResponseCode());
667     }
668
669     @Override
670     public ListenableFuture<RpcResult<TempServiceCreateOutput>> tempServiceCreate(TempServiceCreateInput input) {
671         LOG.info("RPC tempServiceCreate received");
672         // Validation
673         OperationResult validationResult = ServiceCreateValidation.validateServiceCreateRequest(
674                 new ServiceInput(input), RpcActions.TempServiceCreate);
675         if (! validationResult.isSuccess()) {
676             LOG.warn(TEMP_SERVICE_CREATE_MSG, LogMessages.ABORT_VALID_FAILED);
677             return ModelMappingUtils.createCreateServiceReply(
678                     input, ResponseCodes.FINAL_ACK_YES,
679                     validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
680         }
681
682         //Check any presence of temp-service with the same commonId
683         String commonId = input.getCommonId();
684         if (this.serviceDataStoreOperations.getTempService(commonId).isPresent()) {
685             LOG.warn(TEMP_SERVICE_CREATE_MSG, LogMessages.serviceInDS("Temp (" + commonId + ")"));
686             return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
687                     LogMessages.serviceInDS("Temp (" + commonId + ")"), ResponseCodes.RESPONSE_FAILED);
688         }
689
690         // Starting service create operation
691         LOG.debug(TEMP_SERVICE_CREATE_MSG, LogMessages.PCE_CALLING);
692         this.pceListenerImpl.setInput(new ServiceInput(input));
693         this.pceListenerImpl.setServiceReconfigure(false);
694         this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
695         this.pceListenerImpl.setTempService(true);
696         this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
697         this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
698         this.rendererListenerImpl.setTempService(true);
699         this.networkModelListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
700         PathComputationRequestOutput output = this.pceServiceWrapper.performPCE(input, true);
701         if (output == null) {
702             LOG.warn(TEMP_SERVICE_CREATE_MSG, LogMessages.ABORT_PCE_FAILED);
703             return ModelMappingUtils.createCreateServiceReply(
704                     input, ResponseCodes.FINAL_ACK_YES,
705                     LogMessages.PCE_FAILED, ResponseCodes.RESPONSE_FAILED);
706         }
707         LOG.info("RPC tempServiceCreate in progress...");
708         ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
709         return ModelMappingUtils.createCreateServiceReply(
710                 input, common.getAckFinalIndicator(),
711                 common.getResponseMessage(), common.getResponseCode());
712     }
713
714     @Override
715     public ListenableFuture<RpcResult<
716         ServiceDeleteComplexResultNotificationRequestOutput>> serviceDeleteComplexResultNotificationRequest(
717             ServiceDeleteComplexResultNotificationRequestInput input) {
718         // TODO Auto-generated method stub
719         return null;
720     }
721
722     @Override
723     public ListenableFuture<RpcResult<
724         ServiceCreateResultNotificationRequestOutput>> serviceCreateResultNotificationRequest(
725             ServiceCreateResultNotificationRequestInput input) {
726         // TODO Auto-generated method stub
727         return null;
728     }
729
730     @Override
731     public ListenableFuture<RpcResult<
732         ServiceDeleteResultNotificationRequestOutput>> serviceDeleteResultNotificationRequest(
733             ServiceDeleteResultNotificationRequestInput input) {
734         // TODO Auto-generated method stub
735         return null;
736     }
737
738     @Override
739     public ListenableFuture<RpcResult<
740         ServiceCreateComplexResultNotificationRequestOutput>> serviceCreateComplexResultNotificationRequest(
741             ServiceCreateComplexResultNotificationRequestInput input) {
742         // TODO Auto-generated method stub
743         return null;
744     }
745
746     @Override
747     public ListenableFuture<RpcResult<ServiceFeasibilityCheckBulkOutput>> serviceFeasibilityCheckBulk(
748         ServiceFeasibilityCheckBulkInput input) {
749         // TODO Auto-generated method stub
750         return null;
751     }
752
753     /**
754      * Send notification to NBI notification in order to publish message.
755      * @param service PublishNotificationService
756      */
757     private void sendNbiNotification(PublishNotificationProcessService service) {
758         try {
759             notificationPublishService.putNotification(service);
760         } catch (InterruptedException e) {
761             LOG.warn("Cannot send notification to nbi", e);
762             Thread.currentThread().interrupt();
763         }
764     }
765
766
767     @Override
768     public ListenableFuture<RpcResult<ServiceCreateBulkOutput>> serviceCreateBulk(ServiceCreateBulkInput input) {
769         // TODO Auto-generated method stub
770         return null;
771     }
772
773     @Override
774     public ListenableFuture<RpcResult<TempServiceCreateBulkOutput>> tempServiceCreateBulk(
775         TempServiceCreateBulkInput input) {
776         // TODO Auto-generated method stub
777         return null;
778     }
779
780     @Override
781     public ListenableFuture<RpcResult<ServiceRollResultNotificationRequestOutput>> serviceRollResultNotificationRequest(
782         ServiceRollResultNotificationRequestInput input) {
783         // TODO Auto-generated method stub
784         return null;
785     }
786
787     @Override
788     public ListenableFuture<RpcResult<ServiceReconfigureBulkOutput>> serviceReconfigureBulk(
789         ServiceReconfigureBulkInput input) {
790         // TODO Auto-generated method stub
791         return null;
792     }
793
794     @Override
795     public ListenableFuture<RpcResult<ServiceReconfigureResultNotificationRequestOutput>>
796             serviceReconfigureResultNotificationRequest(ServiceReconfigureResultNotificationRequestInput input) {
797         // TODO Auto-generated method stub
798         return null;
799     }
800
801     @Override
802     public ListenableFuture<RpcResult<ServiceRestorationResultNotificationRequestOutput>>
803             serviceRestorationResultNotificationRequest(ServiceRestorationResultNotificationRequestInput input) {
804         // TODO Auto-generated method stub
805         return null;
806     }
807
808     @Override
809     public ListenableFuture<RpcResult<ServiceReversionResultNotificationRequestOutput>>
810             serviceReversionResultNotificationRequest(ServiceReversionResultNotificationRequestInput input) {
811         // TODO Auto-generated method stub
812         return null;
813     }
814
815     @Override
816     public ListenableFuture<RpcResult<ServiceRerouteConfirmResultNotificationRequestOutput>>
817             serviceRerouteConfirmResultNotificationRequest(ServiceRerouteConfirmResultNotificationRequestInput input) {
818         // TODO Auto-generated method stub
819         return null;
820     }
821
822     @Override
823     public ListenableFuture<RpcResult<OpticalTunnelCreateOutput>> opticalTunnelCreate(OpticalTunnelCreateInput input) {
824         // TODO Auto-generated method stub
825         return null;
826     }
827
828     @Override
829     public ListenableFuture<RpcResult<OpticalTunnelRequestCancelOutput>> opticalTunnelRequestCancel(
830             OpticalTunnelRequestCancelInput input) {
831         // TODO Auto-generated method stub
832         return null;
833     }
834
835     @Override
836     /**
837      * Implementation of the RPC to set OR  operational modes in the catalog of the controller.
838      * Semantics of the RPC is such that the information in the input replaces the full content
839      * of the OR operational modes catalog in the config data store. Incremental changes to the
840      * catalog, if required, must be done via individual PUT/POST/DELETE RESTconf APIs.
841      *
842      * @param input AddOpenroadmOperationalModesToCatalogInput to be added to Catalog
843      * @return Result of the request
844      */
845     public ListenableFuture<RpcResult<AddOpenroadmOperationalModesToCatalogOutput>>
846         addOpenroadmOperationalModesToCatalog(AddOpenroadmOperationalModesToCatalogInput input) {
847
848         LOG.info("RPC addOpenroadmOperationalModesToCatalog in progress");
849         LOG.debug(" Input openRoadm {}", input);
850         // Validation
851         OperationResult validationResult = CatalogValidation.validateORCatalogRequest(
852                 new CatalogInput(input), RpcActions.FillCatalogWithOrOperationalModes);
853         if (! validationResult.isSuccess()) {
854             LOG.warn(ADD_OR_TO_CATALOG_MSG, LogMessages.ABORT_OR_TO_CATALOG_FAILED);
855             return ModelMappingUtils.addOpenroadmServiceReply(
856                     input, ResponseCodes.FINAL_ACK_YES,
857                     validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
858         }
859         LOG.info(" Request System Id {} " ,input.getSdncRequestHeader().getRequestSystemId());
860         LOG.info(" Rpc Action {} " ,input.getSdncRequestHeader().getRpcAction());
861
862         OpenroadmOperationalModes objToSave = CatalogMapper.createORModesToSave(input);
863         catalogDataStoreOperations.addOpenroadmOperationalModesToCatalog(objToSave);
864         LOG.info("RPC addOpenroadmOperationalModesToCatalog Completed");
865         return ModelMappingUtils.addOpenroadmServiceReply(input, ResponseCodes.FINAL_ACK_YES,
866                 validationResult.getResultMessage(), ResponseCodes.RESPONSE_OK);
867     }
868
869     @Override
870     /**
871      * Implementation of the RPC to set specific operational modes in the catalog of the controller.
872      * Semantics of the RPC is such that the information in the input replaces the full content
873      * of the specific operational modes catalog in the config data store. Incremental changes to the
874      * catalog, if required, must be done via individual PUT/POST/DELETE RESTconf APIs.
875      *
876      * @param input AddSpecificOperationalModesToCatalogInput to be added to Catalog
877      * @return Result of the request
878      */
879     public ListenableFuture<RpcResult<AddSpecificOperationalModesToCatalogOutput>> addSpecificOperationalModesToCatalog(
880             AddSpecificOperationalModesToCatalogInput input) {
881
882         LOG.info("RPC addSpecificOperationalModesToCatalog in progress");
883         LOG.debug(" Input openSpecificRoadm {}", input);
884         // Validation
885         OperationResult validationResult = CatalogValidation.validateSpecificCatalogRequest(
886                 new CatalogInput(input), RpcActions.FillCatalogWithSpecificOperationalModes);
887         if (! validationResult.isSuccess()) {
888             LOG.warn(ADD_SPECIFIC_TO_CATALOG_MSG, LogMessages.ABORT_SPECIFIC_TO_CATALOG_FAILED);
889             return ModelMappingUtils.addSpecificOpenroadmServiceReply(
890                     input, ResponseCodes.FINAL_ACK_YES,
891                     validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
892         }
893         LOG.info(" Request System Id {} " ,input.getSdncRequestHeader().getRequestSystemId());
894         LOG.info(" Rpc Action {} " ,input.getSdncRequestHeader().getRpcAction());
895
896         SpecificOperationalModes objToSave = CatalogMapper.createSpecificModesToSave(input);
897         catalogDataStoreOperations.addSpecificOperationalModesToCatalog(objToSave);
898         LOG.info("RPC addSpecificOperationalModesToCatalog Completed");
899         return ModelMappingUtils.addSpecificOpenroadmServiceReply(input, ResponseCodes.FINAL_ACK_YES,
900                 validationResult.getResultMessage(), ResponseCodes.RESPONSE_OK);
901     }
902
903     @Override
904     public ListenableFuture<RpcResult<ServiceSrlgGetOutput>> serviceSrlgGet(ServiceSrlgGetInput input) {
905         // TODO Auto-generated method stub
906         return null;
907     }
908
909     @Override
910     public ListenableFuture<RpcResult<EndTerminalPerformanceInfoRequestOutput>> endTerminalPerformanceInfoRequest(
911         EndTerminalPerformanceInfoRequestInput input) {
912         // TODO Auto-generated method stub
913         return null;
914     }
915
916     @Override
917     public ListenableFuture<RpcResult<EndTerminalActivationRequestOutput>> endTerminalActivationRequest(
918         EndTerminalActivationRequestInput input) {
919         // TODO Auto-generated method stub
920         return null;
921     }
922
923     @Override
924     public ListenableFuture<RpcResult<EndTerminalDeactivationRequestOutput>> endTerminalDeactivationRequest(
925         EndTerminalDeactivationRequestInput input) {
926         // TODO Auto-generated method stub
927         return null;
928     }
929
930     @Override
931     public ListenableFuture<RpcResult<EndTerminalPowerControlOutput>> endTerminalPowerControl(
932         EndTerminalPowerControlInput input) {
933         // TODO Auto-generated method stub
934         return null;
935     }
936 }
937