public static DeviceDescription descriptionOf(Device device) {
   checkNotNull(device, "Must supply non-null Device");
   return new DefaultDeviceDescription(
       device.id().uri(), device.type(),
       device.manufacturer(), device.hwVersion(),
       device.swVersion(), device.serialNumber(),
       device.chassisId(), (SparseAnnotations) device.annotations());
 }
Exemple #2
0
 // 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);
   }
 }