Merge "Bug 6641: Fix ip_address in allowed_address_pairs info"
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronQosBandwidthRule.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.math.BigInteger;
13 import java.util.Iterator;
14 import java.util.List;
15 import javax.xml.bind.annotation.XmlAccessType;
16 import javax.xml.bind.annotation.XmlAccessorType;
17 import javax.xml.bind.annotation.XmlElement;
18 import javax.xml.bind.annotation.XmlRootElement;
19
20 @XmlRootElement
21 @XmlAccessorType(XmlAccessType.NONE)
22 public final class NeutronQosBandwidthRule extends NeutronObject<NeutronQosBandwidthRule>
23         implements Serializable, INeutronObject<NeutronQosBandwidthRule> {
24     private static final long serialVersionUID = 1L;
25
26     @XmlElement(name = "max_kbps")
27     BigInteger maxKbps;
28
29     @XmlElement(name = "max_burst_kbps")
30     BigInteger maxBurstKbps;
31
32     public BigInteger getMaxKbps() {
33         return maxKbps;
34     }
35
36     public void setMaxKbps(BigInteger maxKbps) {
37         this.maxKbps = maxKbps;
38     }
39
40     public BigInteger getMaxBurstKbps() {
41         return maxBurstKbps;
42     }
43
44     public void setMaxBurstKbps(BigInteger maxBurstKbps) {
45         this.maxBurstKbps = maxBurstKbps;
46     }
47
48     public NeutronQosBandwidthRule extractFields(List<String> fields) {
49         NeutronQosBandwidthRule ans = new NeutronQosBandwidthRule();
50         Iterator<String> i = fields.iterator();
51         while (i.hasNext()) {
52             String s = i.next();
53             if (s.equals("id")) {
54                 ans.setID(this.getID());
55             }
56             if (s.equals("tenant_id")) {
57                 ans.setTenantID(this.getTenantID());
58             }
59             if (s.equals("max_kbps")) {
60                 ans.setMaxKbps(this.getMaxKbps());
61             }
62             if (s.equals("max_burst_kbps")) {
63                 ans.setMaxBurstKbps(this.getMaxBurstKbps());
64             }
65         }
66         return ans;
67     }
68
69     @Override
70     public String toString() {
71         return "qosBandwidthRules{" + "qosBandwidthRuleUUID='" + uuid + '\'' + ", qosBandwidthRuleTenantID='" + tenantID
72                 + '\'' + ", qosBandwidthMaxValue='" + maxKbps + '\'' + ", qosBandwidthMaxBurst='" + maxBurstKbps + '\''
73                 + '}';
74     }
75 }