private void updateOMSPorts(int numChls, ConnectPoint srcCp, ConnectPoint dstCp) { // round down to largest slot that allows numChl channels to fit into C band range ChannelSpacing chl = null; Frequency perChl = TOTAL.floorDivision(numChls); for (int i = 0; i < ChannelSpacing.values().length; i++) { Frequency val = ChannelSpacing.values()[i].frequency(); if (val.isLessThan(perChl)) { chl = ChannelSpacing.values()[i]; break; } } if (chl == null) { chl = ChannelSpacing.CHL_6P25GHZ; } // if true, there was less channels than can be tightly packed. Frequency grid = chl.frequency(); // say Linc's 1st slot starts at CENTER and goes up from there. Frequency min = CENTER.add(grid); Frequency max = CENTER.add(grid.multiply(numChls)); PortDescription srcPortDesc = new OmsPortDescription(srcCp.port(), true, min, max, grid); PortDescription dstPortDesc = new OmsPortDescription(dstCp.port(), true, min, max, grid); descriptions.put(srcCp, srcPortDesc); descriptions.put(dstCp, dstPortDesc); deviceProviderService.portStatusChanged(srcCp.deviceId(), srcPortDesc); deviceProviderService.portStatusChanged(dstCp.deviceId(), dstPortDesc); }
// uses 'bandwidth' annotation to determine the channel spacing. private void updateOchPort(double bw, ConnectPoint srcCp, ConnectPoint dstCp) { Device src = deviceService.getDevice(srcCp.deviceId()); Device dst = deviceService.getDevice(dstCp.deviceId()); // bandwidth in MHz (assuming Hz - linc is not clear if that or Mb). Frequency spacing = Frequency.ofMHz(bw); // channel bandwidth is smaller than smallest standard channel spacing. ChannelSpacing chsp = null; if (spacing.compareTo(ChannelSpacing.CHL_6P25GHZ.frequency()) <= 0) { chsp = ChannelSpacing.CHL_6P25GHZ; } for (int i = 1; i < ChannelSpacing.values().length; i++) { Frequency val = ChannelSpacing.values()[i].frequency(); // pick the next highest or equal channel interval. if (val.isLessThan(spacing)) { chsp = ChannelSpacing.values()[i - 1]; break; } } if (chsp == null) { log.warn("Invalid channel spacing ({}), can't configure port(s)", spacing); return; } OchSignal signal = new OchSignal(GridType.DWDM, chsp, 1, 1); if (src.type() == Device.Type.ROADM) { PortDescription portDesc = new OchPortDescription(srcCp.port(), true, OduSignalType.ODU4, true, signal); descriptions.put(srcCp, portDesc); deviceProviderService.portStatusChanged(srcCp.deviceId(), portDesc); } if (dst.type() == Device.Type.ROADM) { PortDescription portDesc = new OchPortDescription(dstCp.port(), true, OduSignalType.ODU4, true, signal); descriptions.put(dstCp, portDesc); deviceProviderService.portStatusChanged(dstCp.deviceId(), portDesc); } }