Search in sources :

Example 1 with DefaultOtuPort

use of org.onosproject.net.optical.impl.DefaultOtuPort 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();
    }
}
Also used : DefaultAnnotations(org.onosproject.net.DefaultAnnotations) Annotations(org.onosproject.net.Annotations) SparseAnnotations(org.onosproject.net.SparseAnnotations) OtuPort(org.onosproject.net.optical.OtuPort) DefaultOtuPort(org.onosproject.net.optical.impl.DefaultOtuPort) DefaultOtuPort(org.onosproject.net.optical.impl.DefaultOtuPort) OtuSignalType(org.onosproject.net.OtuSignalType)

Aggregations

Annotations (org.onosproject.net.Annotations)1 DefaultAnnotations (org.onosproject.net.DefaultAnnotations)1 OtuSignalType (org.onosproject.net.OtuSignalType)1 SparseAnnotations (org.onosproject.net.SparseAnnotations)1 OtuPort (org.onosproject.net.optical.OtuPort)1 DefaultOtuPort (org.onosproject.net.optical.impl.DefaultOtuPort)1