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;
21 import org.opendaylight.controller.configuration.ConfigurationObject;
24 @XmlAccessorType(XmlAccessType.NONE)
26 public class NeutronRouter extends ConfigurationObject 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")
47 NeutronRouter_NetworkReference externalGatewayInfo;
49 /* Holds a map of OpenStackRouterInterfaces by subnet UUID
50 * used for internal mapping to DOVE
52 HashMap<String, NeutronRouter_Interface> interfaces;
54 public NeutronRouter() {
55 interfaces = new HashMap<String, NeutronRouter_Interface>();
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;
116 * This method copies selected fields from the object and returns them
117 * as a new object, suitable for marshaling.
120 * List of attributes to be extracted
121 * @return an OpenStackRouters object with only the selected fields
125 public NeutronRouter extractFields(List<String> fields) {
126 NeutronRouter ans = new NeutronRouter();
127 Iterator<String> i = fields.iterator();
128 while (i.hasNext()) {
130 if (s.equals("id")) {
131 ans.setRouterUUID(this.getRouterUUID());
133 if (s.equals("name")) {
134 ans.setName(this.getName());
136 if (s.equals("admin_state_up")) {
137 ans.setAdminStateUp(this.getAdminStateUp());
139 if (s.equals("status")) {
140 ans.setStatus(this.getStatus());
142 if (s.equals("tenant_id")) {
143 ans.setTenantID(this.getTenantID());
145 if (s.equals("external_gateway_info")) {
146 ans.setExternalGatewayInfo(this.getExternalGatewayInfo());
152 public HashMap<String, NeutronRouter_Interface> getInterfaces() {
156 public void addInterface(String s, NeutronRouter_Interface i) {
157 interfaces.put(s, i);
160 public void removeInterface(String s) {
161 interfaces.remove(s);
164 public void initDefaults() {