99e2b953f3c3bcd7ea1b04acc065efe2aabab5d3
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronRouterInterface.java
1 /*
2  * Copyright (c) 2013, 2015 IBM Corporation and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.neutron.spi;
10
11 import java.io.Serializable;
12 import javax.xml.bind.annotation.XmlAccessType;
13 import javax.xml.bind.annotation.XmlAccessorType;
14 import javax.xml.bind.annotation.XmlElement;
15 import javax.xml.bind.annotation.XmlRootElement;
16
17 @XmlRootElement
18 @XmlAccessorType(XmlAccessType.NONE)
19 public final class NeutronRouterInterface extends NeutronObject<NeutronRouterInterface>
20         implements Serializable, INeutronObject<NeutronRouterInterface> {
21     private static final long serialVersionUID = 1L;
22
23     // See OpenStack Network API v2.0 Reference for description of
24     // annotated attributes
25
26     @XmlElement(name = "subnet_id")
27     String subnetUUID;
28
29     @XmlElement(name = "port_id")
30     String portUUID;
31
32     public NeutronRouterInterface() {
33     }
34
35     public NeutronRouterInterface(String subnetUUID, String portUUID) {
36         this.subnetUUID = subnetUUID;
37         this.portUUID = portUUID;
38     }
39
40     public String getSubnetUUID() {
41         return subnetUUID;
42     }
43
44     public void setSubnetUUID(String subnetUUID) {
45         this.subnetUUID = subnetUUID;
46     }
47
48     public String getPortUUID() {
49         return portUUID;
50     }
51
52     public void setPortUUID(String portUUID) {
53         this.portUUID = portUUID;
54     }
55
56     @Override
57     protected boolean extractField(String field, NeutronRouterInterface ans) {
58         switch (field) {
59             case "subnet_id":
60                 ans.setSubnetUUID(this.getSubnetUUID());
61                 break;
62             case "port_id":
63                 ans.setPortUUID(this.getPortUUID());
64                 break;
65             default:
66                 return super.extractField(field, ans);
67         }
68         return true;
69     }
70
71     @Override
72     public String toString() {
73         return "NeutronRouterInterface [" + "subnetUUID=" + subnetUUID + ", portUUID=" + portUUID + ", id=" + uuid
74                 + ", tenantID=" + tenantID + "]";
75     }
76 }