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.TempServiceCreateInput;
53 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.TempServiceCreateInputBuilder;
54 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.TempServiceDeleteInput;
55 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.TempServiceDeleteInputBuilder;
56 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.delete.input.ServiceDeleteReqInfo;
57 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.delete.input.ServiceDeleteReqInfoBuilder;
58 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.path.description.AToZDirection;
59 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.path.description.AToZDirectionBuilder;
60 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.path.description.ZToADirection;
61 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.path.description.ZToADirectionBuilder;
62 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev171017.RoutingConstraintsSp.PceMetric;
63 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev171016.RpcStatusEx;
64 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev171016.ServicePathNotificationTypes;
65 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev171016.service.handler.header.ServiceHandlerHeaderBuilder;
66 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
68 public final class ServiceDataUtils {
70 public static ServiceCreateInput buildServiceCreateInput() {
72 ServiceCreateInputBuilder builtInput = new ServiceCreateInputBuilder();
73 org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.create.input
74 .ServiceAEnd serviceAEnd = getServiceAEndBuild()
76 org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.create.input
77 .ServiceZEnd serviceZEnd = new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service
78 .create.input.ServiceZEndBuilder()
79 .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate((long) 1).setNodeId("XPONDER-3-2")
80 .setTxDirection(getTxDirection())
81 .setRxDirection(getRxDirection())
84 builtInput.setCommonId("commonId");
85 builtInput.setConnectionType(ConnectionType.Service);
86 builtInput.setCustomer("Customer");
87 builtInput.setServiceName("service 1");
88 builtInput.setServiceAEnd(serviceAEnd);
89 builtInput.setServiceZEnd(serviceZEnd);
90 builtInput.setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("request 1")
91 .setRpcAction(RpcActions.ServiceCreate).setNotificationUrl("notification url").build());
93 return builtInput.build();
96 public static PathComputationRequestInput createPceRequestInput(ServiceCreateInput input) {
97 MappingConstraints mappingConstraints =
98 new MappingConstraints(input.getHardConstraints(), input.getSoftConstraints());
99 mappingConstraints.serviceToServicePathConstarints();
100 ServiceHandlerHeaderBuilder serviceHandlerHeader = new ServiceHandlerHeaderBuilder();
101 SdncRequestHeader serviceHandler = input.getSdncRequestHeader();
102 if (serviceHandler != null) {
103 serviceHandlerHeader.setRequestId(serviceHandler.getRequestId());
105 return new PathComputationRequestInputBuilder()
106 .setServiceName(input.getServiceName())
107 .setResourceReserve(true)
108 .setServiceHandlerHeader(serviceHandlerHeader.build())
109 .setHardConstraints(mappingConstraints.getServicePathHardConstraints())
110 .setSoftConstraints(mappingConstraints.getServicePathSoftConstraints())
111 .setPceMetric(PceMetric.TEMetric)
112 .setServiceAEnd(ModelMappingUtils.createServiceAEnd(input.getServiceAEnd()))
113 .setServiceZEnd(ModelMappingUtils.createServiceZEnd(input.getServiceZEnd()))
117 public static TempServiceCreateInput buildTempServiceCreateInput() {
119 TempServiceCreateInputBuilder builtInput = new TempServiceCreateInputBuilder();
120 org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.temp.service.create.input
121 .ServiceAEnd serviceAEnd = new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014
122 .temp.service.create.input.ServiceAEndBuilder()
123 .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate((long) 1).setNodeId("XPONDER-1-2")
124 .setTxDirection(getTxDirection())
125 .setRxDirection(getRxDirection())
127 org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.temp.service.create.input
128 .ServiceZEnd serviceZEnd = new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.temp
129 .service.create.input.ServiceZEndBuilder()
130 .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate((long) 1).setNodeId("XPONDER-3-2")
131 .setTxDirection(getTxDirection())
132 .setRxDirection(getRxDirection())
135 builtInput.setCommonId("commonId");
136 builtInput.setConnectionType(ConnectionType.Service);
137 builtInput.setCustomer("Customer");
138 builtInput.setServiceAEnd(serviceAEnd);
139 builtInput.setServiceZEnd(serviceZEnd);
140 builtInput.setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("request 1")
141 .setRpcAction(RpcActions.TempServiceCreate).setNotificationUrl("notification url").build());
143 return builtInput.build();
146 public static ServiceFeasibilityCheckInput buildServiceFeasibilityCheckInput() {
147 ServiceFeasibilityCheckInputBuilder builtInput = new ServiceFeasibilityCheckInputBuilder();
148 org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.feasibility.check.input
149 .ServiceAEnd serviceAEnd = new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service
150 .feasibility.check.input.ServiceAEndBuilder()
151 .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate((long) 1)
152 .setNodeId("XPONDER-1-2").setTxDirection(getTxDirection()).setRxDirection(getRxDirection())
154 org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.feasibility.check.input
155 .ServiceZEnd serviceZEnd = new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service
156 .feasibility.check.input.ServiceZEndBuilder()
157 .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate((long) 1)
158 .setNodeId("XPONDER-3-2").setTxDirection(getTxDirection()).setRxDirection(getRxDirection())
160 builtInput.setCommonId("commonId");
161 builtInput.setConnectionType(ConnectionType.Service);
162 builtInput.setCustomer("Customer");
163 builtInput.setServiceAEnd(serviceAEnd);
164 builtInput.setServiceZEnd(serviceZEnd);
165 builtInput.setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("request 1")
166 .setRpcAction(RpcActions.ServiceFeasibilityCheck).setNotificationUrl("notification url").build());
167 return builtInput.build();
170 public static org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.create.input
171 .ServiceAEndBuilder getServiceAEndBuild() {
172 return new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.create.input
173 .ServiceAEndBuilder()
174 .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate((long) 1).setNodeId("XPONDER-1-2")
175 .setTxDirection(getTxDirection())
176 .setRxDirection(getRxDirection());
179 public static org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.create.input
180 .ServiceZEndBuilder getServiceZEndBuild() {
181 return new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.create.input
182 .ServiceZEndBuilder()
183 .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate((long) 1).setNodeId("XPONDER-1-2")
184 .setTxDirection(getTxDirection())
185 .setRxDirection(getRxDirection());
188 private static TxDirection getTxDirection() {
189 return new org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service
190 .endpoint.TxDirectionBuilder().setPort(new PortBuilder().setPortDeviceName("device name")
191 .setPortName("port name").setPortRack("port rack").setPortShelf("port shelf")
192 .setPortSlot("port slot").setPortSubSlot("port subslot").setPortType("port type").build())
193 .setLgx(new LgxBuilder().setLgxDeviceName("lgx device name").setLgxPortName("lgx port name")
194 .setLgxPortRack("lgx port rack").setLgxPortShelf("lgx port shelf").build())
198 private static RxDirection getRxDirection() {
199 return new org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service
200 .endpoint.RxDirectionBuilder()
201 .setPort(new PortBuilder().setPortDeviceName("device name").setPortName("port name")
202 .setPortRack("port rack").setPortShelf("port shelf").setPortSlot("port slot")
203 .setPortSubSlot("port subslot").setPortType("port type").build())
204 .setLgx(new LgxBuilder().setLgxDeviceName("lgx device name")
205 .setLgxPortName("lgx port name").setLgxPortRack("lgx port rack")
206 .setLgxPortShelf("lgx port shelf").build())
210 public static ServiceDeleteInput buildServiceDeleteInput() {
211 ServiceDeleteInputBuilder deleteInputBldr = new ServiceDeleteInputBuilder();
212 DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
213 OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
214 DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime));
215 deleteInputBldr.setServiceDeleteReqInfo(new ServiceDeleteReqInfoBuilder().setServiceName("service 1")
216 .setDueDate(datetime).setTailRetention(ServiceDeleteReqInfo.TailRetention.No).build());
217 SdncRequestHeaderBuilder sdncBuilder = new SdncRequestHeaderBuilder();
218 sdncBuilder.setNotificationUrl("notification url");
219 sdncBuilder.setRequestId("request 1");
220 sdncBuilder.setRequestSystemId("request system 1");
221 sdncBuilder.setRpcAction(RpcActions.ServiceDelete);
222 deleteInputBldr.setSdncRequestHeader(sdncBuilder.build());
223 return deleteInputBldr.build();
226 public static TempServiceDeleteInput buildTempServiceDeleteInput() {
227 TempServiceDeleteInputBuilder deleteInputBldr = new TempServiceDeleteInputBuilder();
228 deleteInputBldr.setCommonId("service 1");
229 return deleteInputBldr.build();
232 public static ServiceRerouteInput buildServiceRerouteInput() {
233 ServiceRerouteInputBuilder builder = new ServiceRerouteInputBuilder();
234 builder.setServiceName("service 1");
235 return builder.build();
238 public static ServiceReconfigureInput buildServiceReconfigureInput() {
239 ServiceReconfigureInputBuilder builtInput = new ServiceReconfigureInputBuilder();
240 org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.reconfigure.input
241 .ServiceAEnd serviceAEnd = new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service
242 .reconfigure.input.ServiceAEndBuilder()
243 .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate((long) 1)
244 .setNodeId("XPONDER-1-2").setTxDirection(getTxDirection()).setRxDirection(getRxDirection())
246 org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.reconfigure.input
247 .ServiceZEnd serviceZEnd = new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service
248 .reconfigure.input.ServiceZEndBuilder()
249 .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate((long) 1)
250 .setNodeId("XPONDER-3-2").setTxDirection(getTxDirection()).setRxDirection(getRxDirection())
252 builtInput.setCommonId("commonId");
253 builtInput.setConnectionType(ConnectionType.Service);
254 builtInput.setCustomer("Customer");
255 builtInput.setServiceName("service 1");
256 builtInput.setServiceAEnd(serviceAEnd);
257 builtInput.setServiceZEnd(serviceZEnd);
258 return builtInput.build();
261 public static ServicePathRpcResult buildServicePathRpcResult() {
262 DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
263 OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
264 DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime));
265 ServicePathRpcResultBuilder builder = new ServicePathRpcResultBuilder();
266 builder.setActualDate(datetime).setNotificationType(ServicePathNotificationTypes.PathComputationRequest)
267 .setPathDescription(createPathDescription(0,1, 0, 1))
268 .setServiceName("service 1")
269 .setStatus(RpcStatusEx.Successful).setStatusMessage("success");
270 return builder.build();
273 public static ServicePathRpcResult buildServicePathRpcResult(
274 ServicePathNotificationTypes servicePathNotificationTypes, String serviceName, RpcStatusEx rpcStatusEx,
275 String message, Boolean pathDescription) {
276 DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
277 OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
278 DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime));
279 ServicePathRpcResultBuilder builder = new ServicePathRpcResultBuilder();
280 builder.setNotificationType(servicePathNotificationTypes)
281 .setServiceName(serviceName)
282 .setStatus(rpcStatusEx).setStatusMessage(message);
283 if (pathDescription) {
284 builder.setPathDescription(createPathDescription(0L, 5L, 0L, 5L));
286 return builder.build();
289 public static ServicePathRpcResult buildFailedPceServicePathRpcResult() {
290 DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
291 OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
292 DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime));
293 ServicePathRpcResultBuilder builder = new ServicePathRpcResultBuilder();
294 builder.setActualDate(datetime).setNotificationType(ServicePathNotificationTypes.PathComputationRequest)
295 .setPathDescription(createPathDescription(0, 1, 0, 1)).setServiceName("service 1")
296 .setStatus(RpcStatusEx.Failed).setStatusMessage("failed");
297 return builder.build();
300 public static ServicePathRpcResult buildFailedServicePathRpcResult() {
301 DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
302 OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
303 DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime));
304 ServicePathRpcResultBuilder builder = new ServicePathRpcResultBuilder();
305 builder.setActualDate(datetime).setNotificationType(ServicePathNotificationTypes.ServiceImplementationRequest)
306 .setPathDescription(createPathDescription(0,1, 0, 1))
307 .setServiceName("service 1")
308 .setStatus(RpcStatusEx.Failed).setStatusMessage("failed");
309 return builder.build();
312 public static ServiceRpcResultSp buildServiceRpcResultSp() {
313 DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
314 OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
315 DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime));
316 ServiceRpcResultSpBuilder builder = new ServiceRpcResultSpBuilder();
317 builder.setActualDate(datetime).setNotificationType(ServicePathNotificationTypes.ServiceImplementationRequest)
318 .setServiceName("service 1").setStatus(RpcStatusEx.Successful).setStatusMessage("success");
319 return builder.build();
322 public static ServiceRpcResultSp buildServiceRpcResultSp(ServicePathNotificationTypes servicePathNotificationTypes,
323 String serviceName, RpcStatusEx rpcStatusEx, String message) {
324 DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
325 OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
326 DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime));
327 ServiceRpcResultSpBuilder builder = new ServiceRpcResultSpBuilder();
328 builder.setNotificationType(servicePathNotificationTypes).setServiceName(serviceName)
329 .setStatus(rpcStatusEx).setStatusMessage(message);
330 return builder.build();
333 public static ServiceRpcResultSh buildServiceRpcResultSh(ServiceNotificationTypes serviceNotificationTypes,
334 String serviceName, org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types
335 .rev170426.RpcStatusEx rpcStatusEx, String message) {
336 DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
337 OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
338 DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime));
339 ServiceRpcResultShBuilder builder = new ServiceRpcResultShBuilder();
340 builder.setNotificationType(serviceNotificationTypes).setServiceName(serviceName)
341 .setStatus(rpcStatusEx).setStatusMessage(message);
342 return builder.build();
345 public static ServiceRpcResultSp buildFailedServiceRpcResultSp() {
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 ServiceRpcResultSpBuilder builder = new ServiceRpcResultSpBuilder();
350 builder.setActualDate(datetime).setNotificationType(ServicePathNotificationTypes.ServiceImplementationRequest)
351 .setServiceName("service 1").setStatus(RpcStatusEx.Failed).setStatusMessage("failed");
352 return builder.build();
355 public static PathDescription createPathDescription(long azRate, long azWaveLength, long zaRate,
357 AToZDirection atozDirection = new AToZDirectionBuilder()
359 .setAToZWavelengthNumber(azWaveLength)
362 ZToADirection ztoaDirection = new ZToADirectionBuilder()
364 .setZToAWavelengthNumber(zaWaveLength)
367 PathDescription pathDescription = new PathDescriptionBuilder()
368 .setAToZDirection(atozDirection)
369 .setZToADirection(ztoaDirection)
371 return pathDescription;
374 public static org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.reconfigure.input
375 .ServiceAEndBuilder getServiceAEndBuildReconfigure() {
376 return new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.reconfigure.input
377 .ServiceAEndBuilder()
378 .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate((long) 1).setNodeId("XPONDER-1-2")
379 .setTxDirection(getTxDirection())
380 .setRxDirection(getRxDirection());
383 public static org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.reconfigure.input
384 .ServiceZEndBuilder getServiceZEndBuildReconfigure() {
385 return new org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.reconfigure.input
386 .ServiceZEndBuilder()
387 .setClli("clli").setServiceFormat(ServiceFormat.OC).setServiceRate((long) 1).setNodeId("XPONDER-1-2")
388 .setTxDirection(getTxDirection())
389 .setRxDirection(getRxDirection());
392 public static <T> ListenableFuture<T> returnFuture(T output) {
393 final ListeningExecutorService executor =
394 MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(1));
395 return executor.submit(new Callable<T>() {
397 public T call() throws Exception {
403 private ServiceDataUtils() {