Search in sources :

Example 1 with MAX_RATE

use of org.onosproject.ovsdb.controller.OvsdbConstant.MAX_RATE in project onos by opennetworkinglab.

the class OvsdbQueueConfig method getQueues.

@Override
public Collection<QueueDescription> getQueues() {
    OvsdbClientService ovsdbClient = getOvsdbClient(handler());
    if (ovsdbClient == null) {
        return Collections.emptyList();
    }
    Set<OvsdbQueue> queues = ovsdbClient.getQueues();
    return queues.stream().map(q -> DefaultQueueDescription.builder().queueId(QueueId.queueId(q.externalIds().get(QUEUE_EXTERNAL_ID_KEY))).type(types(q)).dscp(q.dscp().isPresent() ? q.dscp().get().intValue() : null).maxRate(q.otherConfigs().get(MAX_RATE) != null ? Bandwidth.bps(Long.parseLong(q.otherConfigs().get(MAX_RATE))) : Bandwidth.bps(0L)).minRate(q.otherConfigs().get(MIN_RATE) != null ? Bandwidth.bps(Long.parseLong(q.otherConfigs().get(MIN_RATE))) : Bandwidth.bps(0L)).burst(q.otherConfigs().get(BURST) != null ? Long.valueOf(q.otherConfigs().get(BURST)) : 0L).priority(q.otherConfigs().get(PRIORITY) != null ? Long.valueOf(q.otherConfigs().get(PRIORITY)) : 0L).build()).collect(Collectors.toSet());
}
Also used : QUEUE_EXTERNAL_ID_KEY(org.onosproject.ovsdb.controller.OvsdbConstant.QUEUE_EXTERNAL_ID_KEY) OvsdbNodeId(org.onosproject.ovsdb.controller.OvsdbNodeId) QueueId(org.onosproject.net.behaviour.QueueId) MIN_RATE(org.onosproject.ovsdb.controller.OvsdbConstant.MIN_RATE) AbstractHandlerBehaviour(org.onosproject.net.driver.AbstractHandlerBehaviour) DefaultQueueDescription(org.onosproject.net.behaviour.DefaultQueueDescription) OvsdbController(org.onosproject.ovsdb.controller.OvsdbController) BURST(org.onosproject.ovsdb.controller.OvsdbConstant.BURST) PRIORITY(org.onosproject.ovsdb.controller.OvsdbConstant.PRIORITY) EnumSet(java.util.EnumSet) IpAddress(org.onlab.packet.IpAddress) Logger(org.slf4j.Logger) Bandwidth(org.onlab.util.Bandwidth) Collection(java.util.Collection) Set(java.util.Set) Collectors(java.util.stream.Collectors) OvsdbQueue(org.onosproject.ovsdb.controller.OvsdbQueue) DriverHandler(org.onosproject.net.driver.DriverHandler) QueueDescription(org.onosproject.net.behaviour.QueueDescription) Type(org.onosproject.net.behaviour.QueueDescription.Type) MAX_RATE(org.onosproject.ovsdb.controller.OvsdbConstant.MAX_RATE) LoggerFactory.getLogger(org.slf4j.LoggerFactory.getLogger) OvsdbClientService(org.onosproject.ovsdb.controller.OvsdbClientService) QueueConfigBehaviour(org.onosproject.net.behaviour.QueueConfigBehaviour) DeviceId(org.onosproject.net.DeviceId) Collections(java.util.Collections) OvsdbClientService(org.onosproject.ovsdb.controller.OvsdbClientService) OvsdbQueue(org.onosproject.ovsdb.controller.OvsdbQueue)

Example 2 with MAX_RATE

use of org.onosproject.ovsdb.controller.OvsdbConstant.MAX_RATE in project onos by opennetworkinglab.

the class OvsdbQosConfig method getQoses.

