use of org.onosproject.net.OtuSignalType in project onos by opennetworkinglab.
the class OtuPortHelper method asOtuPort.
public static Optional<OtuPort> asOtuPort(Port port) {
if (port instanceof OtuPort) {
return Optional.of((OtuPort) port);
}
try {
Annotations an = port.annotations();
OtuSignalType signalType = Enum.valueOf(OtuSignalType.class, an.value(SIGNAL_TYPE));
// DefaultOtuPort should filter them, if necessary.
return Optional.of(new DefaultOtuPort(port, signalType));
} catch (NullPointerException | IllegalArgumentException e) {
log.warn("{} was not well-formed Otu port.", port, e);
return Optional.empty();
}
}
Aggregations