Use typed queues for OF message processing

Process OF messages through 8 queues. Output queue for messages
controlled per OF Agent with help of message classifiers.

Queues can be configured through component configuration mechanism
for "org.onosproject.openflow.controller.impl.OpenFlowControllerImpl"
component.

Classifiers can be configured through NetworkConfig API in the following
form:

      {
        "devices": {
           "of:0000000000000001": {
               "classifiers": [{
                   "ethernet-type":"LLDP",
                   "target-queue":0
               },{
                   "ethernet-type":"BDDP",
                   "target-queue":0
               },{
                   "ethernet-type":"0x1234",
                   "target-queue":1
               }]
           }
        }
      }

Where "target_queue" is queue number from 0 to 7 (7 is default queue),
"ethernet_type" is a type of a packet either in "0xFFFF" from or enum
name as defined in the "org.onlab.packet.EthType.EtherType" enum.

Change-Id: I0512ef653d90c36f00289014872170c1a8aa5204
diff --git a/protocols/openflow/api/src/main/java/org/onosproject/openflow/controller/OpenFlowClassifier.java b/protocols/openflow/api/src/main/java/org/onosproject/openflow/controller/OpenFlowClassifier.java
new file mode 100644
index 0000000..6b746a0
--- /dev/null
+++ b/protocols/openflow/api/src/main/java/org/onosproject/openflow/controller/OpenFlowClassifier.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2019-present Open Networking Foundation
+ *
+ * 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.openflow.controller;
+
+import org.onosproject.net.DeviceId;
+import java.util.Objects;
+
+/**
+ * Represents to OpenFlow messages classifier.
+ */
+public final class OpenFlowClassifier {
+
+    private final short ethernetType;
+    private final int idQueue;
+    private final DeviceId deviceId;
+
+    /**
+     * Builder of the OpenFlow classifier.
+     */
+    public static class Builder {
+        private Short ethernetType = 0;
+        private int idQueue;
+        private DeviceId deviceId;
+
+        /**
+         * Builder constructor for OpenFlow classifier.
+         *
+         * @param deviceId the device id
+         * @param idQueue  the queue id
+         */
+        public Builder(DeviceId deviceId, int idQueue) {
+            this.deviceId = deviceId;
+            this.idQueue = idQueue;
+        }
+
+        /**
+         * Sets the ethernet type for the OpenFlow classifier that will be built.
+         *
+         * @param ethernetType the ethernet type
+         * @return this builder
+         */
+        public Builder ethernetType(short ethernetType) {
+            this.ethernetType = ethernetType;
+            return this;
+        }
+
+        /**
+         * Builds the OpenFlow classifier from the accumulated parameters.
+         *
+         * @return OpenFlow classifier instance
+         */
+        public OpenFlowClassifier build() {
+            return new OpenFlowClassifier(this);
+        }
+    }
+
+    private OpenFlowClassifier(Builder builder) {
+        this.idQueue = builder.idQueue;
+        this.ethernetType = builder.ethernetType;
+        this.deviceId = builder.deviceId;
+    }
+
+    /**
+     * Gets the ethernet type matched by the classifier.
+     *
+     * @return matched packet ethernet type
+     */
+    public short ethernetType() {
+        return this.ethernetType;
+    }
+
+    /**
+     * Gets the id of source OpenFlow device matched by the classifier.
+     *
+     * @return connected device id
+     */
+    public DeviceId deviceId() {
+        return this.deviceId;
+    }
+
+    /**
+     * Gets the queue id targeted by the classifier.
+     *
+     * @return target queue id
+     */
+    public int idQueue() {
+        return this.idQueue;
+    }
+
+    /**
+     * Compares OpenFlow classifiers.
+     *
+     * @param o object that we want to compare to
+     * @return equality check result
+     */
+    @Override
+    public boolean equals(Object o) {
+        if (!(o instanceof OpenFlowClassifier)) {
+            return false;
+        }
+        OpenFlowClassifier classifier = (OpenFlowClassifier) o;
+        return this.ethernetType == classifier.ethernetType()
+               && this.idQueue == classifier.idQueue()
+               && this.deviceId.equals(classifier.deviceId());
+    }
+
+    /**
+     * Calculates hashCode of the OpenFlow Classifier object.
+     *
+     * @return hash of the OpenFlow Classifier
+     */
+    @Override
+    public int hashCode() {
+        return Objects.hash(deviceId, idQueue, ethernetType);
+    }
+}