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.rev201012.network.Nodes;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev201012.network.nodes.Mapping;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210315.mapping.Mapping;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210315.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;
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.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.OduRateIdentity;
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;
for (Mapping mapping : mappings) {
// openroadm-otn-topoology augmentation
Map<SupportedInterfaceCapabilityKey, SupportedInterfaceCapability> supIfMap = new HashMap<>();
- for (Class<? extends SupportedIfCapability> supInterCapa : mapping.getSupportedInterfaceCapability()) {
- SupportedInterfaceCapability supIfCapa = new SupportedInterfaceCapabilityBuilder()
- .withKey(new SupportedInterfaceCapabilityKey(convertSupIfCapa(supInterCapa)))
- .setIfCapType(convertSupIfCapa(supInterCapa))
+ TerminationPoint1Builder otnTp1Bldr = new TerminationPoint1Builder();
+ if (mapping.getSupportedInterfaceCapability() != null) {
+ XpdrTpPortConnectionAttributesBuilder xtpcaBldr = new XpdrTpPortConnectionAttributesBuilder();
+ for (Class<? extends SupportedIfCapability> supInterCapa : mapping.getSupportedInterfaceCapability()) {
+ SupportedInterfaceCapability supIfCapa = new SupportedInterfaceCapabilityBuilder()
+ .withKey(new SupportedInterfaceCapabilityKey(convertSupIfCapa(supInterCapa)))
+ .setIfCapType(convertSupIfCapa(supInterCapa))
+ .build();
+ supIfMap.put(supIfCapa.key(), supIfCapa);
+ }
+ TpSupportedInterfaces tpSupIf = new TpSupportedInterfacesBuilder()
+ .setSupportedInterfaceCapability(supIfMap)
.build();
- supIfMap.put(supIfCapa.key(), supIfCapa);
- }
- TpSupportedInterfaces tpSupIf = new TpSupportedInterfacesBuilder()
- .setSupportedInterfaceCapability(supIfMap)
- .build();
- XpdrTpPortConnectionAttributesBuilder xtpcaBldr = new XpdrTpPortConnectionAttributesBuilder();
- if (withRate) {
- xtpcaBldr.setRate(fixRate(mapping.getSupportedInterfaceCapability().get(0)));
+ otnTp1Bldr.setTpSupportedInterfaces(tpSupIf);
+ if (withRate) {
+ xtpcaBldr.setRate(fixRate(mapping.getSupportedInterfaceCapability().get(0)));
+ otnTp1Bldr.setXpdrTpPortConnectionAttributes(xtpcaBldr.build());
+ }
+ } else {
+ LOG.warn("mapping {} of node {} has no if-cap-type", mapping.getLogicalConnectionPoint(),
+ node.getNodeId());
}
- TerminationPoint1 otnTp1 = new TerminationPoint1Builder()
- .setTpSupportedInterfaces(tpSupIf)
- .setXpdrTpPortConnectionAttributes(xtpcaBldr.build())
- .build();
org.opendaylight.yang.gen.v1.http.transportpce.topology.rev201019.TerminationPoint1Builder tpceTp1Bldr =
new org.opendaylight.yang.gen.v1.http.transportpce.topology.rev201019.TerminationPoint1Builder();
TpId tpId = new TpId(mapping.getLogicalConnectionPoint());
- setclientNwTpAttr(tpMap, node, tpId, tpType, otnTp1, tpceTp1Bldr);
+ setclientNwTpAttr(tpMap, node, tpId, tpType, otnTp1Bldr.build(), tpceTp1Bldr, mapping);
}
}
private static void setclientNwTpAttr(Map<TerminationPointKey, TerminationPoint> 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.rev201019.TerminationPoint1Builder tpceTp1Bldr,
+ Mapping mapping) {
switch (tpType) {
case XPONDERNETWORK:
if (node.getXpdrNetConnectionMap().get(tpId.getValue()) != null) {
.setNodeRef(new NodeId(node.getNodeId() + XPDR + node.getXpdrNb()))
.setTpRef(tpId.getValue())
.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:
return ODU4.class;
case "If1GEODU0":
return ODU0.class;
+ case "If10GEODU2":
+ return ODU2.class;
case "If10GEODU2e":
return ODU2e.class;
default:
private static Class<? extends SupportedIfCapability> convertSupIfCapa(Class<? extends
SupportedIfCapability> ifCapType) {
switch (ifCapType.getSimpleName()) {
- case "If100GEODU4":
- return If100GEODU4.class;
+ case "IfOTUCnODUCn":
+ return IfOTUCnODUCn.class;
case "IfOCHOTU4ODU4":
return IfOCHOTU4ODU4.class;
- case "If1GEODU0":
- return If1GEODU0.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;
- case "IfOCH":
- return IfOCH.class;
default:
return null;
}
private static TerminationPoint buildIetfTp(
org.opendaylight.yang.gen.v1.http.transportpce.topology.rev201019.TerminationPoint1Builder tpceTp1Bldr,
TerminationPoint1 otnTp1, OpenroadmTpType tpType, TpId tpId,
- Map<SupportingTerminationPointKey, SupportingTerminationPoint> supportTpMap) {
+ Map<SupportingTerminationPointKey, SupportingTerminationPoint> supportTpMap, Mapping mapping) {
TerminationPointBuilder ietfTpBldr = new TerminationPointBuilder();
if (tpceTp1Bldr.getAssociatedConnectionMapPort() != null) {
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)