2 * Copyright © 2017 Orange, Inc. and others. All rights reserved.
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
8 package org.opendaylight.transportpce.servicehandler.impl;
10 import com.google.common.util.concurrent.ListenableFuture;
12 import java.time.OffsetDateTime;
13 import java.time.ZoneOffset;
14 import java.time.format.DateTimeFormatter;
15 import java.util.Optional;
17 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
18 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
19 import org.opendaylight.transportpce.common.OperationResult;
20 import org.opendaylight.transportpce.common.ResponseCodes;
21 import org.opendaylight.transportpce.pce.service.PathComputationService;
22 import org.opendaylight.transportpce.renderer.NetworkModelWavelengthService;
23 import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
24 import org.opendaylight.transportpce.servicehandler.ModelMappingUtils;
25 import org.opendaylight.transportpce.servicehandler.ServiceInput;
26 import org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl;
27 import org.opendaylight.transportpce.servicehandler.listeners.RendererListenerImpl;
28 import org.opendaylight.transportpce.servicehandler.service.PCEServiceWrapper;
29 import org.opendaylight.transportpce.servicehandler.service.RendererServiceWrapper;
30 import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations;
31 import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperationsImpl;
32 import org.opendaylight.transportpce.servicehandler.validation.ServiceCreateValidation;
33 import org.opendaylight.transportpce.servicehandler.validation.checks.ComplianceCheckResult;
34 import org.opendaylight.transportpce.servicehandler.validation.checks.ServicehandlerCompliancyCheck;
35 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev171017.PathComputationRequestOutput;
36 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.RpcActions;
37 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.ServiceNotificationTypes;
38 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.configuration.response.common.ConfigurationResponseCommon;
39 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.sdnc.request.header.SdncRequestHeaderBuilder;
40 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.RpcStatus;
41 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.EquipmentNotificationInput;
42 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.EquipmentNotificationOutput;
43 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.NetworkReOptimizationInput;
44 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.NetworkReOptimizationOutput;
45 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.OrgOpenroadmServiceService;
46 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceCreateInput;
47 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceCreateOutput;
48 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceDeleteInput;
49 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceDeleteInputBuilder;
50 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceDeleteOutput;
51 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceFeasibilityCheckInput;
52 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceFeasibilityCheckOutput;
53 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceReconfigureInput;
54 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceReconfigureOutput;
55 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRerouteConfirmInput;
56 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRerouteConfirmOutput;
57 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRerouteInput;
58 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRerouteOutput;
59 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRestorationInput;
60 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRestorationOutput;
61 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceReversionInput;
62 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceReversionOutput;
63 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRollInput;
64 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRollOutput;
65 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.TempServiceCreateInput;
66 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.TempServiceCreateOutput;
67 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.TempServiceDeleteInput;
68 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.TempServiceDeleteOutput;
69 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.delete.input.ServiceDeleteReqInfo.TailRetention;
70 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.delete.input.ServiceDeleteReqInfoBuilder;
71 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.list.Services;
72 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
73 import org.opendaylight.yangtools.yang.common.RpcResult;
74 import org.slf4j.Logger;
75 import org.slf4j.LoggerFactory;
79 * Top level service interface providing main OpenROADM controller services.
81 public class ServicehandlerImpl implements OrgOpenroadmServiceService {
83 private static final Logger LOG = LoggerFactory.getLogger(ServicehandlerImpl.class);
85 private DataBroker db;
86 private ServiceDataStoreOperations serviceDataStoreOperations;
87 private PCEServiceWrapper pceServiceWrapper;
88 private RendererServiceWrapper rendererServiceWrapper;
89 private PceListenerImpl pceListenerImpl;
90 private RendererListenerImpl rendererListenerImpl;
92 //TODO: remove private request fields as they are in global scope
94 public ServicehandlerImpl(DataBroker databroker, PathComputationService pathComputationService,
95 RendererServiceOperations rendererServiceOperations, NotificationPublishService notificationPublishService,
96 PceListenerImpl pceListenerImpl, RendererListenerImpl rendererListenerImpl,
97 NetworkModelWavelengthService networkModelWavelengthService) {
99 this.serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(this.db);
100 this.serviceDataStoreOperations.initialize();
101 this.pceServiceWrapper = new PCEServiceWrapper(pathComputationService, notificationPublishService);
102 this.rendererServiceWrapper = new RendererServiceWrapper(rendererServiceOperations, notificationPublishService);
103 this.pceListenerImpl = pceListenerImpl;
104 this.rendererListenerImpl = rendererListenerImpl;
108 public ListenableFuture<RpcResult<ServiceCreateOutput>> serviceCreate(ServiceCreateInput input) {
109 LOG.info("RPC service creation received");
111 OperationResult validationResult = ServiceCreateValidation.validateServiceCreateRequest(
112 new ServiceInput(input), RpcActions.ServiceCreate);
113 if (! validationResult.isSuccess()) {
114 LOG.warn("Aborting service create because validation of service create request failed: {}",
115 validationResult.getResultMessage());
116 return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
117 validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
119 this.pceListenerImpl.setInput(new ServiceInput(input));
120 this.pceListenerImpl.setServiceReconfigure(false);
121 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
122 this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
123 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
124 LOG.info("Commencing PCE");
125 PathComputationRequestOutput output = this.pceServiceWrapper.performPCE(input, true);
126 if (output != null) {
127 LOG.info("Service compliant, serviceCreate in progress...");
128 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
129 return ModelMappingUtils.createCreateServiceReply(input, common.getAckFinalIndicator(),
130 common.getResponseMessage(), common.getResponseCode());
132 return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
133 "PCE calculation failed", ResponseCodes.RESPONSE_FAILED);
138 public ListenableFuture<RpcResult<ServiceDeleteOutput>> serviceDelete(ServiceDeleteInput input) {
139 LOG.info("RPC serviceDelete request received for {}", input.getServiceDeleteReqInfo().getServiceName());
143 * Upon receipt of service-deleteService RPC, service header and sdnc-request
144 * header compliancy are verified.
146 LOG.info("checking Service Compliancy ...");
147 ComplianceCheckResult serviceHandlerCheckResult = ServicehandlerCompliancyCheck.check(
148 input.getServiceDeleteReqInfo().getServiceName(),
149 input.getSdncRequestHeader(), null, RpcActions.ServiceDelete, false, true);
150 if (serviceHandlerCheckResult.hasPassed()) {
151 LOG.info("Service compliant !");
153 LOG.info("Service is not compliant !");
154 return ModelMappingUtils
155 .createDeleteServiceReply(input, ResponseCodes.FINAL_ACK_YES,
156 "Service not compliant !", ResponseCodes.RESPONSE_FAILED);
159 //Check presence of service to be deleted
160 String serviceName = input.getServiceDeleteReqInfo().getServiceName();
161 LOG.info("serviceName : {}", serviceName);
163 Optional<Services> service = this.serviceDataStoreOperations.getService(serviceName);
164 if (!service.isPresent()) {
165 message = "Service '" + serviceName + "' does not exist in datastore";
167 return ModelMappingUtils.createDeleteServiceReply(input, ResponseCodes.FINAL_ACK_YES,
168 message, ResponseCodes.RESPONSE_FAILED);
170 } catch (NullPointerException e) {
171 LOG.error("failed to get service '{}' from datastore : ", serviceName, e);
172 message = "Service '" + serviceName + "' does not exist in datastore";
174 return ModelMappingUtils.createDeleteServiceReply(input, ResponseCodes.FINAL_ACK_YES, message,
175 ResponseCodes.RESPONSE_FAILED);
177 LOG.info("Service '{}' present in datastore !", serviceName);
178 this.pceListenerImpl.setInput(new ServiceInput(input));
179 this.pceListenerImpl.setServiceReconfigure(false);
180 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
181 this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
182 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
183 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017
184 .ServiceDeleteInput serviceDeleteInput = ModelMappingUtils.createServiceDeleteInput(
185 new ServiceInput(input));
186 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceDeleteOutput output =
187 this.rendererServiceWrapper.performRenderer(serviceDeleteInput,
188 ServiceNotificationTypes.ServiceDeleteResult);
189 if (output != null) {
190 LOG.info("Service present in datastore, service-delete in progress...");
191 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
192 return ModelMappingUtils.createDeleteServiceReply(input, common.getAckFinalIndicator(),
193 common.getResponseMessage(), common.getResponseCode());
195 return ModelMappingUtils.createDeleteServiceReply(input, ResponseCodes.FINAL_ACK_YES,
196 "Renderer service delete failed !", ResponseCodes.RESPONSE_FAILED);
201 public ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> serviceFeasibilityCheck(
202 ServiceFeasibilityCheckInput input) {
203 LOG.info("RPC service feasibility check received");
205 ServiceInput serviceInput = new ServiceInput(input);
206 OperationResult validationResult = ServiceCreateValidation.validateServiceCreateRequest(serviceInput,
207 RpcActions.ServiceFeasibilityCheck);
208 if (! validationResult.isSuccess()) {
209 LOG.warn("Aborting service feasibility check because validation of service create request failed: {}",
210 validationResult.getResultMessage());
211 return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
212 validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
214 this.pceListenerImpl.setInput(new ServiceInput(input));
215 this.pceListenerImpl.setServiceReconfigure(false);
216 this.pceListenerImpl.setServiceFeasiblity(true);
217 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
218 this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
219 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
220 LOG.info("Commencing PCE");
221 PathComputationRequestOutput output = this.pceServiceWrapper.performPCE(input, true);
222 if (output != null) {
223 LOG.info("Service compliant, serviceFeasibilityCheck in progress...");
224 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
225 return ModelMappingUtils.createCreateServiceReply(input, common.getAckFinalIndicator(),
226 common.getResponseMessage(), common.getResponseCode());
228 return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
229 "PCE calculation failed", ResponseCodes.RESPONSE_FAILED);
234 public ListenableFuture<RpcResult<ServiceReconfigureOutput>> serviceReconfigure(ServiceReconfigureInput input) {
235 LOG.info("RPC service reconfigure received");
237 Optional<Services> servicesObject = this.serviceDataStoreOperations.getService(input.getServiceName());
238 if (servicesObject.isPresent()) {
239 LOG.info("Service '{}' is present", input.getServiceName());
240 OperationResult validationResult = ServiceCreateValidation
241 .validateServiceCreateRequest(new ServiceInput(input), RpcActions.ServiceReconfigure);
242 if (!validationResult.isSuccess()) {
243 LOG.warn("Aborting service reconfigure because validation of service create request failed: {}",
244 validationResult.getResultMessage());
245 return ModelMappingUtils.createCreateServiceReply(input, validationResult.getResultMessage(),
248 this.pceListenerImpl.setInput(new ServiceInput(input));
249 this.pceListenerImpl.setServiceReconfigure(true);
250 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
251 this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
252 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
253 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017
254 .ServiceDeleteInput serviceDeleteInput =
255 ModelMappingUtils.createServiceDeleteInput(new ServiceInput(input));
256 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017
257 .ServiceDeleteOutput output = this.rendererServiceWrapper.performRenderer(serviceDeleteInput,
258 ServiceNotificationTypes.ServiceDeleteResult);
259 if (output != null) {
260 LOG.info("Service compliant, service reconfigure in progress...");
261 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
262 return ModelMappingUtils.createCreateServiceReply(input, common.getResponseMessage(),
263 RpcStatus.Successful);
265 return ModelMappingUtils.createCreateServiceReply(input, "Renderer service delete failed !",
266 RpcStatus.Successful);
269 LOG.error("Service '{}' is not present", input.getServiceName());
270 message = "Service '" + input.getServiceName() + "' is not present";
271 return ModelMappingUtils.createCreateServiceReply(input, message, RpcStatus.Failed);
276 public ListenableFuture<RpcResult<ServiceRestorationOutput>> serviceRestoration(ServiceRestorationInput input) {
277 throw new UnsupportedOperationException("Not implemented yet");
281 public ListenableFuture<RpcResult<EquipmentNotificationOutput>>
282 equipmentNotification(EquipmentNotificationInput input) {
283 // TODO Auto-generated method stub
288 public ListenableFuture<RpcResult<ServiceRerouteConfirmOutput>>
289 serviceRerouteConfirm(ServiceRerouteConfirmInput input) {
290 // TODO Auto-generated method stub
295 public ListenableFuture<RpcResult<ServiceRerouteOutput>> serviceReroute(ServiceRerouteInput input) {
296 LOG.info("RPC service reroute received");
298 Optional<Services> servicesObject = this.serviceDataStoreOperations.getService(input.getServiceName());
299 if (servicesObject.isPresent()) {
300 Services service = servicesObject.get();
301 ServiceDeleteInputBuilder deleteInputBldr = new ServiceDeleteInputBuilder();
302 DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
303 OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
304 DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime));
305 deleteInputBldr.setServiceDeleteReqInfo(new ServiceDeleteReqInfoBuilder()
306 .setServiceName(input.getServiceName()).setDueDate(datetime)
307 .setTailRetention(TailRetention.No).build());
308 SdncRequestHeaderBuilder sdncBuilder = new SdncRequestHeaderBuilder();
309 sdncBuilder.setNotificationUrl(service.getSdncRequestHeader().getNotificationUrl());
310 sdncBuilder.setRequestId(service.getSdncRequestHeader().getRequestId());
311 sdncBuilder.setRequestSystemId(service.getSdncRequestHeader().getRequestSystemId());
312 sdncBuilder.setRpcAction(RpcActions.ServiceDelete);
313 deleteInputBldr.setSdncRequestHeader(sdncBuilder.build());
314 ServiceInput serviceInput = new ServiceInput(deleteInputBldr.build());
315 serviceInput.setServiceAEnd(service.getServiceAEnd());
316 serviceInput.setServiceZEnd(service.getServiceZEnd());
317 serviceInput.setConnectionType(service.getConnectionType());
318 this.pceListenerImpl.setInput(serviceInput);
319 this.pceListenerImpl.setServiceReconfigure(true);
320 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
321 this.rendererListenerImpl.setServiceInput(serviceInput);
322 this.rendererListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
323 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017
324 .ServiceDeleteInput serviceDeleteInput = ModelMappingUtils.createServiceDeleteInput(
325 new ServiceInput(deleteInputBldr.build()));
326 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017
327 .ServiceDeleteOutput output = this.rendererServiceWrapper.performRenderer(serviceDeleteInput,
328 ServiceNotificationTypes.ServiceDeleteResult);
329 if (output != null) {
330 LOG.info("Service present in datastore, service-reroute in progress...");
331 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
332 return ModelMappingUtils.createRerouteServiceReply(input, common.getAckFinalIndicator(),
333 common.getResponseMessage(), RpcStatus.Successful);
335 return ModelMappingUtils.createRerouteServiceReply(input, ResponseCodes.FINAL_ACK_YES,
336 "Renderer service delete failed !", RpcStatus.Failed);
339 LOG.error("Service '{}' is not present", input.getServiceName());
340 message = "Service '" + input.getServiceName() + "' is not present";
341 return ModelMappingUtils.createRerouteServiceReply(input, ResponseCodes.FINAL_ACK_NO, message,
347 public ListenableFuture<RpcResult<ServiceReversionOutput>> serviceReversion(ServiceReversionInput input) {
348 // TODO Auto-generated method stub
353 public ListenableFuture<RpcResult<ServiceRollOutput>> serviceRoll(ServiceRollInput input) {
354 // TODO Auto-generated method stub
359 public ListenableFuture<RpcResult<NetworkReOptimizationOutput>>
360 networkReOptimization(NetworkReOptimizationInput input) {
361 // TODO Auto-generated method stub
366 public ListenableFuture<RpcResult<TempServiceDeleteOutput>> tempServiceDelete(TempServiceDeleteInput input) {
367 LOG.info("RPC temp serviceDelete request received for {}", input.getCommonId());
371 * Upon receipt of service-deleteService RPC, service header and sdnc-request
372 * header compliancy are verified.
374 LOG.info("checking Service Compliancy ...");
375 ComplianceCheckResult serviceHandlerCheckResult = ServicehandlerCompliancyCheck.check(input.getCommonId(),
376 null, null, RpcActions.ServiceDelete, false, false);
377 if (serviceHandlerCheckResult.hasPassed()) {
378 LOG.info("Service compliant !");
380 LOG.info("Service is not compliant !");
381 return ModelMappingUtils.createDeleteServiceReply(input, ResponseCodes.FINAL_ACK_YES,
382 "Service not compliant !", ResponseCodes.RESPONSE_FAILED);
385 //Check presence of service to be deleted
386 String commonId = input.getCommonId();
387 LOG.info("service common-id : {}", commonId);
389 Optional<org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.temp.service.list
390 .Services> service = this.serviceDataStoreOperations.getTempService(commonId);
391 if (!service.isPresent()) {
392 message = "Service '" + commonId + "' does not exist in datastore";
394 return ModelMappingUtils.createDeleteServiceReply(input, ResponseCodes.FINAL_ACK_YES,
395 message, ResponseCodes.RESPONSE_FAILED);
397 } catch (NullPointerException e) {
398 LOG.info("failed to get service '{}' from datastore : ", commonId, e);
401 LOG.info("Service '{}' present in datastore !", commonId);
402 this.pceListenerImpl.setInput(new ServiceInput(input));
403 this.pceListenerImpl.setServiceReconfigure(false);
404 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
405 this.rendererListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
406 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
407 this.rendererListenerImpl.setTempService(true);
408 org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceDeleteOutput output =
409 this.rendererServiceWrapper.performRenderer(input, ServiceNotificationTypes.ServiceDeleteResult);
410 if (output != null) {
411 LOG.info("Temp Service present in datastore, service-delete in progress...");
412 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
413 return ModelMappingUtils.createDeleteServiceReply(input, common.getAckFinalIndicator(),
414 common.getResponseMessage(), common.getResponseCode());
416 return ModelMappingUtils.createDeleteServiceReply(input, ResponseCodes.FINAL_ACK_YES,
417 "Renderer service delete failed !", ResponseCodes.RESPONSE_FAILED);
422 public ListenableFuture<RpcResult<TempServiceCreateOutput>> tempServiceCreate(TempServiceCreateInput input) {
423 LOG.info("RPC temp service creation received");
425 OperationResult validationResult = ServiceCreateValidation.validateServiceCreateRequest(
426 new ServiceInput(input), RpcActions.TempServiceCreate);
427 if (! validationResult.isSuccess()) {
428 LOG.warn("Aborting service create because validation of service create request failed: {}",
429 validationResult.getResultMessage());
430 return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
431 validationResult.getResultMessage(), ResponseCodes.RESPONSE_FAILED);
434 // Starting service create operation
435 LOG.info("Commencing PCE");
436 this.pceListenerImpl.setInput(new ServiceInput(input));
437 this.pceListenerImpl.setServiceReconfigure(false);
438 this.pceListenerImpl.setserviceDataStoreOperations(this.serviceDataStoreOperations);
439 this.pceListenerImpl.setTempService(true);
440 this.rendererListenerImpl.setserviceDataStoreOperations(serviceDataStoreOperations);
441 this.rendererListenerImpl.setServiceInput(new ServiceInput(input));
442 this.rendererListenerImpl.setTempService(true);
443 this.pceServiceWrapper.performPCE(input, true);
444 PathComputationRequestOutput output = this.pceServiceWrapper.performPCE(input, true);
445 if (output != null) {
446 LOG.info("Service compliant, temp serviceCreate in progress...");
447 ConfigurationResponseCommon common = output.getConfigurationResponseCommon();
448 return ModelMappingUtils.createCreateServiceReply(input, common.getAckFinalIndicator(),
449 common.getResponseMessage(), common.getResponseCode());
451 return ModelMappingUtils.createCreateServiceReply(input, ResponseCodes.FINAL_ACK_YES,
452 "PCE calculation failed", ResponseCodes.RESPONSE_FAILED);