Merge "Bug 6641: Fix ip_address in allowed_address_pairs info"
[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 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;
18
19 @XmlRootElement(name = "l2gatewayConnection")
20 @XmlAccessorType(XmlAccessType.NONE)
21 public final class NeutronL2gatewayConnection extends NeutronObject<NeutronL2gatewayConnection>
22         implements Serializable, INeutronObject<NeutronL2gatewayConnection> {
23     private static final long serialVersionUID = 1L;
24
25     @XmlElement(name = "gateway_id")
26     String l2gatewayID;
27
28     @XmlElement(name = "network_id")
29     String networkID;
30
31     @XmlElement(name = "segmentation_id")
32     Integer segmentID;
33
34     @XmlElement(name = "port_id")
35     String portID;
36
37     public String getL2gatewayID() {
38         return l2gatewayID;
39     }
40
41     public String getNetworkID() {
42         return networkID;
43     }
44
45     public Integer getSegmentID() {
46         return segmentID;
47     }
48
49     public void setL2gatewayID(String l2gatewayID) {
50         this.l2gatewayID = l2gatewayID;
51     }
52
53     public void setNetworkID(String networkID) {
54         this.networkID = networkID;
55     }
56
57     public void setSegmentID(Integer segmentID) {
58         this.segmentID = segmentID;
59     }
60
61     public String getPortID() {
62         return portID;
63     }
64
65     public void setPortID(String portID) {
66         this.portID = portID;
67     }
68
69     public NeutronL2gatewayConnection extractFields(List<String> fields) {
70         NeutronL2gatewayConnection ans = new NeutronL2gatewayConnection();
71         Iterator<String> i = fields.iterator();
72         while (i.hasNext()) {
73             String s = i.next();
74             if (s.equals("tenant_id")) {
75                 ans.setTenantID(this.getTenantID());
76             }
77             if (s.equals("connection_id")) {
78                 ans.setID(this.getID());
79             }
80             if (s.equals("gateway_id")) {
81                 ans.setL2gatewayID(this.getL2gatewayID());
82             }
83             if (s.equals("network_id")) {
84                 ans.setNetworkID(this.getNetworkID());
85             }
86             if (s.equals("segmentation_id")) {
87                 ans.setSegmentID(this.getSegmentID());
88             }
89             if (s.equals("port_id")) {
90                 ans.setPortID(this.getPortID());
91             }
92         }
93         return ans;
94     }
95
96     @Override
97     public String toString() {
98         return "NeutronL2GatewayConnection [" + "tenant_id = " + tenantID + ", connection_id = " + uuid
99                 + ", gateway_id = " + l2gatewayID + ", network_id = " + networkID + ", segmentation_id = " + segmentID
100                 + ", port_id = " + portID + "]";
101     }
102
103 }