2 * Copyright (c) 2013, 2015 IBM Corporation and others. All rights reserved.
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
9 package org.opendaylight.netvirt.openstack.netvirt.translator;
11 import java.io.Serializable;
12 import java.util.HashMap;
13 import java.util.List;
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;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.l3.attributes.Routes;
24 @XmlAccessorType(XmlAccessType.NONE)
26 public class NeutronRouter implements Serializable, INeutronObject {
27 private static final long serialVersionUID = 1L;
29 // See OpenStack Network API v2.0 Reference for description of
30 // annotated attributes
31 @XmlElement (name = "id")
34 @XmlElement (name = "name")
37 @XmlElement (defaultValue = "true", name = "admin_state_up")
40 @XmlElement (name = "status")
43 @XmlElement (name = "tenant_id")
46 @XmlElement (name = "external_gateway_info", nillable = true)
47 NeutronRouter_NetworkReference externalGatewayInfo;
49 @XmlElement (name = "distributed")
52 @XmlElement (name = "gw_port_id", nillable = true)
55 @XmlElement (name = "routes")
58 public String getID() { return routerUUID; }
60 public void setID(String id) { this.routerUUID = id; }
62 public String getRouterUUID() {
66 public void setRouterUUID(String routerUUID) {
67 this.routerUUID = routerUUID;
70 public String getName() {
74 public void setName(String name) {
78 public boolean isAdminStateUp() {
79 if (adminStateUp == null) {
85 public Boolean getAdminStateUp() { return adminStateUp; }
87 public void setAdminStateUp(Boolean newValue) {
88 adminStateUp = newValue;
91 public String getStatus() {
95 public void setStatus(String status) {
99 public String getTenantID() {
103 public void setTenantID(String tenantID) {
104 this.tenantID = tenantID;
107 public NeutronRouter_NetworkReference getExternalGatewayInfo() {
108 return externalGatewayInfo;
111 public void setExternalGatewayInfo(NeutronRouter_NetworkReference externalGatewayInfo) {
112 this.externalGatewayInfo = externalGatewayInfo;
115 public Boolean getDistributed() {
119 public void setDistributed(Boolean distributed) {
120 this.distributed = distributed;
123 public String getGatewayPortId() {
124 return gatewayPortId;
127 public void setGatewayPortId(String gatewayPortId) {
128 this.gatewayPortId = gatewayPortId;
131 public List<Routes> getRoutes() {
135 public void setRoutes(List<Routes> routes) {
136 this.routes = routes;
140 * This method copies selected fields from the object and returns them
141 * as a new object, suitable for marshaling.
144 * List of attributes to be extracted
145 * @return an OpenStackRouters object with only the selected fields
148 public NeutronRouter extractFields(List<String> fields) {
149 NeutronRouter ans = new NeutronRouter();
150 for (String s : fields) {
153 ans.setRouterUUID(this.getRouterUUID());
156 ans.setName(this.getName());
158 case "admin_state_up":
159 ans.setAdminStateUp(this.getAdminStateUp());
162 ans.setStatus(this.getStatus());
165 ans.setTenantID(this.getTenantID());
167 case "external_gateway_info":
168 ans.setExternalGatewayInfo(this.getExternalGatewayInfo());
171 ans.setDistributed(this.getDistributed());
174 ans.setGatewayPortId(this.getGatewayPortId());
177 ans.setRoutes(this.getRoutes());
184 public void initDefaults() {
189 public String toString() {
190 return "NeutronRouter [" +
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 +