Merge "Changed lookup of Controller IP to the following: - Start with OVSDB config...
[netvirt.git] / ovsdb / src / main / java / org / opendaylight / ovsdb / lib / database / OvsdbType.java
1 /*
2  * [[ Authors will Fill in the Copyright header ]]
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  * Authors : Brent Salisbury, Evan Zeller
9  */
10 package org.opendaylight.ovsdb.lib.database;\r
11 \r
12 import java.util.Arrays;\r
13 \r
14 import com.fasterxml.jackson.annotation.JsonProperty;\r
15 \r
16 \r
17 public class OvsdbType {\r
18     public enum PortType {\r
19         VLAN("vlan"),\r
20         TUNNEL("Tunnel"),\r
21         BONDING("Bonding"),\r
22         PATCH("patch"),\r
23         INTERNAL("internal");\r
24 \r
25         private PortType(String name) {\r
26             this.name = name;\r
27         }\r
28 \r
29         private String name;\r
30 \r
31         public String toString() {\r
32             return name;\r
33         }\r
34     }\r
35     public OvsdbType(String type){\r
36         this.key = new BaseType(type);\r
37     }\r
38 \r
39     public OvsdbType(@JsonProperty("key") BaseType key, @JsonProperty("value") BaseType value,\r
40             @JsonProperty("min") Integer min, @JsonProperty("max") Object max){\r
41         this.key = key;\r
42         this.value = value;\r
43         this.min = min;\r
44         this.max = max;\r
45     }\r
46 \r
47     public BaseType key;\r
48     public BaseType value;\r
49     public Integer min;\r
50     public Object max;\r
51 \r
52     public static class BaseType{\r
53 \r
54         public BaseType(String type){\r
55             this.type = type;\r
56         }\r
57 \r
58         public BaseType(@JsonProperty("type") String type, @JsonProperty("enum") Object[] ovsdbEnum,\r
59                 @JsonProperty("minInteger") Integer minInteger, @JsonProperty("maxInteger") Integer maxInteger,\r
60                 @JsonProperty("minReal") Double minReal, @JsonProperty("maxReal") Double maxReal,\r
61                 @JsonProperty("minLength") Integer minLength, @JsonProperty("maxLength") Integer maxLength,\r
62                 @JsonProperty("refTable") String refTable, @JsonProperty("refType") String refType){\r
63             this.type = type;\r
64             this.ovsdbEnum = ovsdbEnum;\r
65             this.minInteger = minInteger;\r
66             this.maxInteger = maxInteger;\r
67             this.minReal = minReal;\r
68             this.maxReal = maxReal;\r
69             this.minLength = minLength;\r
70             this.maxLength = maxLength;\r
71             this.refTable = refTable;\r
72             this.refType = refType;\r
73         }\r
74 \r
75         public String type;\r
76         public Object[] ovsdbEnum;\r
77         public Integer minInteger;\r
78         public Integer maxInteger;\r
79         public Double minReal;\r
80         public Double maxReal;\r
81         public Integer minLength;\r
82         public Integer maxLength;\r
83         public String refTable;\r
84         public String refType;\r
85         @Override\r
86         public String toString() {\r
87             return "BaseType [type=" + type + ", ovsdbEnum="\r
88                     + Arrays.toString(ovsdbEnum) + ", minInteger=" + minInteger\r
89                     + ", maxInteger=" + maxInteger + ", minReal=" + minReal\r
90                     + ", maxReal=" + maxReal + ", minLength=" + minLength\r
91                     + ", maxLength=" + maxLength + ", refTable=" + refTable\r
92                     + ", refType=" + refType + "]";\r
93         }\r
94     }\r
95 \r
96     @Override\r
97     public String toString() {\r
98         return "OvsdbType [key=" + key + ", value=" + value + ", min=" + min\r
99                 + ", max=" + max + "]";\r
100     }\r
101 }\r