neutron: unbreak of neutron northbound yang model revise
[netvirt.git] / openstack / net-virt / src / main / java / org / opendaylight / netvirt / openstack / netvirt / translator / NeutronRouter.java
1 /*
2  * Copyright (c) 2013, 2015 IBM Corporation and others.  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.netvirt.openstack.netvirt.translator;
10
11 import java.io.Serializable;
12 import java.util.HashMap;
13 import java.util.List;
14 import java.util.Map;
15
16 import javax.xml.bind.annotation.XmlAccessType;
17 import javax.xml.bind.annotation.XmlAccessorType;
18 import javax.xml.bind.annotation.XmlElement;
19 import javax.xml.bind.annotation.XmlRootElement;
20
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.l3.attributes.Routes;
22
23 @XmlRootElement
24 @XmlAccessorType(XmlAccessType.NONE)
25
26 public class NeutronRouter implements Serializable, INeutronObject {
27     private static final long serialVersionUID = 1L;
28
29     // See OpenStack Network API v2.0 Reference for description of
30     // annotated attributes
31     @XmlElement (name = "id")
32     String routerUUID;
33
34     @XmlElement (name = "name")
35     String name;
36
37     @XmlElement (defaultValue = "true", name = "admin_state_up")
38     Boolean adminStateUp;
39
40     @XmlElement (name = "status")
41     String status;
42
43     @XmlElement (name = "tenant_id")
44     String tenantID;
45
46     @XmlElement (name = "external_gateway_info", nillable = true)
47     NeutronRouter_NetworkReference externalGatewayInfo;
48
49     @XmlElement (name = "distributed")
50     Boolean distributed;
51
52     @XmlElement (name = "gw_port_id", nillable = true)
53     String gatewayPortId;
54
55     @XmlElement (name = "routes")
56     List<Routes> routes;
57
58     public String getID() { return routerUUID; }
59
60     public void setID(String id) { this.routerUUID = id; }
61
62     public String getRouterUUID() {
63         return routerUUID;
64     }
65
66     public void setRouterUUID(String routerUUID) {
67         this.routerUUID = routerUUID;
68     }
69
70     public String getName() {
71         return name;
72     }
73
74     public void setName(String name) {
75         this.name = name;
76     }
77
78     public boolean isAdminStateUp() {
79         if (adminStateUp == null) {
80             return true;
81         }
82         return adminStateUp;
83     }
84
85     public Boolean getAdminStateUp() { return adminStateUp; }
86
87     public void setAdminStateUp(Boolean newValue) {
88         adminStateUp = newValue;
89     }
90
91     public String getStatus() {
92         return status;
93     }
94
95     public void setStatus(String status) {
96         this.status = status;
97     }
98
99     public String getTenantID() {
100         return tenantID;
101     }
102
103     public void setTenantID(String tenantID) {
104         this.tenantID = tenantID;
105     }
106
107     public NeutronRouter_NetworkReference getExternalGatewayInfo() {
108         return externalGatewayInfo;
109     }
110
111     public void setExternalGatewayInfo(NeutronRouter_NetworkReference externalGatewayInfo) {
112         this.externalGatewayInfo = externalGatewayInfo;
113     }
114
115     public Boolean getDistributed() {
116         return distributed;
117     }
118
119     public void setDistributed(Boolean distributed) {
120         this.distributed = distributed;
121     }
122
123     public String getGatewayPortId() {
124         return gatewayPortId;
125     }
126
127     public void setGatewayPortId(String gatewayPortId) {
128         this.gatewayPortId = gatewayPortId;
129     }
130
131     public List<Routes> getRoutes() {
132         return routes;
133     }
134
135     public void setRoutes(List<Routes> routes) {
136         this.routes = routes;
137     }
138
139     /**
140      * This method copies selected fields from the object and returns them
141      * as a new object, suitable for marshaling.
142      *
143      * @param fields
144      *            List of attributes to be extracted
145      * @return an OpenStackRouters object with only the selected fields
146      * populated
147      */
148     public NeutronRouter extractFields(List<String> fields) {
149         NeutronRouter ans = new NeutronRouter();
150         for (String s : fields) {
151             switch (s) {
152                 case "id":
153                     ans.setRouterUUID(this.getRouterUUID());
154                     break;
155                 case "name":
156                     ans.setName(this.getName());
157                     break;
158                 case "admin_state_up":
159                     ans.setAdminStateUp(this.getAdminStateUp());
160                     break;
161                 case "status":
162                     ans.setStatus(this.getStatus());
163                     break;
164                 case "tenant_id":
165                     ans.setTenantID(this.getTenantID());
166                     break;
167                 case "external_gateway_info":
168                     ans.setExternalGatewayInfo(this.getExternalGatewayInfo());
169                     break;
170                 case "distributed":
171                     ans.setDistributed(this.getDistributed());
172                     break;
173                 case "gw_port_id":
174                     ans.setGatewayPortId(this.getGatewayPortId());
175                     break;
176                 case "routes":
177                     ans.setRoutes(this.getRoutes());
178                     break;
179             }
180         }
181         return ans;
182     }
183
184     public void initDefaults() {
185         adminStateUp = true;
186     }
187
188     @Override
189     public String toString() {
190         return "NeutronRouter [" +
191             "id=" + routerUUID +
192             ", name=" + name +
193             ", adminStateUp=" + adminStateUp +
194             ", status=" + status +
195             ", tenantID=" + tenantID +
196             ", external_gateway_info=" + externalGatewayInfo +
197             ", distributed=" + distributed +
198             ", gw_port_id=" + gatewayPortId +
199             ", routes=" + routes +
200             "]";
201     }
202 }