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)
21 public class NeutronRouter extends NeutronObject<NeutronRouter>
22 implements Serializable, INeutronObject<NeutronRouter> {
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() {
70 public void setAdminStateUp(Boolean newValue) {
71 adminStateUp = newValue;
74 public String getStatus() {
78 public void setStatus(String status) {
82 public NeutronRouter_NetworkReference getExternalGatewayInfo() {
83 return externalGatewayInfo;
86 public void setExternalGatewayInfo(NeutronRouter_NetworkReference externalGatewayInfo) {
87 this.externalGatewayInfo = externalGatewayInfo;
90 public Boolean getDistributed() {
94 public void setDistributed(Boolean distributed) {
95 this.distributed = distributed;
98 public String getGatewayPortId() {
102 public void setGatewayPortId(String gatewayPortId) {
103 this.gatewayPortId = gatewayPortId;
106 public List<NeutronRoute> getRoutes() {
110 public void setRoutes(List<NeutronRoute> routes) {
111 this.routes = routes;
115 * This method copies selected fields from the object and returns them
116 * as a new object, suitable for marshaling.
119 * List of attributes to be extracted
120 * @return an OpenStackRouters object with only the selected fields
123 public NeutronRouter extractFields(List<String> fields) {
124 NeutronRouter ans = new NeutronRouter();
125 Iterator<String> i = fields.iterator();
126 while (i.hasNext()) {
128 if (s.equals("id")) {
129 ans.setID(this.getID());
131 if (s.equals("name")) {
132 ans.setName(this.getName());
134 if (s.equals("admin_state_up")) {
135 ans.setAdminStateUp(this.getAdminStateUp());
137 if (s.equals("status")) {
138 ans.setStatus(this.getStatus());
140 if (s.equals("tenant_id")) {
141 ans.setTenantID(this.getTenantID());
143 if (s.equals("external_gateway_info")) {
144 ans.setExternalGatewayInfo(this.getExternalGatewayInfo());
146 if (s.equals("distributed")) {
147 ans.setDistributed(this.getDistributed());
149 if (s.equals("gw_port_id")) {
150 ans.setGatewayPortId(this.getGatewayPortId());
152 if (s.equals("routes")) {
153 ans.setRoutes(this.getRoutes());
160 public void initDefaults() {
165 public String toString() {
166 return "NeutronRouter [" + "id=" + uuid + ", name=" + name + ", adminStateUp=" + adminStateUp + ", status="
167 + status + ", tenantID=" + tenantID + ", external_gateway_info=" + externalGatewayInfo
168 + ", distributed=" + distributed + ", gw_port_id=" + gatewayPortId + ", routes=" + routes + "]";