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.stubpce.impl;
11 import com.google.common.base.Optional;
12 import com.google.common.util.concurrent.FutureCallback;
13 import com.google.common.util.concurrent.Futures;
14 import com.google.common.util.concurrent.ListenableFuture;
15 import com.google.common.util.concurrent.ListeningExecutorService;
16 import com.google.common.util.concurrent.MoreExecutors;
18 import java.util.Iterator;
19 import java.util.SortedSet;
20 import java.util.concurrent.ExecutionException;
21 import java.util.concurrent.Executors;
22 import java.util.concurrent.Future;
24 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
25 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
26 import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
27 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
28 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
29 import org.opendaylight.transportpce.stubpce.CheckCoherencyHardSoft;
30 import org.opendaylight.transportpce.stubpce.SendingPceRPCs;
31 import org.opendaylight.transportpce.stubpce.StubpceCompliancyCheck;
32 import org.opendaylight.transportpce.stubpce.StubpceTxRxCheck;
33 import org.opendaylight.transportpce.stubpce.topology.PathDescriptionsOrdered;
34 import org.opendaylight.transportpce.stubpce.topology.SuperNodePath;
35 import org.opendaylight.transportpce.stubpce.topology.Topology;
36 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.CancelResourceReserveInput;
37 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.CancelResourceReserveOutput;
38 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.CancelResourceReserveOutputBuilder;
39 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.PathComputationRequestInput;
40 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.PathComputationRequestOutput;
41 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.PathComputationRequestOutputBuilder;
42 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.PathDescriptionList;
43 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.PathDescriptionListBuilder;
44 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.ServicePathList;
45 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.ServicePathListBuilder;
46 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.ServicePathRpcResult;
47 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.ServicePathRpcResultBuilder;
48 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.StubpceService;
49 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.path.description.list.PathDescriptions;
50 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.path.description.list.PathDescriptionsBuilder;
51 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.path.description.list.PathDescriptionsKey;
52 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.service.path.list.ServicePaths;
53 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.service.path.list.ServicePathsBuilder;
54 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.service.path.list.ServicePathsKey;
55 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.service.path.rpc.result.PathDescriptionBuilder;
56 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.configuration.response.common.ConfigurationResponseCommonBuilder;
57 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceList;
58 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.list.Services;
59 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.list.ServicesBuilder;
60 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.list.ServicesKey;
61 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.RpcStatusEx;
62 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.ServicePathNotificationTypes;
63 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.service.path.rpc.result.PathDescription;
64 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
65 import org.opendaylight.yangtools.yang.common.RpcResult;
66 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
67 import org.slf4j.Logger;
68 import org.slf4j.LoggerFactory;
71 * Class to implement StubpceService StubpceListener.
72 * @author <a href="mailto:martial.coulibaly@gfi.com">Martial Coulibaly</a> on
76 public class StubpceImpl implements StubpceService {
78 private static final Logger LOG = LoggerFactory.getLogger(StubpceImpl.class);
79 /** Permit to access database. */
80 private DataBroker db;
81 /** check service sdnc-request-header compliancy. */
82 private StubpceCompliancyCheck compliancyCheck;
83 /** check missing info on Tx/Rx for A/Z end. */
84 private StubpceTxRxCheck txrxCheck;
85 /** check coherency between hard and soft constraints. */
86 private CheckCoherencyHardSoft checkCoherencyHardSoft;
87 private NotificationPublishService notificationPublishService;
88 private ServicePathRpcResult notification;
89 private PathDescriptionBuilder pathDescriptionBuilder;
90 private SendingPceRPCs sendingPCE;
91 private final ListeningExecutorService executor = MoreExecutors
92 .listeningDecorator(Executors.newFixedThreadPool(10));
94 public StubpceImpl(NotificationPublishService notificationPublishService, DataBroker databroker) {
95 this.notificationPublishService = notificationPublishService;
97 pathDescriptionBuilder = null;
98 if (initializePathDescriptionList(databroker)) {
99 fillPathDesciptionList();
101 initializeServicePathList(databroker);
102 /*if (initializeServicePathList(databroker)) {
103 fillServicePathList();
108 public Future<RpcResult<CancelResourceReserveOutput>> cancelResourceReserve(CancelResourceReserveInput input) {
109 LOG.info("RPC cancelResourceReserve request received");
111 String responseCode = "";
112 ConfigurationResponseCommonBuilder configurationResponseCommon = null;
113 String serviceName = input.getServiceName();
114 LOG.info("serviceName : {}", serviceName);
115 if (serviceName != null) {
116 sendingPCE = new SendingPceRPCs(input,db,executor);
117 FutureCallback<Boolean> pceCallback = new FutureCallback<Boolean>() {
119 ServicePathRpcResult notification = null;
122 public void onFailure(Throwable arg0) {
123 LOG.error("Cancel resource failed : {}", arg0);
124 notification = new ServicePathRpcResultBuilder()
125 .setNotificationType(ServicePathNotificationTypes.CancelResourceReserve)
126 .setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Failed)
127 .setStatusMessage("Cancel resource request failed : " + arg0.getMessage()).build();
129 notificationPublishService.putNotification(notification);
130 } catch (InterruptedException e) {
131 LOG.info("notification offer rejected : {}", e);
136 public void onSuccess(Boolean response) {
137 LOG.info("response : {}", response);
139 message = "Resource cancelled !";
140 notification = new ServicePathRpcResultBuilder()
141 .setNotificationType(ServicePathNotificationTypes.CancelResourceReserve)
142 .setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Successful)
143 .setStatusMessage(message)
146 message = sendingPCE.getError();
147 notification = new ServicePathRpcResultBuilder()
148 .setNotificationType(ServicePathNotificationTypes.CancelResourceReserve)
150 .setStatus(RpcStatusEx.Failed).setStatusMessage(message)
152 message = "Cancel request failed !";
154 LOG.info(notification.toString());
156 notificationPublishService.putNotification(notification);
157 } catch (InterruptedException e) {
158 LOG.info("notification offer rejected : {}", e);
163 ListenableFuture<Boolean> pce = sendingPCE.cancelResourceReserve();
164 Futures.addCallback(pce, pceCallback, executor);
165 LOG.info("Cancel Resource Request in progress ...");
166 configurationResponseCommon = new ConfigurationResponseCommonBuilder()
167 .setAckFinalIndicator("No")
168 .setRequestId(input.getServiceHandlerHeader().getRequestId())
169 .setResponseMessage("Service compliant, Cancel resource request in progress...")
170 .setResponseCode("200");
172 CancelResourceReserveOutputBuilder output = new CancelResourceReserveOutputBuilder()
173 .setConfigurationResponseCommon(configurationResponseCommon.build());
174 return RpcResultBuilder.success(output.build()).buildFuture();
176 message = "serviceName / requestId is not correct !";
177 responseCode = "500";
178 notification = new ServicePathRpcResultBuilder()
179 .setNotificationType(ServicePathNotificationTypes.CancelResourceReserve)
180 .setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Failed)
181 .setStatusMessage(message).build();
183 notificationPublishService.putNotification(notification);
184 } catch (InterruptedException e) {
185 LOG.info("notification offer rejected : {}", e);
188 configurationResponseCommon = new ConfigurationResponseCommonBuilder();
189 configurationResponseCommon.setAckFinalIndicator("Yes")
190 .setRequestId(input.getServiceHandlerHeader().getRequestId())
191 .setResponseMessage(message)
192 .setResponseCode(responseCode).build();
193 CancelResourceReserveOutputBuilder output = new CancelResourceReserveOutputBuilder();
194 output.setConfigurationResponseCommon(configurationResponseCommon.build());
195 return RpcResultBuilder.success(output.build()).buildFuture();
199 public Future<RpcResult<PathComputationRequestOutput>> pathComputationRequest(PathComputationRequestInput input) {
200 LOG.info("RPC pathcomputation request received");
202 String responseCode = "";
203 boolean coherencyHardSoft = false;
204 boolean commonId = true;
205 ConfigurationResponseCommonBuilder configurationResponseCommon = null;
206 compliancyCheck = new StubpceCompliancyCheck(input.getServiceName(), input.getServiceHandlerHeader());
207 if (compliancyCheck.check(false, true)) {
208 LOG.info("Service compliant !");
210 * If compliant, service-request parameters are verified in order to
211 * check if there is no missing parameter that prevents calculating
212 * a path and implement a service.
214 LOG.info("checking Tx/Rx Info for AEnd ...");
215 txrxCheck = new StubpceTxRxCheck(input.getServiceAEnd(), 1);
216 if (txrxCheck.check()) {
217 LOG.info("Tx/Rx Info for AEnd checked !");
218 LOG.info("checking Tx/Rx Info for ZEnd ...");
219 txrxCheck = new StubpceTxRxCheck(input.getServiceZEnd(), 2);
220 if (txrxCheck.check()) {
221 LOG.info("Tx/Rx Info for ZEnd checked !");
223 * If OK, common-id is verified in order to see if there is
224 * no routing policy provided. If yes, the routing
225 * constraints of the policy are recovered and coherency
226 * with hard/soft constraints provided in the input of the
229 if (input.getHardConstraints() != null || input.getSoftConstraints() != null) {
230 LOG.info("Constraints specified !");
231 checkCoherencyHardSoft = new CheckCoherencyHardSoft(input.getHardConstraints(),
232 input.getSoftConstraints());
233 if (checkCoherencyHardSoft.check()) {
234 LOG.info("hard/soft constraints coherent !");
235 coherencyHardSoft = true;
237 LOG.info("hard/soft constraints are not coherent !");
238 message = "hard/soft constraints are not coherent !";
239 responseCode = "500";
244 if (!commonId || (commonId && coherencyHardSoft)) {
245 notification = new ServicePathRpcResultBuilder()
246 .setNotificationType(ServicePathNotificationTypes.PathComputationRequest)
247 .setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Pending)
248 .setStatusMessage("Service compliant, submitting pathComputation Request ...").build();
250 notificationPublishService.putNotification(notification);
251 } catch (InterruptedException e) {
252 LOG.info("notification offer rejected : {}", e);
254 sendingPCE = new SendingPceRPCs(input,db,executor);
255 FutureCallback<Boolean> pceCallback = new FutureCallback<Boolean>() {
257 ServicePathRpcResult notification = null;
260 public void onFailure(Throwable arg0) {
261 LOG.error("Failure message : {}", arg0.toString());
262 LOG.error("Path calculation failed !");
263 notification = new ServicePathRpcResultBuilder()
264 .setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Failed)
265 .setStatusMessage("PCR Request failed : " + arg0.getMessage()).build();
267 notificationPublishService.putNotification(notification);
268 } catch (InterruptedException e) {
269 LOG.info("notification offer rejected : {}", e);
274 public void onSuccess(Boolean response) {
275 LOG.info("response : {}", response);
277 message = "Path Computated !";
278 ServicePathRpcResultBuilder tmp = new ServicePathRpcResultBuilder()
279 .setNotificationType(ServicePathNotificationTypes.PathComputationRequest)
280 .setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Successful)
281 .setStatusMessage(message);
282 pathDescriptionBuilder = sendingPCE.getPathDescription();
283 if (pathDescriptionBuilder != null) {
284 PathDescription pathDescription = new org.opendaylight.yang.gen.v1.http.org
285 .transportpce.b.c._interface.servicepath.rev170426.service.path
286 .rpc.result.PathDescriptionBuilder()
287 .setAToZDirection(pathDescriptionBuilder.getAToZDirection())
288 .setZToADirection(pathDescriptionBuilder.getZToADirection())
290 tmp.setPathDescription(new PathDescriptionBuilder()
291 .setAToZDirection(pathDescription.getAToZDirection())
292 .setZToADirection(pathDescription.getZToADirection())
295 notification = tmp.build();
297 message = sendingPCE.getError();
298 notification = new ServicePathRpcResultBuilder()
299 .setNotificationType(ServicePathNotificationTypes.PathComputationRequest)
301 .setStatus(RpcStatusEx.Failed).setStatusMessage(message)
303 message = "Path not calculated!";
306 notificationPublishService.putNotification(notification);
307 } catch (InterruptedException e) {
308 LOG.info("notification offer rejected : {}", e);
313 ListenableFuture<Boolean> pce = sendingPCE.pathComputation();
314 Futures.addCallback(pce, pceCallback, executor);
315 LOG.info("PathComputation Request in progress ...");
316 configurationResponseCommon = new ConfigurationResponseCommonBuilder()
317 .setAckFinalIndicator("No")
318 .setRequestId(input.getServiceHandlerHeader().getRequestId())
319 .setResponseMessage("Service compliant, Path calculating in progress...")
320 .setResponseCode("200");
322 PathComputationRequestOutputBuilder output = new PathComputationRequestOutputBuilder()
323 .setConfigurationResponseCommon(configurationResponseCommon.build());
324 return RpcResultBuilder.success(output.build()).buildFuture();
328 message = txrxCheck.getMessage();
329 responseCode = "500";
332 message = txrxCheck.getMessage();
333 responseCode = "500";
336 message = compliancyCheck.getMessage();
337 responseCode = "500";
338 notification = new ServicePathRpcResultBuilder()
339 .setNotificationType(ServicePathNotificationTypes.PathComputationRequest)
340 .setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Failed)
341 .setStatusMessage("Service not compliant : " + message).build();
343 notificationPublishService.putNotification(notification);
344 } catch (InterruptedException e) {
345 LOG.info("notification offer rejected : {}", e);
348 configurationResponseCommon = new ConfigurationResponseCommonBuilder();
349 configurationResponseCommon.setAckFinalIndicator("Yes")
350 .setRequestId(input.getServiceHandlerHeader().getRequestId())
351 .setResponseMessage(message)
352 .setResponseCode(responseCode).build();
353 PathComputationRequestOutputBuilder output = new PathComputationRequestOutputBuilder();
354 output.setConfigurationResponseCommon(configurationResponseCommon.build());
355 return RpcResultBuilder.success(output.build()).buildFuture();
360 * Initialize PathDescriptionList Structure on DataStore.
365 private boolean initializePathDescriptionList(DataBroker db) {
366 Boolean result = true;
367 LOG.info("Preparing to initialize the PathDescription List");
368 WriteTransaction transaction = db.newWriteOnlyTransaction();
369 InstanceIdentifier<PathDescriptionList> iid = InstanceIdentifier.create(PathDescriptionList.class);
370 PathDescriptionList pathDescriptionList = new PathDescriptionListBuilder().build();
371 transaction.put(LogicalDatastoreType.OPERATIONAL, iid, pathDescriptionList);
372 Future<Void> future = transaction.submit();
374 Futures.getChecked(future, ExecutionException.class);
375 } catch (ExecutionException e) {
376 LOG.error("Failed to create PathDescription List");
383 * Initialize ServicePathList Structure on DataStore.
387 * @return <code>true</code> if ok, <code>false</code> else
389 private boolean initializeServicePathList(DataBroker db) {
390 Boolean result = true;
391 LOG.info("Preparing to initialize the ServicePathList registry");
392 WriteTransaction transaction = db.newWriteOnlyTransaction();
393 InstanceIdentifier<ServicePathList> iid = InstanceIdentifier.create(ServicePathList.class);
394 ServicePathList servicePathList = new ServicePathListBuilder().build();
395 transaction.put(LogicalDatastoreType.OPERATIONAL, iid, servicePathList);
396 Future<Void> future = transaction.submit();
398 Futures.getChecked(future, ExecutionException.class);
399 } catch (ExecutionException e) {
400 LOG.error("Failed to create ServicePathList List : {}", e.toString());
407 * fill PathDescriptionList
408 * with direct paths and
411 private void fillPathDesciptionList() {
412 LOG.info("filling PathDescription List...");
413 Topology topo = new Topology();
415 LOG.info("Network : {}", topo.getNetwork());
416 SuperNodePath superNodePath = new SuperNodePath(topo.getNetwork());
417 String aend = "NodeA";
418 String zend = "NodeZ";
419 superNodePath.run(aend, zend);
420 fill(superNodePath.getDirectPathDesc(aend, zend, superNodePath.getPaths()));
421 fill(superNodePath.getIndirectPathDesc(aend, zend, superNodePath.getPaths()));
425 * fill datastore with
426 * Pathdescriptions List.
428 * @param sortedSet PathDescriptionsOrdered List
430 private void fill(SortedSet<PathDescriptionsOrdered> sortedSet) {
431 InstanceIdentifier<PathDescriptions> iid;
432 WriteTransaction writeTx;
434 if (!sortedSet.isEmpty()) {
435 Iterator<PathDescriptionsOrdered> it = sortedSet.iterator();
436 while (it.hasNext()) {
437 PathDescriptions pathDesc = it.next().getPathDescriptions();
438 if (pathDesc != null) {
439 iid = InstanceIdentifier.create(PathDescriptionList.class)
440 .child(PathDescriptions.class, new PathDescriptionsKey(pathDesc.getPathName()));
441 writeTx = db.newWriteOnlyTransaction();
442 writeTx.put(LogicalDatastoreType.OPERATIONAL, iid, pathDesc);
443 future = writeTx.submit();
445 Futures.getChecked(future, ExecutionException.class);
446 } catch (ExecutionException e) {
447 LOG.error("Failed to write PathDescriptions to PathDescriptionsList : {}", e.toString());
450 LOG.error("PathDescriptions gets is null !");
454 LOG.info("PathDescriptions List is empty !");
459 * read Service from ServiceList DataStore.
464 * @return <code>Services</code>
466 @SuppressWarnings("unused")
467 private Services readServiceList(String serviceName) {
468 Services result = null;
469 ReadOnlyTransaction readTx = db.newReadOnlyTransaction();
470 InstanceIdentifier<Services> iid = InstanceIdentifier.create(ServiceList.class).child(Services.class,
471 new ServicesKey(serviceName));
472 Future<Optional<Services>> future = readTx.read(LogicalDatastoreType.OPERATIONAL,iid);
473 Optional<Services> optional = Optional.absent();
475 optional = Futures.getChecked(future, ExecutionException.class);
476 } catch (ExecutionException e) {
477 LOG.error("Reading service failed:", e);
479 if (optional.isPresent()) {
480 LOG.debug("Service '{}' present !", serviceName);
481 result = new ServicesBuilder(optional.get()).build();
487 * read ServicePath Service from ServicePathList DataStore.
490 * Name of ServicePath
492 * @return <code>Services</code>
494 @SuppressWarnings("unused")
495 private ServicePaths readServicePathList(String serviceName) {
496 ServicePaths result = null;
497 ReadOnlyTransaction readTx = db.newReadOnlyTransaction();
498 InstanceIdentifier<ServicePaths> iid = InstanceIdentifier.create(ServicePathList.class)
499 .child(ServicePaths.class, new ServicePathsKey(serviceName));
500 Future<Optional<ServicePaths>> future = readTx.read(LogicalDatastoreType.OPERATIONAL,iid);
501 Optional<ServicePaths> optional = Optional.absent();
503 optional = Futures.getChecked(future, ExecutionException.class);
504 } catch (ExecutionException e) {
505 LOG.error("Reading service failed:", e);
507 if (optional.isPresent()) {
508 LOG.debug("Service '{}' present !", serviceName);
509 result = new ServicePathsBuilder(optional.get()).build();
515 * read PathDescription information from PathDescriptionList.
518 * Name of PathDescription
520 * @return <code>PathDescriptions</code>
522 @SuppressWarnings("unused")
523 private PathDescriptions readPathDescriptionList(String pathName) {
524 PathDescriptions result = null;
525 ReadOnlyTransaction readTx = db.newReadOnlyTransaction();
526 InstanceIdentifier<PathDescriptions> iid = InstanceIdentifier.create(PathDescriptionList.class)
527 .child(PathDescriptions.class, new PathDescriptionsKey(pathName));
528 Future<Optional<PathDescriptions>> future = readTx.read(LogicalDatastoreType.OPERATIONAL,iid);
529 Optional<PathDescriptions> optional = Optional.absent();
531 optional = Futures.getChecked(future, ExecutionException.class);
532 } catch (ExecutionException e) {
533 LOG.error("Reading service failed:", e);
535 if (optional.isPresent()) {
536 LOG.debug("PathDescritions '{}' present !", pathName);
537 result = new PathDescriptionsBuilder(optional.get()).build();
543 * register ServicePath Service to ServicePathList with PathDescription
547 * PathComputationRequestInput
548 * @return String operations result, null if ok or not otherwise
550 @SuppressWarnings("unused")
551 private String writeServicePathList(PathComputationRequestInput input) {
552 String serviceName = input.getServiceName();
553 LOG.debug("Write ServicePath '{}' Service", serviceName);
554 String result = null;
555 LOG.debug("Writing '{}' ServicePath", serviceName);
556 InstanceIdentifier<ServicePaths> iid = InstanceIdentifier.create(ServicePathList.class)
557 .child(ServicePaths.class, new ServicePathsKey(serviceName));
559 org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.service
560 .path.PathDescriptionBuilder path = new org.opendaylight.yang.gen.v1.http.org.transportpce
561 .b.c._interface.service.types.rev170426.service.path.PathDescriptionBuilder();
562 path.setAToZDirection(pathDescriptionBuilder.getAToZDirection());
563 path.setZToADirection(pathDescriptionBuilder.getZToADirection());
564 ServicePaths service = new ServicePathsBuilder().setServicePathName(input.getServiceName())
565 .setSoftConstraints(input.getSoftConstraints()).setHardConstraints(input.getHardConstraints())
566 .setPathDescription(path.build()).build();
567 WriteTransaction writeTx = db.newWriteOnlyTransaction();
568 writeTx.put(LogicalDatastoreType.OPERATIONAL, iid, service);
569 Future<Void> future = writeTx.submit();
571 Futures.getChecked(future, ExecutionException.class);
573 } catch (ExecutionException e) {
574 LOG.error("Failed to write service to Service List");
575 result = "Failed to write service to Service List";
580 public PathDescriptionBuilder getPathDescriptionBuilder() {
581 return pathDescriptionBuilder;
584 public void setPathDescriptionBuilder(PathDescriptionBuilder pathDescriptionBuilder) {
585 this.pathDescriptionBuilder = pathDescriptionBuilder;