X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=pce%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Fpce%2FPcePathDescription.java;h=27fd931e6dd4be1923192eb3df1b3d393242dd94;hb=refs%2Fchanges%2F46%2F100646%2F27;hp=c5967f278a1226b4831f340a6e09d0a8b78b8084;hpb=feb80c05128f6292a0c9735db4e7e542fbac1999;p=transportpce.git diff --git a/pce/src/main/java/org/opendaylight/transportpce/pce/PcePathDescription.java b/pce/src/main/java/org/opendaylight/transportpce/pce/PcePathDescription.java index c5967f278..27fd931e6 100644 --- a/pce/src/main/java/org/opendaylight/transportpce/pce/PcePathDescription.java +++ b/pce/src/main/java/org/opendaylight/transportpce/pce/PcePathDescription.java @@ -16,25 +16,26 @@ import org.opendaylight.transportpce.common.StringConstants; import org.opendaylight.transportpce.common.fixedflex.GridConstant; import org.opendaylight.transportpce.pce.networkanalyzer.PceLink; import org.opendaylight.transportpce.pce.networkanalyzer.PceResult; -import org.opendaylight.yang.gen.v1.http.org.openroadm.common.optical.channel.types.rev200529.FrequencyTHz; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.optical.channel.types.rev211210.FrequencyTHz; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.types.rev181019.ModulationFormat; -import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201210.path.description.AToZDirectionBuilder; -import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201210.path.description.ZToADirectionBuilder; -import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201210.path.description.atoz.direction.AToZ; -import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201210.path.description.atoz.direction.AToZBuilder; -import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201210.path.description.atoz.direction.AToZKey; -import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201210.path.description.ztoa.direction.ZToA; -import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201210.path.description.ztoa.direction.ZToABuilder; -import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201210.path.description.ztoa.direction.ZToAKey; -import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201210.pce.resource.Resource; -import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201210.pce.resource.ResourceBuilder; -import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201210.pce.resource.resource.resource.LinkBuilder; -import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201210.pce.resource.resource.resource.NodeBuilder; -import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201210.pce.resource.resource.resource.TerminationPoint; -import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201210.pce.resource.resource.resource.TerminationPointBuilder; +import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.common.types.rev181130.OpucnTribSlotDef; +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.AToZDirectionBuilder; +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.ZToADirectionBuilder; +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.atoz.direction.AToZ; +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.atoz.direction.AToZBuilder; +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.atoz.direction.AToZKey; +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.ztoa.direction.ZToA; +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.ztoa.direction.ZToABuilder; +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.ztoa.direction.ZToAKey; +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.pce.resource.Resource; +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.pce.resource.ResourceBuilder; +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.pce.resource.resource.resource.LinkBuilder; +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.pce.resource.resource.resource.NodeBuilder; +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.pce.resource.resource.resource.TerminationPoint; +import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.pce.resource.resource.resource.TerminationPointBuilder; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.LinkId; -import org.opendaylight.yangtools.yang.common.Uint16; +import org.opendaylight.yangtools.yang.common.Decimal64; import org.opendaylight.yangtools.yang.common.Uint32; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -93,31 +94,36 @@ public class PcePathDescription { .setAToZ(atozMap); switch (rc.getServiceType()) { case StringConstants.SERVICE_TYPE_400GE: + case StringConstants.SERVICE_TYPE_OTUC2: + case StringConstants.SERVICE_TYPE_OTUC3: case StringConstants.SERVICE_TYPE_OTUC4: case StringConstants.SERVICE_TYPE_100GE_T: case StringConstants.SERVICE_TYPE_OTU4: - atoZDirectionBldr.setAToZMaxFrequency(new FrequencyTHz(rc.getMaxFreq())); - atoZDirectionBldr.setAToZMinFrequency(new FrequencyTHz(rc.getMinFreq())); + atoZDirectionBldr.setAToZMaxFrequency(new FrequencyTHz(Decimal64.valueOf(rc.getMaxFreq()))); + atoZDirectionBldr.setAToZMinFrequency(new FrequencyTHz(Decimal64.valueOf(rc.getMinFreq()))); atoZDirectionBldr.setAToZWavelengthNumber(Uint32.valueOf(rc.getResultWavelength())); break; case StringConstants.SERVICE_TYPE_100GE_M: + case StringConstants.SERVICE_TYPE_100GE_S: case StringConstants.SERVICE_TYPE_10GE: case StringConstants.SERVICE_TYPE_1GE: case StringConstants.SERVICE_TYPE_ODU4: + case StringConstants.SERVICE_TYPE_ODUC2: + case StringConstants.SERVICE_TYPE_ODUC3: case StringConstants.SERVICE_TYPE_ODUC4: - if (rc.getResultTribSlot() != null && rc.getResultTribPort() != null) { - @SuppressWarnings("unchecked") - List tribSlotList = (List) rc.getResultTribSlot().values().toArray()[0]; + if (rc.getResultTribPortTribSlot() != null && rc.getResultTribPortTribSlot().get(0) != null + && rc.getResultTribPortTribSlot().get(1) != null) { atoZDirectionBldr.setAToZWavelengthNumber(Uint32.valueOf(0)) - .setTribPortNumber(Uint16.valueOf(rc.getResultTribPort().values().toArray()[0].toString())) - .setTribSlotNumber(tribSlotList.get(0)); + .setMinTribSlot(rc.getResultTribPortTribSlot().get(0)) + .setMaxTribSlot(rc.getResultTribPortTribSlot().get(1)); } else { - LOG.error("Trib port and trib slot number should be present"); - atoZDirectionBldr.setTribSlotNumber(Uint16.valueOf(0)).setTribPortNumber(Uint16.valueOf(0)); + LOG.warn("Trib port and trib slot number should be present"); + atoZDirectionBldr.setMinTribSlot(new OpucnTribSlotDef("0.0")) + .setMaxTribSlot(new OpucnTribSlotDef("0.0")); } break; default: - LOG.warn("unknown service type : unable to set Min/Max frequencies"); + LOG.warn("unknown service type : unable to set Min/Max frequencies or trib-port/trib-slot"); break; } return atoZDirectionBldr; @@ -135,26 +141,32 @@ public class PcePathDescription { .setZToA(ztoaMap); switch (rc.getServiceType()) { case StringConstants.SERVICE_TYPE_400GE: + case StringConstants.SERVICE_TYPE_OTUC2: + case StringConstants.SERVICE_TYPE_OTUC3: case StringConstants.SERVICE_TYPE_OTUC4: case StringConstants.SERVICE_TYPE_100GE_T: case StringConstants.SERVICE_TYPE_OTU4: - ztoADirectionBldr.setZToAMaxFrequency(new FrequencyTHz(rc.getMaxFreq())); - ztoADirectionBldr.setZToAMinFrequency(new FrequencyTHz(rc.getMinFreq())); + ztoADirectionBldr.setZToAMaxFrequency(new FrequencyTHz(Decimal64.valueOf(rc.getMaxFreq()))); + ztoADirectionBldr.setZToAMinFrequency(new FrequencyTHz(Decimal64.valueOf(rc.getMinFreq()))); ztoADirectionBldr.setZToAWavelengthNumber(Uint32.valueOf(rc.getResultWavelength())); break; case StringConstants.SERVICE_TYPE_100GE_M: + case StringConstants.SERVICE_TYPE_100GE_S: case StringConstants.SERVICE_TYPE_10GE: case StringConstants.SERVICE_TYPE_1GE: case StringConstants.SERVICE_TYPE_ODU4: - if (rc.getResultTribSlot() != null && rc.getResultTribPort() != null) { - @SuppressWarnings("unchecked") - List tribSlotList = (List) rc.getResultTribSlot().values().toArray()[0]; + case StringConstants.SERVICE_TYPE_ODUC2: + case StringConstants.SERVICE_TYPE_ODUC3: + case StringConstants.SERVICE_TYPE_ODUC4: + if (rc.getResultTribPortTribSlot() != null && rc.getResultTribPortTribSlot().get(0) != null + && rc.getResultTribPortTribSlot().get(1) != null) { ztoADirectionBldr.setZToAWavelengthNumber(Uint32.valueOf(0)) - .setTribPortNumber(Uint16.valueOf(rc.getResultTribPort().values().toArray()[0].toString())) - .setTribSlotNumber(tribSlotList.get(0)); + .setMinTribSlot(rc.getResultTribPortTribSlot().get(0)) + .setMaxTribSlot(rc.getResultTribPortTribSlot().get(1)); } else { - LOG.error("Trib port and trib slot number should be present"); - ztoADirectionBldr.setTribSlotNumber(Uint16.valueOf(0)).setTribPortNumber(Uint16.valueOf(0)); + LOG.warn("Trib port and trib slot number should be present"); + ztoADirectionBldr.setMinTribSlot(new OpucnTribSlotDef("0.0")) + .setMaxTribSlot(new OpucnTribSlotDef("0.0")); } break; default: @@ -187,7 +199,7 @@ public class PcePathDescription { for (PceLink pcelink : path) { String srcName = pcelink.getSourceId().getValue(); // Nodes - org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201210.pce + org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.pce .resource.resource.resource.Node sourceNode = new NodeBuilder() .setNodeId(srcName) .build(); @@ -200,7 +212,7 @@ public class PcePathDescription { atozMap.put(srcResource.key(),srcResource); // source TP - tpName = pcelink.getSourceTP().toString(); + tpName = pcelink.getSourceTP().getValue(); stp = new TerminationPointBuilder() .setTpNodeId(srcName).setTpId(tpName) .build(); @@ -214,7 +226,7 @@ public class PcePathDescription { String linkName = pcelink.getLinkId().getValue(); // Link - org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201210.pce + org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.pce .resource.resource.resource.Link atozLink = new LinkBuilder() .setLinkId(linkName) .build(); @@ -228,7 +240,7 @@ public class PcePathDescription { String destName = pcelink.getDestId().getValue(); // target TP - tpName = pcelink.getDestTP().toString(); + tpName = pcelink.getDestTP().getValue(); TerminationPoint dtp = new TerminationPointBuilder() .setTpNodeId(destName).setTpId(tpName) .build(); @@ -240,7 +252,7 @@ public class PcePathDescription { index += 1; atozMap.put(ttpResource.key(),ttpResource); - org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201210.pce + org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.pce .resource.resource.resource.Node targetNode = new NodeBuilder() .setNodeId(destName) .build(); @@ -300,7 +312,7 @@ public class PcePathDescription { // Nodes - org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201210.pce + org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.pce .resource.resource.resource.Node sourceNode = new NodeBuilder() .setNodeId(srcName).build(); @@ -313,7 +325,7 @@ public class PcePathDescription { ztoaList.put(srcResource.key(),srcResource); // source TP - tpName = pcelink.getSourceTP().toString(); + tpName = pcelink.getSourceTP().getValue(); stp = new TerminationPointBuilder() .setTpNodeId(srcName).setTpId(tpName) .build(); @@ -327,7 +339,7 @@ public class PcePathDescription { String linkName = pcelink.getLinkId().getValue(); // Link - org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201210.pce + org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.pce .resource.resource.resource.Link ztoaLink = new LinkBuilder() .setLinkId(linkName).build(); @@ -340,7 +352,7 @@ public class PcePathDescription { String destName = pcelink.getDestId().getValue(); // target TP - tpName = pcelink.getDestTP().toString(); + tpName = pcelink.getDestTP().getValue(); TerminationPoint ttp = new TerminationPointBuilder() .setTpNodeId(destName).setTpId(tpName).build(); @@ -352,7 +364,7 @@ public class PcePathDescription { ztoaList.put(ttpResource.key(),ttpResource); - org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev201210.pce + org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.pce .resource.resource.resource.Node targetNode = new NodeBuilder() .setNodeId(destName).build(); // Target Resource