+ /**
+ * Create a builder for AtoZDirection object.
+ * @param atozMap Map of AToZ object
+ * @return a builder for AtoZDirection object
+ */
+ private AToZDirectionBuilder buildAtoZDirection(Map<AToZKey, AToZ> atozMap) {
+ AToZDirectionBuilder atoZDirectionBldr = new AToZDirectionBuilder()
+ .setRate(Uint32.valueOf(rc.getRate()))
+ .setModulationFormat(GridConstant.RATE_MODULATION_FORMAT_MAP
+ .getOrDefault(Uint32.valueOf(rc.getRate()), ModulationFormat.DpQpsk).getName())
+ .setAToZ(atozMap);
+ switch (rc.getServiceType()) {
+ case StringConstants.SERVICE_TYPE_400GE:
+ case StringConstants.SERVICE_TYPE_OTUC2:
+ case StringConstants.SERVICE_TYPE_OTUC3:
+ case StringConstants.SERVICE_TYPE_OTUC4:
+ case StringConstants.SERVICE_TYPE_100GE_T:
+ case StringConstants.SERVICE_TYPE_OTU4:
+ atoZDirectionBldr.setAToZMaxFrequency(new FrequencyTHz(Decimal64.valueOf(rc.getMaxFreq())));
+ atoZDirectionBldr.setAToZMinFrequency(new FrequencyTHz(Decimal64.valueOf(rc.getMinFreq())));
+ atoZDirectionBldr.setAToZWavelengthNumber(Uint32.valueOf(rc.getResultWavelength()));
+ break;
+ case StringConstants.SERVICE_TYPE_100GE_M:
+ case StringConstants.SERVICE_TYPE_100GE_S:
+ case StringConstants.SERVICE_TYPE_10GE:
+ case StringConstants.SERVICE_TYPE_1GE:
+ case StringConstants.SERVICE_TYPE_ODU4:
+ case StringConstants.SERVICE_TYPE_ODUC2:
+ case StringConstants.SERVICE_TYPE_ODUC3:
+ case StringConstants.SERVICE_TYPE_ODUC4:
+ if (rc.getResultTribPortTribSlot() != null && rc.getResultTribPortTribSlot().get(0) != null
+ && rc.getResultTribPortTribSlot().get(1) != null) {
+ atoZDirectionBldr.setAToZWavelengthNumber(Uint32.valueOf(0))
+ .setMinTribSlot(rc.getResultTribPortTribSlot().get(0))
+ .setMaxTribSlot(rc.getResultTribPortTribSlot().get(1));
+ } else {
+ LOG.warn("Trib port and trib slot number should be present");
+ atoZDirectionBldr.setMinTribSlot(new OpucnTribSlotDef("0.0"))
+ .setMaxTribSlot(new OpucnTribSlotDef("0.0"));
+ }
+ break;
+ default:
+ LOG.warn("unknown service type : unable to set Min/Max frequencies or trib-port/trib-slot");
+ break;
+ }
+ return atoZDirectionBldr;
+ }
+
+ /**
+ * Create a builder for ZtoADirection object.
+ * @param ztoaMap Map of ZToA object
+ * @return a builder for ZtoADirection object
+ */
+ private ZToADirectionBuilder buildZtoADirection(Map<ZToAKey, ZToA> ztoaMap) {
+ ZToADirectionBuilder ztoADirectionBldr = new ZToADirectionBuilder().setRate(Uint32.valueOf(rc.getRate()))
+ .setModulationFormat(GridConstant.RATE_MODULATION_FORMAT_MAP
+ .getOrDefault(Uint32.valueOf(rc.getRate()), ModulationFormat.DpQpsk).getName())
+ .setZToA(ztoaMap);
+ switch (rc.getServiceType()) {
+ case StringConstants.SERVICE_TYPE_400GE:
+ case StringConstants.SERVICE_TYPE_OTUC2:
+ case StringConstants.SERVICE_TYPE_OTUC3:
+ case StringConstants.SERVICE_TYPE_OTUC4:
+ case StringConstants.SERVICE_TYPE_100GE_T:
+ case StringConstants.SERVICE_TYPE_OTU4:
+ ztoADirectionBldr.setZToAMaxFrequency(new FrequencyTHz(Decimal64.valueOf(rc.getMaxFreq())));
+ ztoADirectionBldr.setZToAMinFrequency(new FrequencyTHz(Decimal64.valueOf(rc.getMinFreq())));
+ ztoADirectionBldr.setZToAWavelengthNumber(Uint32.valueOf(rc.getResultWavelength()));
+ break;
+ case StringConstants.SERVICE_TYPE_100GE_M:
+ case StringConstants.SERVICE_TYPE_100GE_S:
+ case StringConstants.SERVICE_TYPE_10GE:
+ case StringConstants.SERVICE_TYPE_1GE:
+ case StringConstants.SERVICE_TYPE_ODU4:
+ case StringConstants.SERVICE_TYPE_ODUC2:
+ case StringConstants.SERVICE_TYPE_ODUC3:
+ case StringConstants.SERVICE_TYPE_ODUC4:
+ if (rc.getResultTribPortTribSlot() != null && rc.getResultTribPortTribSlot().get(0) != null
+ && rc.getResultTribPortTribSlot().get(1) != null) {
+ ztoADirectionBldr.setZToAWavelengthNumber(Uint32.valueOf(0))
+ .setMinTribSlot(rc.getResultTribPortTribSlot().get(0))
+ .setMaxTribSlot(rc.getResultTribPortTribSlot().get(1));
+ } else {
+ LOG.warn("Trib port and trib slot number should be present");
+ ztoADirectionBldr.setMinTribSlot(new OpucnTribSlotDef("0.0"))
+ .setMaxTribSlot(new OpucnTribSlotDef("0.0"));
+ }
+ break;
+ default:
+ LOG.warn("unknown service type : unable to set Min/Max frequencies");
+ break;
+ }
+ return ztoADirectionBldr;
+ }
+
+ @SuppressWarnings("java:S138")
+ //sonar issue This method has 77 lines, which is greater than the 75 lines authorized. Split it into smaller
+ //ignore as it's not relevant to split it from functional point
+ private void buildAtoZ(Map<AToZKey, AToZ> atozMap, List<PceLink> path) {