private static final Map<String, Class<? extends SupportedIfCapability>> SERVICE_TYPE_ETH_CLASS_MAP = Map.of(
StringConstants.SERVICE_TYPE_1GE, If1GEODU0.class,
StringConstants.SERVICE_TYPE_10GE, If10GEODU2e.class,
- StringConstants.SERVICE_TYPE_100GE_T, If100GEODU4.class,
StringConstants.SERVICE_TYPE_100GE_M, If100GEODU4.class,
StringConstants.SERVICE_TYPE_100GE_S, If100GEODU4.class);
private static final Map<String, Integer> SERVICE_TYPE_ETH_TS_NB_MAP = Map.of(
node.getNodeId().getValue());
continue;
}
- // TODO what about SERVICE_TYPE_100GE_T ?
} else {
LOG.error("TP {} of {} does not allow any termination creation",
tp.getTpId().getValue(), node.getNodeId().getValue());
break;
case XPONDERCLIENT:
- if (SERVICE_TYPE_ETH_CLASS_MAP.containsKey(otnServiceType)
- && !StringConstants.SERVICE_TYPE_100GE_T.equals(this.otnServiceType)) {
- // TODO should we really exclude SERVICE_TYPE_100GE_T ?
+ if (SERVICE_TYPE_ETH_CLASS_MAP.containsKey(otnServiceType)) {
if (tp.augmentation(TerminationPoint1.class) == null) {
continue;
}
}
}
this.valid = SERVICE_TYPE_ODU_LIST.contains(this.otnServiceType)
- || SERVICE_TYPE_ETH_TS_NB_MAP.containsKey(this.otnServiceType)
- && isAzOrIntermediateAvl(mode, null, availableXpdrClientTps, availableXpdrNWTps)
- || StringConstants.SERVICE_TYPE_100GE_S.equals(this.otnServiceType)
- && isAzOrIntermediateAvl(mode, availableXpdrClientTps, availableXpdrClientTps, availableXpdrNWTps);
- //TODO very similar to isOtnServiceTypeValid method
- // check whether the different treatment for SERVICE_TYPE_100GE_S here is appropriate or not
+ || SERVICE_TYPE_ETH_CLASS_MAP.containsKey(this.otnServiceType)
+ && isAzOrIntermediateAvl(availableXpdrClientTps, availableXpdrNWTps,
+ StringConstants.SERVICE_TYPE_100GE_S.equals(this.otnServiceType)
+ ? availableXpdrClientTps
+ : null);
+ //TODO check whether it makes sense to pass twice availableXpdrClientTps tp isAzOrIntermediateAvl
+ // and to differentiate SERVICE_TYPE_100GE_S case
+ // better pass otnServiceType -> this should probably be refactored
+ }
+
+ private boolean isAzOrIntermediateAvl(List<TpId> clientTps, List<TpId> netwTps, List<TpId> clientTps0) {
+ switch (modeType) {
+ case "intermediate":
+ return checkSwPool(clientTps0, netwTps, 0, 2);
+
+ case "AZ":
+ return checkSwPool(clientTps, netwTps, 1, 1);
+
+ default:
+ LOG.error("unknown mode type {}", modeType);
+ return false;
+ }
}
private boolean checkSwPool(List<TpId> clientTps, List<TpId> netwTps, int nbClient, int nbNetw) {
}
public boolean isValid() {
- if (isNotValid(this)) {
+ if (nodeId == null || nodeType == null
+ || this.getSupNetworkNodeId() == null || this.getSupClliNodeId() == null) {
LOG.error("PceNode: one of parameters is not populated : nodeId, node type, supporting nodeId");
valid = false;
}
return valid;
}
- private boolean isNotValid(final PceOtnNode poNode) {
- return poNode == null || poNode.nodeId == null || poNode.nodeType == null
- || poNode.getSupNetworkNodeId() == null || poNode.getSupClliNodeId() == null;
- }
-
- public boolean isPceOtnNodeValid(final PceOtnNode pceOtnNode) {
- if (isNotValid(pceOtnNode) || pceOtnNode.otnServiceType == null) {
- LOG.error(
- "PceOtnNode: one of parameters is not populated : nodeId, node type, supporting nodeId, otnServiceType"
- );
- return false;
- }
- if (VALID_NODETYPES_LIST.contains(pceOtnNode.nodeType)) {
- return isOtnServiceTypeValid(pceOtnNode);
- }
- LOG.error("PceOtnNode node type: node type is not one of MUXPDR or SWITCH or TPDR");
- return false;
- }
-
- private boolean isOtnServiceTypeValid(final PceOtnNode poNode) {
- if (poNode.modeType == null) {
- return false;
- }
- //Todo refactor Strings (mode and otnServiceType ) to enums
- if (poNode.otnServiceType.equals(StringConstants.SERVICE_TYPE_ODU4)
- && poNode.modeType.equals("AZ")) {
- return true;
- }
- return (poNode.otnServiceType.equals(StringConstants.SERVICE_TYPE_10GE)
- || poNode.otnServiceType.equals(StringConstants.SERVICE_TYPE_1GE)
- || poNode.otnServiceType.equals(StringConstants.SERVICE_TYPE_100GE_S))
- && isAzOrIntermediateAvl(poNode.modeType, null, poNode.availableXpdrClientTps, poNode.availableXpdrNWTps);
- //TODO SERVICE_TYPE_ETH_TS_NB_MAP.containsKey(this.otnServiceType) might be more appropriate here
- // but only SERVICE_TYPE_100GE_S is managed and not SERVICE_TYPE_100GE_M and _T
- }
-
- private boolean isAzOrIntermediateAvl(
- String mdType, List<TpId> clientTps0, List<TpId> clientTps, List<TpId> netwTps) {
- return mdType.equals("intermediate") && checkSwPool(clientTps0, netwTps, 0, 2)
- || mdType.equals("AZ") && checkSwPool(clientTps, netwTps, 1, 1);
- }
-
@Override
public void addOutgoingLink(PceLink outLink) {
this.outgoingLinks.add(outLink);