2 * Copyright IBM Corporation, 2013. 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.controller.networkconfig.neutron;
11 import java.io.Serializable;
12 import java.util.HashMap;
13 import java.util.Iterator;
14 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;
22 @XmlAccessorType(XmlAccessType.NONE)
24 public class NeutronRouter implements Serializable {
25 private static final long serialVersionUID = 1L;
27 // See OpenStack Network API v2.0 Reference for description of
28 // annotated attributes
29 @XmlElement (name="id")
32 @XmlElement (name="name")
35 @XmlElement (defaultValue="true", name="admin_state_up")
38 @XmlElement (name="status")
41 @XmlElement (name="tenant_id")
44 @XmlElement (name="external_gateway_info")
45 NeutronRouter_NetworkReference externalGatewayInfo;
47 /* Holds a map of OpenStackRouterInterfaces by subnet UUID
48 * used for internal mapping to DOVE
50 HashMap<String, NeutronRouter_Interface> interfaces;
52 public NeutronRouter() {
53 interfaces = new HashMap<String, NeutronRouter_Interface>();
56 public String getID() { return routerUUID; }
58 public String getRouterUUID() {
62 public void setRouterUUID(String routerUUID) {
63 this.routerUUID = routerUUID;
66 public String getName() {
70 public void setName(String name) {
74 public boolean isAdminStateUp() {
75 if (adminStateUp == null) {
81 public Boolean getAdminStateUp() { return adminStateUp; }
83 public void setAdminStateUp(Boolean newValue) {
84 adminStateUp = newValue;
87 public String getStatus() {
91 public void setStatus(String status) {
95 public String getTenantID() {
99 public void setTenantID(String tenantID) {
100 this.tenantID = tenantID;
103 public NeutronRouter_NetworkReference getExternalGatewayInfo() {
104 return externalGatewayInfo;
107 public void setExternalGatewayInfo(NeutronRouter_NetworkReference externalGatewayInfo) {
108 this.externalGatewayInfo = externalGatewayInfo;
112 * This method copies selected fields from the object and returns them
113 * as a new object, suitable for marshaling.
116 * List of attributes to be extracted
117 * @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.setRouterUUID(this.getRouterUUID());
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());
148 public HashMap<String, NeutronRouter_Interface> getInterfaces() {
152 public void addInterface(String s, NeutronRouter_Interface i) {
153 interfaces.put(s, i);
156 public void removeInterface(String s) {
157 interfaces.remove(s);
160 public void initDefaults() {