+ private Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> populateNepsForRdmNode(String nodeId,
+ Map<String, TerminationPoint1> tpMap, boolean withSip, String nepPhotonicSublayer) {
+ // create neps for MC and and Photonic Media OTS/OMS
+ Map<OwnedNodeEdgePointKey, OwnedNodeEdgePoint> onepMap = new HashMap<>();
+ for (Map.Entry<String, TerminationPoint1> entry : tpMap.entrySet()) {
+ // Admin and oper state common for all tps
+ OpenroadmTpType tpType = entry.getValue().getTpType();
+ // PHOTONIC MEDIA nep
+ LOG.debug("PHOTO NEP = {}", String.join("+", nodeId, nepPhotonicSublayer,
+ entry.getKey()));
+ SupportedCepLayerProtocolQualifierInstancesBuilder sclpqiBd =
+ new SupportedCepLayerProtocolQualifierInstancesBuilder()
+ .setNumberOfCepInstances(Uint64.valueOf(1));
+ switch (nepPhotonicSublayer) {
+ case TapiStringConstants.PHTNC_MEDIA_OMS:
+ sclpqiBd.setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROMS.VALUE);
+ break;
+ case TapiStringConstants.PHTNC_MEDIA_OTS:
+ sclpqiBd.setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTS.VALUE);
+ break;
+ case TapiStringConstants.MC:
+ sclpqiBd.setLayerProtocolQualifier(PHOTONICLAYERQUALIFIERMC.VALUE);
+ break;
+ case TapiStringConstants.OTSI_MC:
+ sclpqiBd.setLayerProtocolQualifier(PHOTONICLAYERQUALIFIEROTSiMC.VALUE);
+ break;
+ default:
+ break;
+ }
+
+ List<SupportedCepLayerProtocolQualifierInstances> sclpqiList = new ArrayList<>(List.of(sclpqiBd.build()));
+ OwnedNodeEdgePointBuilder onepBd = new OwnedNodeEdgePointBuilder();
+ if (!nepPhotonicSublayer.equals(TapiStringConstants.MC)
+ && !nepPhotonicSublayer.equals(TapiStringConstants.OTSI_MC)) {
+ Map<Double,Double> usedFreqMap = new HashMap<>();
+ Map<Double,Double> availableFreqMap = new HashMap<>();
+ switch (tpType) {
+ // Whatever is the TP and its type we consider that it is handled in a bidirectional way :
+ // same wavelength(s) used in both direction.
+ case SRGRXPP:
+ case SRGTXPP:
+ case SRGTXRXPP:
+ usedFreqMap = tapiFactory.getPP11UsedWavelength(
+ getNetworkTerminationPoint11FromDatastore(nodeId, entry.getKey()));
+ if (usedFreqMap == null || usedFreqMap.isEmpty()) {
+ availableFreqMap.put(GridConstant.START_EDGE_FREQUENCY * 1E09,
+ GridConstant.START_EDGE_FREQUENCY * 1E09
+ + GridConstant.GRANULARITY * GridConstant.EFFECTIVE_BITS * 1E06);
+ } else {
+ LOG.debug("EnteringLOOPcreateOTSiMC & MC with usedFreqMap non empty {} for Node {}, tp {}",
+ usedFreqMap.toString(), nodeId, tpMap.toString());
+ onepMap.putAll(populateNepsForRdmNode(nodeId,
+ new HashMap<>(Map.of(entry.getKey(), entry.getValue())),
+ true, TapiStringConstants.MC));
+ onepMap.putAll(populateNepsForRdmNode(nodeId,
+ new HashMap<>(Map.of(entry.getKey(), entry.getValue())),
+ true, TapiStringConstants.OTSI_MC));
+ }
+ break;
+ case DEGREERXTTP:
+ case DEGREETXTTP:
+ case DEGREETXRXTTP:
+ usedFreqMap = tapiFactory.getTTP11UsedFreqMap(
+ getNetworkTerminationPoint11FromDatastore(nodeId, entry.getKey()));
+ availableFreqMap = tapiFactory.getTTP11AvailableFreqMap(
+ getNetworkTerminationPoint11FromDatastore(nodeId, entry.getKey()));
+ break;
+ default:
+ break;
+ }
+ LOG.debug("calling add Photonic NEP spec for Roadm");
+ onepBd = tapiFactory.addPhotSpecToRoadmOnep(nodeId, usedFreqMap, availableFreqMap, onepBd,
+ nepPhotonicSublayer);
+ }
+ AdminStates admin = entry.getValue().getAdministrativeState();
+ State oper = entry.getValue().getOperationalState();
+ Name nepName = new NameBuilder()
+ .setValueName(nepPhotonicSublayer + "NodeEdgePoint")
+ .setValue(String.join("+", nodeId, nepPhotonicSublayer,
+ entry.getKey()))
+ .build();
+ OwnedNodeEdgePoint onep = onepBd
+ .setUuid(new Uuid(UUID.nameUUIDFromBytes((String.join("+", nodeId,
+ nepPhotonicSublayer, entry.getKey()))
+ .getBytes(Charset.forName("UTF-8"))).toString()))
+ .setLayerProtocolName(LayerProtocolName.PHOTONICMEDIA)
+ .setName(Map.of(nepName.key(), nepName))
+ .setSupportedCepLayerProtocolQualifierInstances(sclpqiList)
+ .setDirection(Direction.BIDIRECTIONAL)
+ .setLinkPortRole(PortRole.SYMMETRIC)
+ .setAdministrativeState(this.tapiLink.setTapiAdminState(admin.getName()))
+ .setOperationalState(this.tapiLink.setTapiOperationalState(oper.getName()))
+ .setLifecycleState(LifecycleState.INSTALLED)
+ .build();
+ LOG.debug("ROADMNEPPopulation TapiNetworkModelServiceImpl populate NEP {} for Node {}",
+ onep.getName().entrySet(), nodeId);
+ onepMap.put(onep.key(), onep);
+ }
+ LOG.debug("ROADMNEPPopulation FINISH for Node {}", nodeId);
+ return onepMap;
+ }
+