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=aab9df4b0d1b5435e5142d39ba74cf9c57b6c2cf;hb=56d1795b647693ec1d620d6aca2c4003e3b302ca;hp=2d999780ad98e685454e666993168a1ac5a2e2ea;hpb=6bb5391db7481775991661ae582ad9a3f6de1a77;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 2d999780a..aab9df4b0 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 @@ -9,8 +9,8 @@ package org.opendaylight.transportpce.tapi.topology; 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; @@ -20,22 +20,25 @@ 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.rev200529.TerminationPoint1; -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.Link1; -import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev200529.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.rev211210.Link1; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.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.rev201211.xpdr.odu.switching.pools.OduSwitchingPools; +import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev201211.xpdr.odu.switching.pools.OduSwitchingPoolsBuilder; +import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev201211.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingList; +import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev201211.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingListBuilder; +import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev201211.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingListKey; +import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev211210.OpenroadmNodeType; +import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev211210.OpenroadmTpType; +import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev211210.xpdr.tp.supported.interfaces.SupportedInterfaceCapability; +import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210.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; @@ -46,9 +49,6 @@ 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; @@ -82,21 +82,17 @@ 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.NodeBuilder; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey; import org.opendaylight.yangtools.yang.common.Uint16; -import org.opendaylight.yangtools.yang.common.Uint64; 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; @@ -105,29 +101,37 @@ 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(); - if (ietfNode.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Node1.class) - == null) { + if (ietfNode.augmentation(org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.Node1.class) + == null) { return; } this.ietfNodeType = ietfNode.augmentation( - org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Node1.class).getNodeType(); + org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.Node1.class).getNodeType(); + this.ietfNodeAdminState = ietfNode.augmentation( + org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.Node1.class) + .getAdministrativeState(); + this.ietfNodeOperState = ietfNode.augmentation( + org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.Node1.class) + .getOperationalState(); this.oorNetworkPortList = 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.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()); if (!OpenroadmNodeType.TPDR.equals(this.ietfNodeType)) { @@ -135,11 +139,11 @@ public class ConvertORTopoToTapiTopo { .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()); + .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() @@ -157,24 +161,30 @@ public class ConvertORTopoToTapiTopo { // node creation [DSR/ODU] LOG.info("creation of a DSR/ODU node for {}", this.ietfNodeId); - 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); - Name nameDsr = new NameBuilder().setValueName("dsr/odu node name").setValue(this.ietfNodeId).build(); - List dsrLayerProtocols = Arrays.asList(LayerProtocolName.DSR, LayerProtocolName.ODU); + 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(String.join("+", this.ietfNodeId, TapiStringConstants.DSR)).build(); + Name nameNodeType = new NameBuilder().setValueName("Node Type") + .setValue(this.ietfNodeType.getName()).build(); + Set dsrLayerProtocols = Set.of(LayerProtocolName.DSR, LayerProtocolName.ODU); org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology - .Node dsrNode = createTapiNode(Map.of(nameDsr.key(), nameDsr), dsrLayerProtocols); + .Node dsrNode = createTapiNode(Map.of(nameDsr.key(), nameDsr, nameNodeType.key(), nameNodeType), + dsrLayerProtocols); tapiNodes.put(dsrNode.key(), dsrNode); // node creation [otsi] LOG.info("creation of an OTSi node for {}", this.ietfNodeId); - nodeUuid = new Uuid(UUID.nameUUIDFromBytes((String.join("+", this.ietfNodeId, OTSI)) + 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); - Name nameOtsi = new NameBuilder().setValueName("otsi node name").setValue(this.ietfNodeId).build(); - List otsiLayerProtocols = Arrays.asList(LayerProtocolName.PHOTONICMEDIA); + this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.OTSI), nodeUuid); + Name nameOtsi = new NameBuilder().setValueName("otsi node name") + .setValue(String.join("+", this.ietfNodeId, TapiStringConstants.OTSI)).build(); + Set otsiLayerProtocols = Set.of(LayerProtocolName.PHOTONICMEDIA); org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology - .Node otsiNode = createTapiNode(Map.of(nameOtsi.key(), nameOtsi), otsiLayerProtocols); + .Node otsiNode = createTapiNode(Map.of(nameOtsi.key(), nameOtsi, nameNodeType.key(), nameNodeType), + otsiLayerProtocols); tapiNodes.put(otsiNode.key(), otsiNode); // transitional link cration between network nep of DSR/ODU node and iNep of otsi node @@ -182,28 +192,71 @@ 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.rev200529.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, Set.of(layerProtocolName), + Set.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(); - List nodeLayerProtocols = Arrays.asList(LayerProtocolName.PHOTONICMEDIA); + 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(); + Name nameNodeType = new NameBuilder().setValueName("Node Type") + .setValue(OpenroadmNodeType.ROADM.getName()).build(); + Set nodeLayerProtocols = Set.of(LayerProtocolName.PHOTONICMEDIA); List tapiPhotonicNodes = pruneTapiPhotonicNodes(); @@ -216,7 +269,7 @@ public class ConvertORTopoToTapiTopo { // build RDM infra node abstraction org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node rdmNode = new NodeBuilder() .setUuid(nodeUuid) - .setName(Map.of(nodeName.key(), nodeName)) + .setName(Map.of(nodeName.key(), nodeName, nameNodeType.key(), nameNodeType)) .setLayerProtocolName(nodeLayerProtocols) .setAdministrativeState(AdministrativeState.UNLOCKED) .setOperationalState(OperationalState.ENABLED) @@ -240,10 +293,10 @@ public class ConvertORTopoToTapiTopo { 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.rev201019.TerminationPoint1.class) - .getAssociatedConnectionMapPort()); - List tpList = new ArrayList<>(); + TpId tpid2 = tp.augmentation( + org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.TerminationPoint1.class) + .getAssociatedConnectionMapTp().iterator().next(); + Set tpList = new HashSet<>(); tpList.add(tpid1); tpList.add(tpid2); NonBlockingList nbl = new NonBlockingListBuilder() @@ -260,20 +313,19 @@ public class ConvertORTopoToTapiTopo { } private List - pruneTapiPhotonicNodes() { + pruneTapiPhotonicNodes() { List prunedTapiPhotonicNodes = new ArrayList<>(); List tapiPhotonicNodes = this.tapiNodes.values().stream() - .filter(n -> LayerProtocolName.PHOTONICMEDIA.equals(n.getLayerProtocolName().get(0))) - .collect(Collectors.toList()); + .filter(n -> LayerProtocolName.PHOTONICMEDIA.equals(n.getLayerProtocolName().stream().findFirst().get())) + .collect(Collectors.toList()); for (org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node node : 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()); } } @@ -301,7 +353,7 @@ public class ConvertORTopoToTapiTopo { } private org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node - createTapiNode(Map nodeNames, List layerProtocols) { + createTapiNode(Map nodeNames, Set layerProtocols) { Uuid nodeUuid = null; Map onepl = new HashMap<>(); Map nodeRuleGroupList = new HashMap<>(); @@ -321,55 +373,58 @@ 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("iNodeEdgePoint") - .setValue(oorNetworkPortList.get(i).getTpId().getValue()) + .setValue(String.join("+", this.ietfNodeId, TapiStringConstants.I_OTSI, + 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("eNodeEdgePoint") - .setValue(oorNetworkPortList.get(i).getTpId().getValue()) + .setValue(String.join("+", this.ietfNodeId, TapiStringConstants.E_OTSI, + 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 @@ -382,24 +437,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(); @@ -410,17 +466,18 @@ 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); - NameBuilder nameBldr = new NameBuilder().setValue(oorClientPortList.get(i).getTpId().getValue()); + (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(String.join("+", this.ietfNodeId, TapiStringConstants.DSR, + oorClientPortList.get(i).getTpId().getValue())); Name name; if (OpenroadmNodeType.TPDR.equals(this.ietfNodeType)) { name = nameBldr.setValueName("100G-tpdr").build(); @@ -429,23 +486,26 @@ public class ConvertORTopoToTapiTopo { } 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.I_ODU, + oorNetworkPortList.get(i).getTpId().getValue())).getBytes(Charset.forName("UTF-8"))).toString()); + this.uuidMap.put(String.join("+", this.ietfNodeId, TapiStringConstants.I_ODU, + oorNetworkPortList.get(i).getTpId().getValue()), nepUuid); Name onedName = new NameBuilder() - .setValueName("NodeEdgePoint_N") - .setValue(oorNetworkPortList.get(i).getTpId().getValue()) + .setValueName("iNodeEdgePoint_N") + .setValue(String.join("+", this.ietfNodeId, TapiStringConstants.I_ODU, + 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.I_ODU)); onepl.put(onep.key(), onep); } // create NodeRuleGroup @@ -455,21 +515,27 @@ public class ConvertORTopoToTapiTopo { org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.rule.group.NodeEdgePoint> 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())) || this.uuidMap.containsKey(String.join( + "+", this.ietfNodeId, TapiStringConstants.I_ODU, tp.getValue()))) { + String qual = tp.getValue().contains("CLIENT") ? TapiStringConstants.DSR + : TapiStringConstants.I_ODU; 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, + qual, 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(); @@ -480,20 +546,32 @@ 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(this.uuidMap.get(key), 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(); } @@ -510,7 +588,7 @@ public class ConvertORTopoToTapiTopo { .setUuid(nepUuid) .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA) .setName(Map.of(nepName.key(), nepName)) - .setSupportedCepLayerProtocolQualifier(List.of(PHOTONICLAYERQUALIFIEROMS.class)) + .setSupportedCepLayerProtocolQualifier(Set.of(PHOTONICLAYERQUALIFIEROMS.class)) .setLinkPortDirection(PortDirection.BIDIRECTIONAL).setLinkPortRole(PortRole.SYMMETRIC) .setAdministrativeState(AdministrativeState.UNLOCKED).setOperationalState(OperationalState.ENABLED) .setLifecycleState(LifecycleState.INSTALLED).setTerminationDirection(TerminationDirection.BIDIRECTIONAL) @@ -522,7 +600,7 @@ public class ConvertORTopoToTapiTopo { } private Map createNodeRuleGroupForRdmNode(Uuid nodeUuid, - Collection onepl) { + Collection onepl) { Map nepMap = new HashMap<>(); @@ -554,25 +632,26 @@ public class ConvertORTopoToTapiTopo { return nodeRuleGroupMap; } - private Map createSIP(Uuid nepUuid, 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.nameUUIDFromBytes(nepUuid.getValue() - .getBytes(Charset.forName("UTF-8"))).toString())) + .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) { + private Set> + createSupportedCepLayerProtocolQualifier(TerminationPoint tp, LayerProtocolName lpn) { Set> sclpqSet = new HashSet<>(); - List sicList = new ArrayList<>( - tp.augmentation(org.opendaylight.yang.gen.v1.http - .org.openroadm.otn.network.topology.rev200529.TerminationPoint1.class).getTpSupportedInterfaces() - .getSupportedInterfaceCapability().values()); + Collection sicList = tp.augmentation( + org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210.TerminationPoint1.class) + .getTpSupportedInterfaces() + .getSupportedInterfaceCapability().values(); for (SupportedInterfaceCapability sic : sicList) { switch (lpn.getName()) { case "DSR": @@ -606,7 +685,7 @@ public class ConvertORTopoToTapiTopo { break; case "PHOTONIC_MEDIA": if (sic.getIfCapType().getSimpleName().equals("IfOCHOTU4ODU4") - || sic.getIfCapType().getSimpleName().equals("IfOCH")) { + || sic.getIfCapType().getSimpleName().equals("IfOCH")) { sclpqSet.add(PHOTONICLAYERQUALIFIEROTSi.class); sclpqSet.add(PHOTONICLAYERQUALIFIEROMS.class); } @@ -616,146 +695,21 @@ public class ConvertORTopoToTapiTopo { break; } } - return new ArrayList<>(sclpqSet); + return 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.I_ODU, TapiStringConstants.I_OTSI, + "inService", "inService", Set.of(LayerProtocolName.ODU, LayerProtocolName.PHOTONICMEDIA), + Set.of(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(); @@ -784,11 +738,11 @@ 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)) + .setLayerProtocolName(Set.of(LayerProtocolName.PHOTONICMEDIA)) .setNodeEdgePoint(nepMap) .setDirection(ForwardingDirection.BIDIRECTIONAL) .build(); @@ -797,7 +751,7 @@ public class ConvertORTopoToTapiTopo { } public Map - getTapiNodes() { + getTapiNodes() { return tapiNodes; }