- /**
- * This private method gets the list of circuit packs on an Srg. For each
- * circuit pack on an Srg, it does a get on circuit-pack subtree with
- * circuit-pack-name as key in order to get the list of ports. It then
- * iterates over the list of ports to get ports with port-qual as
- * roadm-external. It appends a TX,RX,TXRX to the logical connection point
- * name based on the direction of the port.
- *
- * @param nodeId
- * Id of device
- * @param deviceInfo
- * Info subtree read from the device
- * @param portMapList
- * Reference to the list containing the mapping to be pushed to
- * MD-SAL
- *
- * @return true/false based on status of operation
- */
-
- private boolean createPpPortMapping(String nodeId, Info deviceInfo, List<Mapping> portMapList) {
- // Creating mapping data for SRG's PP
- HashMap<Integer, List<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.srg
- .CircuitPacks>> srgCps = getSrgCps(nodeId, deviceInfo);
- Set<Map.Entry<Integer, List<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206
- .srg.CircuitPacks>>> circuitPacks = srgCps.entrySet();
- for (Entry<Integer, List<org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.srg
- .CircuitPacks>> entry : circuitPacks) {
- Integer srgIndex = entry.getKey();
- for (org.opendaylight.yang.gen.v1.http.org.openroadm.device.rev170206.srg.CircuitPacks cp : entry
- .getValue()) {
- String circuitPackName = cp.getCircuitPackName();
- InstanceIdentifier<CircuitPacks> cpIID = InstanceIdentifier.create(OrgOpenroadmDevice.class)
- .child(CircuitPacks.class, new CircuitPacksKey(circuitPackName));
- Optional<CircuitPacks> circuitPackObject = this.deviceTransactionManager.getDataFromDevice(nodeId,
- LogicalDatastoreType.OPERATIONAL, cpIID,
- Timeouts.DEVICE_READ_TIMEOUT, Timeouts.DEVICE_READ_TIMEOUT_UNIT);
-
- if (!circuitPackObject.isPresent() || (circuitPackObject.get().getPorts() == null)) {
- LOG.warn("{} : Circuit pack {} not found or without ports.", nodeId, circuitPackName);
- continue; // TODO continue or return false?
- }
- CircuitPacks circuitPack = circuitPackObject.get();
- for (Ports port : circuitPack.getPorts()) {
- if (port.getLogicalConnectionPoint() != null) {
- String logicalConnectionPoint = getLogicalConnectionPort(port, srgIndex);
- LOG.info("{} : Logical Connection Point for {} {} is {}", nodeId, circuitPackName, port
- .getPortName(),
- logicalConnectionPoint);
- portMapList.add(createMappingObject(nodeId, port, circuitPackName, logicalConnectionPoint));
- } else if (Port.PortQual.RoadmInternal.equals(port.getPortQual())) {
- LOG.info("Port is internal, skipping Logical Connection Point missing for {} {}",
- circuitPackName,
- port.getPortName());
- } else if (port.getLogicalConnectionPoint() == null) {
- LOG.info("Value missing, Skipping Logical Connection Point missing for {} {}", circuitPackName,
- port.getPortName());
- }
- }
- }
- }
- return true;
- }