[ONOS-5565]Implementation of QosConfig and QueueConfig
Change-Id: I6a367b53cfca2e85e8aaa6cddb541d7b3ffccbc0
diff --git a/core/api/src/main/java/org/onosproject/net/behaviour/DefaultQosDescription.java b/core/api/src/main/java/org/onosproject/net/behaviour/DefaultQosDescription.java
new file mode 100644
index 0000000..39bd548
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/behaviour/DefaultQosDescription.java
@@ -0,0 +1,180 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.behaviour;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.MoreObjects;
+import org.onlab.util.Bandwidth;
+import org.onosproject.net.AbstractDescription;
+import org.onosproject.net.SparseAnnotations;
+
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+
+/**
+ * Default implementation of Qos description entity.
+ */
+@Beta
+public final class DefaultQosDescription extends AbstractDescription
+ implements QosDescription {
+
+ private final QosId qosId;
+ private final Type type;
+ private final Optional<Bandwidth> maxRate;
+ private final Optional<Long> cir;
+ private final Optional<Long> cbs;
+ private final Optional<Map<Long, QueueDescription>> queues;
+
+ private DefaultQosDescription(QosId qosId, Type type, Optional<Bandwidth> maxRate,
+ Optional<Long> cir, Optional<Long> cbs,
+ Optional<Map<Long, QueueDescription>> queues,
+ SparseAnnotations... annotations) {
+ super(annotations);
+ this.qosId = checkNotNull(qosId);
+ this.type = checkNotNull(type);
+ this.maxRate = maxRate;
+ this.cir = cir;
+ this.cbs = cbs;
+ this.queues = queues;
+ }
+
+ @Override
+ public QosId qosId() {
+ return qosId;
+ }
+
+ @Override
+ public Type type() {
+ return type;
+ }
+
+ @Override
+ public Optional<Bandwidth> maxRate() {
+ return maxRate;
+ }
+
+ @Override
+ public Optional<Long> cir() {
+ return cir;
+ }
+
+ @Override
+ public Optional<Long> cbs() {
+ return cbs;
+ }
+
+ @Override
+ public Optional<Map<Long, QueueDescription>> queues() {
+ return queues;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(qosId, type, maxRate, cir, cbs, queues);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof DefaultQosDescription) {
+ final DefaultQosDescription other = (DefaultQosDescription) obj;
+ return Objects.equals(this.qosId, other.qosId) &&
+ Objects.equals(this.type, other.type) &&
+ Objects.equals(this.maxRate, other.maxRate) &&
+ Objects.equals(this.cir, other.cir) &&
+ Objects.equals(this.cbs, other.cbs) &&
+ Objects.equals(this.queues, other.queues);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("qosId", qosId())
+ .add("type", type())
+ .add("maxRate", maxRate().orElse(null))
+ .add("cir", cir().orElse(0L))
+ .add("cbs", cbs().orElse(0L))
+ .add("queues", queues().orElse(null))
+ .toString();
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public static final class Builder implements QosDescription.Builder {
+
+ private QosId qosId;
+ private Type type;
+ private Optional<Bandwidth> maxRate = Optional.empty();
+ private Optional<Long> cir = Optional.empty();
+ private Optional<Long> cbs = Optional.empty();
+ private Optional<Map<Long, QueueDescription>> queues = Optional.empty();
+
+ private Builder() {
+ }
+
+ @Override
+ public QosDescription build() {
+ return new DefaultQosDescription(qosId, type, maxRate, cir, cbs, queues);
+ }
+
+ @Override
+ public Builder qosId(QosId qosId) {
+ this.qosId = qosId;
+ return this;
+ }
+
+ @Override
+ public Builder type(Type type) {
+ this.type = type;
+ return this;
+ }
+
+ @Override
+ public Builder maxRate(Bandwidth maxRate) {
+ this.maxRate = Optional.ofNullable(maxRate);
+ return this;
+ }
+
+ @Override
+ public Builder cir(Long cir) {
+ this.cir = Optional.ofNullable(cir);
+ return this;
+ }
+
+ @Override
+ public Builder cbs(Long cbs) {
+ this.cbs = Optional.ofNullable(cbs);
+ return this;
+ }
+
+ @Override
+ public Builder queues(Map<Long, QueueDescription> queues) {
+ this.queues = Optional.ofNullable(queues);
+ return this;
+ }
+ }
+}
+
diff --git a/core/api/src/main/java/org/onosproject/net/behaviour/DefaultQueueDescription.java b/core/api/src/main/java/org/onosproject/net/behaviour/DefaultQueueDescription.java
new file mode 100644
index 0000000..400c2a5
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/behaviour/DefaultQueueDescription.java
@@ -0,0 +1,202 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.behaviour;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.MoreObjects;
+import org.onlab.util.Bandwidth;
+import org.onosproject.net.AbstractDescription;
+import org.onosproject.net.SparseAnnotations;
+
+import java.util.EnumSet;
+import java.util.Objects;
+import java.util.Optional;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Default implementation of Queue description entity.
+ */
+@Beta
+public final class DefaultQueueDescription extends AbstractDescription
+ implements QueueDescription {
+
+ private final QueueId queueId;
+ private final Optional<Integer> dscp;
+ private final EnumSet<Type> type;
+ private final Optional<Bandwidth> maxRate;
+ private final Optional<Bandwidth> minRate;
+ private final Optional<Long> burst;
+ private final Optional<Long> priority;
+
+ public static final int MIN_DSCP = 0;
+ public static final int MAX_DSCP = 63;
+
+ private DefaultQueueDescription(QueueId queueId, Optional<Integer> dscp, EnumSet<Type> type,
+ Optional<Bandwidth> maxRate, Optional<Bandwidth> minRate,
+ Optional<Long> burst, Optional<Long> priority,
+ SparseAnnotations... annotations) {
+ super(annotations);
+ if (dscp.isPresent()) {
+ checkArgument(dscp.get() < MIN_DSCP || dscp.get() > MAX_DSCP, "dscp should be in range 0 to 63.");
+ }
+ this.queueId = checkNotNull(queueId);
+ this.dscp = dscp;
+ this.type = type;
+ this.maxRate = maxRate;
+ this.minRate = minRate;
+ this.burst = burst;
+ this.priority = priority;
+ }
+
+ @Override
+ public QueueId queueId() {
+ return queueId;
+ }
+
+ @Override
+ public EnumSet<Type> type() {
+ return type;
+ }
+
+ @Override
+ public Optional<Integer> dscp() {
+ return dscp;
+ }
+
+ @Override
+ public Optional<Bandwidth> maxRate() {
+ return maxRate;
+ }
+
+ @Override
+ public Optional<Bandwidth> minRate() {
+ return minRate;
+ }
+
+ @Override
+ public Optional<Long> burst() {
+ return burst;
+ }
+
+ @Override
+ public Optional<Long> priority() {
+ return priority;
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(queueId, type, dscp, maxRate, minRate, burst, priority);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof DefaultQueueDescription) {
+ final DefaultQueueDescription other = (DefaultQueueDescription) obj;
+ return Objects.equals(this.queueId, other.queueId) &&
+ Objects.equals(this.type, other.type) &&
+ Objects.equals(this.dscp, other.dscp) &&
+ Objects.equals(this.maxRate, other.maxRate) &&
+ Objects.equals(this.minRate, other.minRate) &&
+ Objects.equals(this.burst, other.burst) &&
+ Objects.equals(this.priority, other.priority);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return MoreObjects.toStringHelper(this)
+ .add("name", queueId())
+ .add("type", type())
+ .add("dscp", dscp().orElse(0))
+ .add("maxRate", maxRate().orElse(null))
+ .add("minRate", minRate().orElse(null))
+ .add("burst", burst().orElse(0L))
+ .add("priority", priority().orElse(0L))
+ .toString();
+ }
+
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ public static final class Builder implements QueueDescription.Builder {
+
+ private QueueId queueId;
+ private Optional<Integer> dscp = Optional.empty();
+ private EnumSet<Type> type;
+ private Optional<Bandwidth> minRate = Optional.empty();
+ private Optional<Bandwidth> maxRate = Optional.empty();
+ private Optional<Long> burst = Optional.empty();
+ private Optional<Long> priority = Optional.empty();
+
+ private Builder() {
+ }
+
+ @Override
+ public QueueDescription build() {
+ return new DefaultQueueDescription(queueId, dscp, type,
+ maxRate, minRate, burst, priority);
+ }
+
+ @Override
+ public Builder queueId(QueueId queueId) {
+ this.queueId = queueId;
+ return this;
+ }
+
+ @Override
+ public Builder dscp(Integer dscp) {
+ this.dscp = Optional.ofNullable(dscp);
+ return this;
+ }
+
+ @Override
+ public Builder type(EnumSet<Type> type) {
+ this.type = type;
+ return this;
+ }
+
+ @Override
+ public Builder maxRate(Bandwidth maxRate) {
+ this.maxRate = Optional.ofNullable(maxRate);
+ return this;
+ }
+
+ @Override
+ public Builder minRate(Bandwidth minRate) {
+ this.minRate = Optional.ofNullable(minRate);
+ return this;
+ }
+
+ @Override
+ public Builder burst(Long burst) {
+ this.burst = Optional.ofNullable(burst);
+ return this;
+ }
+
+ @Override
+ public Builder priority(Long priority) {
+ this.priority = Optional.ofNullable(priority);
+ return this;
+ }
+ }
+}
diff --git a/core/api/src/main/java/org/onosproject/net/behaviour/PortConfig.java b/core/api/src/main/java/org/onosproject/net/behaviour/PortConfig.java
index e14d336..35130e8 100644
--- a/core/api/src/main/java/org/onosproject/net/behaviour/PortConfig.java
+++ b/core/api/src/main/java/org/onosproject/net/behaviour/PortConfig.java
@@ -21,7 +21,9 @@
/**
* Means to configure a logical port at the device.
+ * @deprecated in Junco (1.9.1), use PortConfigBehaviour instead
*/
+@Deprecated
public interface PortConfig extends HandlerBehaviour {
/**
@@ -37,4 +39,4 @@
*/
void removeQoS(PortDescription port);
-}
+}
\ No newline at end of file
diff --git a/core/api/src/main/java/org/onosproject/net/behaviour/PortConfigBehaviour.java b/core/api/src/main/java/org/onosproject/net/behaviour/PortConfigBehaviour.java
new file mode 100644
index 0000000..ebf11da
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/behaviour/PortConfigBehaviour.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2015-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.behaviour;
+
+import com.google.common.annotations.Beta;
+import org.onosproject.net.PortNumber;
+import org.onosproject.net.device.PortDescription;
+import org.onosproject.net.driver.HandlerBehaviour;
+
+/**
+ * Means to configure a logical port at the device.
+ */
+@Beta
+public interface PortConfigBehaviour extends HandlerBehaviour {
+
+ /**
+ * Apply QoS configuration on a device.
+ * @param port a port description
+ * @param qosDesc qos description
+ */
+ void applyQoS(PortDescription port, QosDescription qosDesc);
+
+ /**
+ * Remove a QoS configuration.
+ * @param portNumber port identifier
+ */
+ void removeQoS(PortNumber portNumber);
+
+}
diff --git a/core/api/src/main/java/org/onosproject/net/behaviour/QosConfigBehaviour.java b/core/api/src/main/java/org/onosproject/net/behaviour/QosConfigBehaviour.java
new file mode 100644
index 0000000..178ff92
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/behaviour/QosConfigBehaviour.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.behaviour;
+import com.google.common.annotations.Beta;
+import org.onosproject.net.driver.HandlerBehaviour;
+
+import java.util.Collection;
+
+/**
+ * Behaviour for handling various operations for qos configurations.
+ */
+@Beta
+public interface QosConfigBehaviour extends HandlerBehaviour {
+
+ /**
+ * Obtain all qoses configured on a device.
+ *
+ * @return a set of qos descriptions
+ */
+ Collection<QosDescription> getQoses();
+
+ /**
+ * Obtain a qos configured on a device.
+ * @param qosDesc qos description
+ * @return a qos description
+ */
+ QosDescription getQos(QosDescription qosDesc);
+
+ /**
+ * create QoS configuration on a device.
+ * @param qosDesc qos description
+ * @return true if succeeds, or false
+ */
+ boolean addQoS(QosDescription qosDesc);
+
+ /**
+ * Delete a QoS configuration.
+ * @param qosId qos identifier
+ */
+ void deleteQoS(QosId qosId);
+}
\ No newline at end of file
diff --git a/core/api/src/main/java/org/onosproject/net/behaviour/QosDescription.java b/core/api/src/main/java/org/onosproject/net/behaviour/QosDescription.java
new file mode 100644
index 0000000..53e34d0
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/behaviour/QosDescription.java
@@ -0,0 +1,174 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.behaviour;
+
+import com.google.common.annotations.Beta;
+import org.onlab.util.Bandwidth;
+import org.onosproject.net.Annotated;
+import org.onosproject.net.Description;
+
+import java.util.Map;
+import java.util.Optional;
+
+/**
+ * Default implementation of immutable Qos description.
+ */
+@Beta
+public interface QosDescription extends Description, Annotated {
+
+ /**
+ * Denotes the type of the Qos.
+ */
+ enum Type {
+ /**
+ * Corresponds to Hierarchy token bucket classifier.
+ */
+ HTB,
+
+ /**
+ * Corresponds to Hierarchical Fair Service Curve classifier.
+ */
+ HFSC,
+
+ /**
+ * Corresponds to Stochastic Fairness Queueing classifier.
+ */
+ SFQ,
+
+ /**
+ * Corresponds to Controlled Delay classifier classifier.
+ */
+ CODEL,
+
+ /**
+ * Corresponds to Fair Queuing with Controlled Delay classifier.
+ */
+ FQ_CODEL,
+
+ /**
+ * No operation.
+ */
+ NOOP,
+
+ /**
+ * DPDK egress policer.
+ */
+ EGRESS_POLICER
+ }
+
+ /**
+ * Returns qos identifier.
+ *
+ * @return qos identifier
+ */
+ QosId qosId();
+
+ /**
+ * Returns qos type.
+ *
+ * @return qos type
+ */
+ Type type();
+
+ /**
+ * Returns the max rate of qos, Valid only in specific qos type.
+ *
+ * @return Maximum rate shared by all queued traffic, in bit/s.
+ */
+ Optional<Bandwidth> maxRate();
+
+ /**
+ * Returns Committed Information Rate of Qos, Valid only in specific qos type.
+ * the CIR is measured in bytes of IP packets per second.
+ *
+ * @return cir
+ */
+ Optional<Long> cir();
+
+ /**
+ * Returns Committed Burst Size of Qos, Valid only in specific qos type.
+ * the CBS is measured in bytes and represents a token bucket.
+ *
+ * @return cbs
+ */
+ Optional<Long> cbs();
+
+ /**
+ * Returns map of integer-Queue pairs, Valid only in specific qos type.
+ *
+ * @return queues
+ */
+ Optional<Map<Long, QueueDescription>> queues();
+
+ /**
+ * Builder of qos description entities.
+ */
+ interface Builder {
+ /**
+ * Returns qos description builder with a given name.
+ *
+ * @param qosId qos identifier
+ * @return bridge description builder
+ */
+ Builder qosId(QosId qosId);
+
+ /**
+ * Returns qos description builder with a given type.
+ *
+ * @param type qos type
+ * @return bridge description builder
+ */
+ Builder type(Type type);
+
+ /**
+ * Returns qos description builder with given maxRate.
+ *
+ * @param maxRate qos max rate
+ * @return qos description builder
+ */
+ Builder maxRate(Bandwidth maxRate);
+
+ /**
+ * Returns qos description builder with a given cir.
+ * @param cir in bytes of IP packets per second
+ * @return qos description builder
+ */
+ Builder cir(Long cir);
+
+ /**
+ * Returns qos description builder with a given cbs.
+ *
+ * @param cbs in bytes and represents a token bucket
+ * @return qos description builder
+ */
+ Builder cbs(Long cbs);
+
+ /**
+ * Returns qos description builder with a given queues.
+ *
+ * @param queues the map from queue numbers to Queue records
+ * @return qos description builder
+ */
+ Builder queues(Map<Long, QueueDescription> queues);
+
+ /**
+ * Builds an immutable qos description.
+ *
+ * @return qos description
+ */
+ QosDescription build();
+ }
+}
diff --git a/core/api/src/main/java/org/onosproject/net/behaviour/QosId.java b/core/api/src/main/java/org/onosproject/net/behaviour/QosId.java
new file mode 100644
index 0000000..db98970
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/behaviour/QosId.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.behaviour;
+
+import com.google.common.annotations.Beta;
+import java.util.Objects;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Immutable representation of a Qos identity.
+ */
+@Beta
+public final class QosId {
+
+ private final String name;
+
+ private QosId(String name) {
+ this.name = checkNotNull(name);
+ }
+
+ public static QosId qosId(String name) {
+ return new QosId(name);
+ }
+
+ public String name() {
+ return name;
+ }
+
+ @Override
+ public int hashCode() {
+ return name.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof QosId) {
+ final QosId that = (QosId) obj;
+ return this.getClass() == that.getClass() &&
+ Objects.equals(this.name, that.name);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return name;
+ }
+}
diff --git a/core/api/src/main/java/org/onosproject/net/behaviour/QueueConfig.java b/core/api/src/main/java/org/onosproject/net/behaviour/QueueConfig.java
index 1a44110..d5f6aaa 100644
--- a/core/api/src/main/java/org/onosproject/net/behaviour/QueueConfig.java
+++ b/core/api/src/main/java/org/onosproject/net/behaviour/QueueConfig.java
@@ -21,7 +21,9 @@
/**
* Means to alter a device's dataplane queues.
+ * @deprecated in Junco (1.9.1), use QueueConfigBehaviour instead
*/
+@Deprecated
public interface QueueConfig {
/**
@@ -53,4 +55,4 @@
*/
void removeQueue(UnsignedInteger queueId);
-}
+}
\ No newline at end of file
diff --git a/core/api/src/main/java/org/onosproject/net/behaviour/QueueConfigBehaviour.java b/core/api/src/main/java/org/onosproject/net/behaviour/QueueConfigBehaviour.java
new file mode 100644
index 0000000..4a48ce2
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/behaviour/QueueConfigBehaviour.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2015-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.behaviour;
+
+import com.google.common.annotations.Beta;
+import org.onosproject.net.driver.HandlerBehaviour;
+
+import java.util.Collection;
+
+/**
+ * Behaviour for handling various operations for queue configurations.
+ */
+@Beta
+public interface QueueConfigBehaviour extends HandlerBehaviour {
+
+ /**
+ * Obtain all queues configured on a device.
+ *
+ * @return a list of queue descriptions
+ */
+ Collection<QueueDescription> getQueues();
+
+ /**
+ * Obtain a queue configured on a device.
+ * @param queueDesc queue description
+ * @return a queue description
+ */
+ QueueDescription getQueue(QueueDescription queueDesc);
+
+ /**
+ * Create a queue to a device.
+ * @param queueDesc a queue description
+ * @return true if succeeds, or false
+ */
+ boolean addQueue(QueueDescription queueDesc);
+
+ /**
+ * Delete a queue from a device.
+ * @param queueId queue identifier
+ */
+ void deleteQueue(QueueId queueId);
+}
\ No newline at end of file
diff --git a/core/api/src/main/java/org/onosproject/net/behaviour/QueueDescription.java b/core/api/src/main/java/org/onosproject/net/behaviour/QueueDescription.java
new file mode 100644
index 0000000..43cb0a0
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/behaviour/QueueDescription.java
@@ -0,0 +1,172 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.behaviour;
+
+import com.google.common.annotations.Beta;
+import org.onlab.util.Bandwidth;
+import org.onosproject.net.Annotated;
+import org.onosproject.net.Description;
+
+import java.util.EnumSet;
+import java.util.Optional;
+
+/**
+ * Default implementation of immutable Queue description.
+ */
+@Beta
+public interface QueueDescription extends Description, Annotated {
+
+ /**
+ * Denotes the type of the Queue.
+ */
+ enum Type {
+ /**
+ * Support min rate.
+ */
+ MIN,
+
+ /**
+ * Support max rate.
+ */
+ MAX,
+
+ /**
+ * Support priority.
+ */
+ PRIORITY,
+
+ /**
+ * Support burst.
+ */
+ BURST
+ }
+
+ /**
+ * Returns queue identifier.
+ *
+ * @return queue identifier
+ */
+ QueueId queueId();
+
+ /**
+ * Returns dscp in range 0 to 63.
+ *
+ * @return dscp
+ */
+ Optional<Integer> dscp();
+
+ /**
+ * Returns type.
+ *
+ * @return type
+ */
+ EnumSet<Type> type();
+
+ /**
+ * Returns max rate, Valid only in specific type.
+ *
+ * @return Maximum allowed bandwidth, in bit/s.
+ */
+ Optional<Bandwidth> maxRate();
+
+ /**
+ * Returns min rate, Valid only in specific type.
+ *
+ * @return Minimum guaranteed bandwidth, in bit/s.
+ */
+ Optional<Bandwidth> minRate();
+
+ /**
+ * Returns burst, Valid only in specific type.
+ *
+ * @return Burst size, in bits
+ */
+ Optional<Long> burst();
+
+ /**
+ * Returns priority, Valid only in specific type.
+ * small number have higher priority, in range 0 to 0xFFFFFFFF
+ * @return priority
+ */
+ Optional<Long> priority();
+
+
+
+ interface Builder {
+
+ /**
+ * Returns queue description builder with given name.
+ *
+ * @param queueId queue identifier
+ * @return queue description builder
+ */
+ Builder queueId(QueueId queueId);
+
+ /**
+ * Returns queue description builder with given dscp.
+ *
+ * @param dscp dscp
+ * @return queue description builder
+ */
+ Builder dscp(Integer dscp);
+
+ /**
+ * Returns queue description builder with given type.
+ *
+ * @param type type
+ * @return queue description builder
+ */
+ Builder type(EnumSet<Type> type);
+
+ /**
+ * Returns queue description builder with max rate.
+ * @param maxRate Maximum allowed bandwidth
+ * @return queue description builder
+ */
+ Builder maxRate(Bandwidth maxRate);
+
+ /**
+ * Returns queue description builder with a given min rate.
+ *
+ * @param minRate Minimum guaranteed bandwidth
+ * @return queue description builder
+ */
+ Builder minRate(Bandwidth minRate);
+
+ /**
+ * Returns queue description builder with a given burst.
+ *
+ * @param burst burst size
+ * @return queue description builder
+ */
+ Builder burst(Long burst);
+
+ /**
+ * Returns queue description builder with a given priority.
+ * small number have higher priority, in range 0 to 0xFFFFFFFF
+ * @param priority priority
+ * @return queue description builder
+ */
+ Builder priority(Long priority);
+
+ /**
+ * Builds an immutable bridge description.
+ *
+ * @return queue description
+ */
+ QueueDescription build();
+ }
+}
diff --git a/core/api/src/main/java/org/onosproject/net/behaviour/QueueId.java b/core/api/src/main/java/org/onosproject/net/behaviour/QueueId.java
new file mode 100644
index 0000000..61e5dfd
--- /dev/null
+++ b/core/api/src/main/java/org/onosproject/net/behaviour/QueueId.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.onosproject.net.behaviour;
+
+import com.google.common.annotations.Beta;
+import java.util.Objects;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+/**
+ * Immutable representation of a Queue identity.
+ */
+@Beta
+public final class QueueId {
+ private final String name;
+
+ private QueueId(String name) {
+ this.name = checkNotNull(name);
+ }
+
+ public static QueueId queueId(String name) {
+ return new QueueId(name);
+ }
+
+ public String name() {
+ return name;
+ }
+
+ @Override
+ public int hashCode() {
+ return name.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj instanceof QueueId) {
+ final QueueId that = (QueueId) obj;
+ return this.getClass() == that.getClass() &&
+ Objects.equals(this.name, that.name);
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return name;
+ }
+}
diff --git a/core/api/src/main/java/org/onosproject/net/behaviour/QueueInfo.java b/core/api/src/main/java/org/onosproject/net/behaviour/QueueInfo.java
index 116ac7c..7758896 100644
--- a/core/api/src/main/java/org/onosproject/net/behaviour/QueueInfo.java
+++ b/core/api/src/main/java/org/onosproject/net/behaviour/QueueInfo.java
@@ -18,8 +18,10 @@
import com.google.common.primitives.UnsignedInteger;
/**
- * Represents a dataplane queue.
+ * @deprecated in Junco Release (1.9.1), Use QueueDescription instead
+ * {@link org.onosproject.net.behaviour.QueueDescription}
*/
+@Deprecated
public class QueueInfo {
public enum Type {