X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=tapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Ftapi%2Ftopology%2FConvertORTopoToTapiTopo.java;h=ad6106b07a037b7132e54e98149aa6e8bfae7ca6;hb=02120b6f30aece5acfa0fba69419c6b65f0f1659;hp=2e8c183bdba18f596105327372ec5397b6a78e35;hpb=60be2f9eca6d48db9efd1db876d846c60fddc2b6;p=transportpce.git diff --git a/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToTapiTopo.java b/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToTapiTopo.java index 2e8c183bd..ad6106b07 100644 --- a/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToTapiTopo.java +++ b/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToTapiTopo.java @@ -11,25 +11,35 @@ import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.Set; import java.util.UUID; import java.util.stream.Collectors; -import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev181130.TerminationPoint1; -import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev181130.xpdr.odu.switching.pools.OduSwitchingPools; -import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev181130.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingList; -import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev181130.OpenroadmTpType; -import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev181130.xpdr.tp.supported.interfaces.SupportedInterfaceCapability; -import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev181130.Link1; -import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev181130.Node1; +import org.opendaylight.transportpce.tapi.TapiStringConstants; +import org.opendaylight.transportpce.tapi.utils.TapiLink; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.TerminationPoint1; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State; +import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates; +import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev200327.xpdr.odu.switching.pools.OduSwitchingPools; +import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev200327.xpdr.odu.switching.pools.OduSwitchingPoolsBuilder; +import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev200327.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingList; +import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev200327.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingListBuilder; +import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev200327.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingListKey; +import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.OpenroadmNodeType; +import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.OpenroadmTpType; +import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.xpdr.tp.supported.interfaces.SupportedInterfaceCapability; +import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev200529.Node1; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.TpId; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.node.TerminationPoint; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.AdministrativeState; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.CapacityUnit; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.ForwardingDirection; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LAYERPROTOCOLQUALIFIER; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LayerProtocolName; @@ -40,14 +50,12 @@ import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Port import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.TerminationDirection; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.TerminationState; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Uuid; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.capacity.TotalSizeBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.capacity.pac.AvailableCapacityBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.capacity.pac.TotalPotentialCapacityBuilder; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.Name; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameBuilder; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameKey; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE100GigE; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.dsr.rev181210.DIGITALSIGNALTYPE10GigELAN; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU2E; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.odu.rev181210.ODUTYPEODU4; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.photonic.media.rev181210.PHOTONICLAYERQUALIFIEROMS; @@ -74,20 +82,18 @@ import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.to import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.LinkKey; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeBuilder; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey; -import org.opendaylight.yangtools.yang.common.Uint64; +import org.opendaylight.yangtools.yang.common.Uint16; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class ConvertORTopoToTapiTopo { - private static final String DSR = "DSR"; - private static final String OTSI = "OTSi"; - private static final String E_OTSI = "eOTSi"; - private static final String I_OTSI = "iOTSi"; - private static final String RDM_INFRA = "ROADM-infra"; private static final Logger LOG = LoggerFactory.getLogger(ConvertORTopoToTapiTopo.class); private String ietfNodeId; + private OpenroadmNodeType ietfNodeType; + private AdminStates ietfNodeAdminState; + private State ietfNodeOperState; private List oorClientPortList; private List oorNetworkPortList; private OduSwitchingPools oorOduSwitchingPool; @@ -96,40 +102,69 @@ public class ConvertORTopoToTapiTopo { tapiNodes; private Map tapiLinks; private Map uuidMap; + private final TapiLink tapiLink; - public ConvertORTopoToTapiTopo(Uuid tapiTopoUuid) { + public ConvertORTopoToTapiTopo(Uuid tapiTopoUuid, TapiLink tapiLink) { this.tapiTopoUuid = tapiTopoUuid; this.tapiNodes = new HashMap<>(); this.tapiLinks = new HashMap<>(); this.uuidMap = new HashMap<>(); + this.tapiLink = tapiLink; } public void convertNode(Node ietfNode, List networkPorts) { this.ietfNodeId = ietfNode.getNodeId().getValue(); - this.oorClientPortList = ietfNode.augmentation( - org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class) - .getTerminationPoint().values().stream() - .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue() - == OpenroadmTpType.XPONDERCLIENT.getIntValue()) - .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue())) - .collect(Collectors.toList()); + if (ietfNode.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Node1.class) + == null) { + return; + } + this.ietfNodeType = ietfNode.augmentation( + org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Node1.class).getNodeType(); + this.ietfNodeAdminState = ietfNode.augmentation( + org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Node1.class) + .getAdministrativeState(); + this.ietfNodeOperState = ietfNode.augmentation( + org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Node1.class) + .getOperationalState(); this.oorNetworkPortList = ietfNode.augmentation( - org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class) + org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class) .getTerminationPoint().values().stream() .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue() - == OpenroadmTpType.XPONDERNETWORK.getIntValue() - && networkPorts.contains(tp.getTpId().getValue())) + == OpenroadmTpType.XPONDERNETWORK.getIntValue() + && networkPorts.contains(tp.getTpId().getValue())) .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue())) .collect(Collectors.toList()); - this.oorOduSwitchingPool = ietfNode.augmentation(Node1.class).getSwitchingPools().getOduSwitchingPools() - .values().stream().findFirst().get(); + if (!OpenroadmNodeType.TPDR.equals(this.ietfNodeType)) { + this.oorOduSwitchingPool = ietfNode.augmentation(Node1.class).getSwitchingPools().getOduSwitchingPools() + .values().stream().findFirst().get(); + this.oorClientPortList = ietfNode.augmentation( + org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class) + .getTerminationPoint().values().stream() + .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue() + == OpenroadmTpType.XPONDERCLIENT.getIntValue()) + .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue())) + .collect(Collectors.toList()); + } else { + this.oorOduSwitchingPool = createOduSwitchingPoolForTp100G(); + List tpList = this.oorOduSwitchingPool.getNonBlockingList().values().stream() + .flatMap(nbl -> nbl.getTpList().stream()) + .collect(Collectors.toList()); + this.oorClientPortList = ietfNode.augmentation( + org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Node1.class) + .getTerminationPoint().values().stream() + .filter(tp -> tp.augmentation(TerminationPoint1.class).getTpType().getIntValue() + == OpenroadmTpType.XPONDERCLIENT.getIntValue() && tpList.contains(tp.getTpId())) + .sorted((tp1, tp2) -> tp1.getTpId().getValue().compareTo(tp2.getTpId().getValue())) + .collect(Collectors.toList()); + this.oorClientPortList.forEach(tp -> LOG.info("tp = {}", tp.getTpId())); + } // node creation [DSR/ODU] - LOG.info("creation of a DSR/ODU node"); - Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId, DSR)) - .getBytes(Charset.forName("UTF-8"))).toString()); - this.uuidMap.put(String.join("+", this.ietfNodeId, DSR), nodeUuid); + LOG.info("creation of a DSR/ODU node for {}", this.ietfNodeId); + Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId, + TapiStringConstants.DSR)).getBytes(Charset.forName("UTF-8"))).toString()); + this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.DSR), nodeUuid); Name nameDsr = new NameBuilder().setValueName("dsr/odu node name").setValue(this.ietfNodeId).build(); List dsrLayerProtocols = Arrays.asList(LayerProtocolName.DSR, LayerProtocolName.ODU); org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology @@ -137,10 +172,10 @@ public class ConvertORTopoToTapiTopo { tapiNodes.put(dsrNode.key(), dsrNode); // node creation [otsi] - LOG.info("creation of an OTSi node"); - nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId, OTSI)) + LOG.info("creation of an OTSi node for {}", this.ietfNodeId); + nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId, TapiStringConstants.OTSI)) .getBytes(Charset.forName("UTF-8"))).toString()); - this.uuidMap.put(String.join("+", this.ietfNodeId, OTSI), nodeUuid); + this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.OTSI), nodeUuid); Name nameOtsi = new NameBuilder().setValueName("otsi node name").setValue(this.ietfNodeId).build(); List otsiLayerProtocols = Arrays.asList(LayerProtocolName.PHOTONICMEDIA); org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology @@ -152,27 +187,68 @@ public class ConvertORTopoToTapiTopo { createTapiTransitionalLinks(); } - public void convertLinks(List - - otnLinkList) { + public void convertLinks(Map< + org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network + .LinkKey, + org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network + .Link> otnLinkMap) { + List otnLinkList = new ArrayList<>(otnLinkMap.values()); + Collections.sort(otnLinkList, (l1, l2) -> l1.getLinkId().getValue() + .compareTo(l2.getLinkId().getValue())); List linksToNotConvert = new ArrayList<>(); - LOG.info("creation of {} otn links", otnLinkList.size() / 2); + LOG.info("creation of {} otn links", otnLinkMap.size() / 2); for (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network - .Link link : otnLinkList) { - if (!linksToNotConvert.contains(link.getLinkId().getValue())) { - Link tapiLink = createTapiLink(link); - linksToNotConvert.add(link - .augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev181130.Link1.class) - .getOppositeLink().getValue()); - tapiLinks.put(tapiLink.key(), tapiLink); + .Link otnlink : otnLinkList) { + if (!linksToNotConvert.contains(otnlink.getLinkId().getValue())) { + org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks + .network.Link oppositeLink = otnLinkMap.get(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns + .yang.ietf.network.topology.rev180226.networks.network.LinkKey(otnlink.augmentation(Link1.class) + .getOppositeLink())); + + AdminStates oppLnkAdmState = null; + State oppLnkOpState = null; + String oppositeLinkId = null; + if (oppositeLink != null) { + oppLnkAdmState = oppositeLink.augmentation(Link1.class).getAdministrativeState(); + oppLnkOpState = oppositeLink.augmentation(Link1.class).getOperationalState(); + oppositeLinkId = oppositeLink.getLinkId().getValue(); + } + String adminState = + otnlink.augmentation(Link1.class).getAdministrativeState() == null + || oppLnkAdmState == null + ? null + : this.tapiLink.setTapiAdminState( + otnlink.augmentation(Link1.class).getAdministrativeState(), oppLnkAdmState).getName(); + String operState = otnlink.augmentation(Link1.class).getOperationalState() == null + || oppLnkOpState == null + ? null + : this.tapiLink.setTapiOperationalState( + otnlink.augmentation(Link1.class).getOperationalState(), oppLnkOpState).getName(); + + String prefix = otnlink.getLinkId().getValue().split("-")[0]; + String nodesQual = prefix.equals("OTU4") ? TapiStringConstants.OTSI : TapiStringConstants.DSR; + String tpsQual = prefix.equals("OTU4") ? TapiStringConstants.I_OTSI : TapiStringConstants.E_ODU; + LayerProtocolName layerProtocolName = prefix.equals("OTU4") ? LayerProtocolName.PHOTONICMEDIA + : LayerProtocolName.ODU; + + Link tapLink = this.tapiLink.createTapiLink(otnlink.getSource().getSourceNode().getValue(), + otnlink.getSource().getSourceTp().getValue(), otnlink.getDestination().getDestNode().getValue(), + otnlink.getDestination().getDestTp().getValue(), TapiStringConstants.OTN_XPDR_XPDR_LINK, nodesQual, + nodesQual, tpsQual, tpsQual, adminState, operState, List.of(layerProtocolName), + List.of(layerProtocolName.getName()), this.tapiTopoUuid); + linksToNotConvert.add(oppositeLinkId); + tapiLinks.put(tapLink.key(), tapLink); } } } public void convertRoadmInfrastructure() { LOG.info("abstraction of the ROADM infrastructure towards a photonic node"); - Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes(RDM_INFRA.getBytes(Charset.forName("UTF-8"))).toString()); - Name nodeName = new NameBuilder().setValueName("otsi node name").setValue(RDM_INFRA).build(); + Uuid nodeUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.RDM_INFRA + .getBytes(Charset.forName("UTF-8"))).toString()); + Name nodeName = new NameBuilder().setValueName("otsi node name").setValue(TapiStringConstants.RDM_INFRA) + .build(); List nodeLayerProtocols = Arrays.asList(LayerProtocolName.PHOTONICMEDIA); List tapiPhotonicNodes @@ -205,8 +281,32 @@ public class ConvertORTopoToTapiTopo { } } + private OduSwitchingPools createOduSwitchingPoolForTp100G() { + Map nblMap = new HashMap<>(); + int count = 1; + for (TerminationPoint tp : this.oorNetworkPortList) { + TpId tpid1 = tp.getTpId(); + TpId tpid2 = new TpId(tp.augmentation( + org.opendaylight.yang.gen.v1.http.transportpce.topology.rev210511.TerminationPoint1.class) + .getAssociatedConnectionMapPort()); + List tpList = new ArrayList<>(); + tpList.add(tpid1); + tpList.add(tpid2); + NonBlockingList nbl = new NonBlockingListBuilder() + .setNblNumber(Uint16.valueOf(count)) + .setTpList(tpList) + .build(); + nblMap.put(nbl.key(), nbl); + count++; + } + return new OduSwitchingPoolsBuilder() + .setNonBlockingList(nblMap) + .setSwitchingPoolNumber(Uint16.valueOf(1)) + .build(); + } + private List - pruneTapiPhotonicNodes() { + pruneTapiPhotonicNodes() { List prunedTapiPhotonicNodes = new ArrayList<>(); List tapiPhotonicNodes @@ -214,12 +314,11 @@ public class ConvertORTopoToTapiTopo { .filter(n -> LayerProtocolName.PHOTONICMEDIA.equals(n.getLayerProtocolName().get(0))) .collect(Collectors.toList()); for (org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node node - : tapiPhotonicNodes) { + : tapiPhotonicNodes) { Map onepM = new HashMap<>(); for (Map.Entry entry : node.getOwnedNodeEdgePoint().entrySet()) { if (entry.getValue().getName().values().stream() - .filter(name -> name.getValueName().startsWith("eNodeEdgePoint")) - .count() > 0) { + .filter(name -> name.getValueName().startsWith("eNodeEdgePoint")).count() > 0) { onepM.put(entry.getKey(), entry.getValue()); } } @@ -231,7 +330,7 @@ public class ConvertORTopoToTapiTopo { } private Map convertListNodeWithListNepToMapForUuidAndName( - List nodes) { + List nodes) { Map uuidNameMap = new HashMap<>(); for (org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node node : nodes) { for (OwnedNodeEdgePoint nep : node.nonnullOwnedNodeEdgePoint().values()) { @@ -246,8 +345,8 @@ public class ConvertORTopoToTapiTopo { return uuidNameMap; } - private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology - .Node createTapiNode(Map nodeNames, List layerProtocols) { + private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node + createTapiNode(Map nodeNames, List layerProtocols) { Uuid nodeUuid = null; Map onepl = new HashMap<>(); Map nodeRuleGroupList = new HashMap<>(); @@ -267,55 +366,55 @@ public class ConvertORTopoToTapiTopo { .getValueName(), nodeNames.get(nodeNames.keySet().iterator().next()).getValue()); } return new NodeBuilder() - .setUuid(nodeUuid) - .setName(nodeNames) - .setLayerProtocolName(layerProtocols) - .setAdministrativeState(AdministrativeState.UNLOCKED) - .setOperationalState(OperationalState.ENABLED) - .setLifecycleState(LifecycleState.INSTALLED) - .setOwnedNodeEdgePoint(onepl) - .setNodeRuleGroup(nodeRuleGroupList) - .build(); + .setUuid(nodeUuid) + .setName(nodeNames) + .setLayerProtocolName(layerProtocols) + .setAdministrativeState(this.tapiLink.setTapiAdminState(this.ietfNodeAdminState.getName())) + .setOperationalState(this.tapiLink.setTapiOperationalState(this.ietfNodeOperState.getName())) + .setLifecycleState(LifecycleState.INSTALLED) + .setOwnedNodeEdgePoint(onepl) + .setNodeRuleGroup(nodeRuleGroupList) + .build(); } private Uuid getNodeUuid4Photonic(Map onepl, - Map nodeRuleGroupList, Map ruleList) { + Map nodeRuleGroupList, Map ruleList) { Uuid nodeUuid; - nodeUuid = this.uuidMap.get(String.join("+", this.ietfNodeId, OTSI)); + nodeUuid = this.uuidMap.get(String.join("+", this.ietfNodeId, TapiStringConstants.OTSI)); // iNep creation on otsi node for (int i = 0; i < oorNetworkPortList.size(); i++) { Uuid nepUuid1 = new Uuid(UUID.nameUUIDFromBytes( - (String.join("+", this.ietfNodeId, I_OTSI, oorNetworkPortList.get(i).getTpId().getValue())) - .getBytes(Charset.forName("UTF-8"))) + (String.join("+", this.ietfNodeId, TapiStringConstants.I_OTSI, + oorNetworkPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8"))) .toString()); - this.uuidMap.put(String.join("+", this.ietfNodeId, I_OTSI, oorNetworkPortList.get(i).getTpId().getValue()), - nepUuid1); + this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.I_OTSI, + oorNetworkPortList.get(i).getTpId().getValue()), nepUuid1); Name onedName = new NameBuilder() - .setValueName(new StringBuilder("iNodeEdgePoint_").append(i + 1).toString()) + .setValueName("iNodeEdgePoint") .setValue(oorNetworkPortList.get(i).getTpId().getValue()) .build(); OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA, true, - String.join("+", this.ietfNodeId, I_OTSI)); + String.join("+", this.ietfNodeId, TapiStringConstants.I_OTSI)); onepl.put(onep.key(), onep); } // eNep creation on otsi node for (int i = 0; i < oorNetworkPortList.size(); i++) { Uuid nepUuid2 = new Uuid(UUID.nameUUIDFromBytes( - (String.join("+", this.ietfNodeId, E_OTSI, oorNetworkPortList.get(i).getTpId().getValue())) - .getBytes(Charset.forName("UTF-8"))) + (String.join("+", this.ietfNodeId, TapiStringConstants.E_OTSI, + oorNetworkPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8"))) .toString()); - this.uuidMap.put(String.join("+", this.ietfNodeId, E_OTSI, oorNetworkPortList.get(i).getTpId().getValue()), - nepUuid2); + this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.E_OTSI, + oorNetworkPortList.get(i).getTpId().getValue()), nepUuid2); Name onedName = new NameBuilder() - .setValueName(new StringBuilder("eNodeEdgePoint_").append(i + 1).toString()) + .setValueName("eNodeEdgePoint") .setValue(oorNetworkPortList.get(i).getTpId().getValue()) .build(); OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName), LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.PHOTONICMEDIA, true, - String.join("+", this.ietfNodeId, E_OTSI)); + String.join("+", this.ietfNodeId, TapiStringConstants.E_OTSI)); onepl.put(onep.key(), onep); } // create NodeRuleGroup @@ -328,24 +427,25 @@ public class ConvertORTopoToTapiTopo { .NodeEdgePoint inep = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210 .node.rule.group.NodeEdgePointBuilder() .setTopologyUuid(tapiTopoUuid) - .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, OTSI))) + .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, TapiStringConstants.OTSI))) .setNodeEdgePointUuid( - this.uuidMap.get(String.join("+", this.ietfNodeId, I_OTSI, tp.getTpId().getValue()))) - .build(); + this.uuidMap.get(String.join("+", this.ietfNodeId, TapiStringConstants.I_OTSI, + tp.getTpId().getValue()))).build(); org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group .NodeEdgePoint enep = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210 .node.rule.group.NodeEdgePointBuilder() .setTopologyUuid(tapiTopoUuid) - .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, OTSI))) + .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, TapiStringConstants.OTSI))) .setNodeEdgePointUuid( - this.uuidMap.get(String.join("+", this.ietfNodeId, E_OTSI, tp.getTpId().getValue()))) + this.uuidMap.get(String.join("+", this.ietfNodeId, TapiStringConstants.E_OTSI, + tp.getTpId().getValue()))) .build(); nepList.put(inep.key(), inep); nepList.put(enep.key(), enep); NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder() .setUuid(new Uuid( - UUID.nameUUIDFromBytes(("otsi node rule group " + count).getBytes(Charset.forName("UTF-8"))) - .toString())) + UUID.nameUUIDFromBytes(("otsi node rule group " + count).getBytes(Charset.forName("UTF-8"))) + .toString())) .setRule(ruleList) .setNodeEdgePoint(nepList) .build(); @@ -356,63 +456,72 @@ public class ConvertORTopoToTapiTopo { } private Uuid getNodeUuid4Dsr(Map onepl, - Map nodeRuleGroupList, Map ruleList) { + Map nodeRuleGroupList, Map ruleList) { Uuid nodeUuid; - nodeUuid = this.uuidMap.get(String.join("+", this.ietfNodeId, DSR)); + nodeUuid = this.uuidMap.get(String.join("+", this.ietfNodeId, TapiStringConstants.DSR)); // client nep creation on DSR/ODU node for (int i = 0; i < oorClientPortList.size(); i++) { Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes( - (String.join("+", this.ietfNodeId, DSR, oorClientPortList.get(i).getTpId().getValue())) - .getBytes(Charset.forName("UTF-8"))).toString()); - this.uuidMap.put(String.join("+", this.ietfNodeId, DSR, oorClientPortList.get(i).getTpId().getValue()), - nepUuid); - Name name = new NameBuilder() - .setValueName(new StringBuilder("NodeEdgePoint_C").append(i + 1).toString()) - .setValue(oorClientPortList.get(i).getTpId().getValue()) - .build(); + (String.join("+", this.ietfNodeId, TapiStringConstants.DSR, + oorClientPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString()); + this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.DSR, + oorClientPortList.get(i).getTpId().getValue()), nepUuid); + NameBuilder nameBldr = new NameBuilder().setValue(oorClientPortList.get(i).getTpId().getValue()); + Name name; + if (OpenroadmNodeType.TPDR.equals(this.ietfNodeType)) { + name = nameBldr.setValueName("100G-tpdr").build(); + } else { + name = nameBldr.setValueName("NodeEdgePoint_C").build(); + } OwnedNodeEdgePoint onep = createNep(oorClientPortList.get(i), Map.of(name.key(), name), - LayerProtocolName.ETH, LayerProtocolName.DSR, true, String.join("+", this.ietfNodeId, DSR)); + LayerProtocolName.ETH, LayerProtocolName.DSR, true, String.join("+", this.ietfNodeId, + TapiStringConstants.DSR)); onepl.put(onep.key(), onep); } // network nep creation on DSR/ODU node for (int i = 0; i < oorNetworkPortList.size(); i++) { Uuid nepUuid = new Uuid(UUID.nameUUIDFromBytes( - (String.join("+", this.ietfNodeId, DSR, oorNetworkPortList.get(i).getTpId().getValue())) - .getBytes(Charset.forName("UTF-8"))).toString()); - this.uuidMap.put(String.join("+", this.ietfNodeId, DSR, oorNetworkPortList.get(i).getTpId().getValue()), - nepUuid); + (String.join("+", this.ietfNodeId, TapiStringConstants.DSR, + oorNetworkPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString()); + this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.DSR, + oorNetworkPortList.get(i).getTpId().getValue()), nepUuid); Name onedName = new NameBuilder() - .setValueName(new StringBuilder("NodeEdgePoint_N").append(i + 1).toString()) + .setValueName("NodeEdgePoint_N") .setValue(oorNetworkPortList.get(i).getTpId().getValue()) .build(); OwnedNodeEdgePoint onep = createNep(oorNetworkPortList.get(i), Map.of(onedName.key(), onedName), - LayerProtocolName.ODU, LayerProtocolName.DSR, true, String.join("+", this.ietfNodeId, DSR)); + LayerProtocolName.ODU, LayerProtocolName.DSR, true, String.join("+", this.ietfNodeId, + TapiStringConstants.DSR)); onepl.put(onep.key(), onep); } // create NodeRuleGroup int count = 1; - for (NonBlockingList nbl : this.oorOduSwitchingPool.getNonBlockingList().values()) { + for (NonBlockingList nbl : this.oorOduSwitchingPool.nonnullNonBlockingList().values()) { Map nepList = new HashMap<>(); for (TpId tp : nbl.getTpList()) { - if (this.uuidMap.containsKey(String.join("+", this.ietfNodeId, DSR, tp.getValue()))) { + if (this.uuidMap.containsKey(String.join("+", this.ietfNodeId, TapiStringConstants.DSR, + tp.getValue()))) { + org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint nep = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group .NodeEdgePointBuilder() .setTopologyUuid(tapiTopoUuid) - .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, DSR))) - .setNodeEdgePointUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, DSR, tp.getValue()))) + .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, + TapiStringConstants.DSR))) + .setNodeEdgePointUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, + TapiStringConstants.DSR, tp.getValue()))) .build(); nepList.put(nep.key(), nep); } } NodeRuleGroup nodeRuleGroup = new NodeRuleGroupBuilder() .setUuid(new Uuid( - UUID.nameUUIDFromBytes(("dsr node rule group " + count).getBytes(Charset.forName("UTF-8"))) - .toString())) + UUID.nameUUIDFromBytes(("dsr node rule group " + count).getBytes(Charset.forName("UTF-8"))) + .toString())) .setRule(ruleList) .setNodeEdgePoint(nepList) .build(); @@ -423,20 +532,31 @@ public class ConvertORTopoToTapiTopo { } private OwnedNodeEdgePoint createNep(TerminationPoint oorTp, Map nepNames, - LayerProtocolName nepProtocol, LayerProtocolName nodeProtocol, boolean withSip, String keyword) { + LayerProtocolName nepProtocol, LayerProtocolName nodeProtocol, boolean withSip, String keyword) { String key = String.join("+", keyword, oorTp.getTpId().getValue()); + AdministrativeState adminState = (oorTp.augmentation(TerminationPoint1.class).getAdministrativeState() != null) + ? this.tapiLink.setTapiAdminState(oorTp.augmentation(TerminationPoint1.class).getAdministrativeState() + .getName()) + : null; + OperationalState operState = (oorTp.augmentation(TerminationPoint1.class).getOperationalState() != null) + ? this.tapiLink.setTapiOperationalState(oorTp.augmentation(TerminationPoint1.class).getOperationalState() + .getName()) + : null; OwnedNodeEdgePointBuilder onepBldr = new OwnedNodeEdgePointBuilder() .setUuid(this.uuidMap.get(key)) .setLayerProtocolName(nepProtocol) - .setName(nepNames); + .setName(nepNames) + .setSupportedCepLayerProtocolQualifier(createSupportedCepLayerProtocolQualifier(oorTp, nodeProtocol)) + .setLinkPortDirection(PortDirection.BIDIRECTIONAL) + .setLinkPortRole(PortRole.SYMMETRIC) + .setAdministrativeState(adminState) + .setOperationalState(operState) + .setLifecycleState(LifecycleState.INSTALLED) + .setTerminationDirection(TerminationDirection.BIDIRECTIONAL) + .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL); if (withSip) { - onepBldr.setMappedServiceInterfacePoint(createSIP(1)); + onepBldr.setMappedServiceInterfacePoint(createSIP(1, oorTp, keyword)); } - onepBldr.setSupportedCepLayerProtocolQualifier(createSupportedCepLayerProtocolQualifier(oorTp, nodeProtocol)); - onepBldr.setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC) - .setAdministrativeState(AdministrativeState.UNLOCKED).setOperationalState(OperationalState.ENABLED) - .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL) - .setTerminationState(TerminationState.TERMINATEDBIDIRECTIONAL); return onepBldr.build(); } @@ -465,7 +585,7 @@ public class ConvertORTopoToTapiTopo { } private Map createNodeRuleGroupForRdmNode(Uuid nodeUuid, - Collection onepl) { + Collection onepl) { Map nepMap = new HashMap<>(); @@ -497,40 +617,62 @@ public class ConvertORTopoToTapiTopo { return nodeRuleGroupMap; } - private Map createSIP(int nb) { + private Map createSIP(int nb, TerminationPoint tp, + String nodeId) { Map msipl = new HashMap<>(); for (int i = 0; i < nb; i++) { MappedServiceInterfacePoint msip = new MappedServiceInterfacePointBuilder() - .setServiceInterfacePointUuid(new Uuid(UUID.randomUUID().toString())).build(); + .setServiceInterfacePointUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", "SIP", nodeId, + tp.getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString())) + .build(); msipl.put(msip.key(), msip); } return msipl; } private List> createSupportedCepLayerProtocolQualifier(TerminationPoint tp, - LayerProtocolName lpn) { - List> sclpqList = new ArrayList<>(); + LayerProtocolName lpn) { + Set> sclpqSet = new HashSet<>(); List sicList = new ArrayList<>( - tp.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm - .otn.network.topology.rev181130.TerminationPoint1.class).getTpSupportedInterfaces() - .getSupportedInterfaceCapability().values()); + tp.augmentation(org.opendaylight.yang.gen.v1.http + .org.openroadm.otn.network.topology.rev200529.TerminationPoint1.class).getTpSupportedInterfaces() + .getSupportedInterfaceCapability().values()); for (SupportedInterfaceCapability sic : sicList) { switch (lpn.getName()) { case "DSR": - if (sic.getIfCapType().getSimpleName().equals("If10GEODU2e")) { - sclpqList.add(DIGITALSIGNALTYPE10GigELAN.class); - sclpqList.add(ODUTYPEODU2E.class); - } else if (sic.getIfCapType().getSimpleName().equals("IfOCHOTU4ODU4")) { - sclpqList.add(ODUTYPEODU4.class); - } else if (sic.getIfCapType().getSimpleName().equals("If100GEODU4")) { - sclpqList.add(DIGITALSIGNALTYPE100GigE.class); - sclpqList.add(ODUTYPEODU4.class); + switch (sic.getIfCapType().getSimpleName()) { + case "If10GEODU2e": + sclpqSet.add(ODUTYPEODU2E.class); + sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class); + break; + case "If10GEODU2": + sclpqSet.add(ODUTYPEODU2.class); + sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class); + break; + case "If10GE": + sclpqSet.add(DIGITALSIGNALTYPE10GigELAN.class); + break; + case "If100GEODU4": + sclpqSet.add(DIGITALSIGNALTYPE100GigE.class); + sclpqSet.add(ODUTYPEODU4.class); + break; + case "If100GE": + sclpqSet.add(DIGITALSIGNALTYPE100GigE.class); + break; + case "IfOCHOTU4ODU4": + case "IfOCH": + sclpqSet.add(ODUTYPEODU4.class); + break; + default: + LOG.error("IfCapability type not managed"); + break; } break; case "PHOTONIC_MEDIA": - if (sic.getIfCapType().getSimpleName().equals("IfOCHOTU4ODU4")) { - sclpqList.add(PHOTONICLAYERQUALIFIEROTSi.class); - sclpqList.add(PHOTONICLAYERQUALIFIEROMS.class); + if (sic.getIfCapType().getSimpleName().equals("IfOCHOTU4ODU4") + || sic.getIfCapType().getSimpleName().equals("IfOCH")) { + sclpqSet.add(PHOTONICLAYERQUALIFIEROTSi.class); + sclpqSet.add(PHOTONICLAYERQUALIFIEROMS.class); } break; default: @@ -538,146 +680,22 @@ public class ConvertORTopoToTapiTopo { break; } } - return sclpqList; + return new ArrayList<>(sclpqSet); } private void createTapiTransitionalLinks() { for (TerminationPoint tp : this.oorNetworkPortList) { - Map nepList = new HashMap<>(); - String sourceKey = String.join("+", this.ietfNodeId, DSR, tp.getTpId().getValue()); - Uuid sourceUuidTp = this.uuidMap.get(sourceKey); - String destKey = String.join("+", this.ietfNodeId, I_OTSI, tp.getTpId().getValue()); - Uuid destUuidTp = this.uuidMap.get(destKey); - NodeEdgePoint sourceNep = new NodeEdgePointBuilder() - .setTopologyUuid(this.tapiTopoUuid) - .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, DSR))) - .setNodeEdgePointUuid(sourceUuidTp) - .build(); - nepList.put(sourceNep.key(), sourceNep); - NodeEdgePoint destNep = new NodeEdgePointBuilder() - .setTopologyUuid(this.tapiTopoUuid) - .setNodeUuid(this.uuidMap.get(String.join("+", this.ietfNodeId, OTSI))) - .setNodeEdgePointUuid(destUuidTp) - .build(); - nepList.put(destNep.key(), destNep); - Name linkName = new NameBuilder().setValueName("transitional link name") - .setValue(String.join("--", this.ietfNodeId, sourceKey, destKey)) - .build(); - Link transiLink = new LinkBuilder() - .setUuid(new Uuid( - UUID.nameUUIDFromBytes((String.join("--", this.ietfNodeId, sourceKey, destKey)) - .getBytes(Charset.forName("UTF-8"))) - .toString())) - .setName(Map.of(linkName.key(), linkName)) - .setTransitionedLayerProtocolName(Arrays.asList(LayerProtocolName.ODU.getName(), - LayerProtocolName.PHOTONICMEDIA.getName())) - .setNodeEdgePoint(nepList) - .setDirection(ForwardingDirection.BIDIRECTIONAL) - .setAvailableCapacity(new AvailableCapacityBuilder().setTotalSize( - new TotalSizeBuilder().setUnit(CapacityUnit.GBPS).setValue(Uint64.valueOf(100)).build()).build()) - .build(); + Link transiLink = tapiLink.createTapiLink(this.ietfNodeId, tp.getTpId().getValue(), this.ietfNodeId, + tp.getTpId().getValue(), TapiStringConstants.TRANSITIONAL_LINK, TapiStringConstants.DSR, + TapiStringConstants.OTSI, TapiStringConstants.DSR, TapiStringConstants.I_OTSI, + "inService", "inService", Arrays.asList(LayerProtocolName.ODU, + LayerProtocolName.PHOTONICMEDIA), + Arrays.asList(LayerProtocolName.ODU.getName(), LayerProtocolName.PHOTONICMEDIA.getName()), + this.tapiTopoUuid); this.tapiLinks.put(transiLink.key(), transiLink); } } - private Link createTapiLink(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226 - .networks.network.Link link) { - String prefix = link.getLinkId().getValue().split("-")[0]; - String sourceNode = link.getSource().getSourceNode().getValue(); - String sourceTp = link.getSource().getSourceTp().toString(); - String destNode = link.getDestination().getDestNode().getValue(); - String destTp = link.getDestination().getDestTp().toString(); - Map nepList = new HashMap<>(); - Uuid sourceUuidTp; - Uuid sourceUuidNode; - Uuid destUuidTp; - Uuid destUuidNode; - Name linkName; - switch (prefix) { - case "OTU4": - sourceUuidTp = this.uuidMap.get(String.join("+", sourceNode, I_OTSI, sourceTp)); - sourceUuidNode = this.uuidMap.get(String.join("+", sourceNode, OTSI)); - NodeEdgePoint sourceNep = new NodeEdgePointBuilder() - .setTopologyUuid(this.tapiTopoUuid) - .setNodeUuid(sourceUuidNode) - .setNodeEdgePointUuid(sourceUuidTp) - .build(); - nepList.put(sourceNep.key(), sourceNep); - destUuidTp = this.uuidMap.get(String.join("+", destNode, I_OTSI, destTp)); - destUuidNode = this.uuidMap.get(String.join("+", destNode, OTSI)); - NodeEdgePoint destNep = new NodeEdgePointBuilder() - .setTopologyUuid(this.tapiTopoUuid) - .setNodeUuid(destUuidNode) - .setNodeEdgePointUuid(destUuidTp) - .build(); - nepList.put(destNep.key(), destNep); - linkName = new NameBuilder().setValueName("otn link name") - .setValue(link.getLinkId().getValue()) - .build(); - return new LinkBuilder() - .setUuid(new Uuid( - UUID.nameUUIDFromBytes((link.getLinkId().getValue()) - .getBytes(Charset.forName("UTF-8"))) - .toString())) - .setName(Map.of(linkName.key(), linkName)) - .setLayerProtocolName(Arrays.asList(LayerProtocolName.PHOTONICMEDIA)) - .setAdministrativeState(AdministrativeState.UNLOCKED) - .setOperationalState(OperationalState.ENABLED) - .setDirection(ForwardingDirection.BIDIRECTIONAL) - .setNodeEdgePoint(nepList) - .setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().setTotalSize( - new TotalSizeBuilder().setUnit(CapacityUnit.GBPS) - .setValue(Uint64.valueOf(100)).build()).build()) - .setAvailableCapacity(new AvailableCapacityBuilder().setTotalSize( - new TotalSizeBuilder().setUnit(CapacityUnit.MBPS) - .setValue(Uint64.valueOf(link.augmentation(Link1.class).getAvailableBandwidth())).build()) - .build()) - .build(); - case "ODU4": - sourceUuidTp = this.uuidMap.get(String.join("+", sourceNode, DSR, sourceTp)); - sourceUuidNode = this.uuidMap.get(String.join("+", sourceNode, DSR)); - NodeEdgePoint sourceNep2 = new NodeEdgePointBuilder() - .setTopologyUuid(this.tapiTopoUuid) - .setNodeUuid(sourceUuidNode) - .setNodeEdgePointUuid(sourceUuidTp) - .build(); - nepList.put(sourceNep2.key(), sourceNep2); - destUuidTp = this.uuidMap.get(String.join("+", destNode, DSR, destTp)); - destUuidNode = this.uuidMap.get(String.join("+", destNode, DSR)); - NodeEdgePoint destNep2 = new NodeEdgePointBuilder() - .setTopologyUuid(this.tapiTopoUuid) - .setNodeUuid(destUuidNode) - .setNodeEdgePointUuid(destUuidTp) - .build(); - nepList.put(destNep2.key(), destNep2); - linkName = new NameBuilder().setValueName("otn link name") - .setValue(link.getLinkId().getValue()) - .build(); - return new LinkBuilder() - .setUuid(new Uuid( - UUID.nameUUIDFromBytes((link.getLinkId().getValue()) - .getBytes(Charset.forName("UTF-8"))) - .toString())) - .setName(Map.of(linkName.key(), linkName)) - .setLayerProtocolName(Arrays.asList(LayerProtocolName.ODU)) - .setAdministrativeState(AdministrativeState.UNLOCKED) - .setOperationalState(OperationalState.ENABLED) - .setDirection(ForwardingDirection.BIDIRECTIONAL) - .setNodeEdgePoint(nepList) - .setTotalPotentialCapacity(new TotalPotentialCapacityBuilder().setTotalSize( - new TotalSizeBuilder().setUnit(CapacityUnit.GBPS) - .setValue(Uint64.valueOf(100)).build()).build()) - .setAvailableCapacity(new AvailableCapacityBuilder().setTotalSize( - new TotalSizeBuilder().setUnit(CapacityUnit.MBPS) - .setValue(Uint64.valueOf(link.augmentation(Link1.class).getAvailableBandwidth())).build()) - .build()) - .build(); - default: - LOG.error("OTN link of type {} not managed yet", prefix); - return null; - } - } - private void createTapiOmsLinks(Map photonicNepUuisMap, Map rdmInfraNepUuisMap) { Iterator> it1 = photonicNepUuisMap.entrySet().iterator(); Iterator> it2 = rdmInfraNepUuisMap.entrySet().iterator(); @@ -706,9 +724,9 @@ public class ConvertORTopoToTapiTopo { .build(); Link omsLink = new LinkBuilder() .setUuid(new Uuid( - UUID.nameUUIDFromBytes((String.join(" and ", photonicEntry.getValue(), rdmEntry.getValue())) - .getBytes(Charset.forName("UTF-8"))) - .toString())) + UUID.nameUUIDFromBytes((String.join(" and ", photonicEntry.getValue(), rdmEntry.getValue())) + .getBytes(Charset.forName("UTF-8"))) + .toString())) .setName(Map.of(linkName.key(), linkName)) .setLayerProtocolName(List.of(LayerProtocolName.PHOTONICMEDIA)) .setNodeEdgePoint(nepMap) @@ -719,7 +737,7 @@ public class ConvertORTopoToTapiTopo { } public Map - getTapiNodes() { + getTapiNodes() { return tapiNodes; }