From: Gilles Thouenon Date: Mon, 12 Jul 2021 11:34:41 +0000 (+0200) Subject: Manage OTN links at 400G X-Git-Tag: 4.0.0~49 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=transportpce.git;a=commitdiff_plain;h=3e2029fe2f4ccc019f2d05e58ba3ae69481b3a99 Manage OTN links at 400G - put otn-link-type as prefix for link name - propagate and use otn-link-type to differentiate treatments between 100G and 400G supported links - use min and max trib slot and trib port comming from path-description to update ODU4/ODUC4 links - adapt existing UT jira: TRNSPRTPCE-492 Signed-off-by: Gilles Thouenon Change-Id: I4bef0c7edbe02f5b8cbee3f1db7bc32cd0746f59 --- diff --git a/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/service/NetworkModelService.java b/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/service/NetworkModelService.java index c3606ed2b..4845ba307 100644 --- a/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/service/NetworkModelService.java +++ b/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/service/NetworkModelService.java @@ -97,14 +97,16 @@ public interface NetworkModelService { * @param link * link containing termination points to be updated * @param serviceRate - * Service rate may be 1G, 10G or 100G + * Service rate may be 1G, 10G, 100G or 400G * @param tribPortNb * Trib port number allocated by the service - * @param tribSoltNb - * First trib slot number allocated by the service + * @param minTribSoltNb + * First contiguous trib slot number allocated by the service + * @param maxTribSoltNb + * Last contiguous trib slot number allocated by the service * @param isDeletion * True indicates if the low-order otn service must be deleted */ - void updateOtnLinks(Link link, Uint32 serviceRate, Short tribPortNb, Short tribSoltNb, boolean isDeletion); - + void updateOtnLinks(Link link, Uint32 serviceRate, Short tribPortNb, Short minTribSoltNb, Short maxTribSoltNb, + boolean isDeletion); } diff --git a/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/service/NetworkModelServiceImpl.java b/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/service/NetworkModelServiceImpl.java index fb8059c2f..867f341e6 100644 --- a/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/service/NetworkModelServiceImpl.java +++ b/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/service/NetworkModelServiceImpl.java @@ -390,18 +390,25 @@ public class NetworkModelServiceImpl implements NetworkModelService { TopologyShard otnTopologyShard; switch (linkType) { case OTU4: + case OTUC4: otnTopologyShard = OpenRoadmOtnTopology.createOtnLinks(nodeA, tpA, nodeZ, tpZ, linkType); break; case ODTU4: + case ODUC4: String nodeTopoA = new StringBuilder(nodeA).append("-").append(tpA.split("-")[0]).toString(); String nodeTopoZ = new StringBuilder(nodeZ).append("-").append(tpZ.split("-")[0]).toString(); List linkIdList = new ArrayList<>(); - linkIdList.add(LinkIdUtil.buildOtnLinkId(nodeTopoA, tpA, nodeTopoZ, tpZ, "OTU4")); - linkIdList.add(LinkIdUtil.buildOtnLinkId(nodeTopoZ, tpZ, nodeTopoA, tpA, "OTU4")); + String prefix; + if (OtnLinkType.ODTU4.equals(linkType)) { + prefix = OtnLinkType.OTU4.getName(); + } else { + prefix = OtnLinkType.OTUC4.getName(); + } + linkIdList.add(LinkIdUtil.buildOtnLinkId(nodeTopoA, tpA, nodeTopoZ, tpZ, prefix)); + linkIdList.add(LinkIdUtil.buildOtnLinkId(nodeTopoZ, tpZ, nodeTopoA, tpA, prefix)); List supportedOtu4links = getOtnLinks(linkIdList); List tps = getOtnNodeTps(nodeTopoA, tpA, nodeTopoZ, tpZ); - - otnTopologyShard = OpenRoadmOtnTopology.createOtnLinks(supportedOtu4links, tps); + otnTopologyShard = OpenRoadmOtnTopology.createOtnLinks(supportedOtu4links, tps, linkType); break; default: LOG.error("unknown otn link type {}", linkType); @@ -446,32 +453,48 @@ public class NetworkModelServiceImpl implements NetworkModelService { TopologyShard otnTopologyShard; String nodeTopoA = new StringBuilder(nodeA).append("-").append(tpA.split("-")[0]).toString(); String nodeTopoZ = new StringBuilder(nodeZ).append("-").append(tpZ.split("-")[0]).toString(); - List otu4Links; + List otuLinks; List linkIdList = new ArrayList<>(); + String prefix; switch (linkType) { case OTU4: - linkIdList.add(LinkIdUtil.buildOtnLinkId(nodeTopoA, tpA, nodeTopoZ, tpZ, "OTU4")); - linkIdList.add(LinkIdUtil.buildOtnLinkId(nodeTopoZ, tpZ, nodeTopoA, tpA, "OTU4")); - otu4Links = getOtnLinks(linkIdList); - if (checkLinks(otu4Links)) { - deleteLinks(otu4Links); + case OTUC4: + if (OtnLinkType.OTU4.equals(linkType)) { + prefix = OtnLinkType.OTU4.getName(); + } else { + prefix = OtnLinkType.OTUC4.getName(); + } + linkIdList.add(LinkIdUtil.buildOtnLinkId(nodeTopoA, tpA, nodeTopoZ, tpZ, prefix)); + linkIdList.add(LinkIdUtil.buildOtnLinkId(nodeTopoZ, tpZ, nodeTopoA, tpA, prefix)); + otuLinks = getOtnLinks(linkIdList); + if (checkLinks(otuLinks)) { + deleteLinks(otuLinks); } else { LOG.error("Error deleting OTU4 links"); } otnTopologyShard = new TopologyShard(null, null); break; case ODTU4: - linkIdList.add(LinkIdUtil.buildOtnLinkId(nodeTopoA, tpA, nodeTopoZ, tpZ, "ODU4")); - linkIdList.add(LinkIdUtil.buildOtnLinkId(nodeTopoZ, tpZ, nodeTopoA, tpA, "ODU4")); - List odu4Links = getOtnLinks(linkIdList); + case ODUC4: + String prefix2; + if (OtnLinkType.ODTU4.equals(linkType)) { + prefix = OtnLinkType.ODTU4.getName(); + prefix2 = OtnLinkType.OTU4.getName(); + } else { + prefix = OtnLinkType.ODUC4.getName(); + prefix2 = OtnLinkType.OTUC4.getName(); + } + linkIdList.add(LinkIdUtil.buildOtnLinkId(nodeTopoA, tpA, nodeTopoZ, tpZ, prefix)); + linkIdList.add(LinkIdUtil.buildOtnLinkId(nodeTopoZ, tpZ, nodeTopoA, tpA, prefix)); + List oduLinks = getOtnLinks(linkIdList); List tps = getOtnNodeTps(nodeTopoA, tpA, nodeTopoZ, tpZ); - if (checkLinks(odu4Links) && checkTerminationPoints(tps)) { - deleteLinks(odu4Links); + if (checkLinks(oduLinks) && checkTerminationPoints(tps)) { + deleteLinks(oduLinks); linkIdList.clear(); - linkIdList.add(LinkIdUtil.buildOtnLinkId(nodeTopoA, tpA, nodeTopoZ, tpZ, "OTU4")); - linkIdList.add(LinkIdUtil.buildOtnLinkId(nodeTopoZ, tpZ, nodeTopoA, tpA, "OTU4")); - otu4Links = getOtnLinks(linkIdList); - otnTopologyShard = OpenRoadmOtnTopology.deleteOtnLinks(otu4Links, tps); + linkIdList.add(LinkIdUtil.buildOtnLinkId(nodeTopoA, tpA, nodeTopoZ, tpZ, prefix2)); + linkIdList.add(LinkIdUtil.buildOtnLinkId(nodeTopoZ, tpZ, nodeTopoA, tpA, prefix2)); + otuLinks = getOtnLinks(linkIdList); + otnTopologyShard = OpenRoadmOtnTopology.deleteOtnLinks(otuLinks, tps, linkType); } else { LOG.error("Error deleting ODU4 links"); otnTopologyShard = new TopologyShard(null, null); @@ -518,7 +541,8 @@ public class NetworkModelServiceImpl implements NetworkModelService { @Override public void updateOtnLinks( org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210618.renderer.rpc.result.sp.Link - notifLink, Uint32 serviceRate, Short tribPortNb, Short tribSoltNb, boolean isDeletion) { + notifLink, Uint32 serviceRate, Short tribPortNb, Short minTribSoltNb, Short maxTribSlotNb, + boolean isDeletion) { LinkTp atermination = new LinkTpBuilder() .setNodeId(notifLink.getATermination().getNodeId()) @@ -536,7 +560,7 @@ public class NetworkModelServiceImpl implements NetworkModelService { List tps = getOtnNodeTps(linkTerminations); TopologyShard otnTopologyShard; otnTopologyShard = OpenRoadmOtnTopology.updateOtnLinks(supportedOdu4Links, tps, serviceRate, tribPortNb, - tribSoltNb, isDeletion); + minTribSoltNb, maxTribSlotNb, isDeletion); if (otnTopologyShard.getLinks() != null) { for (Link otnTopologyLink : otnTopologyShard.getLinks()) { LOG.info("creating and updating otn links {} in {}", otnTopologyLink.getLinkId().getValue(), @@ -737,7 +761,7 @@ public class NetworkModelServiceImpl implements NetworkModelService { odu4links = netw1Opt .get() .nonnullLink().values() - .stream().filter(lk -> lk.getLinkId().getValue().startsWith("ODU4")) + .stream().filter(lk -> lk.getLinkId().getValue().startsWith("ODTU4")) .collect(Collectors.toList()); } List links = new ArrayList<>(); diff --git a/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/util/OpenRoadmOtnTopology.java b/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/util/OpenRoadmOtnTopology.java index 0700331a9..649852dba 100644 --- a/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/util/OpenRoadmOtnTopology.java +++ b/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/util/OpenRoadmOtnTopology.java @@ -36,10 +36,12 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.x import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.xpdr.tp.supported.interfaces.SupportedInterfaceCapabilityBuilder; import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev200529.xpdr.tp.supported.interfaces.SupportedInterfaceCapabilityKey; import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev200327.ODTU4TsAllocated; +import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev200327.ODTUCnTs; import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev200327.ODU0; import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev200327.ODU2; import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev200327.ODU2e; import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev200327.ODU4; +import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev200327.OdtuTypeIdentity; import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev200327.OduRateIdentity; 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.Link1Builder; @@ -122,32 +124,36 @@ public final class OpenRoadmOtnTopology { public static TopologyShard createOtnLinks(String nodeA, String tpA, String nodeZ, String tpZ, OtnLinkType linkType) { List links = null; - if (OtnLinkType.OTU4.equals(linkType)) { - links = initialiseOtnLinks(nodeA, tpA, nodeZ, tpZ, linkType, "OTU4"); + if (OtnLinkType.OTU4.equals(linkType) || OtnLinkType.OTUC4.equals(linkType)) { + links = initialiseOtnLinks(nodeA, tpA, nodeZ, tpZ, linkType); } return new TopologyShard(null, links); } - public static TopologyShard createOtnLinks(List suppOtu4Links, List oldTps) { + public static TopologyShard createOtnLinks(List suppOtuLinks, List oldTps, + OtnLinkType linkType) { List links = new ArrayList<>(); - for (Link link : suppOtu4Links) { - if (link.augmentation(Link1.class) != null + for (Link link : suppOtuLinks) { + if (OtnLinkType.ODTU4.equals(linkType) && link.augmentation(Link1.class) != null && link.augmentation(Link1.class).getAvailableBandwidth().equals(Uint32.valueOf(100000))) { links.add(updateOtnLinkBwParameters(link, 0L, 100000L)); + } else if (OtnLinkType.ODUC4.equals(linkType) && link.augmentation(Link1.class) != null + && link.augmentation(Link1.class).getAvailableBandwidth().equals(Uint32.valueOf(400000))) { + links.add(updateOtnLinkBwParameters(link, 0L, 400000L)); } else { LOG.error("Error with otn parameters of supported link {}", link.getLinkId().getValue()); } } if (links.size() == 2) { - links.addAll(initialiseOtnLinks(suppOtu4Links.get(0).getSource().getSourceNode().getValue(), - suppOtu4Links.get(0).getSource().getSourceTp().toString(), - suppOtu4Links.get(0).getDestination().getDestNode().getValue(), - suppOtu4Links.get(0).getDestination().getDestTp().toString(), - OtnLinkType.ODTU4, "ODU4")); + links.addAll(initialiseOtnLinks(suppOtuLinks.get(0).getSource().getSourceNode().getValue(), + suppOtuLinks.get(0).getSource().getSourceTp().toString(), + suppOtuLinks.get(0).getDestination().getDestNode().getValue(), + suppOtuLinks.get(0).getDestination().getDestTp().toString(), + linkType)); } List tps = new ArrayList<>(); for (TerminationPoint tp : oldTps) { - tps.add(updateTp(tp, true)); + tps.add(updateTp(tp, true, linkType)); } if (links.size() == 4 && tps.size() == 2) { return new TopologyShard(null, links, tps); @@ -156,14 +162,25 @@ public final class OpenRoadmOtnTopology { } } - public static TopologyShard updateOtnLinks(List suppOdu4Links, List oldTps, - Uint32 serviceRate, Short tribPortNb, Short tribSoltNb, boolean isDeletion) { + public static TopologyShard updateOtnLinks(List suppOduLinks, List oldTps, + Uint32 serviceRate, Short tribPortNb, Short minTribSlotNb, Short maxTribSlotNb, boolean isDeletion) { List links = new ArrayList<>(); - Long bwIncr = 10000L; - if (serviceRate.intValue() == 1) { - bwIncr = 1000L; + Long bwIncr; + switch (serviceRate.intValue()) { + case 1: + bwIncr = 1000L; + break; + case 10: + bwIncr = 10000L; + break; + case 100: + bwIncr = 100000L; + break; + default: + LOG.warn("Error with not managed service rate {}", serviceRate.toString()); + return new TopologyShard(null, null, null); } - for (Link link : suppOdu4Links) { + for (Link link : suppOduLinks) { if (link.augmentation(Link1.class) != null && link.augmentation(Link1.class).getAvailableBandwidth() != null && link.augmentation(Link1.class).getUsedBandwidth() != null) { Uint32 avlBw = link.augmentation(Link1.class).getAvailableBandwidth(); @@ -185,7 +202,7 @@ public final class OpenRoadmOtnTopology { List tps = new ArrayList<>(); for (TerminationPoint tp : oldTps) { if (bwIncr != 0) { - tps.add(updateNodeTpTsPool(tp, serviceRate, tribPortNb, tribSoltNb, isDeletion)); + tps.add(updateNodeTpTsPool(tp, serviceRate, tribPortNb, minTribSlotNb, maxTribSlotNb, isDeletion)); } } if (!links.isEmpty() && !tps.isEmpty()) { @@ -196,18 +213,30 @@ public final class OpenRoadmOtnTopology { } } - public static TopologyShard deleteOtnLinks(List suppOtu4Links, List oldTps) { + public static TopologyShard deleteOtnLinks(List suppOtuLinks, List oldTps, + OtnLinkType linkType) { List links = new ArrayList<>(); - for (Link link : suppOtu4Links) { - if (link.augmentation(Link1.class) != null) { - links.add(updateOtnLinkBwParameters(link, 100000L, 0L)); + OtnLinkType otnLinkType = null; + for (Link link : suppOtuLinks) { + if (link.augmentation(Link1.class) != null && link.augmentation( + org.opendaylight.yang.gen.v1.http.transportpce.topology.rev210511.Link1.class) != null) { + otnLinkType = link.augmentation( + org.opendaylight.yang.gen.v1.http.transportpce.topology.rev210511.Link1.class).getOtnLinkType(); + if (OtnLinkType.OTU4.equals(otnLinkType)) { + links.add(updateOtnLinkBwParameters(link, 100000L, 0L)); + } else if (OtnLinkType.OTUC4.equals(otnLinkType)) { + links.add(updateOtnLinkBwParameters(link, 400000L, 0L)); + } else { + LOG.warn("Unexpected otn-link-type {} for link {}", otnLinkType, link.getLinkId()); + } } else { LOG.error("Error with otn parameters of supported link {}", link.getLinkId().getValue()); + return new TopologyShard(null, null, null); } } List tps = new ArrayList<>(); for (TerminationPoint tp : oldTps) { - tps.add(updateTp(tp, false)); + tps.add(updateTp(tp, false, linkType)); } if (links.size() == 2 && tps.size() == 2) { return new TopologyShard(null, links, tps); @@ -217,29 +246,33 @@ public final class OpenRoadmOtnTopology { } private static List initialiseOtnLinks(String nodeA, String tpA, String nodeZ, String tpZ, - OtnLinkType linkType, String linkIdPrefix) { + OtnLinkType linkType) { List links = new ArrayList<>(); + String nodeATopo = formatNodeName(nodeA, tpA); + String nodeZTopo = formatNodeName(nodeZ, tpZ); org.opendaylight.yang.gen.v1.http.transportpce.topology.rev210511.Link1 tpceLink1 = new org.opendaylight.yang.gen.v1.http.transportpce.topology.rev210511.Link1Builder() .setOtnLinkType(linkType).build(); - Link1 otnLink1 = new Link1Builder() - .setAvailableBandwidth(Uint32.valueOf(100000)) - .setUsedBandwidth(Uint32.valueOf(0)) - .build(); - // create link A-Z - String nodeATopo; - String nodeZTopo; - if (nodeA.contains(XPDR) && nodeZ.contains(XPDR)) { - nodeATopo = nodeA; - nodeZTopo = nodeZ; - } else { - nodeATopo = nodeA + "-" + tpA.split("-")[0]; - nodeZTopo = nodeZ + "-" + tpZ.split("-")[0]; + Link1Builder otnLink1Bldr = new Link1Builder() + .setUsedBandwidth(Uint32.valueOf(0)); + switch (linkType) { + case OTU4: + case ODTU4: + otnLink1Bldr.setAvailableBandwidth(Uint32.valueOf(100000)); + break; + case OTUC4: + case ODUC4: + otnLink1Bldr.setAvailableBandwidth(Uint32.valueOf(400000)); + break; + default: + LOG.error("unable to set available bandwidth to unknown link type"); + break; } - LinkBuilder ietfLinkAZBldr = TopologyUtils.createLink(nodeATopo, nodeZTopo, tpA, tpZ, linkIdPrefix); + // create link A-Z + LinkBuilder ietfLinkAZBldr = TopologyUtils.createLink(nodeATopo, nodeZTopo, tpA, tpZ, linkType.getName()); ietfLinkAZBldr .addAugmentation(tpceLink1) - .addAugmentation(otnLink1) + .addAugmentation(otnLink1Bldr.build()) .addAugmentation( new org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1Builder( ietfLinkAZBldr.augmentation( @@ -250,10 +283,10 @@ public final class OpenRoadmOtnTopology { .build()); links.add(ietfLinkAZBldr.build()); // create link Z-A - LinkBuilder ietfLinkZABldr = TopologyUtils.createLink(nodeZTopo, nodeATopo, tpZ, tpA, linkIdPrefix); + LinkBuilder ietfLinkZABldr = TopologyUtils.createLink(nodeZTopo, nodeATopo, tpZ, tpA, linkType.getName()); ietfLinkZABldr .addAugmentation(tpceLink1) - .addAugmentation(otnLink1) + .addAugmentation(otnLink1Bldr.build()) .addAugmentation( new org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1Builder( ietfLinkZABldr.augmentation( @@ -276,7 +309,8 @@ public final class OpenRoadmOtnTopology { return updatedLinkBldr.build(); } - private static TerminationPoint updateTp(TerminationPoint originalTp, boolean addingTsTpnPoolTermination) { + private static TerminationPoint updateTp(TerminationPoint originalTp, boolean addingTsTpnPoolTermination, + OtnLinkType linkType) { LOG.debug("in updateTp"); TerminationPointBuilder tpBldr = new TerminationPointBuilder(originalTp); TerminationPoint1Builder otnTp1Bldr = new TerminationPoint1Builder( @@ -285,12 +319,16 @@ public final class OpenRoadmOtnTopology { .getXpdrTpPortConnectionAttributes()); if (addingTsTpnPoolTermination) { List tsPool = new ArrayList<>(); - for (int i = 0; i < NB_TRIB_SLOTS; i++) { - tsPool.add(Uint16.valueOf(i + 1)); + for (int i = 1; i <= NB_TRIB_SLOTS; i++) { + tsPool.add(Uint16.valueOf(i)); } xtpcaBldr.setTsPool(tsPool); List tpnPool = new ArrayList<>(); - for (int i = 1; i <= NB_TRIB_PORTS; i++) { + int nbTribPort = NB_TRIB_PORTS; + if (OtnLinkType.ODUC4.equals(linkType)) { + nbTribPort = 4; + } + for (int i = 1; i <= nbTribPort; i++) { tpnPool.add(Uint16.valueOf(i)); } OdtuTpnPool oduTpnPool = new OdtuTpnPoolBuilder().setOdtuType(ODTU4TsAllocated.class) @@ -304,35 +342,21 @@ public final class OpenRoadmOtnTopology { } private static TerminationPoint updateNodeTpTsPool(TerminationPoint tp, Uint32 serviceRate, Short tribPortNb, - Short tribSlotNb, boolean isDeletion) { + Short minTribSlotNb, Short maxTribSlotNb, boolean isDeletion) { LOG.debug("in updateNodeTpTsPool"); TerminationPointBuilder tpBldr = new TerminationPointBuilder(tp); @Nullable XpdrTpPortConnectionAttributesBuilder xtpcaBldr = new XpdrTpPortConnectionAttributesBuilder( tpBldr.augmentation(TerminationPoint1.class).getXpdrTpPortConnectionAttributes()); List tsPool = new ArrayList<>(xtpcaBldr.getTsPool()); - switch (serviceRate.intValue()) { - case 1: - if (isDeletion) { - tsPool.add(Uint16.valueOf(tribSlotNb)); - } else { - tsPool.remove(Uint16.valueOf(tribSlotNb)); - } - break; - case 10: - if (isDeletion) { - for (int i = 0; i < NB_TRIB_SLOT_PER_10GE; i++) { - tsPool.add(Uint16.valueOf(tribSlotNb + i)); - } - } else { - for (int i = 0; i < NB_TRIB_SLOT_PER_10GE; i++) { - tsPool.remove(Uint16.valueOf(tribSlotNb + i)); - } - } - break; - default: - LOG.error("error updating tpn and ts pool for tp {}", tp.getTpId().getValue()); - break; + if (isDeletion) { + for (int i = minTribSlotNb; i <= maxTribSlotNb; i++) { + tsPool.add(Uint16.valueOf(i)); + } + } else { + for (int i = minTribSlotNb; i <= maxTribSlotNb; i++) { + tsPool.remove(Uint16.valueOf(i)); + } } xtpcaBldr.setTsPool(tsPool); List tpnPool; @@ -347,7 +371,20 @@ public final class OpenRoadmOtnTopology { } else { tpnPool = new ArrayList<>(); } - OdtuTpnPool odtuTpnPool = new OdtuTpnPoolBuilder().setOdtuType(ODTU4TsAllocated.class) + Class odtuType = null; + switch (serviceRate.intValue()) { + case 1: + case 10: + odtuType = ODTU4TsAllocated.class; + break; + case 100: + odtuType = ODTUCnTs.class; + break; + default: + LOG.warn("Unable to set the odtu-type"); + break; + } + OdtuTpnPool odtuTpnPool = new OdtuTpnPoolBuilder().setOdtuType(odtuType) .setTpnPool(tpnPool).build(); xtpcaBldr.setOdtuTpnPool(ImmutableMap.of(odtuTpnPool.key(),odtuTpnPool)); @@ -721,4 +758,14 @@ public final class OpenRoadmOtnTopology { .addAugmentation(ocnTp); return ietfTpBldr.build(); } + + private static String formatNodeName(String nodeName, String tpName) { + String newNodeName = null; + if (nodeName.contains(XPDR)) { + newNodeName = nodeName; + } else { + newNodeName = new StringBuilder(nodeName).append("-").append(tpName.split("-")[0]).toString(); + } + return newNodeName; + } } diff --git a/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/util/OpenRoadmOtnTopologyTest.java b/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/util/OpenRoadmOtnTopologyTest.java index df5d60f52..5a186b52b 100644 --- a/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/util/OpenRoadmOtnTopologyTest.java +++ b/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/util/OpenRoadmOtnTopologyTest.java @@ -296,7 +296,7 @@ public class OpenRoadmOtnTopologyTest { TopologyShard topoShard = OpenRoadmOtnTopology .createOtnLinks( NetworkmodelTestUtil.createSuppOTNLinks(OtnLinkType.OTU4, Uint32.valueOf(100000)), - NetworkmodelTestUtil.createTpList(false)); + NetworkmodelTestUtil.createTpList(false), OtnLinkType.ODTU4); assertNotNull("TopologyShard should never be null", topoShard); assertNull("list of nodes should be null", topoShard.getNodes()); List sortedLinks = topoShard.getLinks().stream() @@ -314,10 +314,10 @@ public class OpenRoadmOtnTopologyTest { sortedLinks.get(2).augmentation(Link1.class).getUsedBandwidth()); assertEquals( - "ODU4-SPDRA-XPDR1-XPDR1-NETWORK1toSPDRZ-XPDR1-XPDR1-NETWORK1", + "ODTU4-SPDRA-XPDR1-XPDR1-NETWORK1toSPDRZ-XPDR1-XPDR1-NETWORK1", sortedLinks.get(0).getLinkId().getValue()); assertEquals( - "ODU4-SPDRZ-XPDR1-XPDR1-NETWORK1toSPDRA-XPDR1-XPDR1-NETWORK1", + "ODTU4-SPDRZ-XPDR1-XPDR1-NETWORK1toSPDRA-XPDR1-XPDR1-NETWORK1", sortedLinks.get(1).getLinkId().getValue()); assertEquals("SPDRA-XPDR1", sortedLinks.get(0).getSource().getSourceNode().getValue()); assertEquals("SPDRZ-XPDR1", sortedLinks.get(0).getDestination().getDestNode().getValue()); @@ -339,7 +339,7 @@ public class OpenRoadmOtnTopologyTest { .getLinkType()); assertEquals( "opposite link must be present", - "ODU4-SPDRZ-XPDR1-XPDR1-NETWORK1toSPDRA-XPDR1-XPDR1-NETWORK1", + "ODTU4-SPDRZ-XPDR1-XPDR1-NETWORK1toSPDRA-XPDR1-XPDR1-NETWORK1", sortedLinks.get(0) .augmentation( org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.Link1.class) @@ -404,7 +404,8 @@ public class OpenRoadmOtnTopologyTest { otu4LinksWithBadBWParam.add(new LinkBuilder(link).removeAugmentation(Link1.class).build()); } TopologyShard topoShard = - OpenRoadmOtnTopology.createOtnLinks(otu4LinksWithBadBWParam, NetworkmodelTestUtil.createTpList(false)); + OpenRoadmOtnTopology.createOtnLinks(otu4LinksWithBadBWParam, NetworkmodelTestUtil.createTpList(false), + OtnLinkType.OTU4); assertNotNull("TopologyShard should never be null", topoShard); assertNull("list of nodes should be null", topoShard.getNodes()); assertNull("list of links should be null", topoShard.getLinks()); @@ -414,7 +415,7 @@ public class OpenRoadmOtnTopologyTest { topoShard = OpenRoadmOtnTopology.createOtnLinks( NetworkmodelTestUtil.createSuppOTNLinks(OtnLinkType.OTU4, Uint32.valueOf(99000)), - NetworkmodelTestUtil.createTpList(false)); + NetworkmodelTestUtil.createTpList(false), OtnLinkType.OTU4); assertNull("list of nodes should be null", topoShard.getNodes()); assertNull("list of links should be null", topoShard.getLinks()); assertNull("list of tps should be null", topoShard.getTps()); @@ -425,7 +426,7 @@ public class OpenRoadmOtnTopologyTest { TopologyShard topoShard = OpenRoadmOtnTopology.deleteOtnLinks( NetworkmodelTestUtil.createSuppOTNLinks(OtnLinkType.OTU4, Uint32.valueOf(0)), - NetworkmodelTestUtil.createTpList(true)); + NetworkmodelTestUtil.createTpList(true), OtnLinkType.OTU4); assertNotNull("TopologyShard should never be null", topoShard); assertEquals("list of links should contain 2 links", 2, topoShard.getLinks().size()); assertEquals( @@ -464,7 +465,8 @@ public class OpenRoadmOtnTopologyTest { otu4LinksWithBadBWParam.add(new LinkBuilder(link).removeAugmentation(Link1.class).build()); } TopologyShard topoShard = - OpenRoadmOtnTopology.deleteOtnLinks(otu4LinksWithBadBWParam, NetworkmodelTestUtil.createTpList(true)); + OpenRoadmOtnTopology.deleteOtnLinks(otu4LinksWithBadBWParam, NetworkmodelTestUtil.createTpList(true), + OtnLinkType.OTU4); assertNotNull("TopologyShard should never be null", topoShard); assertNull("list of nodes should be null", topoShard.getNodes()); assertNull("list of links should be null", topoShard.getLinks()); @@ -478,14 +480,14 @@ public class OpenRoadmOtnTopologyTest { OpenRoadmOtnTopology.updateOtnLinks( NetworkmodelTestUtil.createSuppOTNLinks(OtnLinkType.ODTU4, Uint32.valueOf(100000)), NetworkmodelTestUtil.createTpList(true), - Uint32.valueOf(10), (short)1, (short)1, false); + Uint32.valueOf(10), (short)1, (short)1, (short)8, false); assertNotNull("TopologyShard should never be null", topoShard); assertNull("list of nodes should be null", topoShard.getNodes()); List sortedLinks = topoShard.getLinks().stream() .sorted((l1, l2) -> l1.getLinkId().getValue().compareTo(l2.getLinkId().getValue())) .collect(Collectors.toList()); assertEquals("list of links should contain 2 links", 2, sortedLinks.size()); - assertTrue(sortedLinks.get(0).getLinkId().getValue().startsWith("ODU4-")); + assertTrue(sortedLinks.get(0).getLinkId().getValue().startsWith("ODTU4-")); assertEquals( "after 10G creation, available BW of supported ODU4 should be 90000", Uint32.valueOf(90000), @@ -550,12 +552,12 @@ public class OpenRoadmOtnTopologyTest { // tests update for 10G deletion sortedLinks.clear(); topoShard = OpenRoadmOtnTopology.updateOtnLinks(topoShard.getLinks(), topoShard.getTps(), Uint32.valueOf(10), - (short)1, (short)1, true); + (short)1, (short)1, (short)8, true); sortedLinks = topoShard.getLinks().stream() .sorted((l1, l2) -> l1.getLinkId().getValue().compareTo(l2.getLinkId().getValue())) .collect(Collectors.toList()); assertEquals("list of links should contain 2 links", 2, sortedLinks.size()); - assertTrue(sortedLinks.get(0).getLinkId().getValue().startsWith("ODU4-")); + assertTrue(sortedLinks.get(0).getLinkId().getValue().startsWith("ODTU4-")); assertEquals( "after 10G deletion, available BW of supported ODU4 should be 100 000", Uint32.valueOf(100000), @@ -616,14 +618,14 @@ public class OpenRoadmOtnTopologyTest { OpenRoadmOtnTopology.updateOtnLinks( NetworkmodelTestUtil.createSuppOTNLinks(OtnLinkType.ODTU4, Uint32.valueOf(100000)), NetworkmodelTestUtil.createTpList(true), - Uint32.valueOf(1), (short)1, (short)1, false); + Uint32.valueOf(1), (short)1, (short)1, (short)1, false); assertNotNull("TopologyShard should never be null", topoShard); assertNull("list of nodes should be null", topoShard.getNodes()); List sortedLinks = topoShard.getLinks().stream() .sorted((l1, l2) -> l1.getLinkId().getValue().compareTo(l2.getLinkId().getValue())) .collect(Collectors.toList()); assertEquals("list of links should contain 2 links", 2, sortedLinks.size()); - assertTrue(sortedLinks.get(0).getLinkId().getValue().startsWith("ODU4-")); + assertTrue(sortedLinks.get(0).getLinkId().getValue().startsWith("ODTU4-")); assertEquals( "after 1G creation, available BW of supported ODU4 should be 99000", Uint32.valueOf(99000), @@ -690,12 +692,12 @@ public class OpenRoadmOtnTopologyTest { OpenRoadmOtnTopology.updateOtnLinks( topoShard.getLinks(), topoShard.getTps(), - Uint32.valueOf(1), (short)1, (short)1, true); + Uint32.valueOf(1), (short)1, (short)1, (short)1, true); sortedLinks = topoShard.getLinks().stream() .sorted((l1, l2) -> l1.getLinkId().getValue().compareTo(l2.getLinkId().getValue())) .collect(Collectors.toList()); assertEquals("list of links should contain 2 links", 2, sortedLinks.size()); - assertTrue(sortedLinks.get(0).getLinkId().getValue().startsWith("ODU4-")); + assertTrue(sortedLinks.get(0).getLinkId().getValue().startsWith("ODTU4-")); assertEquals( "after 1G deletion, available BW of supported ODU4 should be 100 000", Uint32.valueOf(100000), @@ -760,7 +762,7 @@ public class OpenRoadmOtnTopologyTest { OpenRoadmOtnTopology.updateOtnLinks( odu4LinksWithBadBWParam, NetworkmodelTestUtil.createTpList(true), - Uint32.valueOf(1), (short)1, (short)1, false); + Uint32.valueOf(1), (short)1, (short)1, (short)10, false); assertNotNull("TopologyShard should never be null", topoShard); assertNull("list of nodes should be null", topoShard.getNodes()); assertNull("list of links should be null", topoShard.getLinks()); @@ -775,7 +777,7 @@ public class OpenRoadmOtnTopologyTest { OpenRoadmOtnTopology.updateOtnLinks( odu4LinksWithBadBWParam, NetworkmodelTestUtil.createTpList(true), - Uint32.valueOf(10), (short)1, (short)1, false); + Uint32.valueOf(10), (short)1, (short)1, (short)10, false); assertNotNull("TopologyShard should never be null", topoShard); assertNull("list of nodes should be null", topoShard.getNodes()); assertNull("list of links should be null", topoShard.getLinks()); diff --git a/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/util/test/NetworkmodelTestUtil.java b/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/util/test/NetworkmodelTestUtil.java index 30457ecda..6bafebb88 100644 --- a/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/util/test/NetworkmodelTestUtil.java +++ b/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/util/test/NetworkmodelTestUtil.java @@ -87,14 +87,8 @@ public final class NetworkmodelTestUtil { } public static List createSuppOTNLinks(OtnLinkType type, Uint32 availBW) { - String prefix = null; - if (OtnLinkType.OTU4.equals(type)) { - prefix = "OTU4-"; - } else if (OtnLinkType.ODTU4.equals(type)) { - prefix = "ODU4-"; - } Link linkAZ = new LinkBuilder() - .setLinkId(new LinkId(prefix + "SPDRA-XPDR1-XPDR1-NETWORK1toSPDRZ-XPDR1-XPDR1-NETWORK1")) + .setLinkId(new LinkId(type.getName() + "-SPDRA-XPDR1-XPDR1-NETWORK1toSPDRZ-XPDR1-XPDR1-NETWORK1")) .setSource(new SourceBuilder() .setSourceNode(new NodeId("SPDRA-XPDR1")) .setSourceTp("XPDR1-NETWORK1").build()) @@ -104,7 +98,8 @@ public final class NetworkmodelTestUtil { .addAugmentation( new Link1Builder() .setLinkType(OpenroadmLinkType.OTNLINK) - .setOppositeLink(new LinkId(prefix + "SPDRZ-XPDR1-XPDR1-NETWORK1toSPDRA-XPDR1-XPDR1-NETWORK1")) + .setOppositeLink(new LinkId(type.getName() + + "-SPDRZ-XPDR1-XPDR1-NETWORK1toSPDRA-XPDR1-XPDR1-NETWORK1")) .build()) .addAugmentation( new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev200529.Link1Builder() @@ -117,7 +112,7 @@ public final class NetworkmodelTestUtil { .build()) .build(); Link linkZA = new LinkBuilder() - .setLinkId(new LinkId(prefix + "SPDRZ-XPDR1-XPDR1-NETWORK1toSPDRA-XPDR1-XPDR1-NETWORK1")) + .setLinkId(new LinkId(type.getName() + "-SPDRZ-XPDR1-XPDR1-NETWORK1toSPDRA-XPDR1-XPDR1-NETWORK1")) .setSource(new SourceBuilder() .setSourceNode(new NodeId("SPDRZ-XPDR1")) .setSourceTp("XPDR1-NETWORK1").build()) @@ -127,7 +122,8 @@ public final class NetworkmodelTestUtil { .addAugmentation( new Link1Builder() .setLinkType(OpenroadmLinkType.OTNLINK) - .setOppositeLink(new LinkId(prefix + "SPDRA-XPDR1-XPDR1-NETWORK1toSPDRZ-XPDR1-XPDR1-NETWORK1")) + .setOppositeLink(new LinkId(type.getName() + + "-SPDRA-XPDR1-XPDR1-NETWORK1toSPDRZ-XPDR1-XPDR1-NETWORK1")) .build()) .addAugmentation( new org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev200529.Link1Builder() diff --git a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/listeners/RendererListenerImpl.java b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/listeners/RendererListenerImpl.java index 0c76eb001..82eb67760 100644 --- a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/listeners/RendererListenerImpl.java +++ b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/listeners/RendererListenerImpl.java @@ -93,25 +93,26 @@ public class RendererListenerImpl implements TransportpceRendererListener { private void onServiceDeleteResult(RendererRpcResultSp notification) { switch (serviceRpcResultSp.getStatus()) { case Successful: - LOG.info("Service '{}' deleted !", notification.getServiceName()); String serviceType = notification.getServiceType(); switch (serviceType) { case StringConstants.SERVICE_TYPE_1GE: case StringConstants.SERVICE_TYPE_10GE: case StringConstants.SERVICE_TYPE_100GE_M: Short tribPort = Short.valueOf(notification.getAToZDirection().getMinTribSlot().getValue() - .split("\\.")[0]); + .split("\\.")[0]); Short minTribSlot = Short.valueOf(notification.getAToZDirection().getMinTribSlot().getValue() - .split("\\.")[1]); + .split("\\.")[1]); + Short maxTribSlot = Short.valueOf(notification.getAToZDirection().getMaxTribSlot().getValue() + .split("\\.")[1]); updateOtnTopology(notification.getLink(), true, notification.getServiceType(), - notification.getAToZDirection().getRate(), tribPort, minTribSlot); + notification.getAToZDirection().getRate(), tribPort, minTribSlot, maxTribSlot); break; case StringConstants.SERVICE_TYPE_OTU4: case StringConstants.SERVICE_TYPE_OTUC4: case StringConstants.SERVICE_TYPE_ODU4: case StringConstants.SERVICE_TYPE_ODUC4: updateOtnTopology(notification.getLink(), true, notification.getServiceType(), null, null, - null); + null, null); break; default: break; @@ -187,17 +188,19 @@ public class RendererListenerImpl implements TransportpceRendererListener { case StringConstants.SERVICE_TYPE_10GE: case StringConstants.SERVICE_TYPE_100GE_M: Short tribPort = Short.valueOf(notification.getAToZDirection().getMinTribSlot().getValue() - .split("\\.")[0]); + .split("\\.")[0]); Short minTribSlot = Short.valueOf(notification.getAToZDirection().getMinTribSlot().getValue() - .split("\\.")[1]); + .split("\\.")[1]); + Short maxTribSlot = Short.valueOf(notification.getAToZDirection().getMaxTribSlot().getValue() + .split("\\.")[1]); updateOtnTopology(notification.getLink(), false, notification.getServiceType(), - notification.getAToZDirection().getRate(), tribPort, minTribSlot); + notification.getAToZDirection().getRate(), tribPort, minTribSlot, maxTribSlot); break; case StringConstants.SERVICE_TYPE_OTU4: case StringConstants.SERVICE_TYPE_OTUC4: case StringConstants.SERVICE_TYPE_ODU4: case StringConstants.SERVICE_TYPE_ODUC4: - updateOtnTopology(notification.getLink(), false, notification.getServiceType(), null, null, null); + updateOtnTopology(notification.getLink(), false, notification.getServiceType(), null, null, null, null); break; default: break; @@ -348,7 +351,7 @@ public class RendererListenerImpl implements TransportpceRendererListener { } private void updateOtnTopology(Link link, boolean isDeletion, String serviceType, Uint32 rate, Short portNb, - Short slotNb) { + Short minSlotNb, Short maxSlotNb) { if (link == null) { return; } @@ -392,7 +395,7 @@ public class RendererListenerImpl implements TransportpceRendererListener { case StringConstants.SERVICE_TYPE_10GE: case StringConstants.SERVICE_TYPE_100GE_M: LOG.info("updating otn-topology node tps -tps and tpn pools"); - this.networkModelService.updateOtnLinks(link, rate, portNb, slotNb, isDeletion); + this.networkModelService.updateOtnLinks(link, rate, portNb, minSlotNb, maxSlotNb, isDeletion); break; default: break; diff --git a/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToTapiFullTopo.java b/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToTapiFullTopo.java index 13b15e32f..ac07c7582 100644 --- a/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToTapiFullTopo.java +++ b/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToTapiFullTopo.java @@ -1195,7 +1195,7 @@ public class ConvertORTopoToTapiFullTopo { .setServerIntegrityProcessCharacteristic("server integrity process") .setValidationMechanism(Map.of(validationMechanism.key(), validationMechanism)) .build(); - case "ODU4": + case "ODTU4": sourceUuidTp = this.uuidMap.get(String.join("+", sourceNode, E_ODU, sourceTp)); sourceUuidNode = this.uuidMap.get(String.join("+", sourceNode, DSR)); NodeEdgePoint sourceNep2 = new NodeEdgePointBuilder() 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 2a83ea002..6abf9471c 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 @@ -787,7 +787,7 @@ public class ConvertORTopoToTapiTopo { .setValue(Uint64.valueOf(link.augmentation(Link1.class).getAvailableBandwidth())).build()) .build()) .build(); - case "ODU4": + case "ODTU4": sourceUuidTp = this.uuidMap.get(String.join("+", sourceNode, DSR, sourceTp)); sourceUuidNode = this.uuidMap.get(String.join("+", sourceNode, DSR)); NodeEdgePoint sourceNep2 = new NodeEdgePointBuilder() diff --git a/tapi/src/test/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToTapiTopoTest.java b/tapi/src/test/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToTapiTopoTest.java index 890dab6cb..56225bcbb 100644 --- a/tapi/src/test/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToTapiTopoTest.java +++ b/tapi/src/test/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToTapiTopoTest.java @@ -309,7 +309,7 @@ public class ConvertORTopoToTapiTopoTest extends AbstractTest { .networks.network.Link> otnLinksAlt = new HashMap<>(otnLinks); org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link link = changeOtnLinkState(otnLinks.get(new LinkKey( - new LinkId("ODU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"))), null, null); + new LinkId("ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"))), null, null); otnLinksAlt.replace(link.key(), link); ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid); @@ -346,7 +346,7 @@ public class ConvertORTopoToTapiTopoTest extends AbstractTest { .networks.network.Link> otnLinksAlt = new HashMap<>(otnLinks); org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link link = changeOtnLinkState(otnLinks.get(new LinkKey( - new LinkId("ODU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1"))), null, null); + new LinkId("ODTU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1"))), null, null); otnLinksAlt.replace(link.key(), link); ConvertORTopoToTapiTopo tapiFactory = new ConvertORTopoToTapiTopo(topologyUuid); @@ -383,7 +383,7 @@ public class ConvertORTopoToTapiTopoTest extends AbstractTest { .networks.network.Link> otnLinksAlt = new HashMap<>(otnLinks); org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link link = changeOtnLinkState(otnLinks.get(new LinkKey( - new LinkId("ODU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"))), + new LinkId("ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"))), AdminStates.OutOfService, State.OutOfService); otnLinksAlt.replace(link.key(), link); @@ -423,7 +423,7 @@ public class ConvertORTopoToTapiTopoTest extends AbstractTest { .networks.network.Link> otnLinksAlt = new HashMap<>(otnLinks); org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link link = changeOtnLinkState(otnLinks.get(new LinkKey( - new LinkId("ODU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"))), + new LinkId("ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"))), AdminStates.Maintenance, State.Degraded); otnLinksAlt.replace(link.key(), link); @@ -463,7 +463,7 @@ public class ConvertORTopoToTapiTopoTest extends AbstractTest { .networks.network.Link> otnLinksAlt = new HashMap<>(otnLinks); org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link link = changeOtnLinkState(otnLinks.get(new LinkKey( - new LinkId("ODU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1"))), + new LinkId("ODTU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1"))), AdminStates.OutOfService, State.OutOfService); otnLinksAlt.replace(link.key(), link); @@ -629,7 +629,7 @@ public class ConvertORTopoToTapiTopoTest extends AbstractTest { Uuid tp4Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+iOTSi+XPDR1-NETWORK1" .getBytes(Charset.forName("UTF-8"))).toString()); Uuid link1Uuid = - new Uuid(UUID.nameUUIDFromBytes("ODU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1" + new Uuid(UUID.nameUUIDFromBytes("ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1" .getBytes(Charset.forName("UTF-8"))).toString()); Uuid link2Uuid = new Uuid(UUID.nameUUIDFromBytes("OTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1" @@ -639,7 +639,7 @@ public class ConvertORTopoToTapiTopoTest extends AbstractTest { .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue())) .collect(Collectors.toList()); checkOtnLink(links.get(0), node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, link1Uuid, - "ODU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"); + "ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"); checkOtnLink(links.get(2), node3Uuid, node4Uuid, tp3Uuid, tp4Uuid, link2Uuid, "OTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"); } @@ -1240,7 +1240,7 @@ public class ConvertORTopoToTapiTopoTest extends AbstractTest { if ("OTU4".equals(prefix)) { assertEquals("Available capacity -total size value should be 0", Uint64.valueOf(0), link.getAvailableCapacity().getTotalSize().getValue()); - } else if ("ODU4".equals(prefix)) { + } else if ("ODTU4".equals(prefix)) { assertEquals("Available capacity -total size value should be 100 000", Uint64.valueOf(100000), link.getAvailableCapacity().getTotalSize().getValue()); } @@ -1251,7 +1251,7 @@ public class ConvertORTopoToTapiTopoTest extends AbstractTest { if ("OTU4".equals(prefix)) { assertEquals("otn link should be between 2 nodes of protocol layers PHOTONIC_MEDIA", LayerProtocolName.PHOTONICMEDIA.getName(), link.getLayerProtocolName().get(0).getName()); - } else if ("ODU4".equals(prefix)) { + } else if ("ODTU4".equals(prefix)) { assertEquals("otn link should be between 2 nodes of protocol layers ODU", LayerProtocolName.ODU.getName(), link.getLayerProtocolName().get(0).getName()); } diff --git a/tapi/src/test/java/org/opendaylight/transportpce/tapi/topology/TapiTopologyImplTest.java b/tapi/src/test/java/org/opendaylight/transportpce/tapi/topology/TapiTopologyImplTest.java index 241f27591..96d709e01 100644 --- a/tapi/src/test/java/org/opendaylight/transportpce/tapi/topology/TapiTopologyImplTest.java +++ b/tapi/src/test/java/org/opendaylight/transportpce/tapi/topology/TapiTopologyImplTest.java @@ -237,7 +237,7 @@ public class TapiTopologyImplTest extends AbstractTest { Uuid tp4Uuid = new Uuid(UUID.nameUUIDFromBytes("SPDR-SC1-XPDR1+iOTSi+XPDR1-NETWORK1" .getBytes(Charset.forName("UTF-8"))).toString()); Uuid link1Uuid = - new Uuid(UUID.nameUUIDFromBytes("ODU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1" + new Uuid(UUID.nameUUIDFromBytes("ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1" .getBytes(Charset.forName("UTF-8"))).toString()); Uuid link2Uuid = new Uuid(UUID.nameUUIDFromBytes("OTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1" @@ -248,7 +248,7 @@ public class TapiTopologyImplTest extends AbstractTest { .sorted((l1, l2) -> l1.getUuid().getValue().compareTo(l2.getUuid().getValue())) .collect(Collectors.toList()); checkOtnLink(links.get(0), topoUuid, node1Uuid, node2Uuid, tp1Uuid, tp2Uuid, link1Uuid, - "ODU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"); + "ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"); checkOtnLink(links.get(1), topoUuid, node3Uuid, node4Uuid, tp3Uuid, tp4Uuid, link2Uuid, "OTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1"); } @@ -263,7 +263,7 @@ public class TapiTopologyImplTest extends AbstractTest { if ("OTU4".equals(prefix)) { assertEquals("Available capacity -total size value should be 0", Uint64.valueOf(0), link.getAvailableCapacity().getTotalSize().getValue()); - } else if ("ODU4".equals(prefix)) { + } else if ("ODTU4".equals(prefix)) { assertEquals("Available capacity -total size value should be 100 000", Uint64.valueOf(100000), link.getAvailableCapacity().getTotalSize().getValue()); } @@ -274,7 +274,7 @@ public class TapiTopologyImplTest extends AbstractTest { if ("OTU4".equals(prefix)) { assertEquals("otn link should be between 2 nodes of protocol layers PHOTONIC_MEDIA", LayerProtocolName.PHOTONICMEDIA.getName(), link.getLayerProtocolName().get(0).getName()); - } else if ("ODU4".equals(prefix)) { + } else if ("ODTU4".equals(prefix)) { assertEquals("otn link should be between 2 nodes of protocol layers ODU", LayerProtocolName.ODU.getName(), link.getLayerProtocolName().get(0).getName()); } diff --git a/tapi/src/test/resources/otn-topology.xml b/tapi/src/test/resources/otn-topology.xml index 0134fca52..e02d8d031 100644 --- a/tapi/src/test/resources/otn-topology.xml +++ b/tapi/src/test/resources/otn-topology.xml @@ -1452,7 +1452,7 @@ OTU4 - ODU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1 + ODTU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1 SPDR-SC1-XPDR1 XPDR1-NETWORK1 @@ -1461,7 +1461,7 @@ 0 OTN-LINK inService - ODU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1 + ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1 inService XPDR1-NETWORK1 @@ -1470,7 +1470,7 @@ ODTU4 - ODU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1 + ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1 SPDR-SA1-XPDR1 XPDR1-NETWORK1 @@ -1479,7 +1479,7 @@ 0 OTN-LINK inService - ODU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1 + ODTU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1 inService XPDR1-NETWORK1 diff --git a/tests/transportpce_tests/2.2.1/test_otn_end2end.py b/tests/transportpce_tests/2.2.1/test_otn_end2end.py index 6e04ca93e..9ffbd62f0 100644 --- a/tests/transportpce_tests/2.2.1/test_otn_end2end.py +++ b/tests/transportpce_tests/2.2.1/test_otn_end2end.py @@ -542,8 +542,8 @@ class TransportPCEtesting(unittest.TestCase): link['org-openroadm-otn-network-topology:available-bandwidth'], 0) self.assertEqual( link['org-openroadm-otn-network-topology:used-bandwidth'], 100000) - elif (linkId in ('ODU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1', - 'ODU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1')): + elif (linkId in ('ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1', + 'ODTU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1')): self.assertEqual( link['org-openroadm-otn-network-topology:available-bandwidth'], 100000) self.assertEqual( @@ -553,8 +553,8 @@ class TransportPCEtesting(unittest.TestCase): self.assertEqual( link['org-openroadm-common-network:link-type'], 'OTN-LINK') self.assertIn(link['org-openroadm-common-network:opposite-link'], - ['ODU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1', - 'ODU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1']) + ['ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1', + 'ODTU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1']) else: self.fail("this link should not exist")