5ecf1de35c2e0620180326cac36489453c973f30
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronQosDscpMarkingRule.java
1 /*
2  * Copyright (c) 2016 Intel Corporation.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.neutron.spi;
10
11 import java.io.Serializable;
12 import java.util.List;
13 import javax.xml.bind.annotation.XmlAccessType;
14 import javax.xml.bind.annotation.XmlAccessorType;
15 import javax.xml.bind.annotation.XmlElement;
16 import javax.xml.bind.annotation.XmlRootElement;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
19
20 @XmlRootElement
21 @XmlAccessorType(XmlAccessType.NONE)
22 public final class NeutronQosDscpMarkingRule extends NeutronObject<NeutronQosDscpMarkingRule>
23         implements Serializable, INeutronObject<NeutronQosDscpMarkingRule> {
24     private static final Logger LOGGER = LoggerFactory.getLogger(NeutronQosDscpMarkingRule.class);
25     private static final long serialVersionUID = 1L;
26
27     @XmlElement(name = "dscp_mark")
28     Short dscpMark;
29
30     public Short getDscpMark() {
31         return dscpMark;
32     }
33
34     public void setDscpMark(Short dscpMark) {
35         this.dscpMark = dscpMark;
36     }
37
38     public NeutronQosDscpMarkingRule extractFields(List<String> fields) {
39         NeutronQosDscpMarkingRule ans = new NeutronQosDscpMarkingRule();
40         for (String s : fields) {
41             if (extractField(s, ans)) {
42                 continue;
43             }
44             switch (s) {
45                 case "dscp_mark":
46                     ans.setDscpMark(this.getDscpMark());
47                     break;
48                 default:
49                     LOGGER.warn("{} is not a NeutronQosDscpMarkingRule suitable field.", s);
50                     break;
51             }
52         }
53         return ans;
54     }
55
56     @Override
57     public String toString() {
58         return "qosDscpRules{" + "qosDscpRuleUUID='" + uuid + '\'' + ", qosDscpRuleTenantID='" + tenantID + '\''
59                 + ", qosDscpRuleDscpMark='" + dscpMark + '\'' + '}';
60     }
61 }