Adds the "Quality of Service" to the OpenDayLight Neutron
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronQosDscpMarkingRule.java
diff --git a/neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronQosDscpMarkingRule.java b/neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronQosDscpMarkingRule.java
new file mode 100644 (file)
index 0000000..a0141cc
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2016 Intel Corporation.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.neutron.spi;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.List;
+
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.NONE)
+public class NeutronQosDscpMarkingRule extends NeutronObject implements Serializable, INeutronObject {
+    private static final long serialVersionUID = 1L;
+
+    @XmlElement(name = "dscp_mark")
+    Short dscpMark;
+
+    public Short getDscpMark() {
+        return dscpMark;
+    }
+
+    public void setDscpMark(Short dscpMark) {
+        this.dscpMark = dscpMark;
+    }
+
+    public NeutronQosDscpMarkingRule extractFields(List<String> fields) {
+        NeutronQosDscpMarkingRule ans = new NeutronQosDscpMarkingRule();
+        Iterator<String> i = fields.iterator();
+        while (i.hasNext()) {
+            String s = i.next();
+            if (s.equals("id")) {
+                ans.setID(this.getID());
+            }
+            if (s.equals("tenant_id")) {
+                ans.setTenantID(this.getTenantID());
+            }
+            if (s.equals("dscp_mark")) {
+                ans.setDscpMark(this.getDscpMark());
+            }
+        }
+        return ans;
+    }
+
+    @Override
+    public String toString() {
+        return "qosDscpRules{" +
+            "qosDscpRuleUUID='" + uuid + '\'' +
+            ", qosDscpRuleTenantID='" + tenantID + '\'' +
+            ", qosDscpRuleDscpMark='" + dscpMark + '\'' +
+            '}';
+    }
+}