d8b2b87af08f390a8e4643b78a2fe0361a5e544d
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronL2gatewayConnection.java
1 /*
2  * Copyright (c) 2015 Hewlett-Packard Development Company, L.P. 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(name = "l2gatewayConnection")
18 @XmlAccessorType(XmlAccessType.NONE)
19 public final class NeutronL2gatewayConnection extends NeutronBaseAttributes<NeutronL2gatewayConnection>
20             implements Serializable {
21     private static final long serialVersionUID = 1L;
22
23     @XmlElement(name = "gateway_id")
24     String l2gatewayID;
25
26     @XmlElement(name = "network_id")
27     String networkID;
28
29     @XmlElement(name = "segmentation_id")
30     Integer segmentID;
31
32     @XmlElement(name = "port_id")
33     String portID;
34
35     public String getL2gatewayID() {
36         return l2gatewayID;
37     }
38
39     public String getNetworkID() {
40         return networkID;
41     }
42
43     public Integer getSegmentID() {
44         return segmentID;
45     }
46
47     public void setL2gatewayID(String l2gatewayID) {
48         this.l2gatewayID = l2gatewayID;
49     }
50
51     public void setNetworkID(String networkID) {
52         this.networkID = networkID;
53     }
54
55     public void setSegmentID(Integer segmentID) {
56         this.segmentID = segmentID;
57     }
58
59     public String getPortID() {
60         return portID;
61     }
62
63     public void setPortID(String portID) {
64         this.portID = portID;
65     }
66
67     @Override
68     protected boolean extractField(String field, NeutronL2gatewayConnection ans) {
69         switch (field) {
70             case "connection_id":
71                 ans.setID(this.getID());
72                 break;
73             case "gateway_id":
74                 ans.setL2gatewayID(this.getL2gatewayID());
75                 break;
76             case "network_id":
77                 ans.setNetworkID(this.getNetworkID());
78                 break;
79             case "segmentation_id":
80                 ans.setSegmentID(this.getSegmentID());
81                 break;
82             case "port_id":
83                 ans.setPortID(this.getPortID());
84                 break;
85             default:
86                 return super.extractField(field, ans);
87         }
88         return true;
89     }
90
91     @Override
92     public String toString() {
93         return "NeutronL2GatewayConnection [" + "tenant_id = " + tenantID + ", connection_id = " + uuid
94                 + ", gateway_id = " + l2gatewayID + ", network_id = " + networkID + ", segmentation_id = " + segmentID
95                 + ", port_id = " + portID + "]";
96     }
97
98 }