X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=networkmodel%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Fnetworkmodel%2Futil%2FOpenRoadmOtnTopology.java;h=dd5325563b63418553daa1dddc46c4217a871d8a;hb=e458fb786a55cfdfe85e25a2083b67e9d38e21a9;hp=08428537b08a78f2a91aafe21bf5525c7db2e8bf;hpb=c8c92c9ac1c175fe200dd347081a8395820798c8;p=transportpce.git 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 08428537b..dd5325563 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 @@ -18,8 +18,8 @@ import org.eclipse.jdt.annotation.Nullable; import org.opendaylight.transportpce.common.NetworkUtils; import org.opendaylight.transportpce.networkmodel.dto.OtnTopoNode; import org.opendaylight.transportpce.networkmodel.dto.TopologyShard; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210310.network.Nodes; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210310.network.nodes.Mapping; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210426.mapping.Mapping; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210426.network.Nodes; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State; import org.opendaylight.yang.gen.v1.http.org.openroadm.device.types.rev191129.XpdrNodeTypes; import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates; @@ -36,9 +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; @@ -55,22 +58,11 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev2 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev200529.networks.network.node.termination.point.TpSupportedInterfaces; import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev200529.networks.network.node.termination.point.TpSupportedInterfacesBuilder; import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev200529.networks.network.node.termination.point.XpdrTpPortConnectionAttributesBuilder; -import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev200327.If100GE; -import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev200327.If100GEODU4; -import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev200327.If10GE; -import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev200327.If10GEODU2; -import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev200327.If10GEODU2e; -import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev200327.If1GE; -import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev200327.If1GEODU0; -import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev200327.If400GE; -import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev200327.IfOCH; -import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev200327.IfOCHOTU4ODU4; -import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev200327.IfOTUCnODUCn; import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev200327.SupportedIfCapability; import org.opendaylight.yang.gen.v1.http.org.openroadm.switching.pool.types.rev191129.SwitchingPoolTypes; import org.opendaylight.yang.gen.v1.http.org.openroadm.xponder.rev200529.xpdr.otn.tp.attributes.OdtuTpnPool; import org.opendaylight.yang.gen.v1.http.org.openroadm.xponder.rev200529.xpdr.otn.tp.attributes.OdtuTpnPoolBuilder; -import org.opendaylight.yang.gen.v1.http.transportpce.topology.rev201019.OtnLinkType; +import org.opendaylight.yang.gen.v1.http.transportpce.topology.rev210511.OtnLinkType; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NetworkId; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NodeId; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node; @@ -132,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().getValue(), + suppOtuLinks.get(0).getDestination().getDestNode().getValue(), + suppOtuLinks.get(0).getDestination().getDestTp().getValue(), + 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); @@ -166,14 +162,25 @@ public final class OpenRoadmOtnTopology { } } - public static TopologyShard updateOtnLinks(List suppOdu4Links, List oldTps, - String 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 ("1G".equals(serviceRate)) { - 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(); @@ -195,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()) { @@ -206,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); @@ -227,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<>(); - org.opendaylight.yang.gen.v1.http.transportpce.topology.rev201019.Link1 tpceLink1 - = new org.opendaylight.yang.gen.v1.http.transportpce.topology.rev201019.Link1Builder() + 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( @@ -260,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( @@ -286,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( @@ -295,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) @@ -313,36 +341,22 @@ public final class OpenRoadmOtnTopology { return tpBldr.addAugmentation(otnTp1Bldr.setXpdrTpPortConnectionAttributes(xtpcaBldr.build()).build()).build(); } - private static TerminationPoint updateNodeTpTsPool(TerminationPoint tp, String serviceRate, Short tribPortNb, - Short tribSlotNb, boolean isDeletion) { + private static TerminationPoint updateNodeTpTsPool(TerminationPoint tp, Uint32 serviceRate, Short tribPortNb, + 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) { - case "1G": - if (isDeletion) { - tsPool.add(Uint16.valueOf(tribSlotNb)); - } else { - tsPool.remove(Uint16.valueOf(tribSlotNb)); - } - break; - case "10G": - 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; @@ -357,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)); @@ -608,8 +635,8 @@ public final class OpenRoadmOtnTopology { XpdrTpPortConnectionAttributesBuilder xtpcaBldr = new XpdrTpPortConnectionAttributesBuilder(); for (Class supInterCapa : mapping.getSupportedInterfaceCapability()) { SupportedInterfaceCapability supIfCapa = new SupportedInterfaceCapabilityBuilder() - .withKey(new SupportedInterfaceCapabilityKey(convertSupIfCapa(supInterCapa))) - .setIfCapType(convertSupIfCapa(supInterCapa)) + .withKey(new SupportedInterfaceCapabilityKey(supInterCapa)) + .setIfCapType(supInterCapa) .build(); supIfMap.put(supIfCapa.key(), supIfCapa); } @@ -625,16 +652,17 @@ public final class OpenRoadmOtnTopology { LOG.warn("mapping {} of node {} has no if-cap-type", mapping.getLogicalConnectionPoint(), node.getNodeId()); } - org.opendaylight.yang.gen.v1.http.transportpce.topology.rev201019.TerminationPoint1Builder tpceTp1Bldr = - new org.opendaylight.yang.gen.v1.http.transportpce.topology.rev201019.TerminationPoint1Builder(); + org.opendaylight.yang.gen.v1.http.transportpce.topology.rev210511.TerminationPoint1Builder tpceTp1Bldr = + new org.opendaylight.yang.gen.v1.http.transportpce.topology.rev210511.TerminationPoint1Builder(); TpId tpId = new TpId(mapping.getLogicalConnectionPoint()); - setclientNwTpAttr(tpMap, node, tpId, tpType, otnTp1Bldr.build(), tpceTp1Bldr); + setclientNwTpAttr(tpMap, node, tpId, tpType, otnTp1Bldr.build(), tpceTp1Bldr, mapping); } } private static void setclientNwTpAttr(Map tpMap, OtnTopoNode node, TpId tpId, OpenroadmTpType tpType, TerminationPoint1 otnTp1, - org.opendaylight.yang.gen.v1.http.transportpce.topology.rev201019.TerminationPoint1Builder tpceTp1Bldr) { + org.opendaylight.yang.gen.v1.http.transportpce.topology.rev210511.TerminationPoint1Builder tpceTp1Bldr, + Mapping mapping) { switch (tpType) { case XPONDERNETWORK: if (node.getXpdrNetConnectionMap().get(tpId.getValue()) != null) { @@ -643,16 +671,17 @@ public final class OpenRoadmOtnTopology { SupportingTerminationPoint stp = new SupportingTerminationPointBuilder() .setNetworkRef(new NetworkId(NetworkUtils.OVERLAY_NETWORK_ID)) .setNodeRef(new NodeId(node.getNodeId() + XPDR + node.getXpdrNb())) - .setTpRef(tpId.getValue()) + .setTpRef(tpId) .build(); - TerminationPoint ietfTpNw = buildIetfTp(tpceTp1Bldr, otnTp1, tpType, tpId, Map.of(stp.key(), stp)); + TerminationPoint ietfTpNw = buildIetfTp(tpceTp1Bldr, otnTp1, tpType, tpId, Map.of(stp.key(), stp), + mapping); tpMap.put(ietfTpNw.key(),ietfTpNw); break; case XPONDERCLIENT: if (node.getXpdrCliConnectionMap().get(tpId.getValue()) != null) { tpceTp1Bldr.setAssociatedConnectionMapPort(node.getXpdrCliConnectionMap().get(tpId.getValue())); } - TerminationPoint ietfTpCl = buildIetfTp(tpceTp1Bldr, otnTp1, tpType, tpId, null); + TerminationPoint ietfTpCl = buildIetfTp(tpceTp1Bldr, otnTp1, tpType, tpId, null, mapping); tpMap.put(ietfTpCl.key(),ietfTpCl); break; default: @@ -669,6 +698,8 @@ public final class OpenRoadmOtnTopology { return ODU4.class; case "If1GEODU0": return ODU0.class; + case "If10GEODU2": + return ODU2.class; case "If10GEODU2e": return ODU2e.class; default: @@ -676,36 +707,6 @@ public final class OpenRoadmOtnTopology { } } - private static Class convertSupIfCapa(Class ifCapType) { - switch (ifCapType.getSimpleName()) { - case "IfOTUCnODUCn": - return IfOTUCnODUCn.class; - case "IfOCHOTU4ODU4": - return IfOCHOTU4ODU4.class; - case "IfOCH": - return IfOCH.class; - case "If100GEODU4": - return If100GEODU4.class; - case "If10GEODU2e": - return If10GEODU2e.class; - case "If10GEODU2": - return If10GEODU2.class; - case "If1GEODU0": - return If1GEODU0.class; - case "If400GE": - return If400GE.class; - case "If100GE": - return If100GE.class; - case "If10GE": - return If10GE.class; - case "If1GE": - return If1GE.class; - default: - return null; - } - } - private static Map createSupportingNodes(OtnTopoNode node) { SupportingNode suppNode1 = new SupportingNodeBuilder() .setNetworkRef(new NetworkId(NetworkUtils.UNDERLAY_NETWORK_ID)) @@ -733,9 +734,9 @@ public final class OpenRoadmOtnTopology { } private static TerminationPoint buildIetfTp( - org.opendaylight.yang.gen.v1.http.transportpce.topology.rev201019.TerminationPoint1Builder tpceTp1Bldr, + org.opendaylight.yang.gen.v1.http.transportpce.topology.rev210511.TerminationPoint1Builder tpceTp1Bldr, TerminationPoint1 otnTp1, OpenroadmTpType tpType, TpId tpId, - Map supportTpMap) { + Map supportTpMap, Mapping mapping) { TerminationPointBuilder ietfTpBldr = new TerminationPointBuilder(); if (tpceTp1Bldr.getAssociatedConnectionMapPort() != null) { @@ -747,14 +748,20 @@ public final class OpenRoadmOtnTopology { org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.TerminationPoint1 ocnTp = new org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev200529.TerminationPoint1Builder() .setTpType(tpType) - .setAdministrativeState(AdminStates.InService) - .setOperationalState(State.InService) + .setAdministrativeState(TopologyUtils.setNetworkAdminState(mapping.getPortAdminState())) + .setOperationalState(TopologyUtils.setNetworkOperState(mapping.getPortOperState())) .build(); - ietfTpBldr.setTpId(tpId) - .withKey(new TerminationPointKey(tpId)) - .addAugmentation(otnTp1) - .addAugmentation(ocnTp); - return ietfTpBldr.build(); + return ietfTpBldr.setTpId(tpId) + .withKey(new TerminationPointKey(tpId)) + .addAugmentation(otnTp1) + .addAugmentation(ocnTp) + .build(); + } + + private static String formatNodeName(String nodeName, String tpName) { + return nodeName.contains(XPDR) + ? nodeName + : new StringBuilder(nodeName).append("-").append(tpName.split("-")[0]).toString(); } }