Search in sources :

Example 11 with Builder

use of org.onosproject.net.DefaultAnnotations.Builder in project onos by opennetworkinglab.

the class OtuPortHelper method otuPortDescription.

/**
 * Creates OTU port description based on the supplied information.
 *
 * @param number        port number
 * @param isEnabled     port enabled state
 * @param signalType    OTU client signal type
 * @param annotations   key/value annotations map
 * @return              port description
 */
public static PortDescription otuPortDescription(PortNumber number, boolean isEnabled, OtuSignalType signalType, SparseAnnotations annotations) {
    Builder builder = DefaultAnnotations.builder();
    builder.putAll(annotations);
    builder.set(SIGNAL_TYPE, signalType.toString());
    // TODO specify appropriate value?
    long portSpeed = 0;
    return DefaultPortDescription.builder().withPortNumber(number).isEnabled(isEnabled).type(Port.Type.OTU).portSpeed(portSpeed).annotations(builder.build()).build();
}
Also used : Builder(org.onosproject.net.DefaultAnnotations.Builder)

Aggregations

Builder (org.onosproject.net.DefaultAnnotations.Builder)11 DefaultAnnotations (org.onosproject.net.DefaultAnnotations)2 PortAnnotationConfig (org.onosproject.net.config.basics.PortAnnotationConfig)2 HashMap (java.util.HashMap)1 HierarchicalConfiguration (org.apache.commons.configuration.HierarchicalConfiguration)1 EqualsBuilder (org.apache.commons.lang3.builder.EqualsBuilder)1 HashCodeBuilder (org.apache.commons.lang3.builder.HashCodeBuilder)1 XmlConfigParser.loadXmlString (org.onosproject.drivers.utilities.XmlConfigParser.loadXmlString)1 Type (org.onosproject.net.Port.Type)1 PortNumber (org.onosproject.net.PortNumber)1 DeviceAnnotationConfig (org.onosproject.net.config.basics.DeviceAnnotationConfig)1 HostAnnotationConfig (org.onosproject.net.config.basics.HostAnnotationConfig)1 DefaultPortStatistics (org.onosproject.net.device.DefaultPortStatistics)1 PortStatistics (org.onosproject.net.device.PortStatistics)1 Dpid (org.onosproject.openflow.controller.Dpid)1 OpenFlowSwitch (org.onosproject.openflow.controller.OpenFlowSwitch)1 OFPortDesc (org.projectfloodlight.openflow.protocol.OFPortDesc)1 OFPortDescProp (org.projectfloodlight.openflow.protocol.OFPortDescProp)1 OFPortDescPropOptical (org.projectfloodlight.openflow.protocol.OFPortDescPropOptical)1 OFPortStatsEntry (org.projectfloodlight.openflow.protocol.OFPortStatsEntry)1