- if (port.getPortQual() == null) {
- LOG.warn("PortQual was not found for port {} on circuit pack: {}",
- port.getPortName(), circuitPackName);
- continue;
- }
-
- switch (port.getPortQual()) {
-
- case XpdrClient:
- case SwitchClient:
- String lcp0 =
- createXpdrLogicalConnectionPort(xponderNb , client, StringConstants.CLIENT_TOKEN);
- lcpMap.put(circuitPackName + '+' + port.getPortName(), lcp0);
- mappingMap.put(lcp0,
- createXpdrMappingObject(nodeId, port, circuitPackName, lcp0, null, null, null, null));
- client++;
- //continue;
- break;
-
- case XpdrNetwork:
- case SwitchNetwork:
- if (port.getPortDirection().getIntValue() == Direction.Bidirectional.getIntValue()) {
- String lcp =
- createXpdrLogicalConnectionPort(xponderNb , line, StringConstants.NETWORK_TOKEN);
- lcpMap.put(circuitPackName + '+' + port.getPortName(), lcp);
- mappingMap.put(lcp,
- createXpdrMappingObject(nodeId, port, circuitPackName, lcp, null, null, null,
- xponderType));
- line++;
- continue;
- }
-
- if (!checkPartnerPortNotNull(port)) {
- LOG.warn("Error in the configuration of port {} of {} for {}",
- port.getPortName(), circuitPackName, nodeId);
- continue;
- }
-
- if (lcpMap.containsKey(circuitPackName + '+' + port.getPortName())) {
- continue;
- }
-
- Optional<CircuitPacks> cpOpt = circuitPackList.stream()
- .filter(
- cP -> cP.getCircuitPackName().equals(port.getPartnerPort().getCircuitPackName()))
- .findFirst();
- if (!cpOpt.isPresent()) {
- LOG.error("Error fetching circuit-pack {} for {}",
- port.getPartnerPort().getCircuitPackName(), nodeId);
- continue;
- }
-
- Optional<Ports> poOpt = cpOpt.get().nonnullPorts().values().stream()
- .filter(p -> p.getPortName().equals(port.getPartnerPort().getPortName().toString()))
- .findFirst();
- if (!poOpt.isPresent()) {
- LOG.error("Error fetching port {} on {} for {}", port.getPartnerPort().getPortName(),
- port.getPartnerPort().getCircuitPackName(), nodeId);
- continue;
- }
- Ports port2 = poOpt.get();
- if (!checkPartnerPort(circuitPackName, port, port2)) {
- LOG.error("port {} on {} is not a correct partner port of {} on {}",
- port2.getPortName(), cpOpt.get().getCircuitPackName(), port.getPortName(),
- circuitPackName);
- continue;
- }
- putXpdrLcpsInMaps(line, nodeId, xponderNb, xponderType,
- circuitPackName, cpOpt.get().getCircuitPackName(), port, port2,
- lcpMap, mappingMap);
- line += 2;
- break;
-
- default:
- LOG.warn(
- "Error in the configuration of port {} of {} for {} - unsupported PortQual {}",
- port.getPortName(), circuitPackName, nodeId, port.getPortQual().getIntValue());
- }