- 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("Unable to get mapping from PortMapping for node % and logical connection port %s",
- 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";
- }
- try {
- double slotWidthGran = portMapping.getMcCapbilities(nodeId, mcLcp)
- .getSlotWidthGranularity().getValue().doubleValue();
-
- // Dead-band is constant (Ref: WP)
- double deadBand = 8; // In GHz
- 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(
- org.opendaylight.yang.gen.v1.http.org.openroadm.network.media.channel.interfaces.rev181019
- .Interface1.class, nmcCtpI1fBuilder.build());
-
- // Post interface on the device
- openRoadmInterfaces.postInterface(nodeId, nmcInterfaceBldr);
-
- }
- catch (NullPointerException e) {
- LOG.error("Port mapping could not find {}", mcLcp);
- LOG.error("Check the port mapping to verify {}", mcLcp);
- }
- return nmcInterfaceBldr.getName();
- }
-
- public String createOpenRoadmOchInterface(String nodeId, String logicalConnPoint, Long waveNumber)
- throws OpenRoadmInterfaceException {
- // TODO : Check this method
-
- fixedFlex = fixedFlex.getFixedFlexWaveMapping(waveNumber.shortValue());
-
- Mapping portMap = portMapping.getMapping(nodeId, logicalConnPoint);
- if (portMap == null) {
- throw new OpenRoadmInterfaceException(
- String.format("Unable to get mapping from PortMapping for node %s and logical connection port %s",
- nodeId, logicalConnPoint));
- }
-
- // OCH interface specific data
- OchBuilder ocIfBuilder = new OchBuilder()
- .setFrequency(FrequencyTHz.getDefaultInstance(String.valueOf(fixedFlex.getCenterFrequency())))
- .setRate(R100G.class)
- // TODO: Check if this the correct way to set modulation format here
- .setModulationFormat(ModulationFormat.DpQpsk)
- .setTransmitPower(new PowerDBm(new BigDecimal("-5")));
-
- // Create generic interface
- InterfaceBuilder ochInterfaceBldr = createGenericInterfaceBuilder(portMap, OpticalChannel.class,
- createOpenRoadmOchInterfaceName(logicalConnPoint, waveNumber));
- // Create Interface1 type object required for adding as augmentation
- // TODO look at imports of different versions of class
- org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev181019.Interface1Builder
- ochIf1Builder = new org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev181019
- .Interface1Builder();
- ochInterfaceBldr.addAugmentation(ochIf1Builder.setOch(ocIfBuilder.build()).build());
-
- // Post interface on the device
- openRoadmInterfaces.postInterface(nodeId, ochInterfaceBldr);
-
- // Post the equipment-state change on the device circuit-pack if xpdr node
- if (portMap.getLogicalConnectionPoint().contains(StringConstants.NETWORK_TOKEN)) {
- this.openRoadmInterfaces.postEquipmentState(nodeId, portMap.getSupportingCircuitPackName(), true);
- }
-
- return ochInterfaceBldr.getName();
- }
-