use of org.onosproject.net.optical.impl.DefaultOmsPort in project onos by opennetworkinglab.
the class OmsPortHelper method asOmsPort.
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();
}
}
Aggregations