+ private boolean processPceLink(Link link, NodeId sourceId, NodeId destId, PceNode source, PceNode dest) {
+ PceLink pcelink = new PceLink(link, source, dest);
+ if (!pcelink.isValid()) {
+ dropOppositeLink(link);
+ LOG.error(" validateLink: Link is ignored due errors in network data or in opposite link");
+ return false;
+ }
+ LinkId linkId = pcelink.getLinkId();
+ if (validateLinkConstraints(pcelink).equals(ConstraintTypes.HARD_EXCLUDE)) {
+ dropOppositeLink(link);
+ LOG.debug("validateLink: constraints : link is ignored == {}", linkId.getValue());
+ return false;
+ }
+ switch (pcelink.getlinkType()) {
+ case ROADMTOROADM:
+ case EXPRESSLINK:
+ allPceLinks.put(linkId, pcelink);
+ source.addOutgoingLink(pcelink);
+ LOG.debug("validateLink: {}-LINK added to allPceLinks {}",
+ pcelink.getlinkType(), pcelink);
+ break;
+ case ADDLINK:
+ pcelink.setClient(
+ source.getRdmSrgClient(pcelink.getSourceTP().getValue(), StringConstants.SERVICE_DIRECTION_AZ));
+ addLinks.add(pcelink);
+ LOG.debug("validateLink: ADD-LINK saved {}", pcelink);
+ break;
+ case DROPLINK:
+ pcelink.setClient(
+ dest.getRdmSrgClient(pcelink.getDestTP().getValue(), StringConstants.SERVICE_DIRECTION_ZA));
+ dropLinks.add(pcelink);
+ LOG.debug("validateLink: DROP-LINK saved {}", pcelink);
+ break;
+ case XPONDERINPUT:
+ // store separately all SRG links directly
+ azSrgs.add(sourceId);
+ // connected to A/Z
+ if (!dest.checkTP(pcelink.getDestTP().getValue())) {
+ LOG.debug(
+ "validateLink: XPONDER-INPUT is rejected as NW port is busy - {} ", pcelink);
+ return false;
+ }
+ if (dest.getXpdrClient(pcelink.getDestTP().getValue()) != null) {
+ pcelink.setClient(dest.getXpdrClient(pcelink.getDestTP().getValue()));
+ }
+ allPceLinks.put(linkId, pcelink);
+ source.addOutgoingLink(pcelink);
+ LOG.debug("validateLink: XPONDER-INPUT link added to allPceLinks {}", pcelink);
+ break;
+ // does it mean XPONDER==>>SRG ?
+ case XPONDEROUTPUT:
+ // store separately all SRG links directly
+ azSrgs.add(destId);
+ // connected to A/Z
+ if (!source.checkTP(pcelink.getSourceTP().getValue())) {
+ LOG.debug(
+ "validateLink: XPONDER-OUTPUT is rejected as NW port is busy - {} ", pcelink);
+ return false;
+ }
+ if (source.getXpdrClient(pcelink.getSourceTP().getValue()) != null) {
+ pcelink.setClient(source.getXpdrClient(pcelink.getSourceTP().getValue()));
+ }
+ allPceLinks.put(linkId, pcelink);
+ source.addOutgoingLink(pcelink);
+ LOG.debug("validateLink: XPONDER-OUTPUT link added to allPceLinks {}", pcelink);
+ break;
+ default:
+ LOG.warn("validateLink: link type is not supported {}", pcelink);
+ }
+ return true;
+ }
+
+ private boolean processPceOtnLink(Link link, PceNode source, PceNode dest) {
+ PceLink pceOtnLink = new PceLink(link, source, dest);
+
+ if (!pceOtnLink.isOtnValid(link, serviceType)) {
+ dropOppositeLink(link);
+ LOG.error(" validateLink: Link is ignored due errors in network data or in opposite link");
+ return false;
+ }
+
+ LinkId linkId = pceOtnLink.getLinkId();
+ if (validateLinkConstraints(pceOtnLink).equals(ConstraintTypes.HARD_EXCLUDE)) {
+ dropOppositeLink(link);
+ LOG.debug("validateLink: constraints : link is ignored == {}", linkId.getValue());
+ return false;
+ }
+
+ switch (pceOtnLink.getlinkType()) {
+ case OTNLINK:
+ if (source.getXpdrClient(pceOtnLink.getSourceTP().getValue()) != null) {
+ pceOtnLink.setClient(source.getXpdrClient(pceOtnLink.getSourceTP().getValue()));
+ }
+ if (dest.getXpdrClient(pceOtnLink.getDestTP().getValue()) != null) {
+ pceOtnLink.setClient(dest.getXpdrClient(pceOtnLink.getDestTP().getValue()));
+ }
+ allPceLinks.put(linkId, pceOtnLink);
+ source.addOutgoingLink(pceOtnLink);
+ LOG.info("validateLink: OTN-LINK added to allPceLinks {}", pceOtnLink);
+ break;
+ default:
+ LOG.warn("validateLink: link type is not supported {}", pceOtnLink);
+ }
+ return true;
+ }
+