31417baf83a647bc6128084931b4189bdc3862e2
[transportpce.git] / pce / src / main / java / org / opendaylight / transportpce / pce / gnpy / ExtractTopoDataStoreImpl.java
1 /*
2  * Copyright © 2018 Orange, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.transportpce.pce.gnpy;
10
11 import java.math.BigDecimal;
12 import java.util.ArrayList;
13 import java.util.HashMap;
14 import java.util.List;
15 import java.util.Map;
16 import java.util.concurrent.ExecutionException;
17 import java.util.stream.IntStream;
18
19 import org.eclipse.jdt.annotation.Nullable;
20 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
21 import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
22 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
23 import org.opendaylight.transportpce.common.NetworkUtils;
24 //import org.opendaylight.yang.gen.v1.gnpy.gnpy.eqpt.config.rev181119.EdfaVariety;
25 //import org.opendaylight.yang.gen.v1.gnpy.gnpy.eqpt.config.rev181119.FiberVariety;
26 import org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.Coordinate;
27 import org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.Km;
28 import org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.edfa.params.Operational;
29 import org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.edfa.params.OperationalBuilder;
30 import org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.element.type.choice.element.type.Edfa;
31 import org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.element.type.choice.element.type.EdfaBuilder;
32 import org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.element.type.choice.element.type.FiberRoadmBuilder;
33 import org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.element.type.choice.element.type.Transceiver;
34 import org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.element.type.choice.element.type.TransceiverBuilder;
35 import org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.element.type.choice.element.type.fiberroadm.Params;
36 import org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.element.type.choice.element.type.fiberroadm.ParamsBuilder;
37 import org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.element.type.choice.element.type.fiberroadm.params.fiberroadm.Fiber;
38 import org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.element.type.choice.element.type.fiberroadm.params.fiberroadm.FiberBuilder;
39 import org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.element.type.choice.element.type.fiberroadm.params.fiberroadm.Roadm;
40 import org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.element.type.choice.element.type.fiberroadm.params.fiberroadm.RoadmBuilder;
41 import org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.location.attributes.Location;
42 import org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.location.attributes.LocationBuilder;
43 import org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.topo.Connections;
44 import org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.topo.ConnectionsBuilder;
45 import org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.topo.Elements;
46 import org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.topo.ElementsBuilder;
47 import org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.topo.elements.Metadata;
48 import org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.topo.elements.MetadataBuilder;
49 import org.opendaylight.yang.gen.v1.gnpy.path.rev190502.RouteIncludeEro;
50 import org.opendaylight.yang.gen.v1.gnpy.path.rev190502.TeHopType;
51 import org.opendaylight.yang.gen.v1.gnpy.path.rev190502.TeNodeId;
52 import org.opendaylight.yang.gen.v1.gnpy.path.rev190502.TePathDisjointness;
53 import org.opendaylight.yang.gen.v1.gnpy.path.rev190502.TeTpId;
54 import org.opendaylight.yang.gen.v1.gnpy.path.rev190502.common.constraints_config.TeBandwidth;
55 import org.opendaylight.yang.gen.v1.gnpy.path.rev190502.common.constraints_config.TeBandwidthBuilder;
56 import org.opendaylight.yang.gen.v1.gnpy.path.rev190502.explicit.route.hop.Type;
57 import org.opendaylight.yang.gen.v1.gnpy.path.rev190502.explicit.route.hop.type.NumUnnumHopBuilder;
58 import org.opendaylight.yang.gen.v1.gnpy.path.rev190502.explicit.route.hop.type.num.unnum.hop.NumUnnumHop;
59 import org.opendaylight.yang.gen.v1.gnpy.path.rev190502.generic.path.constraints.PathConstraints;
60 import org.opendaylight.yang.gen.v1.gnpy.path.rev190502.generic.path.constraints.PathConstraintsBuilder;
61 import org.opendaylight.yang.gen.v1.gnpy.path.rev190502.gnpy.specific.parameters.EffectiveFreqSlot;
62 import org.opendaylight.yang.gen.v1.gnpy.path.rev190502.gnpy.specific.parameters.EffectiveFreqSlotBuilder;
63 import org.opendaylight.yang.gen.v1.gnpy.path.rev190502.path.route.objects.ExplicitRouteObjects;
64 import org.opendaylight.yang.gen.v1.gnpy.path.rev190502.path.route.objects.ExplicitRouteObjectsBuilder;
65 import org.opendaylight.yang.gen.v1.gnpy.path.rev190502.path.route.objects.explicit.route.objects.RouteObjectIncludeExclude;
66 import org.opendaylight.yang.gen.v1.gnpy.path.rev190502.path.route.objects.explicit.route.objects.RouteObjectIncludeExcludeBuilder;
67 import org.opendaylight.yang.gen.v1.gnpy.path.rev190502.service.PathRequest;
68 import org.opendaylight.yang.gen.v1.gnpy.path.rev190502.service.PathRequestBuilder;
69 import org.opendaylight.yang.gen.v1.gnpy.path.rev190502.synchronization.info.Synchronization;
70 import org.opendaylight.yang.gen.v1.gnpy.path.rev190502.synchronization.info.SynchronizationBuilder;
71 import org.opendaylight.yang.gen.v1.gnpy.path.rev190502.synchronization.info.synchronization.Svec;
72 import org.opendaylight.yang.gen.v1.gnpy.path.rev190502.synchronization.info.synchronization.SvecBuilder;
73 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev171017.PathComputationRequestInput;
74 import org.opendaylight.yang.gen.v1.http.org.openroadm.link.rev181130.amplified.link.attributes.AmplifiedLink;
75 import org.opendaylight.yang.gen.v1.http.org.openroadm.link.rev181130.amplified.link.attributes.amplified.link.section.element.section.element.Span;
76 import org.opendaylight.yang.gen.v1.http.org.openroadm.link.rev181130.amplified.link.attributes.amplified.link.section.element.section.element.ila.Ila;
77 import org.opendaylight.yang.gen.v1.http.org.openroadm.link.rev181130.span.attributes.LinkConcatenation;
78 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.rev181130.Node1;
79 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev181130.Link1;
80 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev181130.networks.network.link.OMSAttributes;
81 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.path.description.AToZDirection;
82 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.path.description.ZToADirection;
83 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.path.description.atoz.direction.AToZ;
84 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.path.description.ztoa.direction.ZToA;
85 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
86 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
87 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NetworkId;
88 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.Networks;
89 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network;
90 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.NetworkKey;
91 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node;
92 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.node.SupportingNode;
93 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Network1;
94 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link;
95 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
96 import org.slf4j.Logger;
97 import org.slf4j.LoggerFactory;
98
99 /**
100  * Class to create the topology corresponding to GNPy requirements.
101  *
102  * @author Ahmed Triki ( ahmed.triki@orange.com )
103  *
104  */
105
106 public class ExtractTopoDataStoreImpl {
107     private static final Logger LOG = LoggerFactory.getLogger(ExtractTopoDataStoreImpl.class);
108     private final DataBroker dataBroker;
109     // private final OpenRoadmTopology openRoadmTopology;
110     // private final OpenRoadmInterfaces openRoadmInterfaces;
111     private List<Elements> elements = new ArrayList<>();
112     private List<Connections> connections = new ArrayList<>();
113     private List<PathRequest> pathRequest = new ArrayList<>();
114     private List<Synchronization> synchronization = new ArrayList<>();
115     private Map<String, String> mapDisgNodeRefNode = new HashMap<String, String>();
116     private Map<String, IpAddress> mapNodeRefIp = new HashMap<String, IpAddress>();
117     private Map<String, String> mapLinkFiber = new HashMap<String, String>();
118     private Map<String, IpAddress> mapFiberIp = new HashMap<String, IpAddress>();
119     private static int convertKmM = 1000;
120
121     /*
122      * Construct the ExtractTopoDataStoreImpl.
123      */
124     @SuppressWarnings("unchecked")
125     public ExtractTopoDataStoreImpl(final DataBroker dataBroker, PathComputationRequestInput input, AToZDirection atoz,
126             Long requestId) {
127         this.dataBroker = dataBroker;
128         Map<String, List<?>> map = extractTopo();
129         if (map.containsKey("Elements")) {
130             elements = (List<Elements>) map.get("Elements");
131         } else {
132             elements = null;
133         }
134         if (map.containsKey("Elements")) {
135             connections = (List<Connections>) map.get("Connections");
136         } else {
137             connections = null;
138         }
139         pathRequest = extractPathRequest(input, atoz, requestId);
140         synchronization = extractSynchronization(requestId);
141     }
142
143     public ExtractTopoDataStoreImpl(final DataBroker dataBroker, PathComputationRequestInput input, ZToADirection ztoa,
144             Long requestId) {
145         this.dataBroker = dataBroker;
146         Map<String, List<?>> map = extractTopo();
147         if (map.containsKey("Elements")) {
148             elements = (List<Elements>) map.get("Elements");
149         } else {
150             elements = null;
151         }
152         if (map.containsKey("Elements")) {
153             connections = (List<Connections>) map.get("Connections");
154         } else {
155             connections = null;
156         }
157         pathRequest = extractPathRequest(input, ztoa, requestId);
158         synchronization = extractSynchronization(requestId);
159     }
160
161     /*
162      * extract the topology: all the elements have ipAddress as uid and maintain
163      * a mapping structure to map between the nodeId and the ipAddress (uid)
164      *
165      */
166     public Map<String, List<?>> extractTopo() {
167         Map<String, List<?>> map = new HashMap<String, List<?>>();
168         // Define the elements
169         List<Elements> topoElements = new ArrayList<>();
170         // Define the connections
171         List<Connections> topoConnections = new ArrayList<>();
172         // Define the instance identifier of the OpenRoadm topology
173         InstanceIdentifier<Network> insIdOpenRoadmTopo = InstanceIdentifier
174                 .builder(Networks.class)
175                 .child(Network.class, new NetworkKey(new NetworkId(NetworkUtils.OVERLAY_NETWORK_ID))).build();
176         // Define the instance identifier of the OpenRoadm network
177         InstanceIdentifier<Network> insIdrOpenRoadmNet = InstanceIdentifier
178                 .builder(Networks.class)
179                 .child(Network.class, new NetworkKey(new NetworkId(NetworkUtils.UNDERLAY_NETWORK_ID))).build();
180         ReadOnlyTransaction readOnlyTransaction = this.dataBroker.newReadOnlyTransaction();
181         // Read the data broker
182         try {
183             // Initialize the reading of the data broker
184             // read the configuration part of the data broker that concerns
185             // the openRoadm topology and get all the nodes
186             java.util.Optional<Network> openRoadmTopo = readOnlyTransaction
187                     .read(LogicalDatastoreType.CONFIGURATION, insIdOpenRoadmTopo).get().toJavaUtil();
188             java.util.Optional<Network> openRoadmNet = readOnlyTransaction
189                     .read(LogicalDatastoreType.CONFIGURATION, insIdrOpenRoadmNet).get().toJavaUtil();
190             if (openRoadmNet.isPresent()) {
191                 List<Node> openRoadmNetNodeList = openRoadmNet.get().getNode();
192                 if (openRoadmTopo.isPresent()) {
193                     List<Node> openRoadmTopoNodeList = openRoadmTopo.get().getNode();
194                     List<String> nodesList = new ArrayList<>();
195                     // Create the list of nodes
196                     if (!openRoadmTopoNodeList.isEmpty()) {
197                         // Create elements
198                         for (Node openRoadmTopoNode : openRoadmTopoNodeList) {
199                             // Retrieve the supporting node and the type of the
200                             // node in openRoadm network
201                             List<SupportingNode> supportingNodeList = openRoadmTopoNode.getSupportingNode();
202                             for (SupportingNode supportingNode : supportingNodeList) {
203                                 String nodeRef = supportingNode.getNodeRef().getValue();
204                                 IpAddress ipAddress = null;
205                                 // Retrieve the mapping between the openRoadm
206                                 // topology and openRoadm network
207                                 mapDisgNodeRefNode.put(openRoadmTopoNode.getNodeId().getValue(), nodeRef);
208                                 Node1 openRoadmNetNode1 = null;
209                                 for (Node openRoadmNetNode : openRoadmNetNodeList) {
210                                     if (openRoadmNetNode.getNodeId().getValue().equals(nodeRef)) {
211                                         openRoadmNetNode1 = openRoadmNetNode.augmentation(Node1.class);
212                                         ipAddress = openRoadmNetNode1.getIp();
213                                         mapNodeRefIp.put(nodeRef, ipAddress);
214                                         break;
215                                     }
216                                 }
217                                 if (openRoadmNetNode1.getNodeType().getName().equals("ROADM")) {
218                                     if (!nodesList.contains(nodeRef)) {
219                                         Elements element = addElementsRoadm(2, 0, nodeRef, openRoadmNetNode1.getShelf(),
220                                                 -20, ipAddress.getIpv4Address().getValue().toString());
221                                         topoElements.add(element);
222                                         nodesList.add(nodeRef);
223                                     }
224                                 } else if (openRoadmNetNode1.getNodeType().getName().equals("XPONDER")) {
225                                     if (!nodesList.contains(nodeRef)) {
226                                         Elements element = addElementsTransceiver(2, 0, nodeRef,
227                                                 openRoadmNetNode1.getShelf(),
228                                                 ipAddress.getIpv4Address().getValue().toString());
229                                         topoElements.add(element);
230                                         nodesList.add(nodeRef);
231                                     }
232                                 } else {
233                                     LOG.warn("the type is not implemented");
234                                 }
235                             }
236                         }
237                     } else {
238                         LOG.warn("no nodes in the network");
239                     }
240
241                     // Create the list of connections
242                     Network1 nw1 = openRoadmTopo.get().augmentation(Network1.class);
243                     List<Link> linksList = nw1.getLink();
244                     // 1:EXPRESS-LINK ; 2:ADD-LINK ; 3:DROP-LINK ;
245                     // 4:ROADM-To-ROADM ; 5:XPONDER-INPUT ; 6:XPONDER-OUTPUT
246                     int[] externalLink = {4,5,6};
247                     int idFiber = 0;
248                     int nbEDFA = 0;
249                     if (!linksList.isEmpty()) {
250                         LOG.warn("The link list is not empty");
251                         for (Link link : linksList) {
252                             Link1 link1 = link.augmentation(Link1.class);
253                             int linkType = link1.getLinkType().getIntValue();
254                             if (IntStream.of(externalLink).anyMatch(x -> x == linkType)) {
255                                 // Verify if the node is a ROADM
256                                 String srcId = mapDisgNodeRefNode.get(link.getSource().getSourceNode().getValue());
257                                 IpAddress srcIp = mapNodeRefIp.get(srcId);
258                                 String destId = null;
259                                 IpAddress destIp = null;
260                                 // Add the links between amplifiers
261                                 OMSAttributes omsAttributes = link1.getOMSAttributes();
262                                 if (omsAttributes != null) {
263                                     if (omsAttributes.getAmplifiedLink() != null) {
264                                         List<AmplifiedLink> amplifiedLinkList = omsAttributes.getAmplifiedLink()
265                                                 .getAmplifiedLink();
266                                         if (!amplifiedLinkList.isEmpty()) {
267                                             for (AmplifiedLink amplifiedLink : amplifiedLinkList) {
268                                                 Elements element1 = null;
269                                                 if (amplifiedLink.getSectionElement()
270                                                         .getSectionElement() instanceof Ila) {
271                                                     Ila ila = (Ila) amplifiedLink.getSectionElement()
272                                                             .getSectionElement();
273                                                     String nodeId = ila.getNodeId().getValue();
274                                                     IpAddress ipEdfa = new IpAddress(
275                                                             new Ipv4Address("1.1.1." + nbEDFA));
276                                                     nbEDFA++;
277                                                     mapDisgNodeRefNode.put(nodeId, nodeId);
278                                                     mapNodeRefIp.put(nodeId, ipEdfa);
279                                                     // class std_medium_gain
280                                                     // implements EdfaVariety {}
281                                                     element1 = addElementsEdfa(2, 0, "RLD", "Lannion_CAS",
282                                                             ila.getGain().getValue(), ila.getTilt().getValue(),
283                                                             ila.getOutVoaAtt().getValue(), "std_medium_gain",
284                                                             ipEdfa.getIpv4Address().getValue().toString());
285                                                 } else if (amplifiedLink.getSectionElement()
286                                                         .getSectionElement() instanceof Span) {
287                                                     // Create the location
288                                                     Span span = (Span) amplifiedLink.getSectionElement()
289                                                             .getSectionElement();
290                                                     String clfi = span.getSpan().getClfi();
291                                                     IpAddress ipFiber = new IpAddress(
292                                                             new Ipv4Address("2.2.2." + idFiber));
293                                                     mapLinkFiber.put(link.getLinkId().getValue(), clfi);
294                                                     mapFiberIp.put(clfi, ipFiber);
295                                                     idFiber++;
296                                                     // class SSMF implements
297                                                     // FiberVariety {}
298                                                     element1 = addElementsFiber(2, 0, "RLD", "Lannion_CAS",
299                                                             ipFiber.getIpv4Address().getValue(), 20, 0, 0.2, 0, 0,
300                                                             "SSMF");
301                                                 }
302                                                 if (element1 != null) {
303                                                     topoElements.add(element1);
304                                                     destId = element1.getUid();
305                                                     destIp = null;
306                                                     // Create a new link
307                                                     if (srcId != destId) {
308                                                         Connections connection = createNewConnection(srcId, srcIp,
309                                                                 destId, destIp);
310                                                         topoConnections.add(connection);
311                                                         srcId = destId;
312                                                         srcIp = destIp;
313                                                     }
314                                                 }
315                                             }
316                                         }
317                                     } else if (omsAttributes.getSpan() != null) {
318                                         org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev181130
319                                             .networks.network.link.oms.attributes.@Nullable Span span
320                                                 = omsAttributes.getSpan();
321
322                                         String clfi = span.getClfi();
323                                         IpAddress ipFiber = new IpAddress(new Ipv4Address("2.2.2." + idFiber));
324                                         mapLinkFiber.put(link.getLinkId().getValue(), clfi);
325                                         mapFiberIp.put(clfi, ipFiber);
326                                         idFiber++;
327
328                                         double attIn = span.getSpanlossCurrent().getValue().doubleValue();
329                                         double lossCoef = 0.2;
330                                         double connIn = 0;
331                                         double connOut = 0;
332                                         String typeVariety = "SSMF";
333
334                                         double length = 0; //convert to kilometer
335                                         // Compute the length of the link
336                                         List<LinkConcatenation> linkConcatenationList = span.getLinkConcatenation();
337                                         for (LinkConcatenation linkConcatenation : linkConcatenationList) {
338                                             double srlgLength = linkConcatenation.getSRLGLength();
339                                             length += srlgLength / convertKmM; //convert to kilometer
340                                         }
341
342                                         Elements element1 = addElementsFiber(2, 0, "RLD", "Lannion_CAS",
343                                                 ipFiber.getIpv4Address().getValue(), length, attIn, lossCoef, connIn,
344                                                 connOut, typeVariety);
345
346                                         topoElements.add(element1);
347                                         // Create a new link
348                                         destId = element1.getUid();
349                                         destIp = null;
350                                         if (srcId != destId) {
351                                             Connections connection = createNewConnection(srcId, srcIp, destId, destIp);
352                                             topoConnections.add(connection);
353                                             srcId = destId;
354                                             srcIp = destIp;
355                                         }
356                                     } else {
357                                         // Add a fiber
358                                         String clfi = "Fiber" + idFiber;
359                                         IpAddress ipFiber = new IpAddress(new Ipv4Address("2.2.2." + idFiber));
360                                         mapLinkFiber.put(link.getLinkId().getValue(), clfi);
361                                         mapFiberIp.put(clfi, ipFiber);
362                                         idFiber++;
363                                         // Create a new element
364                                         // class SSMF implements FiberVariety {}
365                                         Elements element1 = addElementsFiber(2, 0, "RLD", "Lannion_CAS",
366                                                 ipFiber.getIpv4Address().getValue(), 20, 0, 0.2, 0, 0, "SSMF");
367                                         topoElements.add(element1);
368                                         // Create a new link
369                                         destId = element1.getUid();
370                                         destIp = null;
371                                         if (srcId != destId) {
372                                             Connections connection = createNewConnection(srcId, srcIp, destId, destIp);
373                                             topoConnections.add(connection);
374                                             srcId = destId;
375                                             srcIp = destIp;
376                                         }
377                                     }
378                                 } else {
379                                     LOG.warn("The oms attributes is null!");
380                                 }
381                                 // Create a new link
382                                 destId = mapDisgNodeRefNode.get(link.getDestination().getDestNode().getValue());
383                                 destIp = mapNodeRefIp.get(destId);
384                                 Connections connection = createNewConnection(srcId, srcIp, destId, destIp);
385                                 topoConnections.add(connection);
386                             }
387                         }
388                     } else {
389                         LOG.warn("no links in the network");
390                     }
391                 } else {
392                     LOG.warn("No nodes in the selected network ...");
393                 }
394             }
395         } catch (InterruptedException | ExecutionException e) {
396             LOG.error("Error reading the topology", e);
397             readOnlyTransaction.close();
398         }
399         readOnlyTransaction.close();
400         map.put("Elements", topoElements);
401         map.put("Connections", topoConnections);
402         return map;
403     }
404
405     /*
406      * Create the pathRequest
407      */
408     public List<PathRequest> extractPathRequest(PathComputationRequestInput input, AToZDirection atoz, Long requestId) {
409         // List of A to Z
410         List<AToZ> listAtoZ = atoz.getAToZ();
411         int atozSize = listAtoZ.size();
412         // String modulationFormat = atoz.getModulationFormat();
413         // Create the path request
414         List<PathRequest> pathRequestList = new ArrayList<>();
415         // Define the instance identifier
416         // InstanceIdentifier<Network> nwInstanceIdentifier = InstanceIdentifier
417         // .builder(Network.class, new NetworkKey(new
418         // NetworkId(NetworkUtils.OVERLAY_NETWORK_ID))).build();
419
420         // read the configuration part of the data broker that concerns the
421         // nodes ID and get all the nodes
422         // java.util.Optional<Network> networkObject = readOnlyTransaction
423         // .read(LogicalDatastoreType.CONFIGURATION,
424         // nwInstanceIdentifier).get().toJavaUtil();
425         // 1.1 Create explicitRouteObjects
426         // 1.1.1. create RouteObjectIncludeExclude list
427         List<RouteObjectIncludeExclude> routeObjectIncludeExcludes = new ArrayList<>();
428         IpAddress ipAddressCurrent = null;
429         Long index = (long) 0;
430         //ReadOnlyTransaction readOnlyTransaction = this.dataBroker.newReadOnlyTransaction();
431         for (int i = 0; i < atozSize; i++) {
432             // String idAtoZ = listAtoZ.get(i).getId();
433             String nodeId = null;
434             if (listAtoZ.get(i).getResource()
435                     .getResource() instanceof org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface
436                     .pathdescription.rev171017.pce.resource.resource.resource.Node) {
437                 org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.pce
438                     .resource.resource.resource.Node node = (org.opendaylight.yang.gen.v1.http.org.transportpce.b.c
439                             ._interface.pathdescription.rev171017.pce.resource.resource.resource.Node) listAtoZ
440                         .get(i).getResource().getResource();
441                 nodeId = node.getNodeId();
442                 if (nodeId != null) {
443                     String nodeRef = mapDisgNodeRefNode.get(nodeId);
444                     IpAddress ipAddress = mapNodeRefIp.get(nodeRef);
445                     for (Elements element : elements) {
446                         if (element.getUid().contains(ipAddress.getIpv4Address().getValue().toString())) {
447                             String type = element.getType().getName();
448                             if ((ipAddressCurrent == null) || (ipAddressCurrent != ipAddress)) {
449                                 ipAddressCurrent = ipAddress;
450                                 // Fill in routeObjectIncludeExcludes
451                                 RouteObjectIncludeExclude routeObjectIncludeExclude1 = addRouteObjectIncludeExclude(
452                                         ipAddress, 1, index);
453                                 routeObjectIncludeExcludes.add(routeObjectIncludeExclude1);
454                                 index++;
455                             }
456                             break;
457                         }
458                     }
459                 } else {
460                     LOG.warn("node ID is null");
461                 }
462             } else if (listAtoZ.get(i).getResource()
463                     .getResource() instanceof org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface
464                     .pathdescription.rev171017.pce.resource.resource.resource.TerminationPoint) {
465                 org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.pce
466                         .resource.resource.resource.TerminationPoint tp = (org.opendaylight.yang.gen.v1.http.org
467                         .transportpce.b.c._interface.pathdescription.rev171017.pce.resource.resource.resource
468                         .TerminationPoint) listAtoZ.get(i).getResource().getResource();
469                 // Not used in this version
470             } else if (listAtoZ.get(i).getResource()
471                     .getResource() instanceof org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface
472                     .pathdescription.rev171017.pce.resource.resource.resource.Link) {
473                 org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.pce
474                     .resource.resource.resource.Link link = (org.opendaylight.yang.gen.v1.http.org.transportpce
475                             .b.c._interface.pathdescription.rev171017.pce.resource.resource.resource.Link) listAtoZ
476                         .get(i).getResource().getResource();
477                 String clfi = mapLinkFiber.get(link.getLinkId());
478                 IpAddress fiberIp = mapFiberIp.get(clfi);
479                 if (clfi != null) {
480                     RouteObjectIncludeExclude routeObjectIncludeExclude1 = addRouteObjectIncludeExclude(fiberIp, 1,
481                             index);
482                     routeObjectIncludeExcludes.add(routeObjectIncludeExclude1);
483                     index++;
484                 }
485             }
486         }
487         // Create ExplicitRouteObjects
488         ExplicitRouteObjects explicitRouteObjects = new ExplicitRouteObjectsBuilder()
489                 .setRouteObjectIncludeExclude(routeObjectIncludeExcludes).build();
490
491         // 1. Create the path request element 1
492         // Find parameters
493         // String serviceName = input.getServiceName();
494         String sourceNode = input.getServiceAEnd().getNodeId();
495         String destNode = input.getServiceZEnd().getNodeId();
496
497         // 1.2 Create a path constraints
498         Long rate = atoz.getRate();
499         // Long wavelengthNumber = atoz.getAToZWavelengthNumber();
500         // Create EffectiveFreqSlot
501         List<EffectiveFreqSlot> effectiveFreqSlot = new ArrayList<>();
502         EffectiveFreqSlot effectiveFreqSlot1 = new EffectiveFreqSlotBuilder().setM(5).setN(8).build();
503         effectiveFreqSlot.add(effectiveFreqSlot1);
504         // Create Te-Bandwidth
505         TeBandwidth teBandwidth = new TeBandwidthBuilder().setPathBandwidth(new BigDecimal(rate))
506                 .setTechnology("flexi-grid").setTrxType("openroadm-beta1").setTrxMode("W100G")
507                 .setEffectiveFreqSlot(effectiveFreqSlot).setSpacing(new BigDecimal(50000000000.0)).build();
508         // .setMaxNbOfChannel(new Long(80)).setOutputPower(new
509         // BigDecimal(0.0012589254117941673))
510         PathConstraints pathConstraints = new PathConstraintsBuilder().setTeBandwidth(teBandwidth).build();
511         // PathRequest pathRequest1 = new
512         // PathRequestBuilder().setRequestId(new
513         // Long(0)).setSource(mapNodeRefIp.get(sourceNode))
514         // .setDestination(mapNodeRefIp.get(destNode)).setSrcTpId(input.getServiceAEnd().getTxDirection()
515         //      .getPort().getPortName().getBytes())
516         // .setDstTpId(input.getServiceAEnd().getRxDirection().getPort().getPortName().getBytes())
517         //      .setPathConstraints(pathConstraints)
518         // .setExplicitRouteObjects(explicitRouteObjects).build();
519         PathRequest pathRequest1 = new PathRequestBuilder().setRequestId(requestId)
520                 .setSource(mapNodeRefIp.get(sourceNode)).setDestination(mapNodeRefIp.get(destNode))
521                 .setSrcTpId("srcTpId".getBytes()).setDstTpId("dstTpId".getBytes()).setPathConstraints(pathConstraints)
522                 .setExplicitRouteObjects(explicitRouteObjects).build();
523         pathRequestList.add(pathRequest1);
524         //readOnlyTransaction.close();
525         return pathRequestList;
526     }
527
528     public List<PathRequest> extractPathRequest(PathComputationRequestInput input, ZToADirection ztoa, Long requestId) {
529         // List of A to Z
530         List<ZToA> listZToA = ztoa.getZToA();
531         int ztoaSize = listZToA.size();
532         // String modulationFormat = ztoa.getModulationFormat();
533         // Create the path request
534         List<PathRequest> servicePathRequest = new ArrayList<>();
535         // Define the instance identifier
536         InstanceIdentifier<Network> nwInstanceIdentifier = InstanceIdentifier
537                 .builder(Networks.class)
538                 .child(Network.class, new NetworkKey(new NetworkId(NetworkUtils.OVERLAY_NETWORK_ID))).build();
539         //ReadOnlyTransaction readOnlyTransaction = this.dataBroker.newReadOnlyTransaction();
540
541         // read the configuration part of the data broker that concerns the
542         // nodes ID and get all the nodes
543         // java.util.Optional<Network> networkObject = readOnlyTransaction
544         // .read(LogicalDatastoreType.CONFIGURATION,
545         // nwInstanceIdentifier).get().toJavaUtil();
546         // 1.1 Create explicitRouteObjects
547         // 1.1.1. create RouteObjectIncludeExclude list
548         List<RouteObjectIncludeExclude> routeObjectIncludeExcludes = new ArrayList<>();
549         IpAddress ipAddressCurrent = null;
550         Long index = (long) 0;
551         for (int i = 0; i < ztoaSize; i++) {
552             // String idZtoA = listZToA.get(i).getId();
553             String nodeId = null;
554             if (listZToA.get(i).getResource()
555                     .getResource() instanceof org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface
556                     .pathdescription.rev171017.pce.resource.resource.resource.Node) {
557                 org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.pce
558                     .resource.resource.resource.Node node = (org.opendaylight.yang.gen.v1.http.org.transportpce.b.c
559                     ._interface.pathdescription.rev171017.pce.resource.resource.resource.Node) listZToA.get(i)
560                     .getResource().getResource();
561                 nodeId = node.getNodeId();
562                 if (nodeId != null) {
563                     String nodeRef = mapDisgNodeRefNode.get(nodeId);
564                     IpAddress ipAddress = mapNodeRefIp.get(nodeRef);
565                     for (Elements element : elements) {
566                         if (element.getUid().contains(ipAddress.getIpv4Address().getValue().toString())) {
567                             // String type = element.getType().getName();
568                             if ((ipAddressCurrent == null) || (ipAddressCurrent != ipAddress)) {
569                                 ipAddressCurrent = ipAddress;
570                                 // Fill in routeObjectIncludeExcludes
571                                 RouteObjectIncludeExclude routeObjectIncludeExclude1 = addRouteObjectIncludeExclude(
572                                         ipAddress, 1, index);
573                                 routeObjectIncludeExcludes.add(routeObjectIncludeExclude1);
574                                 index++;
575                             }
576                             break;
577                         }
578                     }
579                 } else {
580                     LOG.warn("node ID is null");
581                 }
582             } else if (listZToA.get(i).getResource()
583                     .getResource() instanceof org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface
584                     .pathdescription.rev171017.pce.resource.resource.resource.TerminationPoint) {
585                 org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.pce
586                     .resource.resource.resource.TerminationPoint tp = (org.opendaylight.yang.gen.v1.http.org
587                     .transportpce.b.c._interface.pathdescription.rev171017.pce.resource.resource.resource
588                     .TerminationPoint) listZToA.get(i).getResource().getResource();
589                 // Not used in this version
590             } else if (listZToA.get(i).getResource()
591                     .getResource() instanceof org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface
592                     .pathdescription.rev171017.pce.resource.resource.resource.Link) {
593                 org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev171017.pce
594                     .resource.resource.resource.Link link = (org.opendaylight.yang.gen.v1.http.org.transportpce
595                     .b.c._interface.pathdescription.rev171017.pce.resource.resource.resource.Link) listZToA.get(i)
596                     .getResource().getResource();
597                 String clfi = mapLinkFiber.get(link.getLinkId());
598                 IpAddress fiberIp = mapFiberIp.get(clfi);
599                 if (clfi != null) {
600                     RouteObjectIncludeExclude routeObjectIncludeExclude1 = addRouteObjectIncludeExclude(fiberIp, 1,
601                             index);
602                     routeObjectIncludeExcludes.add(routeObjectIncludeExclude1);
603                     index++;
604                 }
605             }
606         }
607         // Create ExplicitRouteObjects
608         ExplicitRouteObjects explicitRouteObjects = new ExplicitRouteObjectsBuilder()
609                 .setRouteObjectIncludeExclude(routeObjectIncludeExcludes).build();
610
611         // 1. Create the path request element 1
612         // Find parameters
613         // String serviceName = input.getServiceName();
614         String sourceNode = input.getServiceZEnd().getNodeId();
615         String destNode = input.getServiceAEnd().getNodeId();
616
617         // 1.2 Create a path constraints
618         Long rate = ztoa.getRate();
619         // Long wavelengthNumber = ztoa.getZToAWavelengthNumber();
620         // Create EffectiveFreqSlot
621         List<EffectiveFreqSlot> effectiveFreqSlot = new ArrayList<>();
622         EffectiveFreqSlot effectiveFreqSlot1 = new EffectiveFreqSlotBuilder().setM(5).setN(8).build();
623         effectiveFreqSlot.add(effectiveFreqSlot1);
624         // Create Te-Bandwidth
625         TeBandwidth teBandwidth = new TeBandwidthBuilder().setPathBandwidth(new BigDecimal(rate))
626                 .setTechnology("flexi-grid").setTrxType("openroadm-beta1").setTrxMode("W100G")
627                 .setEffectiveFreqSlot(effectiveFreqSlot).setSpacing(new BigDecimal(50000000000.0)).build();
628         // .setMaxNbOfChannel(new Long(80)).setOutputPower(new
629         // BigDecimal(0.0012589254117941673))
630         PathConstraints pathConstraints = new PathConstraintsBuilder().setTeBandwidth(teBandwidth).build();
631         // PathRequest pathRequest1 = new
632         // PathRequestBuilder().setRequestId(new
633         // Long(0)).setSource(mapNodeRefIp.get(sourceNode))
634         // .setDestination(mapNodeRefIp.get(destNode)).setSrcTpId(input.getServiceAEnd().getTxDirection()
635         //      .getPort().getPortName().getBytes())
636         // .setDstTpId(input.getServiceAEnd().getRxDirection().getPort().getPortName().getBytes())
637         //      .setPathConstraints(pathConstraints)
638         // .setExplicitRouteObjects(explicitRouteObjects).build();
639         PathRequest pathRequest1 = new PathRequestBuilder().setRequestId(requestId)
640                 .setSource(mapNodeRefIp.get(sourceNode)).setDestination(mapNodeRefIp.get(destNode))
641                 .setSrcTpId("srcTpId".getBytes()).setDstTpId("dstTpId".getBytes()).setPathConstraints(pathConstraints)
642                 .setExplicitRouteObjects(explicitRouteObjects).build();
643         servicePathRequest.add(pathRequest1);
644         //readOnlyTransaction.close();
645         return servicePathRequest;
646     }
647
648     /*
649      * Create the synchronization
650      */
651     public List<Synchronization> extractSynchronization(Long requestId) {
652         // Create RequestIdNumber
653         List<Long> requestIdNumber = new ArrayList<>();
654         requestIdNumber.add(0, new Long(0));
655         // Create a synchronization
656         Svec svec = new SvecBuilder().setRelaxable(true).setDisjointness(new TePathDisjointness(true, true, false))
657                 .setRequestIdNumber(requestIdNumber).build();
658         List<Synchronization> synchro = new ArrayList<>();
659         Synchronization synchronization1 = new SynchronizationBuilder().setSynchronizationId(new Long(0)).setSvec(svec)
660                 .build();
661         synchro.add(synchronization1);
662         return (synchro);
663     }
664
665     /*
666      * Method to add Fiber
667      */
668     private Elements addElementsFiber(double latitude, double longitude, String region, String city, String clfi,
669             double length, double attIn, double lossCoef, double connIn, double connOut, String typeVariety) {
670         // Create an amplifier after the roadm
671         Coordinate c1 = new Coordinate(new BigDecimal(latitude));
672         Coordinate c2 = new Coordinate(new BigDecimal(longitude));
673         Location location1 = new LocationBuilder().setRegion(region).setCity(city).setLatitude(c1).setLongitude(c2)
674                 .build();
675         Metadata metadata1 = new MetadataBuilder().setLocation(location1).build();
676         Fiber fiber = new FiberBuilder().setLength(new BigDecimal(length)).setLengthUnits(Km.class)
677                 .setAttIn(new BigDecimal(attIn)).setLossCoef(new BigDecimal(lossCoef)).setConIn(new BigDecimal(connIn))
678                 .setConOut(new BigDecimal(connOut)).build();
679         Params params1 = new ParamsBuilder().setFiberroadm(fiber).build();
680         // TypeElement Fiber = ; //new TypeElement(Fiber);
681         Elements element1 = new ElementsBuilder().setUid(clfi)
682                 .setType(org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.Fiber.class)
683                 .setTypeVariety(typeVariety).setMetadata(metadata1)
684                 .setElementType(new FiberRoadmBuilder().setParams(params1).build()).build();
685         return element1;
686     }
687
688     /*
689      * Method to add Edfa
690      */
691     private Elements addElementsEdfa(double latitude, double longitude, String region, String city,
692             BigDecimal gainTarget, BigDecimal tiltTarget, BigDecimal outVoa, String typeVariety, String uidEdfa) {
693         // Create an amplifier after the roadm
694         Coordinate c1 = new Coordinate(new BigDecimal(latitude));
695         Coordinate c2 = new Coordinate(new BigDecimal(longitude));
696         Location location1 = new LocationBuilder().setRegion(region).setCity(city).setLatitude(c1).setLongitude(c2)
697                 .build();
698         Metadata metadata1 = new MetadataBuilder().setLocation(location1).build();
699         Operational operational = new OperationalBuilder().setGainTarget(gainTarget).setTiltTarget(tiltTarget)
700                 .setOutVoa(outVoa).build();
701         Edfa edfa = new EdfaBuilder()
702                 // .setTypeVariety(typeVariety)
703                 .setOperational(operational).build();
704         Elements element1 = new ElementsBuilder().setUid(uidEdfa) // Choose an
705                                                                   // ip
706                                                                   // address
707                 .setType(org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.Edfa.class)
708                 .setMetadata(metadata1).setElementType(edfa).setTypeVariety(typeVariety).build();
709         return element1;
710     }
711
712     /*
713      * Method to add ROADM
714      */
715     private Elements addElementsRoadm(double latitude, double longitude, String region, String city,
716             double targetPchOutDb, String uidRoadm) {
717
718         Coordinate c1 = new Coordinate(new BigDecimal(latitude));
719         Coordinate c2 = new Coordinate(new BigDecimal(longitude));
720         Location location1 = new LocationBuilder().setRegion(region).setCity(city).setLatitude(c1).setLongitude(c2)
721                 .build();
722         Metadata metadata1 = new MetadataBuilder().setLocation(location1).build();
723         // Create the roadm
724         Roadm roadm = new RoadmBuilder().setTargetPchOutDb(new BigDecimal(targetPchOutDb)).build();
725         Params params1 = new ParamsBuilder().setFiberroadm(roadm).build();
726         Elements element1 = new ElementsBuilder().setUid(uidRoadm)
727                 .setType(org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.Roadm.class)
728                 .setMetadata(metadata1).setElementType(new FiberRoadmBuilder().setParams(params1).build()).build();
729         return element1;
730     }
731
732     /*
733      * Method to add Transceiver
734      */
735     private Elements addElementsTransceiver(double latitude, double longitude, String region, String city,
736             String uidTrans) {
737         Coordinate c1 = new Coordinate(new BigDecimal(latitude));
738         Coordinate c2 = new Coordinate(new BigDecimal(longitude));
739         Location location1 = new LocationBuilder().setRegion(region).setCity(city).setLatitude(c1).setLongitude(c2)
740                 .build();
741         Metadata metadata1 = new MetadataBuilder().setLocation(location1).build();
742         Transceiver transceiver = new TransceiverBuilder().build();
743         Elements element1 = new ElementsBuilder().setUid(uidTrans)
744                 .setType(org.opendaylight.yang.gen.v1.gnpy.gnpy.network.topology.rev181214.Transceiver.class)
745                 .setMetadata(metadata1).setElementType(transceiver).build();
746         return element1;
747     }
748
749     /*
750      * Add routeObjectIncludeExclude
751      */
752     private RouteObjectIncludeExclude addRouteObjectIncludeExclude(IpAddress ipAddress, long teTpValue, long index) {
753         TeNodeId teNodeId = new TeNodeId(ipAddress);
754         TeTpId teTpId = new TeTpId(teTpValue);
755         NumUnnumHop numUnnumHop = new org.opendaylight.yang.gen.v1.gnpy.path.rev190502.explicit.route.hop.type.num
756             .unnum.hop.NumUnnumHopBuilder()
757             .setNodeId(teNodeId.getIpv4Address().getValue().toString()).setLinkTpId(teTpId.getUint32().toString())
758             .setHopType(TeHopType.STRICT).build();
759         Type type1 = new NumUnnumHopBuilder().setNumUnnumHop(numUnnumHop).build();
760         // Create routeObjectIncludeExclude element 1
761         RouteObjectIncludeExclude routeObjectIncludeExclude1 = new RouteObjectIncludeExcludeBuilder().setIndex(index)
762                 .setExplicitRouteUsage(RouteIncludeEro.class).setType(type1).build();
763         return routeObjectIncludeExclude1;
764     }
765
766     private String fromToNodeForConnection(String id, IpAddress ip) {
767         String fromToNode = id;
768         if (ip != null) {
769             fromToNode = ip.getIpv4Address().getValue().toString();
770         }
771         return (fromToNode);
772     }
773
774     private Connections createNewConnection(String srcId, IpAddress srcIp, String destId, IpAddress destIp) {
775         String fromNode = srcId;
776         String toNode = destId;
777         if (srcIp != null) {
778             fromNode = srcIp.getIpv4Address().getValue().toString();
779         }
780         if (destIp != null) {
781             toNode = destIp.getIpv4Address().getValue().toString();
782         }
783         Connections connection1 = new ConnectionsBuilder().setFromNode(fromNode).setToNode(toNode).build();
784         return (connection1);
785     }
786
787     public List<Elements> getElements() {
788         return elements;
789     }
790
791     public void setElements(List<Elements> elements) {
792         this.elements = elements;
793     }
794
795     public List<Connections> getConnections() {
796         return connections;
797     }
798
799     public void setConnections(List<Connections> connections) {
800         this.connections = connections;
801     }
802
803     public List<PathRequest> getPathRequest() {
804         return pathRequest;
805     }
806
807     public void setPathRequest(List<PathRequest> pathRequest) {
808         this.pathRequest = pathRequest;
809     }
810
811     public List<Synchronization> getSynchronization() {
812         return synchronization;
813     }
814
815     public void setSynchronization(List<Synchronization> synchronization) {
816         this.synchronization = synchronization;
817     }
818
819     public List<PathRequest> createEmptyPathRequest(PathComputationRequestInput input, AToZDirection atoz) {
820         // List of A to Z
821         // List<AToZ> listAtoZ = atoz.getAToZ();
822         // int atozSize = listAtoZ.size();
823
824         // Create the path request
825         List<PathRequest> pathRequestList = new ArrayList<>();
826
827         // 1. Create the path request element 1
828         // Find parameters
829         // String serviceName = input.getServiceName();
830         String sourceNode = input.getServiceAEnd().getNodeId();
831         String destNode = input.getServiceZEnd().getNodeId();
832
833         // 1.2 Create a path constraints
834         Long rate = atoz.getRate();
835
836         // Create EffectiveFreqSlot
837         List<EffectiveFreqSlot> effectiveFreqSlot = new ArrayList<>();
838         EffectiveFreqSlot effectiveFreqSlot1 = new EffectiveFreqSlotBuilder().setM(5).setN(8).build();
839         effectiveFreqSlot.add(effectiveFreqSlot1);
840
841         // Create Te-Bandwidth
842         TeBandwidth teBandwidth = new TeBandwidthBuilder().setPathBandwidth(new BigDecimal(rate))
843                 .setTechnology("flexi-grid").setTrxType("openroadm-beta1").setTrxMode("W100G")
844                 .setEffectiveFreqSlot(effectiveFreqSlot).setSpacing(new BigDecimal(50000000000.0)).build();
845         PathConstraints pathConstraints = new PathConstraintsBuilder().setTeBandwidth(teBandwidth).build();
846         PathRequest pathRequest1 = new PathRequestBuilder().setRequestId(new Long(0))
847                 .setSource(mapNodeRefIp.get(sourceNode)).setDestination(mapNodeRefIp.get(destNode))
848                 .setSrcTpId("srcTpId".getBytes()).setDstTpId("dstTpId".getBytes()).setPathConstraints(pathConstraints)
849                 .build();
850         pathRequestList.add(pathRequest1);
851         return pathRequestList;
852     }
853
854 }