2 * Copyright IBM Corporation, 2013. All rights reserved.
\r
4 * This program and the accompanying materials are made available under the
\r
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
9 package org.opendaylight.controller.networkconfig.neutron;
\r
11 import java.util.HashMap;
\r
12 import java.util.Iterator;
\r
13 import java.util.List;
\r
14 import javax.xml.bind.annotation.XmlAccessType;
\r
15 import javax.xml.bind.annotation.XmlAccessorType;
\r
16 import javax.xml.bind.annotation.XmlElement;
\r
17 import javax.xml.bind.annotation.XmlRootElement;
\r
20 @XmlAccessorType(XmlAccessType.NONE)
\r
22 public class NeutronRouter {
\r
23 // See OpenStack Network API v2.0 Reference for description of
\r
24 // annotated attributes
\r
25 @XmlElement (name="id")
\r
28 @XmlElement (name="name")
\r
31 @XmlElement (defaultValue="true", name="admin_state_up")
\r
32 Boolean adminStateUp;
\r
34 @XmlElement (name="status")
\r
37 @XmlElement (name="tenant_id")
\r
40 @XmlElement (name="external_gateway_info")
\r
41 NeutronRouter_NetworkReference externalGatewayInfo;
\r
43 /* Holds a map of OpenStackRouterInterfaces by subnet UUID
\r
44 * used for internal mapping to DOVE
\r
46 HashMap<String, NeutronRouter_Interface> interfaces;
\r
48 public NeutronRouter() {
\r
49 interfaces = new HashMap<String, NeutronRouter_Interface>();
\r
52 public String getID() { return routerUUID; }
\r
54 public String getRouterUUID() {
\r
58 public void setRouterUUID(String routerUUID) {
\r
59 this.routerUUID = routerUUID;
\r
62 public String getName() {
\r
66 public void setName(String name) {
\r
70 public boolean isAdminStateUp() {
\r
71 if (adminStateUp == null)
\r
73 return adminStateUp;
\r
76 public Boolean getAdminStateUp() { return adminStateUp; }
\r
78 public void setAdminStateUp(Boolean newValue) {
\r
79 this.adminStateUp = newValue;
\r
82 public String getStatus() {
\r
86 public void setStatus(String status) {
\r
87 this.status = status;
\r
90 public String getTenantID() {
\r
94 public void setTenantID(String tenantID) {
\r
95 this.tenantID = tenantID;
\r
98 public NeutronRouter_NetworkReference getExternalGatewayInfo() {
\r
99 return externalGatewayInfo;
\r
102 public void setExternalGatewayInfo(NeutronRouter_NetworkReference externalGatewayInfo) {
\r
103 this.externalGatewayInfo = externalGatewayInfo;
\r
107 * This method copies selected fields from the object and returns them
\r
108 * as a new object, suitable for marshaling.
\r
111 * List of attributes to be extracted
\r
112 * @return an OpenStackRouters object with only the selected fields
\r
116 public NeutronRouter extractFields(List<String> fields) {
\r
117 NeutronRouter ans = new NeutronRouter();
\r
118 Iterator<String> i = fields.iterator();
\r
119 while (i.hasNext()) {
\r
120 String s = i.next();
\r
121 if (s.equals("id"))
\r
122 ans.setRouterUUID(this.getRouterUUID());
\r
123 if (s.equals("name"))
\r
124 ans.setName(this.getName());
\r
125 if (s.equals("admin_state_up"))
\r
126 ans.setAdminStateUp(this.getAdminStateUp());
\r
127 if (s.equals("status"))
\r
128 ans.setStatus(this.getStatus());
\r
129 if (s.equals("tenant_id"))
\r
130 ans.setTenantID(this.getTenantID());
\r
131 if (s.equals("external_gateway_info")) {
\r
132 ans.setExternalGatewayInfo(this.getExternalGatewayInfo());
\r
138 public HashMap<String, NeutronRouter_Interface> getInterfaces() {
\r
142 public void addInterface(String s, NeutronRouter_Interface i) {
\r
143 interfaces.put(s, i);
\r
146 public void removeInterface(String s) {
\r
147 interfaces.remove(s);
\r
150 public void initDefaults() {
\r
151 adminStateUp = true;
\r