- if (change.getRootNode().dataBefore() == null && change.getRootNode().dataAfter() != null) {
- LOG.info("New link in openroadm topology");
- Link link = change.getRootNode().dataAfter();
- // Todo: XPDR links are unidirectional, therefore we need to check for the current one and
- // the opposite one. But first check the type
- Link1 link1 = link.augmentation(Link1.class);
- if (link1 == null) {
- LOG.error("No type in link. We cannot trigger the TAPI link creation");
- return;
- }
- if (!(link1.getLinkType().equals(OpenroadmLinkType.XPONDERINPUT)
- || link1.getLinkType().equals(OpenroadmLinkType.XPONDEROUTPUT))) {
- LOG.warn("Not triggering creation of link for type = {}", link1.getLinkType().getName());
- return;
- }
- if (!oppositeLinkExists(link1.getOppositeLink())) {
- LOG.warn("Opposite link doest exist. Not creating TAPI link");
- return;
- }
- LOG.info("Opposite link already in datastore. Creatin TAPI bidirectional link");
- String srcNode = getRoadmOrXpdr(link.getSource().getSourceNode().getValue());
- String srcTp = link.getSource().getSourceTp().getValue();
- String destNode = getRoadmOrXpdr(link.getDestination().getDestNode().getValue());
- String destTp = link.getDestination().getDestTp().getValue();
- putTapiLinkInTopology(this.tapiLink.createTapiLink(srcNode, srcTp, destNode, destTp,
- TapiStringConstants.OMS_XPDR_RDM_LINK, getQual(srcNode), getQual(destNode),
- TapiStringConstants.PHTNC_MEDIA_OTS, TapiStringConstants.PHTNC_MEDIA_OTS,
- link1.getAdministrativeState().getName(), link1.getOperationalState().getName(),
- Set.of(LayerProtocolName.PHOTONICMEDIA), Set.of(LayerProtocolName.PHOTONICMEDIA.getName()),
- tapiTopoUuid));