Search in sources :

Example 1 with DefaultOduCltPort

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();
    }
}
Also used : DefaultAnnotations(org.onosproject.net.DefaultAnnotations) Annotations(org.onosproject.net.Annotations) SparseAnnotations(org.onosproject.net.SparseAnnotations) DefaultOduCltPort(org.onosproject.net.optical.impl.DefaultOduCltPort) OduCltPort(org.onosproject.net.optical.OduCltPort) DefaultOduCltPort(org.onosproject.net.optical.impl.DefaultOduCltPort) CltSignalType(org.onosproject.net.CltSignalType)

Aggregations

Annotations (org.onosproject.net.Annotations)1 CltSignalType (org.onosproject.net.CltSignalType)1 DefaultAnnotations (org.onosproject.net.DefaultAnnotations)1 SparseAnnotations (org.onosproject.net.SparseAnnotations)1 OduCltPort (org.onosproject.net.optical.OduCltPort)1 DefaultOduCltPort (org.onosproject.net.optical.impl.DefaultOduCltPort)1