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.neutron.spi;
11 import java.io.Serializable;
12 import java.util.Iterator;
13 import java.util.List;
14 import javax.xml.bind.annotation.XmlAccessType;
15 import javax.xml.bind.annotation.XmlAccessorType;
16 import javax.xml.bind.annotation.XmlElement;
17 import javax.xml.bind.annotation.XmlRootElement;
20 @XmlAccessorType(XmlAccessType.NONE)
22 public class NeutronRouter extends NeutronObject implements Serializable, INeutronObject {
23 private static final long serialVersionUID = 1L;
25 // See OpenStack Network API v2.0 Reference for description of
26 // annotated attributes
27 @XmlElement (name = "name")
30 @XmlElement (defaultValue = "true", name = "admin_state_up")
33 @XmlElement (name = "status")
36 @XmlElement (name = "external_gateway_info", nillable = true)
37 NeutronRouter_NetworkReference externalGatewayInfo;
39 @XmlElement (name = "distributed")
42 @XmlElement (name = "gw_port_id", nillable = true)
45 @XmlElement (name = "routes")
46 List<NeutronRoute> routes;
48 public NeutronRouter() {
51 public String getName() {
55 public void setName(String name) {
59 public boolean isAdminStateUp() {
60 if (adminStateUp == null) {
66 public Boolean getAdminStateUp() { return adminStateUp; }
68 public void setAdminStateUp(Boolean newValue) {
69 adminStateUp = newValue;
72 public String getStatus() {
76 public void setStatus(String status) {
80 public NeutronRouter_NetworkReference getExternalGatewayInfo() {
81 return externalGatewayInfo;
84 public void setExternalGatewayInfo(NeutronRouter_NetworkReference externalGatewayInfo) {
85 this.externalGatewayInfo = externalGatewayInfo;
88 public Boolean getDistributed() {
92 public void setDistributed(Boolean distributed) {
93 this.distributed = distributed;
96 public String getGatewayPortId() {
100 public void setGatewayPortId(String gatewayPortId) {
101 this.gatewayPortId = gatewayPortId;
104 public List<NeutronRoute> getRoutes() {
108 public void setRoutes(List<NeutronRoute> routes) {
109 this.routes = routes;
113 * This method copies selected fields from the object and returns them
114 * as a new object, suitable for marshaling.
117 * List of attributes to be extracted
118 * @return an OpenStackRouters object with only the selected fields
121 public NeutronRouter extractFields(List<String> fields) {
122 NeutronRouter ans = new NeutronRouter();
123 Iterator<String> i = fields.iterator();
124 while (i.hasNext()) {
126 if (s.equals("id")) {
127 ans.setID(this.getID());
129 if (s.equals("name")) {
130 ans.setName(this.getName());
132 if (s.equals("admin_state_up")) {
133 ans.setAdminStateUp(this.getAdminStateUp());
135 if (s.equals("status")) {
136 ans.setStatus(this.getStatus());
138 if (s.equals("tenant_id")) {
139 ans.setTenantID(this.getTenantID());
141 if (s.equals("external_gateway_info")) {
142 ans.setExternalGatewayInfo(this.getExternalGatewayInfo());
144 if (s.equals("distributed")) {
145 ans.setDistributed(this.getDistributed());
147 if (s.equals("gw_port_id")) {
148 ans.setGatewayPortId(this.getGatewayPortId());
150 if (s.equals("routes")){
151 ans.setRoutes(this.getRoutes());
158 public void initDefaults() {
163 public String toString() {
164 return "NeutronRouter [" +
167 ", adminStateUp=" + adminStateUp +
168 ", status=" + status +
169 ", tenantID=" + tenantID +
170 ", external_gateway_info=" + externalGatewayInfo +
171 ", distributed=" + distributed +
172 ", gw_port_id=" + gatewayPortId +
173 ", routes=" + routes +