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.util.HashMap;
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 {
23 // See OpenStack Network API v2.0 Reference for description of
24 // annotated attributes
25 @XmlElement (name="id")
28 @XmlElement (name="name")
31 @XmlElement (defaultValue="true", name="admin_state_up")
34 @XmlElement (name="status")
37 @XmlElement (name="tenant_id")
40 @XmlElement (name="external_gateway_info")
41 NeutronRouter_NetworkReference externalGatewayInfo;
43 /* Holds a map of OpenStackRouterInterfaces by subnet UUID
44 * used for internal mapping to DOVE
46 HashMap<String, NeutronRouter_Interface> interfaces;
48 public NeutronRouter() {
49 interfaces = new HashMap<String, NeutronRouter_Interface>();
52 public String getID() { return routerUUID; }
54 public String getRouterUUID() {
58 public void setRouterUUID(String routerUUID) {
59 this.routerUUID = routerUUID;
62 public String getName() {
66 public void setName(String name) {
70 public boolean isAdminStateUp() {
71 if (adminStateUp == null) {
77 public Boolean getAdminStateUp() { return adminStateUp; }
79 public void setAdminStateUp(Boolean newValue) {
80 adminStateUp = newValue;
83 public String getStatus() {
87 public void setStatus(String status) {
91 public String getTenantID() {
95 public void setTenantID(String tenantID) {
96 this.tenantID = tenantID;
99 public NeutronRouter_NetworkReference getExternalGatewayInfo() {
100 return externalGatewayInfo;
103 public void setExternalGatewayInfo(NeutronRouter_NetworkReference externalGatewayInfo) {
104 this.externalGatewayInfo = externalGatewayInfo;
108 * This method copies selected fields from the object and returns them
109 * as a new object, suitable for marshaling.
112 * List of attributes to be extracted
113 * @return an OpenStackRouters object with only the selected fields
117 public NeutronRouter extractFields(List<String> fields) {
118 NeutronRouter ans = new NeutronRouter();
119 Iterator<String> i = fields.iterator();
120 while (i.hasNext()) {
122 if (s.equals("id")) {
123 ans.setRouterUUID(this.getRouterUUID());
125 if (s.equals("name")) {
126 ans.setName(this.getName());
128 if (s.equals("admin_state_up")) {
129 ans.setAdminStateUp(this.getAdminStateUp());
131 if (s.equals("status")) {
132 ans.setStatus(this.getStatus());
134 if (s.equals("tenant_id")) {
135 ans.setTenantID(this.getTenantID());
137 if (s.equals("external_gateway_info")) {
138 ans.setExternalGatewayInfo(this.getExternalGatewayInfo());
144 public HashMap<String, NeutronRouter_Interface> getInterfaces() {
148 public void addInterface(String s, NeutronRouter_Interface i) {
149 interfaces.put(s, i);
152 public void removeInterface(String s) {
153 interfaces.remove(s);
156 public void initDefaults() {