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