+
+ allPceNodes.put(pceNode.getNodeId(), pceNode);
+ LOG.debug("validateNode: node is saved {}", pceNode.getNodeId().getValue());
+ return;
+ }
+
+ @SuppressWarnings("fallthrough")
+ @SuppressFBWarnings(
+ value = "SF_SWITCH_FALLTHROUGH",
+ justification = "intentional fallthrough")
+ private boolean isAZendPceNode(String serviceFormat, PceOpticalNode pceNode, String azNodeId, String azEndPoint) {
+ switch (serviceFormat) {
+ case "Ethernet":
+ case "OC":
+ if (pceNode.getSupNetworkNodeId().equals(azNodeId)) {
+ return true;
+ }
+ //fallthrough
+ case "OTU":
+ switch (azEndPoint) {
+ case "A":
+ return checkAendInputTxPortDeviceName()
+ && pceNode.getNodeId().getValue()
+ .equals(this.input.getServiceAEnd().getTxDirection().getPort().getPortDeviceName());
+ case "Z":
+ return checkZendInputTxPortDeviceName()
+ && pceNode.getNodeId().getValue()
+ .equals(this.input.getServiceZEnd().getTxDirection().getPort().getPortDeviceName());
+ default:
+ return false;
+ }
+ default:
+ LOG.debug("Unsupported service Format {} for node {}", serviceFormat, pceNode.getNodeId().getValue());
+ return false;
+ }
+ }
+
+ private void validateOtnNode(Node node) {
+ LOG.info("validateOtnNode: {} ", node.getNodeId().getValue());
+ // PceOtnNode will be used in Graph algorithm
+ if (node.augmentation(Node1.class) == null) {
+ LOG.error("ValidateOtnNode: no node-type augmentation. Node {} is ignored", node.getNodeId().getValue());
+ return;
+ }
+
+ OpenroadmNodeType nodeType = node.augmentation(Node1.class).getNodeType();
+ String clientPort = null;
+ if (node.getNodeId().getValue().equals(anodeId)
+ && this.aendPceNode == null
+ && input.getServiceAEnd() != null
+ && input.getServiceAEnd().getRxDirection() != null
+ && input.getServiceAEnd().getRxDirection().getPort() != null
+ && input.getServiceAEnd().getRxDirection().getPort().getPortName() != null) {
+ clientPort = input.getServiceAEnd().getRxDirection().getPort().getPortName();
+ } else if (node.getNodeId().getValue().equals(znodeId)
+ && this.zendPceNode == null
+ && input.getServiceZEnd() != null
+ && input.getServiceZEnd().getRxDirection() != null
+ && input.getServiceZEnd().getRxDirection().getPort() != null
+ && input.getServiceZEnd().getRxDirection().getPort().getPortName() != null) {
+ clientPort = input.getServiceZEnd().getRxDirection().getPort().getPortName();
+ }
+
+ PceOtnNode pceOtnNode = new PceOtnNode(node, nodeType, node.getNodeId(), "otn", serviceType, clientPort);
+ pceOtnNode.validateXponder(anodeId, znodeId);
+
+ if (!pceOtnNode.isValid()) {
+ LOG.warn(" validateOtnNode: Node {} is ignored", node.getNodeId().getValue());
+ return;
+ }
+ if (validateNodeConstraints(pceOtnNode).equals(ConstraintTypes.HARD_EXCLUDE)) {
+ return;
+ }
+ if (pceOtnNode.getNodeId().getValue().equals(anodeId) && this.aendPceNode == null) {
+ this.aendPceNode = pceOtnNode;
+ }
+ if (pceOtnNode.getNodeId().getValue().equals(znodeId) && this.zendPceNode == null) {
+ this.zendPceNode = pceOtnNode;
+ }
+ allPceNodes.put(pceOtnNode.getNodeId(), pceOtnNode);
+ LOG.info("validateOtnNode: node {} is saved", node.getNodeId().getValue());
+ return;
+ }
+
+ private ConstraintTypes validateNodeConstraints(PceNode pcenode) {
+ if (pceHardConstraints.getExcludeSupNodes().isEmpty() && pceHardConstraints.getExcludeCLLI().isEmpty()) {
+ return ConstraintTypes.NONE;
+ }
+ if (pceHardConstraints.getExcludeSupNodes().contains(pcenode.getSupNetworkNodeId())) {
+ LOG.info("validateNodeConstraints: {}", pcenode.getNodeId().getValue());
+ return ConstraintTypes.HARD_EXCLUDE;
+ }
+ if (pceHardConstraints.getExcludeCLLI().contains(pcenode.getSupClliNodeId())) {
+ LOG.info("validateNodeConstraints: {}", pcenode.getNodeId().getValue());
+ return ConstraintTypes.HARD_EXCLUDE;
+ }
+ return ConstraintTypes.NONE;
+ }
+
+ private ConstraintTypes validateLinkConstraints(PceLink link) {
+ if (pceHardConstraints.getExcludeSRLG().isEmpty()) {
+ return ConstraintTypes.NONE;
+ }
+
+ // for now SRLG is the only constraint for link
+ if (link.getlinkType() != OpenroadmLinkType.ROADMTOROADM) {
+ return ConstraintTypes.NONE;
+ }
+
+ List<Long> constraints = new ArrayList<>(pceHardConstraints.getExcludeSRLG());
+ constraints.retainAll(link.getsrlgList());
+ if (!constraints.isEmpty()) {
+ LOG.info("validateLinkConstraints: {}", link.getLinkId().getValue());
+ return ConstraintTypes.HARD_EXCLUDE;
+ }
+
+ return ConstraintTypes.NONE;
+ }
+
+ private void dropOppositeLink(Link link) {
+ LinkId opplink = MapUtils.extractOppositeLink(link);
+
+ if (allPceLinks.containsKey(opplink)) {
+ allPceLinks.remove(opplink);
+ } else {
+ linksToExclude.add(opplink);