+ public String createNMCInterface(String nodeId, String logicalConnPoint,
+ BigDecimal centerFrequency, BigDecimal slotWidth, Long bitmapIndex)
+ throws OpenRoadmInterfaceException {
+ LOG.info("This is the central frequency {}", centerFrequency.floatValue());
+ LOG.info("This is the slot-width {}", slotWidth.floatValue());
+ // TODO : Check this method
+ flexGrid = flexGrid.getFlexWaveMapping(centerFrequency.floatValue(), slotWidth.floatValue());
+ Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
+ if (portMap == null) {
+ throw new OpenRoadmInterfaceException(
+ String.format(MAPPING_ERROR_EXCEPTION_MESSAGE, nodeId, logicalConnPoint));
+ }
+
+ LOG.info("Freq Start {} and Freq End {} and center-Freq {}", flexGrid.getStart(),
+ flexGrid.getStop(),centerFrequency);
+ //TODO : Check this method
+ InterfaceBuilder nmcInterfaceBldr = createGenericInterfaceBuilder(portMap,
+ NetworkMediaChannelConnectionTerminationPoint.class, logicalConnPoint + "-nmc" + "-" + bitmapIndex);
+ if (logicalConnPoint.contains("DEG")) {
+ nmcInterfaceBldr.setSupportingInterface(logicalConnPoint + "-mc" + "-" + bitmapIndex);
+ }
+ NmcCtpBuilder nmcCtpIfBuilder;
+
+ // From the logicalConnPoint, get the substring and for that associated substring find the mc-cap
+ String mcLcp = "";
+ if (logicalConnPoint.contains("-PP")) {
+ mcLcp = logicalConnPoint.substring(0, logicalConnPoint.indexOf("-")) + "-PP";
+ }
+ else if (logicalConnPoint.contains("-TTP")) {
+ mcLcp = logicalConnPoint.substring(0, logicalConnPoint.indexOf("-")) + "-TTP";
+ }
+ McCapabilities mcCapabilities = portMapping.getMcCapbilities(nodeId, mcLcp);
+ if (mcCapabilities == null || mcCapabilities.getSlotWidthGranularity() == null
+ || mcCapabilities.getSlotWidthGranularity().getValue() == null) {
+ LOG.warn("Port mapping could not find {}", mcLcp);
+ LOG.warn("Check the port mapping to verify {}", mcLcp);
+ return nmcInterfaceBldr.getName();
+ }
+ double slotWidthGran = mcCapabilities.getSlotWidthGranularity().getValue().doubleValue();
+ // Dead-band is constant (Ref: WP) In GHz
+ double deadBand = 8;
+ double guardBand = Math.ceil(deadBand / slotWidthGran) * slotWidthGran;
+ nmcCtpIfBuilder = new NmcCtpBuilder()
+ .setFrequency(FrequencyTHz.getDefaultInstance(String.valueOf(centerFrequency)))
+ .setWidth(FrequencyGHz.getDefaultInstance(String.valueOf(slotWidth.doubleValue() - guardBand)));
+
+ // Create Interface1 type object required for adding as augmentation
+ org.opendaylight.yang.gen.v1.http.org.openroadm.network.media.channel.interfaces.rev181019.Interface1Builder
+ nmcCtpI1fBuilder =
+ new org.opendaylight.yang.gen.v1.http.org.openroadm.network.media.channel.interfaces.rev181019
+ .Interface1Builder().setNmcCtp(nmcCtpIfBuilder.build());
+ nmcInterfaceBldr.addAugmentation(nmcCtpI1fBuilder.build());
+ // Post interface on the device
+ openRoadmInterfaces.postInterface(nodeId, nmcInterfaceBldr);
+ return nmcInterfaceBldr.getName();
+ }
+