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
9 package org.opendaylight.transportpce.servicehandler.impl;
11 import com.google.common.base.Optional;
13 import com.google.common.util.concurrent.FutureCallback;
14 import com.google.common.util.concurrent.Futures;
15 import com.google.common.util.concurrent.ListenableFuture;
16 import com.google.common.util.concurrent.ListeningExecutorService;
17 import com.google.common.util.concurrent.MoreExecutors;
19 import java.util.ArrayList;
20 import java.util.List;
21 import java.util.concurrent.ExecutionException;
22 import java.util.concurrent.Executors;
23 import java.util.concurrent.Future;
25 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
26 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
27 import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
28 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
29 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
30 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
31 import org.opendaylight.transportpce.servicehandler.CheckCoherencyHardSoft;
32 import org.opendaylight.transportpce.servicehandler.MappingAndSendingPCRequest;
33 import org.opendaylight.transportpce.servicehandler.MappingAndSendingSIRequest;
34 import org.opendaylight.transportpce.servicehandler.ServicehandlerCompliancyCheck;
35 import org.opendaylight.transportpce.servicehandler.ServicehandlerTxRxCheck;
36 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev170930.ServiceRpcResultSh;
37 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev170930.ServiceRpcResultShBuilder;
38 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev170930.ServiceStateModifyInput;
39 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev170930.ServiceStateModifyOutput;
40 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev170930.ServiceStateModifyOutputBuilder;
41 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev170930.ServicehandlerService;
42 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.PathComputationRequestOutput;
43 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.PathComputationRequestOutputBuilder;
44 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.ServicePathRpcResult;
45 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.StubpceListener;
46 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceRpcResultSp;
47 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.StubrendererListener;
48 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.ConnectionType;
49 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.RpcActions;
50 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.ServiceEndpoint;
51 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.ServiceNotificationTypes;
52 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.configuration.response.common.ConfigurationResponseCommon;
53 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.configuration.response.common.ConfigurationResponseCommonBuilder;
54 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.sdnc.request.header.SdncRequestHeader;
55 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.sdnc.request.header.SdncRequestHeaderBuilder;
56 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.ServiceAEnd;
57 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.ServiceAEndBuilder;
58 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.ServiceZEnd;
59 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.ServiceZEndBuilder;
60 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.Topology;
61 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.TopologyBuilder;
62 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.LifecycleState;
63 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.RpcStatus;
64 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev161014.State;
65 import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev161014.routing.constraints.HardConstraints;
66 import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev161014.routing.constraints.SoftConstraints;
67 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.EquipmentNotificationInput;
68 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.EquipmentNotificationOutput;
69 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.NetworkReOptimizationInput;
70 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.NetworkReOptimizationOutput;
71 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.OrgOpenroadmServiceService;
72 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceCreateInput;
73 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceCreateOutput;
74 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceCreateOutputBuilder;
75 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceDeleteInput;
76 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceDeleteOutput;
77 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceDeleteOutputBuilder;
78 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceFeasibilityCheckInput;
79 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceFeasibilityCheckOutput;
80 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceFeasibilityCheckOutputBuilder;
81 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceList;
82 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceListBuilder;
83 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceReconfigureInput;
84 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceReconfigureOutput;
85 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceReconfigureOutputBuilder;
86 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRerouteConfirmInput;
87 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRerouteConfirmOutput;
88 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRerouteInput;
89 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRerouteOutput;
90 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRestorationInput;
91 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRestorationOutput;
92 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRestorationOutputBuilder;
93 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceReversionInput;
94 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceReversionOutput;
95 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRollInput;
96 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRollOutput;
97 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.TempServiceCreateInput;
98 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.TempServiceCreateOutput;
99 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.TempServiceDeleteInput;
100 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.TempServiceDeleteOutput;
101 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.list.Services;
102 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.list.ServicesBuilder;
103 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.list.ServicesKey;
104 import org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev161014.topology.AToZ;
105 import org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev161014.topology.AToZBuilder;
106 import org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev161014.topology.AToZKey;
107 import org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev161014.topology.ZToA;
108 import org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev161014.topology.ZToABuilder;
109 import org.opendaylight.yang.gen.v1.http.org.openroadm.topology.rev161014.topology.ZToAKey;
110 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.RpcStatusEx;
111 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.response.parameters.sp.response.parameters.PathDescription;
112 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.response.parameters.sp.response.parameters.PathDescriptionBuilder;
113 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.service.rpc.result.sp.PathTopology;
114 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.service.rpc.result.sp.PathTopologyBuilder;
115 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
116 import org.opendaylight.yangtools.yang.common.RpcResult;
117 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
118 import org.slf4j.Logger;
119 import org.slf4j.LoggerFactory;
123 * Class to implement ServicehandlerService and ServicehandlerListener.
125 * @author <a href="mailto:martial.coulibaly@gfi.com">Martial Coulibaly</a> on behalf of Orange
127 public class ServicehandlerImpl implements OrgOpenroadmServiceService, ServicehandlerService, StubpceListener,
128 StubrendererListener,AutoCloseable {
130 private static final Logger LOG = LoggerFactory.getLogger(ServicehandlerImpl.class);
131 /** Permit to access database. */
132 private DataBroker db;
133 /** check service sdnc-request-header compliancy. */
134 private ServicehandlerCompliancyCheck compliancyCheck;
135 /** check missing info on Tx/Rx for A/Z end. */
136 private ServicehandlerTxRxCheck txrxCheck;
137 /** check coherency between hard and soft constraints. */
138 private CheckCoherencyHardSoft checkCoherencyHardSoft;
140 * Map and Send PCE requests : -
141 * path-computation-request/cancel-resource-reserve.
143 private MappingAndSendingPCRequest mappingAndSendingPCRequest;
145 * Map and Send Service Implemention requests : - service
146 * implementation/service delete.
148 private MappingAndSendingSIRequest mappingAndSendingSIRequest;
150 private RpcProviderRegistry rpcRegistry;
151 private NotificationPublishService notificationPublishService;
152 private final ListeningExecutorService executor;
154 private ServicePathRpcResult servicePathRpcResult = null;
155 private ServiceRpcResultSp serviceRpcResultSp = null;
157 private RpcActions action;
159 private PathDescription pathDescription;
160 private PathTopology pathTopology;
161 private ServiceCreateInput serviceCreateInput;
162 private ServiceDeleteInput serviceDeleteInput;
163 private ServiceReconfigureInput serviceReconfigureInput;
164 private Services service;
165 private ServiceFeasibilityCheckInput serviceFeasibilityCheckInput;
167 public ServicehandlerImpl(DataBroker databroker, RpcProviderRegistry rpcRegistry,
168 NotificationPublishService notificationPublishService) {
169 this.db = databroker;
170 this.rpcRegistry = rpcRegistry;
171 this.notificationPublishService = notificationPublishService;
172 executor = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(5));
173 serviceCreateInput = null;
174 setServiceDeleteInput(null);
175 setServiceReconfigureInput(null);
176 initializeDataTree(db);
180 * delete service from
181 * datastore after receiving
182 * Stubrenderer notification.
185 private void deleteServiceFromDatastore() {
186 String serviceName = null;
187 if (serviceDeleteInput != null) {
188 LOG.info("deleteServiceFromDatastore came from RPC serviceDelete");
189 serviceName = serviceDeleteInput.getServiceDeleteReqInfo().getServiceName();
190 } else if (service != null) {
191 LOG.info("deleteServiceFromDatastore came from RPC serviceRestoration");
192 serviceName = service.getServiceName();
194 if (serviceName != null) {
195 LOG.info("deleting service '{}' from datastore ...", serviceName);
196 ServiceRpcResultSh notification = null;
199 * Service delete confirmed deleting service from
202 if (writeOrModifyOrDeleteServiceList(serviceName, null,
204 /** Service delete. */
205 message = "Service deleted from database";
207 message = "deleting service from database failed !";
210 notification = new ServiceRpcResultShBuilder()
211 .setNotificationType(ServiceNotificationTypes.ServiceDeleteResult)
212 .setServiceName(serviceDeleteInput.getServiceDeleteReqInfo().getServiceName())
213 .setStatus(RpcStatusEx.Successful).setStatusMessage(message).build();
215 notificationPublishService.putNotification(notification);
216 } catch (InterruptedException e) {
217 LOG.info("notification offer rejected : {}", e);
220 LOG.error("Parameter 'ServiceName' fro deleteServiceFromDatastore is null !");
226 *Put Service status to up
227 *and add topology information
228 *after receiving Stubrenderer
229 *service implementation
232 * @param input ServiceCreateInput or
234 private <T> void updateServiceStatus(T input) {
235 LOG.info("Updating Service Status ...");
236 ServiceRpcResultSh notification = null;
238 String serviceName = null;
239 ServiceNotificationTypes notif = null;
240 if (input instanceof ServiceCreateInput) {
241 LOG.info("Updating Service Status came from RPC serviceCreateInput ...");
242 serviceName = serviceCreateInput.getServiceName();
243 notif = ServiceNotificationTypes.ServiceCreateResult;
244 } else if (input instanceof ServiceReconfigureInput) {
245 LOG.info("Updating Service Status came from RPC serviceReconfigure ...");
246 serviceName = serviceReconfigureInput.getNewServiceName();
247 notif = ServiceNotificationTypes.ServiceReconfigureResult;
248 } else if (input instanceof Services) {
249 LOG.info("Updating Service Status came from RPC serviceRestoration ...");
250 serviceName = service.getServiceName();
251 notif = ServiceNotificationTypes.ServiceRestorationResult;
253 if (serviceName != null && notif != null) {
254 if (pathTopology != null) {
255 LOG.info("PathTopology contains in Stubrenderer notification received !");
256 Topology topo = new TopologyBuilder()
257 .setAToZ(pathTopology.getAToZ())
258 .setZToA(pathTopology.getZToA())
262 * Service implemented setting
263 * Service op status to up.
265 if (writeOrModifyOrDeleteServiceList(serviceName, null,topo,0) == null) {
269 StringBuilder build = new StringBuilder();
270 build.append(message);
271 build.append(" : Service Op Status changed to Up !");
272 message = build.toString();
274 StringBuilder build = new StringBuilder();
275 build.append(message);
276 build.append(" but Failed to modify service from Service List !");
277 message = build.toString();
279 notification = new ServiceRpcResultShBuilder()
280 .setNotificationType(notif)
281 .setServiceName(serviceName)
282 .setStatus(RpcStatusEx.Successful).setStatusMessage(message)
285 notificationPublishService.putNotification(notification);
286 } catch (InterruptedException e) {
287 LOG.info("notification offer rejected : {}", e);
290 message = "pathTopology not in stubrenderer notification, cancelling pce resource reserve ...";
292 notification = new ServiceRpcResultShBuilder()
293 .setNotificationType(ServiceNotificationTypes.ServiceCreateResult)
294 .setServiceName(serviceCreateInput.getServiceName())
295 .setStatus(RpcStatusEx.Failed)
296 .setStatusMessage("message")
299 notificationPublishService.putNotification(notification);
300 } catch (InterruptedException e) {
301 LOG.info("notification offer rejected : {}", e);
303 pceCancelResResource();
306 LOG.info("Parameters 'serviceName' or/ and 'notiftype' is null");
311 * Send pathComputation
314 * @param input ServiceCreate or ServiceReconfigure or Services
316 private <T> void pcePathComputation(T input) {
317 LOG.info("sending pathcomputation request to pce ...");
318 ServiceRpcResultSh notification = null;
319 String serviceName = null;
320 ServiceNotificationTypes type = null;
322 * Before sending the PCE request, input data need to be
323 * formatted according to the Service Handler PCE
324 * interface data model.
326 if (input instanceof ServiceReconfigureInput) {
327 LOG.info("PCR came from RPC serviceReconfigure ...");
328 ServiceReconfigureInput tmp = (ServiceReconfigureInput)input;
329 serviceName = tmp.getNewServiceName();
330 type = ServiceNotificationTypes.ServiceReconfigureResult;
331 mappingAndSendingPCRequest = new MappingAndSendingPCRequest(rpcRegistry, tmp, true);
332 } else if (input instanceof ServiceCreateInput) {
333 LOG.info("PCR came from RPC serviceCreate ...");
334 ServiceCreateInput tmp = (ServiceCreateInput)input;
335 serviceName = tmp.getServiceName();
336 type = ServiceNotificationTypes.ServiceCreateResult;
337 mappingAndSendingPCRequest = new MappingAndSendingPCRequest(rpcRegistry, tmp, true);
338 } else if (input instanceof Services) {
339 LOG.info("PCR came from RPC serviceRestoration ...");
340 Services tmp = (Services)input;
341 serviceName = tmp.getServiceName();
342 type = ServiceNotificationTypes.ServiceRestorationResult;
343 mappingAndSendingPCRequest = new MappingAndSendingPCRequest(rpcRegistry, tmp, true);
344 } else if (input instanceof ServiceFeasibilityCheckInput) {
345 LOG.info("PCR came from RPC ServiceFeasibilityCheck ...");
346 ServiceFeasibilityCheckInput tmp = (ServiceFeasibilityCheckInput)input;
347 serviceName = "no name";
348 type = ServiceNotificationTypes.ServiceCreateResult;
349 mappingAndSendingPCRequest = new MappingAndSendingPCRequest(rpcRegistry, tmp, false);
351 final String name = serviceName;
352 final ServiceNotificationTypes notifType = type;
355 * Once PCE request is being sent to the PCE on
356 * interface B, PCE reply is expected until a timer
359 notification = new ServiceRpcResultShBuilder()
360 .setNotificationType(notifType)
361 .setServiceName(serviceName).setStatus(RpcStatusEx.Pending)
362 .setStatusMessage("Service compliant, submitting PathComputation Request ...").build();
364 notificationPublishService.putNotification(notification);
365 } catch (InterruptedException e) {
366 LOG.info("notification offer rejected : {}", e);
368 FutureCallback<Boolean> pceCallback = new FutureCallback<Boolean>() {
370 ServiceRpcResultSh notification = null;
373 public void onSuccess(Boolean response) {
376 * If PCE reply is received before timer
377 * expiration with a positive result, a
378 * service is created with admin and
379 * operational status 'down'.
381 message = "PCE replied to PCR Request !";
383 notification = new ServiceRpcResultShBuilder()
384 .setNotificationType(notifType)
385 .setServiceName(name).setStatus(RpcStatusEx.Pending)
386 .setStatusMessage(message).build();
388 notificationPublishService.putNotification(notification);
389 } catch (InterruptedException e) {
390 LOG.info("notification offer rejected : {}", e);
393 message = mappingAndSendingPCRequest.getError();
394 notification = new ServiceRpcResultShBuilder()
395 .setNotificationType(notifType)
396 .setServiceName("").setStatus(RpcStatusEx.Failed).setStatusMessage(message)
399 notificationPublishService.putNotification(notification);
400 } catch (InterruptedException e) {
401 LOG.info("notification offer rejected : {}", e);
407 public void onFailure(Throwable arg0) {
408 LOG.error("Path not calculated..");
409 notification = new ServiceRpcResultShBuilder()
410 .setNotificationType(notifType)
411 .setServiceName(name).setStatus(RpcStatusEx.Failed)
412 .setStatusMessage("PCR Request failed : " + arg0.getMessage()).build();
414 notificationPublishService.putNotification(notification);
415 } catch (InterruptedException e) {
416 LOG.info("notification offer rejected : {}", e);
421 ListenableFuture<Boolean> pce = mappingAndSendingPCRequest.pathComputationRequest();
422 Futures.addCallback(pce, pceCallback, executor);
426 * Send RPC cancel reserve
429 private void pceCancelResResource() {
430 LOG.info("sending RPC cancel reserve resource to PCE ...");
431 Services pceService = null;
432 ServiceNotificationTypes notif = null;
433 if (serviceDeleteInput != null) {
434 LOG.info("pceCancelResResource came from RPC serviceDelete");
435 notif = ServiceNotificationTypes.ServiceDeleteResult;
436 String serviceName = serviceDeleteInput.getServiceDeleteReqInfo().getServiceName();
437 if (serviceName != null) {
438 pceService = readServiceList(serviceName);
440 LOG.info("Parameter 'serviceName' for pceCancelResResource is null");
442 } else if (service != null) {
443 notif = ServiceNotificationTypes.ServiceRestorationResult;
444 LOG.info("pceCancelResResource came from RPC serviceRestoration");
445 pceService = service;
446 } else if (serviceReconfigureInput != null) {
447 notif = ServiceNotificationTypes.ServiceReconfigureResult;
448 LOG.info("pceCancelResResource came from RPC serviceReconfigure");
449 String serviceName = serviceReconfigureInput.getServiceName();
450 if (serviceName != null) {
451 pceService = readServiceList(serviceName);
453 LOG.info("Parameter 'serviceName' for pceCancelResResource is null");
455 } else if (serviceCreateInput != null) {
456 notif = ServiceNotificationTypes.ServiceCreateResult;
457 LOG.info("pceCancelResResource came from RPC serviceCreate");
458 String serviceName = serviceCreateInput.getServiceName();
459 if (serviceName != null) {
460 pceService = readServiceList(serviceName);
462 LOG.info("Parameter 'serviceName' for pceCancelResResource is null");
465 if (pceService != null && notif != null) {
466 final Services cancelService = pceService;
467 final ServiceNotificationTypes type = notif;
468 mappingAndSendingPCRequest = new MappingAndSendingPCRequest(rpcRegistry, pceService, false);
469 FutureCallback<Boolean> pceCallback = new FutureCallback<Boolean>() {
471 ServiceRpcResultSh notification = null;
473 public void onSuccess(Boolean response) {
476 * If PCE reply is received before timer
477 * expiration with a positive result, a
478 * service is created with admin and
479 * operational status 'down'.
481 message = "PCE replied to cancel resource Request !";
483 notification = new ServiceRpcResultShBuilder()
484 .setNotificationType(type)
485 .setServiceName(cancelService.getServiceName()).setStatus(RpcStatusEx.Pending)
486 .setStatusMessage(message).build();
488 notificationPublishService.putNotification(notification);
489 } catch (InterruptedException e) {
490 LOG.info("notification offer rejected : {}", e);
493 message = mappingAndSendingPCRequest.getError();
494 notification = new ServiceRpcResultShBuilder()
495 .setNotificationType(type)
496 .setServiceName("").setStatus(RpcStatusEx.Failed).setStatusMessage(message)
499 notificationPublishService.putNotification(notification);
500 } catch (InterruptedException e) {
501 LOG.info("notification offer rejected : {}", e);
507 public void onFailure(Throwable arg0) {
508 message = "Cancel resource request failed !";
510 notification = new ServiceRpcResultShBuilder()
511 .setNotificationType(type)
512 .setServiceName(cancelService.getServiceName()).setStatus(RpcStatusEx.Failed)
513 .setStatusMessage(message + " : " + arg0.getMessage()).build();
515 notificationPublishService.putNotification(notification);
516 } catch (InterruptedException e) {
517 LOG.info("notification offer rejected : {}", e);
522 ListenableFuture<Boolean> pce = mappingAndSendingPCRequest.cancelResourceReserve();
523 Futures.addCallback(pce, pceCallback, executor);
527 private void stubrendererDelete() {
528 LOG.info("sending RPC service delete to stubrenderer ...");
531 if (service != null) {
532 LOG.info("RPC service delete came from RPC serviceRestoration !");
533 tmp = service.getServiceName();
534 id = service.getCommonId();
535 } else if (serviceDeleteInput != null) {
536 LOG.info("RPC service delete came from ServiceDelete !");
537 tmp = serviceDeleteInput.getServiceDeleteReqInfo().getServiceName();
538 id = serviceDeleteInput.getSdncRequestHeader().getRequestId();
541 if (tmp != null && id != null) {
542 final String serviceName = tmp;
543 LOG.info("stubrendererDelete service '{}'", serviceName);
544 mappingAndSendingSIRequest = new MappingAndSendingSIRequest(rpcRegistry, id, serviceName);
545 ListenableFuture<Boolean> renderer = mappingAndSendingSIRequest.serviceDelete();
546 FutureCallback<Boolean> rendererCallback = new FutureCallback<Boolean>() {
548 ServiceRpcResultSh notification = null;
551 public void onFailure(Throwable arg0) {
552 message = "ServiceDelete Request failed : " + arg0;
553 LOG.error("ServiceDelete Request failed !");
554 notification = new ServiceRpcResultShBuilder()
555 .setNotificationType(ServiceNotificationTypes.ServiceRestorationResult)
556 .setServiceName(serviceName).setStatus(RpcStatusEx.Failed)
557 .setStatusMessage(message).build();
559 notificationPublishService.putNotification(notification);
560 } catch (InterruptedException e) {
561 LOG.info("notification offer rejected : {}", e);
567 public void onSuccess(Boolean response) {
569 message = "Service deleted !";
570 notification = new ServiceRpcResultShBuilder()
571 .setNotificationType(ServiceNotificationTypes.ServiceRestorationResult)
572 .setServiceName(serviceName).setStatus(RpcStatusEx.Pending)
573 .setStatusMessage(message).build();
575 notificationPublishService.putNotification(notification);
576 } catch (InterruptedException e) {
577 LOG.info("notification offer rejected : {}", e);
580 message = "deleting service failed !";
581 notification = new ServiceRpcResultShBuilder()
582 .setNotificationType(ServiceNotificationTypes.ServiceRestorationResult)
583 .setServiceName(serviceName).setStatus(RpcStatusEx.Failed)
584 .setStatusMessage(message)
587 notificationPublishService.putNotification(notification);
588 } catch (InterruptedException e) {
589 LOG.info("notification offer rejected : {}", e);
594 Futures.addCallback(renderer, rendererCallback, executor);
596 LOG.info("Parameter 'serviceName' and / or 'id' is null");
601 * send a RPC serviceImplementation
602 * to stubrenderer after
603 * receiving a stubpce notification.
605 * @param input ServiceCreate or ServiceReconfigure
607 private <T> void stubrendererImplementation(T input) {
608 ServiceRpcResultSh notification = null;
609 String serviceName = null;
611 String newServiceName = null;
612 ServiceNotificationTypes type = null;
613 Boolean create = false;
614 Boolean delete = true;
615 if (pathDescription != null) {
616 LOG.info("Pathdescription conatins in Stubpce notification received !");
617 String result = null;
618 PathComputationRequestOutput pathComputationResponse =
619 new PathComputationRequestOutputBuilder()
620 .setResponseParameters(new org.opendaylight.yang.gen.v1.http.org
621 .transportpce.b.c._interface.service.types.rev170426.response
622 .parameters.sp.ResponseParametersBuilder()
623 .setPathDescription(pathDescription)
626 if (input instanceof ServiceReconfigureInput) {
627 /** delete and write . */
628 LOG.info("RPC serviceImplementation came from RPC serviceReconfigure ...");
629 ServiceReconfigureInput tmp = (ServiceReconfigureInput)input;
630 serviceName = tmp.getServiceName();
631 newServiceName = tmp.getNewServiceName();
632 type = ServiceNotificationTypes.ServiceReconfigureResult;
634 mappingAndSendingSIRequest = new MappingAndSendingSIRequest(rpcRegistry, tmp,pathComputationResponse);
635 } else if (input instanceof ServiceCreateInput) {
637 LOG.info("RPC serviceImplementation came from RPC serviceCreate ...");
638 ServiceCreateInput tmp = (ServiceCreateInput)input;
639 serviceName = tmp.getServiceName();
640 type = ServiceNotificationTypes.ServiceCreateResult;
641 mappingAndSendingSIRequest = new MappingAndSendingSIRequest(rpcRegistry, tmp,pathComputationResponse);
644 } else if (input instanceof Services) {
646 LOG.info("RPC serviceImplementation came from RPC ServiceRestoration ...");
647 Services tmp = new ServicesBuilder((Services)input)
648 .setAdministrativeState(State.OutOfService)
649 .setOperationalState(State.OutOfService)
650 .setLifecycleState(LifecycleState.Planned)
652 serviceName = tmp.getServiceName();
653 type = ServiceNotificationTypes.ServiceRestorationResult;
654 mappingAndSendingSIRequest = new MappingAndSendingSIRequest(rpcRegistry, tmp, pathComputationResponse);
658 final String name = serviceName;
659 final ServiceNotificationTypes notifType = type;
660 if (!create) { /** ServiceReconfigure. */
661 if ((result = writeOrModifyOrDeleteServiceList(serviceName, pathComputationResponse,null, 1)) == null) {
662 LOG.info("Service '{}' deleted from datastore", serviceName);
663 serviceName = newServiceName;
666 LOG.info("deleting Service '{}' failed !", serviceName);
670 if ((result = writeOrModifyOrDeleteServiceList(serviceName,pathComputationResponse,null, 2)) != null) {
671 LOG.info("writting Service failed !");
672 StringBuilder build = new StringBuilder();
673 build.append(message);
674 build.append(" " + result);
675 message = build.toString();
678 * Send Implementation order to renderer
680 notification = new ServiceRpcResultShBuilder()
681 .setNotificationType(notifType)
682 .setServiceName(name)
683 .setStatus(RpcStatusEx.Pending)
684 .setStatusMessage("Submitting ServiceImplementation Request ...")
687 notificationPublishService.putNotification(notification);
688 } catch (InterruptedException e) {
689 LOG.info("notification offer rejected : {}", e);
692 FutureCallback<Boolean> rendererCallback = new FutureCallback<Boolean>() {
694 ServiceRpcResultSh notification = null;
697 public void onSuccess(Boolean response) {
700 * If stubrenderer reply is received before timer
701 * expiration with a positive result, a
702 * service is created with admin and
703 * operational status 'down'.
705 message = "StubRenderer replied to Request !";
707 notification = new ServiceRpcResultShBuilder()
708 .setNotificationType(notifType)
709 .setServiceName(name).setStatus(RpcStatusEx.Pending)
710 .setStatusMessage(message).build();
712 notificationPublishService.putNotification(notification);
713 } catch (InterruptedException e) {
714 LOG.info("notification offer rejected : {}", e);
717 message = mappingAndSendingSIRequest.getError();
718 notification = new ServiceRpcResultShBuilder()
719 .setNotificationType(notifType)
720 .setServiceName(name).setStatus(RpcStatusEx.Failed).setStatusMessage(message)
723 notificationPublishService.putNotification(notification);
724 } catch (InterruptedException e) {
725 LOG.info("notification offer rejected : {}", e);
731 public void onFailure(Throwable arg0) {
732 LOG.error("Service not implemented ...");
733 notification = new ServiceRpcResultShBuilder()
734 .setNotificationType(notifType)
735 .setServiceName(name).setStatus(RpcStatusEx.Failed)
736 .setStatusMessage("Service implementation failed : " + arg0.getMessage()).build();
738 notificationPublishService.putNotification(notification);
739 } catch (InterruptedException e) {
740 LOG.info("notification offer rejected : {}", e);
744 ListenableFuture<Boolean> renderer = mappingAndSendingSIRequest.serviceImplementation();
745 Futures.addCallback(renderer, rendererCallback, executor);
748 LOG.info("deleting Service failed");
751 message = "PathDescription contains in Stubpce notification "
758 * Checking Service Compliancy.
760 * @return String if not compliant, null else
762 private String serviceCompliancy(SdncRequestHeader sdncRequestHeader, String serviceName,
763 ConnectionType connectionType, RpcActions rpcActions, ServiceEndpoint aend, ServiceEndpoint zend,
764 String commonIdValue, HardConstraints hard, SoftConstraints soft) {
765 String message = null;
766 Boolean contype = false;
767 Boolean sdncRequest = false;
768 Boolean commonId = true;
769 Boolean coherencyHardSoft = false;
771 if (rpcActions.equals(RpcActions.ServiceCreate) || rpcActions.equals(RpcActions.ServiceFeasibilityCheck)
772 || rpcActions.equals(RpcActions.ServiceDelete)) {
774 } else if (rpcActions.equals(RpcActions.ServiceCreate)
775 || rpcActions.equals(RpcActions.ServiceFeasibilityCheck)
776 || rpcActions.equals(RpcActions.ServiceReconfigure)) {
779 compliancyCheck = new ServicehandlerCompliancyCheck(sdncRequestHeader, serviceName,
780 connectionType, rpcActions);
781 if (compliancyCheck.check(contype, sdncRequest)) {
782 LOG.info("Service compliant !");
784 * If compliant, service-request parameters are verified in order to
785 * check if there is no missing parameter that prevents calculating
786 * a path and implement a service.
788 LOG.info("checking Tx/Rx Info for AEnd ...");
789 txrxCheck = new ServicehandlerTxRxCheck(aend, 1);
790 if (txrxCheck.check()) {
791 LOG.info("Tx/Rx Info for AEnd checked !");
792 LOG.info("checking Tx/Rx Info for ZEnd ...");
793 txrxCheck = new ServicehandlerTxRxCheck(zend, 2);
794 if (txrxCheck.check()) {
795 LOG.info("Tx/Rx Info for ZEnd checked");
797 * If OK, common-id is verified in order to see if there is
798 * no routing policy provided. If yes, the routing
799 * constraints of the policy are recovered and coherency
800 * with hard/soft constraints provided in the input of the
803 if (commonIdValue != null) {
804 LOG.info("Common-id specified");
806 * Check coherency with hard/soft constraints.
808 checkCoherencyHardSoft = new CheckCoherencyHardSoft(hard,soft);
809 if (checkCoherencyHardSoft.check()) {
810 LOG.info("hard/soft constraints coherent !");
811 coherencyHardSoft = true;
813 LOG.info("hard/soft constraints are not coherent !");
814 message = "hard/soft constraints are not coherent !";
819 if (!commonId || (commonId && coherencyHardSoft)) {
823 message = txrxCheck.getMessage();
826 message = txrxCheck.getMessage();
829 message = compliancyCheck.getMessage();
836 public Future<RpcResult<ServiceCreateOutput>> serviceCreate(ServiceCreateInput input) {
837 LOG.info("RPC service creation received");
838 pathDescription = null;
840 action = RpcActions.ServiceCreate;
841 setPathDescription(null);
842 serviceCreateInput = input;
843 setServiceDeleteInput(null);
844 setServiceReconfigureInput(null);
847 String responseCode = "";
848 ConfigurationResponseCommon configurationResponseCommon;
849 LOG.info("checking Service Compliancy ...");
851 * Upon receipt of service-create RPC, service header and sdnc-request
852 * header compliancy are verified.
854 String serviceCompliancy = null;
855 if ((serviceCompliancy = serviceCompliancy(input.getSdncRequestHeader(), input.getServiceName(),
856 input.getConnectionType(), RpcActions.ServiceCreate, input.getServiceAEnd(), input.getServiceZEnd(),
857 input.getCommonId(), input.getHardConstraints(), input.getSoftConstraints())) != null) {
858 message = "Service not compliant : " + serviceCompliancy;
859 responseCode = "500";
862 LOG.info("Service compliant !");
863 String name = input.getServiceName();
864 if (readServiceList(name) == null) {
865 pcePathComputation(input);
866 LOG.info("PCR Request in progress ");
867 configurationResponseCommon = new ConfigurationResponseCommonBuilder()
868 .setAckFinalIndicator("No").setRequestId(input.getSdncRequestHeader().getRequestId())
869 .setResponseMessage("Service compliant, serviceCreate in progress...")
870 .setResponseCode("200").build();
872 ServiceCreateOutputBuilder output = new ServiceCreateOutputBuilder()
873 .setConfigurationResponseCommon(configurationResponseCommon);
875 return RpcResultBuilder.success(output.build()).buildFuture();
877 LOG.info("Service '{}' already created !", name);
878 configurationResponseCommon = new ConfigurationResponseCommonBuilder()
879 .setAckFinalIndicator("Yes").setRequestId(input.getSdncRequestHeader().getRequestId())
880 .setResponseMessage("Service already created !")
881 .setResponseCode("500").build();
883 ServiceCreateOutputBuilder output = new ServiceCreateOutputBuilder()
884 .setConfigurationResponseCommon(configurationResponseCommon);
886 return RpcResultBuilder.success(output.build()).buildFuture();
889 /*compliancyCheck = new ServicehandlerCompliancyCheck(input.getSdncRequestHeader(), input.getServiceName(),
890 input.getConnectionType(), RpcActions.ServiceCreate);
891 if (compliancyCheck.check(true, true)) {
892 LOG.info("Service compliant !");
893 LOG.info("checking Tx/Rx Info for AEnd ...");
894 txrxCheck = new ServicehandlerTxRxCheck(input.getServiceAEnd(), 1);
895 if (txrxCheck.check()) {
896 LOG.info("Tx/Rx Info for AEnd checked !");
897 LOG.info("checking Tx/Rx Info for ZEnd ...");
898 txrxCheck = new ServicehandlerTxRxCheck(input.getServiceZEnd(), 2);
899 if (txrxCheck.check()) {
900 LOG.info("Tx/Rx Info for ZEnd checked");
901 if (input.getCommonId() != null) {
902 LOG.info("Common-id specified");
903 checkCoherencyHardSoft = new CheckCoherencyHardSoft(input.getHardConstraints(),
904 input.getSoftConstraints());
905 if (checkCoherencyHardSoft.check()) {
906 LOG.info("hard/soft constraints coherent !");
907 coherencyHardSoft = true;
909 LOG.info("hard/soft constraints are not coherent !");
910 message = "hard/soft constraints are not coherent !";
911 responseCode = "500";
916 if (!commonId || (commonId && coherencyHardSoft)) {
917 pcePathComputation(input);
918 LOG.info("PCR Request in progress ");
919 configurationResponseCommon = new ConfigurationResponseCommonBuilder()
920 .setAckFinalIndicator("No").setRequestId(input.getSdncRequestHeader().getRequestId())
921 .setResponseMessage("Service compliant, serviceCreate in progress...")
922 .setResponseCode("200").build();
924 ServiceCreateOutputBuilder output = new ServiceCreateOutputBuilder()
925 .setConfigurationResponseCommon(configurationResponseCommon);
927 return RpcResultBuilder.success(output.build()).buildFuture();
930 message = txrxCheck.getMessage();
931 responseCode = "500";
934 message = txrxCheck.getMessage();
935 responseCode = "500";
938 message = compliancyCheck.getMessage();
939 responseCode = "500";
942 ConfigurationResponseCommonBuilder builder = new ConfigurationResponseCommonBuilder()
943 .setAckFinalIndicator("Yes")
944 .setResponseMessage(message)
945 .setResponseCode(responseCode);
946 SdncRequestHeader sdnc = input.getSdncRequestHeader();
948 String requestId = sdnc.getRequestId();
949 if (requestId != null) {
950 builder.setRequestId(requestId);
953 configurationResponseCommon = builder.build();
955 ServiceCreateOutputBuilder output = new ServiceCreateOutputBuilder()
956 .setConfigurationResponseCommon(configurationResponseCommon);
958 return RpcResultBuilder.success(output.build()).buildFuture();
962 public Future<RpcResult<ServiceDeleteOutput>> serviceDelete(ServiceDeleteInput input) {
963 LOG.info("RPC serviceDelete request received for Service '{}'", input.getServiceDeleteReqInfo()
965 setServiceDeleteInput(input);
966 setServiceReconfigureInput(null);
967 serviceCreateInput = null;
970 String responseCode = "";
971 LOG.info("checking Service Compliancy ...");
973 * Upon receipt of service-delete RPC, service header and sdnc-request
974 * header compliancy are verified.
976 compliancyCheck = new ServicehandlerCompliancyCheck(input.getSdncRequestHeader(),
977 input.getServiceDeleteReqInfo().getServiceName(), RpcActions.ServiceDelete);
978 if (compliancyCheck.check(false, true)) {
979 LOG.info("Service compliant !");
980 String serviceName = input.getServiceDeleteReqInfo().getServiceName();
981 Services service = readServiceList(serviceName);
982 if (service != null) {
983 LOG.debug("Service '{}' present in datastore !", serviceName);
984 stubrendererDelete();
985 LOG.info("ServiceDelete Request in progress ... ");
986 ConfigurationResponseCommon configurationResponseCommon = new ConfigurationResponseCommonBuilder()
987 .setAckFinalIndicator("No").setRequestId(input.getSdncRequestHeader().getRequestId())
988 .setResponseMessage("ServiceDelete Request in progress ...").setResponseCode("200").build();
989 ServiceDeleteOutput output = new ServiceDeleteOutputBuilder()
990 .setConfigurationResponseCommon(configurationResponseCommon).build();
991 return RpcResultBuilder.success(output).buildFuture();
993 message = "Service '" + serviceName + "' not exists in datastore";
998 message = "Service not compliant !";
999 responseCode = "500";
1002 ConfigurationResponseCommon configurationResponseCommon = new ConfigurationResponseCommonBuilder()
1003 .setAckFinalIndicator("Yes").setRequestId(input.getSdncRequestHeader().getRequestId())
1004 .setResponseMessage(message).setResponseCode(responseCode).build();
1005 ServiceDeleteOutput output = new ServiceDeleteOutputBuilder()
1006 .setConfigurationResponseCommon(configurationResponseCommon).build();
1007 return RpcResultBuilder.success(output).buildFuture();
1011 public Future<RpcResult<ServiceFeasibilityCheckOutput>> serviceFeasibilityCheck(
1012 ServiceFeasibilityCheckInput input) {
1013 action = RpcActions.ServiceFeasibilityCheck;
1014 LOG.info("RPC service feasibilityCheck received");
1015 mappingAndSendingPCRequest = null;
1016 serviceFeasibilityCheckInput = input;
1017 serviceCreateInput = null;
1018 serviceDeleteInput = null;
1020 serviceReconfigureInput = null;
1022 ConfigurationResponseCommon configurationResponseCommon = null;
1023 String message = "";
1024 String responseCode = "";
1025 LOG.info("checking Service Compliancy ...");
1027 * Upon receipt of service-create RPC, service header and sdnc-request
1028 * header compliancy are verified.
1030 String name = "no name";
1031 String serviceCompliancy = null;
1032 if ((serviceCompliancy = serviceCompliancy(input.getSdncRequestHeader(), name, input.getConnectionType(),
1033 RpcActions.ServiceFeasibilityCheck, input.getServiceAEnd(), input.getServiceZEnd(), input.getCommonId(),
1034 input.getHardConstraints(), input.getSoftConstraints())) != null) {
1035 message = "Service not compliant : " + serviceCompliancy;
1038 LOG.info("Service compliant !");
1039 pcePathComputation(input);
1040 LOG.info("PCR Request in progress ");
1041 configurationResponseCommon = new ConfigurationResponseCommonBuilder()
1042 .setAckFinalIndicator("No").setRequestId(input.getSdncRequestHeader().getRequestId())
1043 .setResponseMessage("Service compliant, ServiceFeasibilityCheck in progress...")
1044 .setResponseCode("200").build();
1046 ServiceFeasibilityCheckOutput output = new ServiceFeasibilityCheckOutputBuilder()
1047 .setConfigurationResponseCommon(configurationResponseCommon).build();
1048 return RpcResultBuilder.success(output).buildFuture();
1050 /*compliancyCheck = new ServicehandlerCompliancyCheck(input.getSdncRequestHeader(), name,
1051 input.getConnectionType(), RpcActions.ServiceFeasibilityCheck);
1052 if (compliancyCheck.check(true, true)) {
1053 LOG.info("Service compliant !");
1054 LOG.info("checking Tx/Rx Info for AEnd ...");
1055 txrxCheck = new ServicehandlerTxRxCheck(input.getServiceAEnd(), 1);
1056 if (txrxCheck.check()) {
1057 LOG.info("Tx/Rx Info for AEnd checked !");
1058 LOG.info("checking Tx/Rx Info for ZEnd ...");
1059 txrxCheck = new ServicehandlerTxRxCheck(input.getServiceZEnd(), 2);
1060 if (txrxCheck.check()) {
1061 LOG.info("Tx/Rx Info for ZEnd checked");
1062 if (input.getCommonId() != null) {
1063 LOG.info("Common-id specified");
1064 checkCoherencyHardSoft = new CheckCoherencyHardSoft(input.getHardConstraints(),
1065 input.getSoftConstraints());
1066 if (checkCoherencyHardSoft.check()) {
1067 LOG.info("hard/soft constraints coherent !");
1068 coherencyHardSoft = true;
1070 LOG.info("hard/soft constraints are not coherent !");
1071 message = "hard/soft constraints are not coherent !";
1072 responseCode = "500";
1078 if (!commonId || (commonId && coherencyHardSoft)) {
1079 pcePathComputation(input);
1080 LOG.info("PCR Request in progress ");
1081 configurationResponseCommon = new ConfigurationResponseCommonBuilder()
1082 .setAckFinalIndicator("No").setRequestId(input.getSdncRequestHeader().getRequestId())
1083 .setResponseMessage("Service compliant, ServiceFeasibilityCheck in progress...")
1084 .setResponseCode("200").build();
1086 ServiceFeasibilityCheckOutput output = new ServiceFeasibilityCheckOutputBuilder()
1087 .setConfigurationResponseCommon(configurationResponseCommon).build();
1088 return RpcResultBuilder.success(output).buildFuture();
1091 message = txrxCheck.getMessage();
1092 responseCode = "500";
1095 message = txrxCheck.getMessage();
1096 responseCode = "500";
1099 message = compliancyCheck.getMessage();
1100 responseCode = "500";
1102 configurationResponseCommon = new ConfigurationResponseCommonBuilder().setAckFinalIndicator("Yes")
1103 .setRequestId(input.getSdncRequestHeader().getRequestId()).setResponseMessage(message)
1104 .setResponseCode(responseCode).build();
1105 ServiceFeasibilityCheckOutput output = new ServiceFeasibilityCheckOutputBuilder()
1106 .setConfigurationResponseCommon(configurationResponseCommon).build();
1108 return RpcResultBuilder.success(output).buildFuture();
1112 public Future<RpcResult<ServiceReconfigureOutput>> serviceReconfigure(ServiceReconfigureInput input) {
1113 LOG.info("RPC service reconfigure received");
1114 setServiceReconfigureInput(input);
1115 setServiceDeleteInput(null);
1116 serviceCreateInput = null;
1118 String message = "";
1119 LOG.info("checking Service Compliancy ...");
1121 * Upon receipt of service-create RPC, service header and sdnc-request
1122 * header compliancy are verified.
1124 String serviceCompliancy = null;
1125 if ((serviceCompliancy = serviceCompliancy(null, input.getServiceName(), input.getConnectionType(),
1126 RpcActions.ServiceReconfigure, input.getServiceAEnd(), input.getServiceZEnd(), input.getCommonId(),
1127 input.getHardConstraints(), input.getSoftConstraints())) != null) {
1128 message = "Service not compliant : " + serviceCompliancy;
1131 LOG.info("Service compliant !");
1133 * Retrieving initial service topology.
1135 String serviceName = input.getServiceName();
1136 Services service = readServiceList(serviceName);
1137 if (service != null) {
1138 LOG.debug("Service '{}' present in datastore !", serviceName);
1140 * Sending cancel resource reserve request to PCE.
1142 pceCancelResResource();
1143 ServiceReconfigureOutput output = new ServiceReconfigureOutputBuilder()
1144 .setStatus(RpcStatus.Successful)
1145 .setStatusMessage("ServiceReconfigure in progress ...").build();
1146 return RpcResultBuilder.success(output).buildFuture();
1148 message = "Service '" + serviceName + "' not exists in datastore";
1152 /*compliancyCheck = new ServicehandlerCompliancyCheck(input.getServiceName(), input.getConnectionType(),
1153 RpcActions.ServiceReconfigure);
1154 if (compliancyCheck.check(true, false)) {
1155 LOG.info("Service compliant !");
1156 LOG.info("checking Tx/Rx Info for AEnd ...");
1157 txrxCheck = new ServicehandlerTxRxCheck(input.getServiceAEnd(), 1);
1158 if (txrxCheck.check()) {
1159 LOG.info("Tx/Rx Info for AEnd checked !");
1160 LOG.info("checking Tx/Rx Info for ZEnd ...");
1161 txrxCheck = new ServicehandlerTxRxCheck(input.getServiceZEnd(), 2);
1162 if (txrxCheck.check()) {
1163 LOG.info("Tx/Rx Info for ZEnd checked");
1164 if (input.getCommonId() != null) {
1165 LOG.info("Common-id specified");
1166 checkCoherencyHardSoft = new CheckCoherencyHardSoft(input.getHardConstraints(),
1167 input.getSoftConstraints());
1168 if (checkCoherencyHardSoft.check()) {
1169 LOG.info("hard/soft constraints coherent !");
1170 coherencyHardSoft = true;
1172 LOG.info("hard/soft constraints are not coherent !");
1173 message = "hard/soft constraints are not coherent !";
1179 if (!commonId || (commonId && coherencyHardSoft)) {
1180 String serviceName = input.getServiceName();
1181 Services service = readServiceList(serviceName);
1182 if (service != null) {
1183 LOG.debug("Service '{}' present in datastore !", serviceName);
1184 pceCancelResResource();
1185 ServiceReconfigureOutput output = new ServiceReconfigureOutputBuilder()
1186 .setStatus(RpcStatusEx.Pending)
1187 .setStatusMessage("ServiceReconfigure in progress ...").build();
1188 return RpcResultBuilder.success(output).buildFuture();
1190 message = "Service '" + serviceName + "' not exists in datastore";
1191 LOG.error("Service '{}' not exists in datastore", serviceName);
1195 message = txrxCheck.getMessage();
1198 message = txrxCheck.getMessage();
1201 message = compliancyCheck.getMessage();
1204 ServiceReconfigureOutput output = new ServiceReconfigureOutputBuilder().setStatus(RpcStatus.Failed)
1205 .setStatusMessage(message).build();
1206 return RpcResultBuilder.success(output).buildFuture();
1210 public Future<RpcResult<ServiceRestorationOutput>> serviceRestoration(ServiceRestorationInput input) {
1211 LOG.info("RPC service restoration received");
1212 ServiceRpcResultSh notification = null;
1213 setServiceDeleteInput(null);
1214 setServiceReconfigureInput(null);
1215 String message = "";
1216 LOG.info("checking Service Compliancy ...");
1217 compliancyCheck = new ServicehandlerCompliancyCheck(input.getServiceName(), RpcActions.ServiceRestoration);
1218 if (compliancyCheck.check(false, false)) {
1219 LOG.info("Service compliant !");
1221 * If compliant, Getting path from service DB.
1223 String serviceName = input.getServiceName();
1224 Services service = readServiceList(serviceName);
1225 if (service != null) {
1226 this.service = service;
1227 LOG.debug("Service '{}' present in datastore !", serviceName);
1228 /** verify if service state is down. */
1229 State state = service.getOperationalState();
1230 if (state != null && !state.equals(State.InService)) {
1231 notification = new ServiceRpcResultShBuilder()
1232 .setNotificationType(ServiceNotificationTypes.ServiceRestorationResult)
1233 .setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Pending)
1234 .setStatusMessage("Service '" + serviceName + "' present in datastore, deleting service ..")
1237 notificationPublishService.putNotification(notification);
1238 } catch (InterruptedException e) {
1239 LOG.info("notification offer rejected : {}", e);
1241 stubrendererDelete();
1242 LOG.info("PCR Request in progress ");
1243 ServiceRestorationOutput output = new ServiceRestorationOutputBuilder()
1244 .setStatus(RpcStatus.Successful)
1245 .setStatusMessage("ServiceRestoration in progress...").build();
1246 return RpcResultBuilder.success(output).buildFuture();
1248 LOG.info("Service '{}' still in '{}' state", serviceName, state);
1249 ServiceRestorationOutput output = new ServiceRestorationOutputBuilder()
1250 .setStatus(RpcStatus.Failed)
1251 .setStatusMessage("ServiceRestoration failed : Service still in service !")
1253 return RpcResultBuilder.success(output).buildFuture();
1256 message = "Service '" + serviceName + "' not exists in datastore";
1260 message = compliancyCheck.getMessage();
1264 ServiceRestorationOutput output = new ServiceRestorationOutputBuilder().setStatus(RpcStatus.Failed)
1265 .setStatusMessage(message).build();
1267 return RpcResultBuilder.success(output).buildFuture();
1271 public Future<RpcResult<TempServiceDeleteOutput>> tempServiceDelete(TempServiceDeleteInput input) {
1272 // TODO Auto-generated method stub
1277 public Future<RpcResult<TempServiceCreateOutput>> tempServiceCreate(TempServiceCreateInput input) {
1278 // TODO Auto-generated method stub
1283 * Initialize ServiceList Structure on Datastore.
1288 private void initializeDataTree(DataBroker db) {
1289 LOG.info("Preparing to initialize the greeting registry");
1290 WriteTransaction transaction = db.newWriteOnlyTransaction();
1291 InstanceIdentifier<ServiceList> iid = InstanceIdentifier.create(ServiceList.class);
1292 ServiceList greetingRegistry = new ServiceListBuilder().build();
1293 transaction.put(LogicalDatastoreType.OPERATIONAL, iid, greetingRegistry);
1294 Future<Void> future = transaction.submit();
1296 Futures.getChecked(future, ExecutionException.class);
1297 } catch (ExecutionException e) {
1298 LOG.error("Failed to create Service List");
1303 * Map Input (ServiceCreateInmput, ServiceReconfigureInput) and output
1304 * (PathComputationRequestOutput) to Service.
1306 * @param serviceCreateInput
1307 * ServiceCreateInput parameter
1308 * @param serviceReconfigureInput
1309 * serviceReconfigureInput parameter
1311 * PathComputationRequestOutput parameter
1313 * @return Services Service data
1315 private Services mappingServices(ServiceCreateInput serviceCreateInput,
1316 ServiceReconfigureInput serviceReconfigureInput, PathComputationRequestOutput output) {
1317 LOG.info("Mapping informations to Services");
1318 ServiceAEnd aend = null;
1319 ServiceZEnd zend = null;
1320 ServicesBuilder service = new ServicesBuilder();
1321 if (serviceCreateInput != null) {
1322 aend = new ServiceAEndBuilder(serviceCreateInput.getServiceAEnd()).build();
1323 zend = new ServiceZEndBuilder(serviceCreateInput.getServiceZEnd()).build();
1324 service.setServiceName(serviceCreateInput.getServiceName())
1325 .setAdministrativeState(State.OutOfService)
1326 .setOperationalState(State.OutOfService).setCommonId(serviceCreateInput.getCommonId())
1327 .setConnectionType(serviceCreateInput.getConnectionType())
1328 .setCustomer(serviceCreateInput.getCustomer())
1329 .setCustomerContact(serviceCreateInput.getCustomerContact())
1330 .setHardConstraints(serviceCreateInput.getHardConstraints())
1331 .setSoftConstraints(serviceCreateInput.getSoftConstraints())
1332 .setLifecycleState(LifecycleState.Planned).setServiceAEnd(aend).setServiceZEnd(zend)
1333 .setSdncRequestHeader(new SdncRequestHeaderBuilder()
1334 .setRequestId(serviceCreateInput.getSdncRequestHeader().getRequestId())
1335 .setRpcAction(serviceCreateInput.getSdncRequestHeader().getRpcAction())
1338 } else if (serviceReconfigureInput != null) {
1339 aend = new ServiceAEndBuilder(serviceReconfigureInput.getServiceAEnd()).build();
1340 zend = new ServiceZEndBuilder(serviceReconfigureInput.getServiceZEnd()).build();
1341 service.setServiceName(serviceReconfigureInput.getNewServiceName())
1342 .setAdministrativeState(State.OutOfService).setOperationalState(State.OutOfService)
1343 .setCommonId(serviceReconfigureInput.getCommonId())
1344 .setConnectionType(serviceReconfigureInput.getConnectionType())
1345 .setCustomer(serviceReconfigureInput.getCustomer())
1346 .setCustomerContact(serviceReconfigureInput.getCustomerContact())
1347 .setHardConstraints(serviceReconfigureInput.getHardConstraints())
1348 .setSoftConstraints(serviceReconfigureInput.getSoftConstraints())
1349 .setLifecycleState(LifecycleState.Planned).setServiceAEnd(aend).setServiceZEnd(zend)
1350 .setSdncRequestHeader(new SdncRequestHeaderBuilder()
1351 .setRequestId("reconfigure_" + serviceReconfigureInput.getNewServiceName())
1352 .setRpcAction(RpcActions.ServiceReconfigure)
1356 org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.response
1357 .parameters.sp.ResponseParameters responseParameters = output.getResponseParameters();
1358 if (responseParameters != null) {
1359 // service.setPceMetric(responseParameters.getPceMetric());
1360 org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426
1361 .response.parameters.sp.response.parameters.PathDescription pathDescription =
1362 responseParameters.getPathDescription();
1363 if (pathDescription != null) {
1364 List<AToZ> atozList = new ArrayList<AToZ>();
1365 List<ZToA> ztoaList = new ArrayList<ZToA>();
1367 for (org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426
1368 .path.description.atoz.direction.AToZ
1369 tmp : pathDescription.getAToZDirection().getAToZ()) {
1371 AToZKey key = new AToZKey(tmp.getKey().getId());
1372 AToZ atoz = new AToZBuilder().setId(tmp.getId()).setKey(key)
1373 // .setResource(tmp.getResource())
1378 for (org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426
1379 .path.description.ztoa.direction.ZToA
1380 tmp : pathDescription.getZToADirection().getZToA()) {
1381 ZToAKey key = new ZToAKey(tmp.getKey().getId());
1382 ZToA ztoa = new ZToABuilder().setId(tmp.getId()).setKey(key)
1383 // .setResource(tmp.getResource())
1388 Topology topology = new TopologyBuilder().setAToZ(atozList).setZToA(ztoaList).build();
1389 service.setTopology(topology);
1392 return service.build();
1396 * read Service from ServiceList DataStore.
1398 * @param serviceName
1401 * @return <code>Services</code>
1403 private Services readServiceList(String serviceName) {
1404 Services result = null;
1405 ReadOnlyTransaction readTx = db.newReadOnlyTransaction();
1406 InstanceIdentifier<Services> iid = InstanceIdentifier.create(ServiceList.class).child(Services.class,
1407 new ServicesKey(serviceName));
1408 Future<Optional<Services>> future = readTx.read(LogicalDatastoreType.OPERATIONAL,iid);
1409 Optional<Services> optional = Optional.absent();
1411 optional = Futures.getChecked(future, ExecutionException.class);
1412 } catch (ExecutionException e) {
1413 LOG.error("Reading service failed:", e);
1415 if (optional.isPresent()) {
1416 LOG.debug("Service '{}' present !", serviceName);
1417 result = new ServicesBuilder(optional.get()).build();
1423 * Write or Modify or Delete Service from/to ServiceList.
1425 * @param serviceName
1428 * PathComputationRequestOutput
1432 * 0 - Modify 1 - Delete 2 - Write
1433 * @return String operations result, null if ok or not otherwise
1435 private String writeOrModifyOrDeleteServiceList(String serviceName, PathComputationRequestOutput output,
1436 Topology topo, int choice) {
1437 LOG.info("WriteOrModifyOrDeleting '{}' Service", serviceName);
1438 WriteTransaction writeTx = db.newWriteOnlyTransaction();
1439 String result = null;
1440 Services readService = readServiceList(serviceName);
1441 Future<Void> future = null;
1442 if (readService != null) {
1444 * Modify / Delete Service.
1446 InstanceIdentifier<Services> iid = InstanceIdentifier.create(ServiceList.class).child(Services.class,
1447 new ServicesKey(serviceName));
1448 ServicesBuilder service = new ServicesBuilder(readService);
1450 String action = null;
1452 case 0: /** Modify. */
1453 LOG.info("Modifying '{}' Service", serviceName);
1454 service.setOperationalState(State.InService).setAdministrativeState(State.InService);
1455 service.setTopology(topo);
1456 writeTx.merge(LogicalDatastoreType.OPERATIONAL, iid, service.build());
1460 case 1: /** Delete. */
1461 LOG.info("Deleting '{}' Service", serviceName);
1462 writeTx.delete(LogicalDatastoreType.OPERATIONAL, iid);
1467 LOG.info("No choice found");
1470 future = writeTx.submit();
1472 Futures.getChecked(future, ExecutionException.class);
1473 } catch (ExecutionException e) {
1474 LOG.info("Failed to {} service from Service List", action);
1475 result = "Failed to " + action + " service from Service List";
1477 } else if (choice == 2) { /** Write Service. */
1478 LOG.info("Writing '{}' Service", serviceName);
1479 InstanceIdentifier<Services> iid = InstanceIdentifier.create(ServiceList.class).child(Services.class,
1480 new ServicesKey(serviceName));
1481 Services writeService = null;
1482 if (this.service != null) {
1483 writeService = service;
1485 writeService = mappingServices(serviceCreateInput, serviceReconfigureInput, output);
1487 writeTx.put(LogicalDatastoreType.OPERATIONAL, iid, writeService);
1488 future = writeTx.submit();
1490 Futures.getChecked(future, ExecutionException.class);
1492 } catch (ExecutionException e) {
1493 LOG.error("Failed to write service to Service List");
1494 result = "Failed to write service to Service List";
1497 LOG.info("Service is not present in datastore ! ");
1498 result = "Service is not present in datastore ! ";
1504 public void close() throws Exception {
1505 executor.shutdown();
1509 public Future<RpcResult<EquipmentNotificationOutput>> equipmentNotification(EquipmentNotificationInput input) {
1510 // TODO Auto-generated method stub
1515 public Future<RpcResult<ServiceRerouteConfirmOutput>> serviceRerouteConfirm(ServiceRerouteConfirmInput input) {
1516 // TODO Auto-generated method stub
1521 public Future<RpcResult<ServiceRerouteOutput>> serviceReroute(ServiceRerouteInput input) {
1522 // TODO Auto-generated method stub
1527 public Future<RpcResult<ServiceReversionOutput>> serviceReversion(ServiceReversionInput input) {
1528 // TODO Auto-generated method stub
1533 public Future<RpcResult<ServiceRollOutput>> serviceRoll(ServiceRollInput input) {
1534 // TODO Auto-generated method stub
1539 public Future<RpcResult<NetworkReOptimizationOutput>> networkReOptimization(NetworkReOptimizationInput input) {
1540 // TODO Auto-generated method stub
1545 public void onServiceRpcResultSp(ServiceRpcResultSp notification) {
1546 if (notification != null && !compareServiceRpcResultSp(notification)) {
1547 serviceRpcResultSp = notification;
1548 StringBuilder build = new StringBuilder();
1550 "Received '" + notification.getNotificationType() + "' StubRenderer notification" + "from service '"
1551 + notification.getServiceName() + "' " + "with status '" + notification.getStatus() + "'");
1552 build.append(" with StatusMessage '" + notification.getStatusMessage() + "'");
1553 LOG.info(build.toString());
1554 switch (serviceRpcResultSp.getNotificationType().getIntValue()) {
1555 case 3 : /** service-implementation-request. */
1556 if (serviceRpcResultSp.getStatus() == RpcStatusEx.Successful) {
1557 if (serviceRpcResultSp.getPathTopology() != null) {
1558 pathTopology = new PathTopologyBuilder()
1559 .setAToZ(serviceRpcResultSp.getPathTopology().getAToZ())
1560 .setZToA(serviceRpcResultSp.getPathTopology().getZToA())
1562 LOG.info("PathTopology gets !");
1564 LOG.info("'serviceRpcResultSp.getPathTopology()' parameter is null ");
1566 if (serviceCreateInput != null) {
1567 updateServiceStatus(serviceCreateInput);
1568 } else if (serviceReconfigureInput != null) {
1569 updateServiceStatus(serviceReconfigureInput);
1570 } else if (service != null) {
1571 updateServiceStatus(service);
1573 } else if (serviceRpcResultSp.getStatus() == RpcStatusEx.Failed) {
1574 LOG.info("Stubrenderer computation failed !");
1575 pceCancelResResource();
1579 case 4 : /** service-delete. */
1580 if (serviceRpcResultSp.getStatus() == RpcStatusEx.Successful) {
1581 if (service != null) { //serviceRestoration
1582 LOG.info("RPC service delete came from serviceRestoration");
1583 pcePathComputation(service);
1585 pceCancelResResource();
1587 } else if (serviceRpcResultSp.getStatus() == RpcStatusEx.Failed) {
1588 LOG.info("Stubrenderer computation failed !");
1596 LOG.info("ServiceRpcResultSp already wired !");
1601 public void onServicePathRpcResult(ServicePathRpcResult notification) {
1602 if (notification != null && !compareServicePathRpcResult(notification)) {
1603 servicePathRpcResult = notification;
1604 StringBuilder build = new StringBuilder();
1606 "Received '" + notification.getNotificationType() + "' Stubpce notification" + "from service '"
1607 + notification.getServiceName() + "' " + "with status '" + notification.getStatus() + "'");
1608 build.append(" with StatusMessage '" + notification.getStatusMessage() + "'");
1609 LOG.info(build.toString());
1610 switch (servicePathRpcResult.getNotificationType().getIntValue()) {
1611 case 1 : /** path-computation-request. */
1612 if (servicePathRpcResult.getStatus() == RpcStatusEx.Successful) {
1613 if (servicePathRpcResult.getPathDescription() != null) {
1614 pathDescription = new PathDescriptionBuilder()
1615 .setAToZDirection(servicePathRpcResult.getPathDescription().getAToZDirection())
1616 .setZToADirection(servicePathRpcResult.getPathDescription().getZToADirection())
1618 LOG.info("PathDescription gets !");
1619 if (serviceReconfigureInput != null) {
1620 stubrendererImplementation(serviceReconfigureInput);
1621 } else if (serviceCreateInput != null) {
1622 stubrendererImplementation(serviceCreateInput);
1623 } else if (service != null) {
1624 stubrendererImplementation(service);
1627 LOG.info("'servicePathRpcResult.getPathDescription()'parameter is null ");
1629 } else if (servicePathRpcResult.getStatus() == RpcStatusEx.Failed) {
1630 LOG.info("Stupce computation failed !");
1634 case 2 : /** cancel-resource-reserve. */
1635 if (servicePathRpcResult.getStatus() == RpcStatusEx.Successful) {
1636 /**if it was an RPC serviceReconfigure, relaunch
1637 * PCR else delete the service.
1639 if (serviceReconfigureInput != null) {
1640 LOG.info("cancel reserve resource request came from RPC serviceReconfigure !");
1641 pcePathComputation(serviceReconfigureInput);
1643 deleteServiceFromDatastore();
1645 } else if (servicePathRpcResult.getStatus() == RpcStatusEx.Failed) {
1646 LOG.info("Stupce computation failed !");
1654 LOG.info("ServicePathRpcResult already wired !");
1658 public RpcActions getAction() {
1662 public void setAction(RpcActions action) {
1663 this.action = action;
1667 * Compare ServicePathRpcResult.
1669 * @param notification ServicePathRpcResult
1670 * @return <code>Boolean</code> true if idem, false else
1672 public Boolean compareServicePathRpcResult(ServicePathRpcResult notification) {
1673 Boolean result = true;
1674 if (servicePathRpcResult == null) {
1677 if (servicePathRpcResult.getNotificationType() != notification.getNotificationType()) {
1680 if (servicePathRpcResult.getServiceName() != notification.getServiceName()) {
1683 if (servicePathRpcResult.getStatus() != notification.getStatus()) {
1686 if (servicePathRpcResult.getStatusMessage() != notification.getStatusMessage()) {
1694 * Compare ServiceRpcResultSp.
1696 * @param notification ServiceRpcResultSp
1697 * @return <code>Boolean</code> true if idem, false else
1699 public Boolean compareServiceRpcResultSp(ServiceRpcResultSp notification) {
1700 Boolean result = true;
1701 if (serviceRpcResultSp == null) {
1704 if (serviceRpcResultSp.getNotificationType() != notification.getNotificationType()) {
1707 if (serviceRpcResultSp.getServiceName() != notification.getServiceName()) {
1710 if (serviceRpcResultSp.getStatus() != notification.getStatus()) {
1713 if (serviceRpcResultSp.getStatusMessage() != notification.getStatusMessage()) {
1720 public PathDescription getPathDescription() {
1721 return pathDescription;
1724 public void setPathDescription(PathDescription pathDescription) {
1725 this.pathDescription = pathDescription;
1728 public ServiceDeleteInput getServiceDeleteInput() {
1729 return serviceDeleteInput;
1732 public void setServiceDeleteInput(ServiceDeleteInput serviceDeleteInput) {
1733 this.serviceDeleteInput = serviceDeleteInput;
1736 public ServiceReconfigureInput getServiceReconfigureInput() {
1737 return serviceReconfigureInput;
1740 public void setServiceReconfigureInput(ServiceReconfigureInput serviceReconfigureInput) {
1741 this.serviceReconfigureInput = serviceReconfigureInput;
1744 public ServiceFeasibilityCheckInput getServiceFeasibilityCheckInput() {
1745 return serviceFeasibilityCheckInput;
1748 public void setServiceFeasibilityCheckInput(ServiceFeasibilityCheckInput serviceFeasibilityCheckInput) {
1749 this.serviceFeasibilityCheckInput = serviceFeasibilityCheckInput;
1753 public Future<RpcResult<ServiceStateModifyOutput>> serviceStateModify(ServiceStateModifyInput input) {
1754 LOG.info("RPC service state modify received");
1755 String servicename = input.getServiceName();
1756 String message = "";
1757 String responseCode = "500";
1758 if (servicename != null) {
1759 Services service = readServiceList(servicename);
1760 if (service != null) {
1761 LOG.info("Modify '{}' Service state", servicename);
1762 WriteTransaction writeTx = db.newWriteOnlyTransaction();
1763 String result = null;
1764 Future<Void> future = null;
1765 InstanceIdentifier<Services> iid = InstanceIdentifier.create(ServiceList.class).child(Services.class,
1766 new ServicesKey(servicename));
1767 ServicesBuilder modifyService = new ServicesBuilder(service);
1768 modifyService.setOperationalState(State.OutOfService);
1769 writeTx.merge(LogicalDatastoreType.OPERATIONAL, iid, modifyService.build());
1770 future = writeTx.submit();
1772 Futures.getChecked(future, ExecutionException.class);
1773 } catch (ExecutionException e) {
1774 LOG.info("Failed to {} service from Service List", action);
1775 result = "Failed to " + action + " service from Service List";
1777 if (result == null) {
1778 responseCode = "200";
1779 message = "Service state modified !";
1782 message = "Service not present in datastore ! ";
1785 message = "servicename not set in ServiceStateModifyInput";
1787 ConfigurationResponseCommon configurationResponseCommon = new ConfigurationResponseCommonBuilder()
1788 .setAckFinalIndicator("Yes")
1789 .setResponseCode(responseCode)
1790 .setResponseMessage(message)
1792 ServiceStateModifyOutput output = new ServiceStateModifyOutputBuilder()
1793 .setConfigurationResponseCommon(configurationResponseCommon)
1795 return RpcResultBuilder.success(output).buildFuture();