NEUTRON-208: BGPVPN network and router association
[neutron.git] / neutron-spi / src / main / java / org / opendaylight / neutron / spi / NeutronBgpvpnRouterAssociation.java
1 /*
2  * Copyright (c) 2020 Ericsson India Global Services Pvt Ltd. 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 = "bgpvpn_router_association")
18 @XmlAccessorType(XmlAccessType.NONE)
19 public final class NeutronBgpvpnRouterAssociation extends NeutronAdminAttributes<NeutronBgpvpnRouterAssociation>
20         implements Serializable {
21
22     private static final long serialVersionUID = 1L;
23
24     @XmlElement(name = "bgpvpn_id")
25     String bgpvpnId;
26
27     @XmlElement(name = "router_id")
28     String routerId;
29
30     @Override
31     public void initDefaults() {
32     }
33
34     public String getBgpvpnId() {
35         return bgpvpnId;
36     }
37
38     public void setBgpvpnId(String bgpvpnId) {
39         this.bgpvpnId = bgpvpnId;
40     }
41
42     public String getRouterId() {
43         return routerId;
44     }
45
46     public void setRouterId(String routerId) {
47         this.routerId = routerId;
48     }
49
50     @Override
51     protected boolean extractField(String field, NeutronBgpvpnRouterAssociation ans) {
52         switch (field) {
53             case "bgpvpn_id":
54                 ans.setBgpvpnId(this.getBgpvpnId());
55                 break;
56             case "router_id":
57                 ans.setRouterId(this.getRouterId());
58                 break;
59             default:
60                 return super.extractField(field, ans);
61         }
62         return true;
63     }
64
65     @Override
66     public String toString() {
67         return "NeutronBgpvpnRouterAssociation [bgpvpnRouterAssociationUUID=" + uuid + ", bgpvpnId=" + bgpvpnId
68                 + ", routerId=" + routerId + "]";
69     }
70 }