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.List;
13 import javax.xml.bind.annotation.XmlAccessType;
14 import javax.xml.bind.annotation.XmlAccessorType;
15 import javax.xml.bind.annotation.XmlElement;
16 import javax.xml.bind.annotation.XmlRootElement;
19 @XmlAccessorType(XmlAccessType.NONE)
20 public final class NeutronRouter extends NeutronAdminAttributes<NeutronRouter>
21 implements Serializable {
22 private static final long serialVersionUID = 1L;
24 // See OpenStack Network API v2.0 Reference for description of
25 // annotated attributes
26 @XmlElement(name = "external_gateway_info", nillable = true)
27 NeutronRouter_NetworkReference externalGatewayInfo;
29 @XmlElement(name = "distributed")
32 @XmlElement(name = "gw_port_id", nillable = true)
35 @XmlElement(name = "routes")
36 List<NeutronRoute> routes;
38 public NeutronRouter() {
41 public boolean isAdminStateUp() {
42 if (adminStateUp == null) {
48 public NeutronRouter_NetworkReference getExternalGatewayInfo() {
49 return externalGatewayInfo;
52 public void setExternalGatewayInfo(NeutronRouter_NetworkReference externalGatewayInfo) {
53 this.externalGatewayInfo = externalGatewayInfo;
56 public Boolean getDistributed() {
60 public void setDistributed(Boolean distributed) {
61 this.distributed = distributed;
64 public String getGatewayPortId() {
68 public void setGatewayPortId(String gatewayPortId) {
69 this.gatewayPortId = gatewayPortId;
72 public List<NeutronRoute> getRoutes() {
76 public void setRoutes(List<NeutronRoute> routes) {
81 * This method copies selected fields from the object and returns them
82 * as a new object, suitable for marshaling.
85 * List of attributes to be extracted
86 * @return an OpenStackRouters object with only the selected fields
89 public NeutronRouter extractFields(List<String> fields) {
90 NeutronRouter ans = new NeutronRouter();
91 for (String s : fields) {
93 if (s.equals("external_gateway_info")) {
94 ans.setExternalGatewayInfo(this.getExternalGatewayInfo());
96 if (s.equals("distributed")) {
97 ans.setDistributed(this.getDistributed());
99 if (s.equals("gw_port_id")) {
100 ans.setGatewayPortId(this.getGatewayPortId());
102 if (s.equals("routes")) {
103 ans.setRoutes(this.getRoutes());
110 public void initDefaults() {
115 public String toString() {
116 return "NeutronRouter [" + "id=" + uuid + ", name=" + name + ", adminStateUp=" + adminStateUp + ", status="
117 + status + ", tenantID=" + tenantID + ", external_gateway_info=" + externalGatewayInfo
118 + ", distributed=" + distributed + ", gw_port_id=" + gatewayPortId + ", routes=" + routes + "]";