/** * Returns an instance representing the specified value in KHz. * * @param value frequency in KHz * @return instance representing the given frequency */ public static Frequency ofKHz(long value) { return new Frequency(value * KHZ); }
Spectrum.U_BAND_MIN, Spectrum.O_BAND_MAX, Frequency.ofGHz(50), annotations); case 5: // OCH port OchSignal signal = new OchSignal(GridType.DWDM, ChannelSpacing.CHL_50GHZ, 0, 4);
} else if (ochSignal.gridType() == GridType.DWDM) { int startMultiplier = (int) (1 - ochSignal.slotGranularity() + ochSignal.spacingMultiplier() * ochSignal.channelSpacing().frequency().asHz() / ChannelSpacing.CHL_6P25GHZ.frequency().asHz()); return IntStream.range(0, ochSignal.slotGranularity()) .mapToObj(x -> OchSignal.newFlexGridSlot(startMultiplier + (2 * x)))
public static Optional<OmsPort> asOmsPort(Port port) { if (port instanceof OmsPort) { return Optional.of((OmsPort) port); } try { Annotations an = port.annotations(); Frequency minFrequency = Frequency.ofHz(Long.parseLong(an.value(OpticalAnnotations.MIN_FREQ_HZ))); Frequency maxFrequency = Frequency.ofHz(Long.parseLong(an.value(OpticalAnnotations.MAX_FREQ_HZ))); Frequency grid = Frequency.ofHz(Long.parseLong(an.value(OpticalAnnotations.GRID_HZ))); return Optional.of(new DefaultOmsPort(port, minFrequency, maxFrequency, grid)); } catch (NumberFormatException e) { log.warn("{} was not well-formed OMS port.", port, e); return Optional.empty(); } }
case OMSN: portDes = omsPortDescription(portNo, enabled, FREQ191_7, FREQ191_7.add(FREQ4_4), FREQ50, annotations); break; case OCH:
/** * Build a portDescription from a given port description describing a fiber switch optical port. * * @param port description property type. * @param port the port to build from. * @return portDescription for the port. */ private PortDescription buildPortDescription(OFCalientPortDescStatsEntry port) { PortNumber portNo = PortNumber.portNumber(port.getPortNo().getPortNumber()); // Use the alias name if it's available String name = port.getName(); List<OFCalientPortDescProp> props = port.getProperties(); if (props != null && props.size() > 0) { OFCalientPortDescPropOptical propOptical = (OFCalientPortDescPropOptical) props.get(0); if (propOptical != null) { name = propOptical.getInAlias(); } } // FIXME when Calient OF agent reports port status boolean enabled = true; SparseAnnotations annotations = makePortAnnotation(name, port.getHwAddr().toString()); // S160 data sheet // Wavelength range: 1260 - 1630 nm, grid is irrelevant for this type of switch return omsPortDescription(portNo, enabled, Spectrum.U_BAND_MIN, Spectrum.O_BAND_MAX, Frequency.ofGHz(100), annotations); }
/** * Returns an instance representing the specified value in GHz. * * @param value frequency in GHz * @return instance representing the given frequency */ public static Frequency ofGHz(long value) { return new Frequency(value * GHZ); }
/** * Returns an instance representing the specified value in MHz. * * @param value frequency in MHz * @return instance representing the given frequency */ public static Frequency ofMHz(double value) { return new Frequency((long) (value * MHZ)); }
/** * Returns an instance representing the specified value in THz. * * @param value frequency in THz * @return instance representing the given frequency */ public static Frequency ofTHz(long value) { return new Frequency(value * THZ); }
/** * Returns a Frequency whose value is (this + value). * * @param value value to be added to this Frequency * @return this + value */ public Frequency add(Frequency value) { return new Frequency(this.frequency + value.frequency); }
/** * Returns an instance representing the specified value in Hz. * * @param value frequency in Hz * @return instance representing the given frequency */ public static Frequency ofHz(long value) { return new Frequency(value); }
/** * Returns an instance representing the specified value in KHz. * * @param value frequency in KHz * @return instance representing the given frequency */ public static Frequency ofKHz(double value) { return new Frequency((long) (value * KHZ)); }
/** * Returns an instance representing the specified value in GHz. * * @param value frequency in GHz * @return instance representing the given frequency */ public static Frequency ofGHz(double value) { return new Frequency((long) (value * GHZ)); }
/** * Returns a Frequency whose value is (this * value). * * @param value value to be multiplied by this Frequency * @return this * value */ public Frequency multiply(long value) { return new Frequency(this.frequency * value); }
/** * Returns an instance representing the specified value in MHz. * * @param value frequency in MHz * @return instance representing the given frequency */ public static Frequency ofMHz(long value) { return new Frequency(value * MHZ); }
/** * Returns an instance representing the specified value in THz. * * @param value frequency in THz * @return instance representing the given frequency */ public static Frequency ofTHz(double value) { return new Frequency((long) (value * THZ)); }
/** * Returns a Frequency whose value is (this - value). * * @param value value to be subtracted from this Frequency * @return this - value */ public Frequency subtract(Frequency value) { return new Frequency(this.frequency - value.frequency); }