2 * Copyright © 2018 Orange, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.transportpce.servicehandler.utils;
10 import com.google.common.util.concurrent.ListenableFuture;
11 import com.google.common.util.concurrent.ListeningExecutorService;
12 import com.google.common.util.concurrent.MoreExecutors;
14 import java.time.OffsetDateTime;
15 import java.time.ZoneOffset;
16 import java.time.format.DateTimeFormatter;
17 import java.util.concurrent.Callable;
18 import java.util.concurrent.Executors;
20 import org.opendaylight.transportpce.servicehandler.MappingConstraints;
21 import org.opendaylight.transportpce.servicehandler.ModelMappingUtils;
22 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev171017.PathComputationRequestInput;
23 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev171017.PathComputationRequestInputBuilder;
24 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev171017.ServicePathRpcResult;
25 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev171017.ServicePathRpcResultBuilder;
26 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev171017.service.path.rpc.result.PathDescription;
27 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev171017.service.path.rpc.result.PathDescriptionBuilder;
28 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceRpcResultSp;
29 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev171017.ServiceRpcResultSpBuilder;
30 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev170930.ServiceRpcResultSh;
31 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev170930.ServiceRpcResultShBuilder;
32 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.ConnectionType;
33 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.RpcActions;
34 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.ServiceFormat;
35 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.ServiceNotificationTypes;
36 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.sdnc.request.header.SdncRequestHeader;
37 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.sdnc.request.header.SdncRequestHeaderBuilder;
38 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.endpoint.RxDirection;
39 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.endpoint.TxDirection;
40 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.lgx.LgxBuilder;
41 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.port.PortBuilder;
42 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceCreateInput;
43 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceCreateInputBuilder;
44 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceDeleteInput;
45 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceDeleteInputBuilder;
46 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceFeasibilityCheckInput;
47 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceFeasibilityCheckInputBuilder;
48 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceReconfigureInput;
49 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceReconfigureInputBuilder;
50 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRerouteInput;
51 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRerouteInputBuilder;
52 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRestorationInput;
53 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRestorationInput.Option;
54 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceRestorationInputBuilder;
55 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.TempServiceCreateInput;
56 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.TempServiceCreateInputBuilder;
57 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.TempServiceDeleteInput;
58 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.TempServiceDeleteInputBuilder;
59 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.delete.input.ServiceDeleteReqInfo;
60 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.delete.input.ServiceDeleteReqInfoBuilder;
61 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.path.description.AToZDirection;
62 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.path.description.AToZDirectionBuilder;
63 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.path.description.ZToADirection;
64 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.path.description.ZToADirectionBuilder;
65 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev171017.RoutingConstraintsSp.PceMetric;
66 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev171016.RpcStatusEx;
67 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev171016.ServicePathNotificationTypes;
68 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev171016.service.handler.header.ServiceHandlerHeaderBuilder;
69 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
71 public final class ServiceDataUtils {
73 public static ServiceCreateInput buildServiceCreateInput() {
75 ServiceCreateInputBuilder builtInput = new ServiceCreateInputBuilder();
76 org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.create.input
77 .ServiceAEnd serviceAEnd = getServiceAEndBuild()
79 org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.create.input
80 .ServiceZEnd serviceZEnd = new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service
81 .create.input.ServiceZEndBuilder()
82 .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate((long) 1).setNodeId("XPONDER-3-2")
83 .setTxDirection(getTxDirection())
84 .setRxDirection(getRxDirection())
87 builtInput.setCommonId("commonId");
88 builtInput.setConnectionType(ConnectionType.Service);
89 builtInput.setCustomer("Customer");
90 builtInput.setServiceName("service 1");
91 builtInput.setServiceAEnd(serviceAEnd);
92 builtInput.setServiceZEnd(serviceZEnd);
93 builtInput.setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("request 1")
94 .setRpcAction(RpcActions.ServiceCreate).setNotificationUrl("notification url").build());
96 return builtInput.build();
99 public static PathComputationRequestInput createPceRequestInput(ServiceCreateInput input) {
100 MappingConstraints mappingConstraints =
101 new MappingConstraints(input.getHardConstraints(), input.getSoftConstraints());
102 mappingConstraints.serviceToServicePathConstarints();
103 ServiceHandlerHeaderBuilder serviceHandlerHeader = new ServiceHandlerHeaderBuilder();
104 SdncRequestHeader serviceHandler = input.getSdncRequestHeader();
105 if (serviceHandler != null) {
106 serviceHandlerHeader.setRequestId(serviceHandler.getRequestId());
108 return new PathComputationRequestInputBuilder()
109 .setServiceName(input.getServiceName())
110 .setResourceReserve(true)
111 .setServiceHandlerHeader(serviceHandlerHeader.build())
112 .setHardConstraints(mappingConstraints.getServicePathHardConstraints())
113 .setSoftConstraints(mappingConstraints.getServicePathSoftConstraints())
114 .setPceMetric(PceMetric.TEMetric)
115 .setServiceAEnd(ModelMappingUtils.createServiceAEnd(input.getServiceAEnd()))
116 .setServiceZEnd(ModelMappingUtils.createServiceZEnd(input.getServiceZEnd()))
120 public static TempServiceCreateInput buildTempServiceCreateInput() {
122 TempServiceCreateInputBuilder builtInput = new TempServiceCreateInputBuilder();
123 org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.temp.service.create.input
124 .ServiceAEnd serviceAEnd = new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014
125 .temp.service.create.input.ServiceAEndBuilder()
126 .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate((long) 1).setNodeId("XPONDER-1-2")
127 .setTxDirection(getTxDirection())
128 .setRxDirection(getRxDirection())
130 org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.temp.service.create.input
131 .ServiceZEnd serviceZEnd = new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.temp
132 .service.create.input.ServiceZEndBuilder()
133 .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate((long) 1).setNodeId("XPONDER-3-2")
134 .setTxDirection(getTxDirection())
135 .setRxDirection(getRxDirection())
138 builtInput.setCommonId("commonId");
139 builtInput.setConnectionType(ConnectionType.Service);
140 builtInput.setCustomer("Customer");
141 builtInput.setServiceAEnd(serviceAEnd);
142 builtInput.setServiceZEnd(serviceZEnd);
143 builtInput.setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("request 1")
144 .setRpcAction(RpcActions.TempServiceCreate).setNotificationUrl("notification url").build());
146 return builtInput.build();
149 public static ServiceFeasibilityCheckInput buildServiceFeasibilityCheckInput() {
150 ServiceFeasibilityCheckInputBuilder builtInput = new ServiceFeasibilityCheckInputBuilder();
151 org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.feasibility.check.input
152 .ServiceAEnd serviceAEnd = new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service
153 .feasibility.check.input.ServiceAEndBuilder()
154 .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate((long) 1)
155 .setNodeId("XPONDER-1-2").setTxDirection(getTxDirection()).setRxDirection(getRxDirection())
157 org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.feasibility.check.input
158 .ServiceZEnd serviceZEnd = new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service
159 .feasibility.check.input.ServiceZEndBuilder()
160 .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate((long) 1)
161 .setNodeId("XPONDER-3-2").setTxDirection(getTxDirection()).setRxDirection(getRxDirection())
163 builtInput.setCommonId("commonId");
164 builtInput.setConnectionType(ConnectionType.Service);
165 builtInput.setCustomer("Customer");
166 builtInput.setServiceAEnd(serviceAEnd);
167 builtInput.setServiceZEnd(serviceZEnd);
168 builtInput.setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("request 1")
169 .setRpcAction(RpcActions.ServiceFeasibilityCheck).setNotificationUrl("notification url").build());
170 return builtInput.build();
173 public static org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.create.input
174 .ServiceAEndBuilder getServiceAEndBuild() {
175 return new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.create.input
176 .ServiceAEndBuilder()
177 .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate((long) 1).setNodeId("XPONDER-1-2")
178 .setTxDirection(getTxDirection())
179 .setRxDirection(getRxDirection());
182 public static org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.create.input
183 .ServiceZEndBuilder getServiceZEndBuild() {
184 return new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.create.input
185 .ServiceZEndBuilder()
186 .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate((long) 1).setNodeId("XPONDER-1-2")
187 .setTxDirection(getTxDirection())
188 .setRxDirection(getRxDirection());
191 private static TxDirection getTxDirection() {
192 return new org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service
193 .endpoint.TxDirectionBuilder().setPort(new PortBuilder().setPortDeviceName("device name")
194 .setPortName("port name").setPortRack("port rack").setPortShelf("port shelf")
195 .setPortSlot("port slot").setPortSubSlot("port subslot").setPortType("port type").build())
196 .setLgx(new LgxBuilder().setLgxDeviceName("lgx device name").setLgxPortName("lgx port name")
197 .setLgxPortRack("lgx port rack").setLgxPortShelf("lgx port shelf").build())
201 private static RxDirection getRxDirection() {
202 return new org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service
203 .endpoint.RxDirectionBuilder()
204 .setPort(new PortBuilder().setPortDeviceName("device name").setPortName("port name")
205 .setPortRack("port rack").setPortShelf("port shelf").setPortSlot("port slot")
206 .setPortSubSlot("port subslot").setPortType("port type").build())
207 .setLgx(new LgxBuilder().setLgxDeviceName("lgx device name")
208 .setLgxPortName("lgx port name").setLgxPortRack("lgx port rack")
209 .setLgxPortShelf("lgx port shelf").build())
213 public static ServiceDeleteInput buildServiceDeleteInput() {
214 ServiceDeleteInputBuilder deleteInputBldr = new ServiceDeleteInputBuilder();
215 DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
216 OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
217 DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime));
218 deleteInputBldr.setServiceDeleteReqInfo(new ServiceDeleteReqInfoBuilder().setServiceName("service 1")
219 .setDueDate(datetime).setTailRetention(ServiceDeleteReqInfo.TailRetention.No).build());
220 SdncRequestHeaderBuilder sdncBuilder = new SdncRequestHeaderBuilder();
221 sdncBuilder.setNotificationUrl("notification url");
222 sdncBuilder.setRequestId("request 1");
223 sdncBuilder.setRequestSystemId("request system 1");
224 sdncBuilder.setRpcAction(RpcActions.ServiceDelete);
225 deleteInputBldr.setSdncRequestHeader(sdncBuilder.build());
226 return deleteInputBldr.build();
229 public static TempServiceDeleteInput buildTempServiceDeleteInput() {
230 TempServiceDeleteInputBuilder deleteInputBldr = new TempServiceDeleteInputBuilder();
231 deleteInputBldr.setCommonId("service 1");
232 return deleteInputBldr.build();
235 public static ServiceRerouteInput buildServiceRerouteInput() {
236 ServiceRerouteInputBuilder builder = new ServiceRerouteInputBuilder();
237 builder.setServiceName("service 1");
238 return builder.build();
241 public static ServiceRestorationInput buildServiceRestorationInput() {
242 ServiceRestorationInputBuilder builder = new ServiceRestorationInputBuilder();
243 builder.setServiceName("service 1");
244 builder.setOption(Option.Permanent);
245 return builder.build();
248 public static ServiceReconfigureInput buildServiceReconfigureInput() {
249 ServiceReconfigureInputBuilder builtInput = new ServiceReconfigureInputBuilder();
250 org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.reconfigure.input
251 .ServiceAEnd serviceAEnd = new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service
252 .reconfigure.input.ServiceAEndBuilder()
253 .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate((long) 1)
254 .setNodeId("XPONDER-1-2").setTxDirection(getTxDirection()).setRxDirection(getRxDirection())
256 org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.reconfigure.input
257 .ServiceZEnd serviceZEnd = new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service
258 .reconfigure.input.ServiceZEndBuilder()
259 .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate((long) 1)
260 .setNodeId("XPONDER-3-2").setTxDirection(getTxDirection()).setRxDirection(getRxDirection())
262 builtInput.setCommonId("commonId");
263 builtInput.setConnectionType(ConnectionType.Service);
264 builtInput.setCustomer("Customer");
265 builtInput.setServiceName("service 1");
266 builtInput.setServiceAEnd(serviceAEnd);
267 builtInput.setServiceZEnd(serviceZEnd);
268 return builtInput.build();
271 public static ServicePathRpcResult buildServicePathRpcResult() {
272 DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
273 OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
274 DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime));
275 ServicePathRpcResultBuilder builder = new ServicePathRpcResultBuilder();
276 builder.setActualDate(datetime).setNotificationType(ServicePathNotificationTypes.PathComputationRequest)
277 .setPathDescription(createPathDescription(0,1, 0, 1))
278 .setServiceName("service 1")
279 .setStatus(RpcStatusEx.Successful).setStatusMessage("success");
280 return builder.build();
283 public static ServicePathRpcResult buildServicePathRpcResult(
284 ServicePathNotificationTypes servicePathNotificationTypes, String serviceName, RpcStatusEx rpcStatusEx,
285 String message, Boolean pathDescription) {
286 DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
287 OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
288 DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime));
289 ServicePathRpcResultBuilder builder = new ServicePathRpcResultBuilder();
290 builder.setNotificationType(servicePathNotificationTypes)
291 .setServiceName(serviceName)
292 .setStatus(rpcStatusEx).setStatusMessage(message);
293 if (pathDescription) {
294 builder.setPathDescription(createPathDescription(0L, 5L, 0L, 5L));
296 return builder.build();
299 public static ServicePathRpcResult buildFailedPceServicePathRpcResult() {
300 DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
301 OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
302 DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime));
303 ServicePathRpcResultBuilder builder = new ServicePathRpcResultBuilder();
304 builder.setActualDate(datetime).setNotificationType(ServicePathNotificationTypes.PathComputationRequest)
305 .setPathDescription(createPathDescription(0, 1, 0, 1)).setServiceName("service 1")
306 .setStatus(RpcStatusEx.Failed).setStatusMessage("failed");
307 return builder.build();
310 public static ServicePathRpcResult buildFailedServicePathRpcResult() {
311 DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
312 OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
313 DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime));
314 ServicePathRpcResultBuilder builder = new ServicePathRpcResultBuilder();
315 builder.setActualDate(datetime).setNotificationType(ServicePathNotificationTypes.ServiceImplementationRequest)
316 .setPathDescription(createPathDescription(0,1, 0, 1))
317 .setServiceName("service 1")
318 .setStatus(RpcStatusEx.Failed).setStatusMessage("failed");
319 return builder.build();
322 public static ServiceRpcResultSp buildServiceRpcResultSp() {
323 DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
324 OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
325 DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime));
326 ServiceRpcResultSpBuilder builder = new ServiceRpcResultSpBuilder();
327 builder.setActualDate(datetime).setNotificationType(ServicePathNotificationTypes.ServiceImplementationRequest)
328 .setServiceName("service 1").setStatus(RpcStatusEx.Successful).setStatusMessage("success");
329 return builder.build();
332 public static ServiceRpcResultSp buildServiceRpcResultSp(ServicePathNotificationTypes servicePathNotificationTypes,
333 String serviceName, RpcStatusEx rpcStatusEx, String message) {
334 DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
335 OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
336 DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime));
337 ServiceRpcResultSpBuilder builder = new ServiceRpcResultSpBuilder();
338 builder.setNotificationType(servicePathNotificationTypes).setServiceName(serviceName)
339 .setStatus(rpcStatusEx).setStatusMessage(message);
340 return builder.build();
343 public static ServiceRpcResultSh buildServiceRpcResultSh(ServiceNotificationTypes serviceNotificationTypes,
344 String serviceName, org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types
345 .rev170426.RpcStatusEx rpcStatusEx, String message) {
346 DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
347 OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
348 DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime));
349 ServiceRpcResultShBuilder builder = new ServiceRpcResultShBuilder();
350 builder.setNotificationType(serviceNotificationTypes).setServiceName(serviceName)
351 .setStatus(rpcStatusEx).setStatusMessage(message);
352 return builder.build();
355 public static ServiceRpcResultSp buildFailedServiceRpcResultSp() {
356 DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
357 OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
358 DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime));
359 ServiceRpcResultSpBuilder builder = new ServiceRpcResultSpBuilder();
360 builder.setActualDate(datetime).setNotificationType(ServicePathNotificationTypes.ServiceImplementationRequest)
361 .setServiceName("service 1").setStatus(RpcStatusEx.Failed).setStatusMessage("failed");
362 return builder.build();
365 public static PathDescription createPathDescription(long azRate, long azWaveLength, long zaRate,
367 AToZDirection atozDirection = new AToZDirectionBuilder()
369 .setAToZWavelengthNumber(azWaveLength)
372 ZToADirection ztoaDirection = new ZToADirectionBuilder()
374 .setZToAWavelengthNumber(zaWaveLength)
377 PathDescription pathDescription = new PathDescriptionBuilder()
378 .setAToZDirection(atozDirection)
379 .setZToADirection(ztoaDirection)
381 return pathDescription;
384 public static org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.reconfigure.input
385 .ServiceAEndBuilder getServiceAEndBuildReconfigure() {
386 return new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.reconfigure.input
387 .ServiceAEndBuilder()
388 .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate((long) 1).setNodeId("XPONDER-1-2")
389 .setTxDirection(getTxDirection())
390 .setRxDirection(getRxDirection());
393 public static org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.reconfigure.input
394 .ServiceZEndBuilder getServiceZEndBuildReconfigure() {
395 return new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.reconfigure.input
396 .ServiceZEndBuilder()
397 .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate((long) 1).setNodeId("XPONDER-1-2")
398 .setTxDirection(getTxDirection())
399 .setRxDirection(getRxDirection());
402 public static <T> ListenableFuture<T> returnFuture(T output) {
403 final ListeningExecutorService executor =
404 MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(1));
405 return executor.submit(new Callable<T>() {
407 public T call() throws Exception {
413 private ServiceDataUtils() {