@Override
public Collection<QosDescription> getQoses() {
    OvsdbClientService ovsdbClient = getOvsdbClient(handler());
    if (ovsdbClient == null) {
        return null;
    }
    Set<OvsdbQos> qoses = ovsdbClient.getQoses();
    return qoses.stream().map(qos -> DefaultQosDescription.builder().qosId(QosId.qosId(qos.externalIds().get(QOS_EXTERNAL_ID_KEY))).type(QOS_EGRESS_POLICER.equals(qos.qosType()) ? QosDescription.Type.EGRESS_POLICER : QosDescription.Type.valueOf(qos.qosType().replace(QOS_TYPE_PREFIX, "").toUpperCase())).maxRate(qos.otherConfigs().get(MAX_RATE) != null ? Bandwidth.bps(Long.parseLong(qos.otherConfigs().get(MAX_RATE))) : Bandwidth.bps(0L)).cbs(qos.otherConfigs().get(CBS) != null ? Long.valueOf(qos.otherConfigs().get(CBS)) : null).cir(qos.otherConfigs().get(CIR) != null ? Long.valueOf(qos.otherConfigs().get(CIR)) : null).build()).collect(Collectors.toSet());
}
Also used : OvsdbNodeId(org.onosproject.ovsdb.controller.OvsdbNodeId) QOS_EXTERNAL_ID_KEY(org.onosproject.ovsdb.controller.OvsdbConstant.QOS_EXTERNAL_ID_KEY) QOS_TYPE_PREFIX(org.onosproject.ovsdb.controller.OvsdbConstant.QOS_TYPE_PREFIX) QOS_EGRESS_POLICER(org.onosproject.ovsdb.controller.OvsdbConstant.QOS_EGRESS_POLICER) QosDescription(org.onosproject.net.behaviour.QosDescription) AbstractHandlerBehaviour(org.onosproject.net.driver.AbstractHandlerBehaviour) CBS(org.onosproject.ovsdb.controller.OvsdbConstant.CBS) OvsdbController(org.onosproject.ovsdb.controller.OvsdbController) Map(java.util.Map) QosConfigBehaviour(org.onosproject.net.behaviour.QosConfigBehaviour) IpAddress(org.onlab.packet.IpAddress) QosId(org.onosproject.net.behaviour.QosId) Logger(org.slf4j.Logger) Bandwidth(org.onlab.util.Bandwidth) Collection(java.util.Collection) Set(java.util.Set) Collectors(java.util.stream.Collectors) List(java.util.List) DriverHandler(org.onosproject.net.driver.DriverHandler) DefaultQosDescription(org.onosproject.net.behaviour.DefaultQosDescription) QueueDescription(org.onosproject.net.behaviour.QueueDescription) MAX_RATE(org.onosproject.ovsdb.controller.OvsdbConstant.MAX_RATE) LoggerFactory.getLogger(org.slf4j.LoggerFactory.getLogger) CIR(org.onosproject.ovsdb.controller.OvsdbConstant.CIR) OvsdbClientService(org.onosproject.ovsdb.controller.OvsdbClientService) DeviceId(org.onosproject.net.DeviceId) OvsdbQos(org.onosproject.ovsdb.controller.OvsdbQos) OvsdbQos(org.onosproject.ovsdb.controller.OvsdbQos) OvsdbClientService(org.onosproject.ovsdb.controller.OvsdbClientService)

Aggregations

Collection (java.util.Collection)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2 IpAddress (org.onlab.packet.IpAddress)2 Bandwidth (org.onlab.util.Bandwidth)2 DeviceId (org.onosproject.net.DeviceId)2 QueueDescription (org.onosproject.net.behaviour.QueueDescription)2 AbstractHandlerBehaviour (org.onosproject.net.driver.AbstractHandlerBehaviour)2 DriverHandler (org.onosproject.net.driver.DriverHandler)2 OvsdbClientService (org.onosproject.ovsdb.controller.OvsdbClientService)2 MAX_RATE (org.onosproject.ovsdb.controller.OvsdbConstant.MAX_RATE)2 OvsdbController (org.onosproject.ovsdb.controller.OvsdbController)2 OvsdbNodeId (org.onosproject.ovsdb.controller.OvsdbNodeId)2 Logger (org.slf4j.Logger)2 LoggerFactory.getLogger (org.slf4j.LoggerFactory.getLogger)2 Collections (java.util.Collections)1 EnumSet (java.util.EnumSet)1 List (java.util.List)1 Map (java.util.Map)1 DefaultQosDescription (org.onosproject.net.behaviour.DefaultQosDescription)1