2 * Copyright © 2017 AT&T, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.transportpce.pce.networkanalyzer;
11 import java.util.ArrayList;
12 import java.util.HashMap;
13 import java.util.HashSet;
14 import java.util.List;
16 import java.util.Optional;
18 import java.util.concurrent.ExecutionException;
19 import java.util.stream.Collectors;
20 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
21 import org.opendaylight.transportpce.common.NetworkUtils;
22 import org.opendaylight.transportpce.common.ResponseCodes;
23 import org.opendaylight.transportpce.common.StringConstants;
24 import org.opendaylight.transportpce.common.mapping.MappingUtils;
25 import org.opendaylight.transportpce.common.mapping.MappingUtilsImpl;
26 import org.opendaylight.transportpce.common.network.NetworkTransactionService;
27 import org.opendaylight.transportpce.pce.constraints.PceConstraints;
28 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev200128.PathComputationRequestInput;
29 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Node1;
30 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.OpenroadmLinkType;
31 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.OpenroadmNodeType;
32 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NetworkId;
33 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.Networks;
34 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NodeId;
35 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network;
36 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.NetworkKey;
37 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node;
38 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.LinkId;
39 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Network1;
40 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link;
41 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
42 import org.slf4j.Logger;
43 import org.slf4j.LoggerFactory;
45 public class PceCalculation {
47 private static final Logger LOG = LoggerFactory.getLogger(PceCalculation.class);
48 private NetworkTransactionService networkTransactionService = null;
50 ///////////// data parsed from Input/////////////////
51 private PathComputationRequestInput input;
52 private String anodeId = "";
53 private String znodeId = "";
54 private String serviceFormatA = "";
55 private String serviceFormatZ = "";
56 private String serviceType = "";
57 private Long serviceRate = 0L;
59 private PceConstraints pceHardConstraints;
61 ///////////// Intermediate data/////////////////
62 private List<PceLink> addLinks = new ArrayList<>();
63 private List<PceLink> dropLinks = new ArrayList<>();
64 private HashSet<NodeId> azSrgs = new HashSet<>();
66 private PceNode aendPceNode = null;
67 private PceNode zendPceNode = null;
69 private List<Link> allLinks = null;
70 private List<Node> allNodes = null;
72 // this List serves graph calculation
73 private Map<NodeId, PceNode> allPceNodes = new HashMap<>();
74 // this List serves calculation of ZtoA path description
75 // TODO maybe better solution is possible
76 private Map<LinkId, PceLink> allPceLinks = new HashMap<>();
77 private Set<LinkId> linksToExclude = new HashSet<>();
78 private PceResult returnStructure;
80 private enum ConstraintTypes {
81 NONE, HARD_EXCLUDE, HARD_INCLUDE, HARD_DIVERSITY, SOFT_EXCLUDE, SOFT_INCLUDE, SOFT_DIVERSITY;
84 private MappingUtils mappingUtils;
86 public PceCalculation(PathComputationRequestInput input, NetworkTransactionService networkTransactionService,
87 PceConstraints pceHardConstraints, PceConstraints pceSoftConstraints, PceResult rc) {
89 this.networkTransactionService = networkTransactionService;
90 this.returnStructure = rc;
92 this.pceHardConstraints = pceHardConstraints;
93 this.mappingUtils = new MappingUtilsImpl(networkTransactionService.getDataBroker());
97 public void retrievePceNetwork() {
99 LOG.info("In PceCalculation retrieveNetwork: ");
102 returnStructure.setRC(ResponseCodes.RESPONSE_FAILED);
105 MapUtils.mapDiversityConstraints(allNodes, allLinks, pceHardConstraints);
108 returnStructure.setRC(ResponseCodes.RESPONSE_FAILED);
111 printNodesInfo(allPceNodes);
113 returnStructure.setRC(ResponseCodes.RESPONSE_OK);
117 private boolean parseInput() {
118 if (input.getServiceAEnd().getServiceFormat() == null || input.getServiceZEnd().getServiceFormat() == null
119 || input.getServiceAEnd().getServiceRate() == null) {
120 LOG.error("Service Format and Service Rate are required for a path calculation");
123 serviceFormatA = input.getServiceAEnd().getServiceFormat().getName();
124 serviceFormatZ = input.getServiceZEnd().getServiceFormat().getName();
125 serviceRate = input.getServiceAEnd().getServiceRate().toJava();
127 LOG.info("parseInput: A and Z :[{}] and [{}]", anodeId, znodeId);
128 if (!(serviceFormatA.equals(serviceFormatZ))) {
129 LOG.info("parseInput: different service format for A and Z not handled, will use service format from Aend");
130 } else if (serviceRate == 100L) {
131 switch (serviceFormatA) {
134 serviceType = StringConstants.SERVICE_TYPE_100GE;
137 serviceType = StringConstants.SERVICE_TYPE_OTU4;
140 serviceType = StringConstants.SERVICE_TYPE_ODU4;
143 LOG.debug("parseInput: unsupported service type: Format {} Rate 100L", serviceFormatA);
146 //switch(serviceRate) may seem a better option at first glance.
147 //But switching on Long or long is not directly possible in Java.
148 //And casting to int bumps the limit here.
149 //Passing by ENUM or String are possible alternatives.
150 //Maybe HashMap and similar options should also be considered here.
151 } else if ("Ethernet".equals(serviceFormatA)) {
152 //only rate 100L is currently supported except in Ethernet
153 if (serviceRate == 10L) {
154 serviceType = StringConstants.SERVICE_TYPE_10GE;
155 } else if (serviceRate == 1L) {
156 serviceType = StringConstants.SERVICE_TYPE_1GE;
158 LOG.debug("parseInput: unsupported service type: Format Ethernet Rate {}", serviceRate);
161 LOG.debug("parseInput: unsupported service type: Format {} Rate {}",
162 serviceFormatA, serviceRate);
164 if (StringConstants.SERVICE_TYPE_ODU4.equals(serviceType)
165 || StringConstants.SERVICE_TYPE_10GE.equals(serviceType)
166 || StringConstants.SERVICE_TYPE_1GE.equals(serviceType)) {
167 anodeId = input.getServiceAEnd().getTxDirection().getPort().getPortDeviceName();
168 znodeId = input.getServiceZEnd().getTxDirection().getPort().getPortDeviceName();
170 anodeId = input.getServiceAEnd().getNodeId();
171 znodeId = input.getServiceZEnd().getNodeId();
174 returnStructure.setRate(input.getServiceAEnd().getServiceRate().toJava());
175 returnStructure.setServiceFormat(input.getServiceAEnd().getServiceFormat());
179 private boolean readMdSal() {
180 InstanceIdentifier<Network> nwInstanceIdentifier = null;
182 if (("OC".equals(serviceFormatA)) || ("OTU".equals(serviceFormatA)) || (("Ethernet".equals(serviceFormatA))
183 && (serviceRate == 100L))) {
185 LOG.info("readMdSal: network {}", NetworkUtils.OVERLAY_NETWORK_ID);
186 nwInstanceIdentifier = InstanceIdentifier.builder(Networks.class)
187 .child(Network.class, new NetworkKey(new NetworkId(NetworkUtils.OVERLAY_NETWORK_ID))).build();
188 } else if ("ODU".equals(serviceFormatA) || ("Ethernet".equals(serviceFormatA) && serviceRate == 10L)
189 || ("Ethernet".equals(serviceFormatA) && serviceRate == 1L)) {
190 LOG.info("readMdSal: network {}", NetworkUtils.OTN_NETWORK_ID);
191 nwInstanceIdentifier = InstanceIdentifier.builder(Networks.class)
192 .child(Network.class, new NetworkKey(new NetworkId(NetworkUtils.OTN_NETWORK_ID))).build();
194 LOG.info("readMdSal: service-rate {} / service-format not handled {}", serviceRate, serviceFormatA);
199 Optional<Network> nwOptional =
200 networkTransactionService.read(LogicalDatastoreType.CONFIGURATION, nwInstanceIdentifier).get();
201 if (nwOptional.isPresent()) {
202 nw = nwOptional.get();
203 LOG.debug("readMdSal: network nodes: nwOptional.isPresent = true {}", nw);
205 } catch (InterruptedException | ExecutionException e) {
206 LOG.error("readMdSal: Error reading topology {}", nwInstanceIdentifier);
207 networkTransactionService.close();
208 returnStructure.setRC(ResponseCodes.RESPONSE_FAILED);
209 throw new RuntimeException(
210 "readMdSal: Error reading from operational store, topology : " + nwInstanceIdentifier + " :" + e);
212 networkTransactionService.close();
215 LOG.error("readMdSal: network is null: {}", nwInstanceIdentifier);
218 allNodes = nw.nonnullNode().values().stream().sorted((n1, n2)
219 -> n1.getNodeId().getValue().compareTo(n2.getNodeId().getValue())).collect(Collectors.toList());
220 Network1 nw1 = nw.augmentation(Network1.class);
222 allLinks = nw1.nonnullLink().values().stream().sorted((l1, l2)
223 -> l1.getSource().getSourceTp().toString().compareTo(l2.getSource().getSourceTp().toString()))
224 .collect(Collectors.toList());
226 LOG.warn("no otn links in otn-topology");
228 if (allNodes == null || allNodes.isEmpty()) {
229 LOG.error("readMdSal: no nodes ");
232 LOG.info("readMdSal: network nodes: {} nodes added", allNodes.size());
233 LOG.debug("readMdSal: network nodes: {} nodes added", allNodes);
235 if (allLinks == null || allLinks.isEmpty()) {
236 LOG.error("readMdSal: no links ");
239 LOG.info("readMdSal: network links: {} links added", allLinks.size());
240 LOG.debug("readMdSal: network links: {} links added", allLinks);
245 private boolean analyzeNw() {
247 LOG.debug("analyzeNw: allNodes size {}, allLinks size {}", allNodes.size(), allLinks.size());
249 if ((StringConstants.SERVICE_TYPE_100GE.equals(serviceType))
250 || (StringConstants.SERVICE_TYPE_OTU4.equals(serviceType))) {
251 // 100GE service and OTU4 service are handled at the openroadm-topology layer
252 for (Node node : allNodes) {
256 LOG.debug("analyzeNw: allPceNodes size {}", allPceNodes.size());
258 if (aendPceNode == null || zendPceNode == null) {
259 LOG.error("analyzeNw: Error in reading nodes: A or Z do not present in the network");
262 for (Link link : allLinks) {
266 LOG.debug("analyzeNw: addLinks size {}, dropLinks size {}", addLinks.size(), dropLinks.size());
268 LOG.debug("analyzeNw: azSrgs size = {}", azSrgs.size());
269 for (NodeId srg : azSrgs) {
270 LOG.debug("analyzeNw: A/Z Srgs SRG = {}", srg.getValue());
273 for (PceLink link : addLinks) {
274 filteraddLinks(link);
276 for (PceLink link : dropLinks) {
277 filterdropLinks(link);
281 // ODU4, 10GE/ODU2e or 1GE/ODU0 services are handled at openroadm-otn layer
283 for (Node node : allNodes) {
284 validateOtnNode(node);
287 LOG.info("analyzeNw: allPceNodes {}", allPceNodes);
289 if (aendPceNode == null || zendPceNode == null) {
290 LOG.error("analyzeNw: Error in reading nodes: A or Z do not present in the network");
293 for (Link link : allLinks) {
298 LOG.info("analyzeNw: allPceNodes size {}, allPceLinks size {}", allPceNodes.size(), allPceLinks.size());
300 if ((allPceNodes.size() == 0) || (allPceLinks.size() == 0)) {
304 LOG.debug("analyzeNw: allPceNodes {}", allPceNodes);
305 LOG.debug("analyzeNw: allPceLinks {}", allPceLinks);
310 private boolean filteraddLinks(PceLink pcelink) {
312 NodeId nodeId = pcelink.getSourceId();
314 if (azSrgs.contains(nodeId)) {
315 allPceLinks.put(pcelink.getLinkId(), pcelink);
316 allPceNodes.get(nodeId).addOutgoingLink(pcelink);
317 LOG.debug("analyzeNw: Add_LINK added to source and to allPceLinks {}", pcelink.getLinkId());
321 // remove the SRG from PceNodes, as it is not directly connected to A/Z
322 allPceNodes.remove(nodeId);
323 LOG.debug("analyzeNw: SRG removed {}", nodeId.getValue());
328 private boolean filterdropLinks(PceLink pcelink) {
330 NodeId nodeId = pcelink.getDestId();
332 if (azSrgs.contains(nodeId)) {
333 allPceLinks.put(pcelink.getLinkId(), pcelink);
334 allPceNodes.get(nodeId).addOutgoingLink(pcelink);
335 LOG.debug("analyzeNw: Drop_LINK added to dest and to allPceLinks {}", pcelink.getLinkId());
339 // remove the SRG from PceNodes, as it is not directly connected to A/Z
340 allPceNodes.remove(pcelink.getDestId());
341 LOG.debug("analyzeNw: SRG removed {}", nodeId.getValue());
346 private boolean validateLink(Link link) {
347 LOG.info("validateLink: link {} ", link);
349 NodeId sourceId = link.getSource().getSourceNode();
350 NodeId destId = link.getDestination().getDestNode();
351 PceNode source = allPceNodes.get(sourceId);
352 PceNode dest = allPceNodes.get(destId);
354 if (source == null) {
355 LOG.debug("validateLink: Link is ignored due source node is rejected by node validation - {}",
356 link.getSource().getSourceNode().getValue());
360 LOG.debug("validateLink: Link is ignored due dest node is rejected by node validation - {}",
361 link.getDestination().getDestNode().getValue());
365 if ((StringConstants.SERVICE_TYPE_100GE.equals(serviceType))
366 || (StringConstants.SERVICE_TYPE_OTU4.equals(serviceType))) {
367 // 100GE or OTU4 services are handled at WDM Layer
368 PceLink pcelink = new PceLink(link, source, dest);
369 if (!pcelink.isValid()) {
370 dropOppositeLink(link);
371 LOG.error(" validateLink: Link is ignored due errors in network data or in opposite link");
374 LinkId linkId = pcelink.getLinkId();
375 if (validateLinkConstraints(pcelink).equals(ConstraintTypes.HARD_EXCLUDE)) {
376 dropOppositeLink(link);
377 LOG.debug("validateLink: constraints : link is ignored == {}", linkId.getValue());
380 switch (pcelink.getlinkType()) {
383 allPceLinks.put(linkId, pcelink);
384 source.addOutgoingLink(pcelink);
385 LOG.debug("validateLink: {}-LINK added to allPceLinks {}",
386 pcelink.getlinkType(), pcelink);
389 pcelink.setClient(source.getRdmSrgClient(pcelink.getSourceTP().toString()));
390 addLinks.add(pcelink);
391 LOG.debug("validateLink: ADD-LINK saved {}", pcelink);
394 pcelink.setClient(dest.getRdmSrgClient(pcelink.getDestTP().toString()));
395 dropLinks.add(pcelink);
396 LOG.debug("validateLink: DROP-LINK saved {}", pcelink);
399 // store separately all SRG links directly
400 azSrgs.add(sourceId);
402 if (!dest.checkTP(pcelink.getDestTP().toString())) {
404 "validateLink: XPONDER-INPUT is rejected as NW port is busy - {} ", pcelink);
407 if (dest.getXpdrClient(pcelink.getDestTP().toString()) != null) {
408 pcelink.setClient(dest.getXpdrClient(pcelink.getDestTP().toString()));
410 allPceLinks.put(linkId, pcelink);
411 source.addOutgoingLink(pcelink);
412 LOG.debug("validateLink: XPONDER-INPUT link added to allPceLinks {}", pcelink);
414 // does it mean XPONDER==>>SRG ?
416 // store separately all SRG links directly
419 if (!source.checkTP(pcelink.getSourceTP().toString())) {
421 "validateLink: XPONDER-OUTPUT is rejected as NW port is busy - {} ", pcelink);
424 if (source.getXpdrClient(pcelink.getSourceTP().toString()) != null) {
425 pcelink.setClient(source.getXpdrClient(pcelink.getSourceTP().toString()));
427 allPceLinks.put(linkId, pcelink);
428 source.addOutgoingLink(pcelink);
429 LOG.debug("validateLink: XPONDER-OUTPUT link added to allPceLinks {}", pcelink);
432 LOG.warn("validateLink: link type is not supported {}", pcelink);
436 } else if ((StringConstants.SERVICE_TYPE_ODU4.equals(serviceType))
437 || (StringConstants.SERVICE_TYPE_10GE.equals(serviceType))
438 || (StringConstants.SERVICE_TYPE_1GE.equals(serviceType))) {
439 // ODU4, 1GE and 10GE services relying on ODU2, ODU2e or ODU0 services are handled at OTN layer
440 PceLink pceOtnLink = new PceLink(link, source, dest);
442 if (!pceOtnLink.isOtnValid(link, serviceType)) {
443 dropOppositeLink(link);
444 LOG.error(" validateLink: Link is ignored due errors in network data or in opposite link");
448 LinkId linkId = pceOtnLink.getLinkId();
449 if (validateLinkConstraints(pceOtnLink).equals(ConstraintTypes.HARD_EXCLUDE)) {
450 dropOppositeLink(link);
451 LOG.debug("validateLink: constraints : link is ignored == {}", linkId.getValue());
455 switch (pceOtnLink.getlinkType()) {
457 if (dest.getXpdrClient(pceOtnLink.getDestTP().toString()) != null) {
458 pceOtnLink.setClient(dest.getXpdrClient(pceOtnLink.getDestTP().toString()));
461 allPceLinks.put(linkId, pceOtnLink);
462 source.addOutgoingLink(pceOtnLink);
463 LOG.info("validateLink: OTN-LINK added to allPceLinks {}", pceOtnLink);
466 LOG.warn("validateLink: link type is not supported {}", pceOtnLink);
471 LOG.error(" validateLink: Unmanaged service type {}", serviceType);
477 private boolean validateNode(Node node) {
478 LOG.debug("validateNode: node {} ", node);
479 // PceNode will be used in Graph algorithm
480 Node1 node1 = node.augmentation(Node1.class);
482 LOG.error("getNodeType: no Node1 (type) Augmentation for node: [{}]. Node is ignored", node.getNodeId());
485 OpenroadmNodeType nodeType = node1.getNodeType();
486 String deviceNodeId = MapUtils.getSupNetworkNode(node);
487 // Should never happen but because of existing topology test files
488 // we have to manage this case
489 if (deviceNodeId == null || deviceNodeId.isBlank()) {
490 deviceNodeId = node.getNodeId().getValue();
492 LOG.info("Device node id {} for {}", deviceNodeId, node);
493 PceOpticalNode pceNode = new PceOpticalNode(node, nodeType, mappingUtils.getOpenRoadmVersion(deviceNodeId));
494 pceNode.validateAZxponder(anodeId, znodeId, input.getServiceAEnd().getServiceFormat());
495 pceNode.initFrequenciesBitSet();
497 if (!pceNode.isValid()) {
498 LOG.warn(" validateNode: Node is ignored");
501 if (validateNodeConstraints(pceNode).equals(ConstraintTypes.HARD_EXCLUDE)) {
504 if (endPceNode(nodeType, pceNode.getNodeId(), pceNode) && this.aendPceNode == null
505 && isAZendPceNode(this.serviceFormatA, pceNode, anodeId, "A")) {
506 this.aendPceNode = pceNode;
508 if (endPceNode(nodeType, pceNode.getNodeId(), pceNode) && this.zendPceNode == null
509 && isAZendPceNode(this.serviceFormatZ, pceNode, znodeId, "Z")) {
510 this.zendPceNode = pceNode;
513 allPceNodes.put(pceNode.getNodeId(), pceNode);
514 LOG.debug("validateNode: node is saved {}", pceNode.getNodeId().getValue());
518 private boolean isAZendPceNode(String serviceFormat, PceOpticalNode pceNode, String azNodeId, String azEndPoint) {
519 switch (serviceFormat) {
522 if (pceNode.getSupNetworkNodeId().equals(azNodeId)) {
527 if ("A".equals(azEndPoint) && pceNode.getNodeId().getValue()
528 .equals(this.input.getServiceAEnd().getRxDirection().getPort().getPortDeviceName())) {
531 if ("Z".equals(azEndPoint) && pceNode.getNodeId().getValue()
532 .equals(this.input.getServiceZEnd().getRxDirection().getPort().getPortDeviceName())) {
537 LOG.debug("Unsupported service Format {} for node {}", serviceFormat, pceNode.getNodeId().getValue());
542 private boolean validateOtnNode(Node node) {
543 LOG.info("validateOtnNode: {} ", node.getNodeId().getValue());
544 // PceOtnNode will be used in Graph algorithm
545 if (node.augmentation(Node1.class) != null) {
546 OpenroadmNodeType nodeType = node.augmentation(Node1.class).getNodeType();
548 PceOtnNode pceOtnNode = new PceOtnNode(node, nodeType, node.getNodeId(), "otn", serviceType);
549 pceOtnNode.validateXponder(anodeId, znodeId);
551 if (!pceOtnNode.isValid()) {
552 LOG.warn(" validateOtnNode: Node {} is ignored", node.getNodeId().getValue());
555 if (validateNodeConstraints(pceOtnNode).equals(ConstraintTypes.HARD_EXCLUDE)) {
558 if (pceOtnNode.getNodeId().getValue().equals(anodeId) && this.aendPceNode == null) {
559 this.aendPceNode = pceOtnNode;
561 if (pceOtnNode.getNodeId().getValue().equals(znodeId) && this.zendPceNode == null) {
562 this.zendPceNode = pceOtnNode;
564 allPceNodes.put(pceOtnNode.getNodeId(), pceOtnNode);
565 LOG.info("validateOtnNode: node {} is saved", node.getNodeId().getValue());
568 LOG.error("ValidateOtnNode: no node-type augmentation. Node {} is ignored", node.getNodeId().getValue());
573 private ConstraintTypes validateNodeConstraints(PceNode pcenode) {
574 if (pceHardConstraints.getExcludeSupNodes().isEmpty() && pceHardConstraints.getExcludeCLLI().isEmpty()) {
575 return ConstraintTypes.NONE;
577 if (pceHardConstraints.getExcludeSupNodes().contains(pcenode.getSupNetworkNodeId())) {
578 LOG.info("validateNodeConstraints: {}", pcenode.getNodeId().getValue());
579 return ConstraintTypes.HARD_EXCLUDE;
581 if (pceHardConstraints.getExcludeCLLI().contains(pcenode.getSupClliNodeId())) {
582 LOG.info("validateNodeConstraints: {}", pcenode.getNodeId().getValue());
583 return ConstraintTypes.HARD_EXCLUDE;
585 return ConstraintTypes.NONE;
588 private ConstraintTypes validateLinkConstraints(PceLink link) {
589 if (pceHardConstraints.getExcludeSRLG().isEmpty()) {
590 return ConstraintTypes.NONE;
593 // for now SRLG is the only constraint for link
594 if (link.getlinkType() != OpenroadmLinkType.ROADMTOROADM) {
595 return ConstraintTypes.NONE;
598 List<Long> constraints = new ArrayList<>(pceHardConstraints.getExcludeSRLG());
599 constraints.retainAll(link.getsrlgList());
600 if (!constraints.isEmpty()) {
601 LOG.info("validateLinkConstraints: {}", link.getLinkId().getValue());
602 return ConstraintTypes.HARD_EXCLUDE;
605 return ConstraintTypes.NONE;
608 private void dropOppositeLink(Link link) {
609 LinkId opplink = MapUtils.extractOppositeLink(link);
611 if (allPceLinks.containsKey(opplink)) {
612 allPceLinks.remove(opplink);
614 linksToExclude.add(opplink);
618 private Boolean endPceNode(OpenroadmNodeType openroadmNodeType, NodeId nodeId, PceOpticalNode pceNode) {
619 switch (openroadmNodeType) {
621 pceNode.initSrgTps();
622 this.azSrgs.add(nodeId);
625 pceNode.initXndrTps(input.getServiceAEnd().getServiceFormat());
628 LOG.warn("endPceNode: Node {} is not SRG or XPONDER !", nodeId);
632 if (!pceNode.isValid()) {
633 LOG.error("validateNode : there are no availaible wavelengths in node {}", pceNode.getNodeId().getValue());
639 public PceNode getaendPceNode() {
643 public PceNode getzendPceNode() {
647 public Map<NodeId, PceNode> getAllPceNodes() {
648 return this.allPceNodes;
651 public Map<LinkId, PceLink> getAllPceLinks() {
652 return this.allPceLinks;
655 public String getServiceType() {
659 public PceResult getReturnStructure() {
660 return returnStructure;
663 private static void printNodesInfo(Map<NodeId, PceNode> allPceNodes) {
664 allPceNodes.forEach(((nodeId, pceNode) -> {
665 LOG.info("In printNodes in node {} : outgoing links {} ", pceNode.getNodeId().getValue(),
666 pceNode.getOutgoingLinks());