45206903875d3795c26f09aabf89bcbbf1270a0b
[onosfw.git] /
1 /*
2  * Copyright 2014-2015 Open Networking Laboratory
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.onosproject.routing.config.impl;
17
18 import com.fasterxml.jackson.annotation.JsonProperty;
19
20 import org.onlab.packet.MacAddress;
21 import org.onosproject.routing.config.BgpPeer;
22 import org.onosproject.routing.config.BgpSpeaker;
23 import org.onosproject.routing.config.LocalIpPrefixEntry;
24
25 import java.util.Collections;
26 import java.util.List;
27
28 /**
29  * Contains the configuration data for SDN-IP that has been read from a
30  * JSON-formatted configuration file.
31  */
32 public class Configuration {
33     // We call the BGP routers in our SDN network the BGP speakers, and call
34     // the BGP routers outside our SDN network the BGP peers.
35     private List<BgpSpeaker> bgpSpeakers;
36     private List<BgpPeer> peers;
37     private MacAddress virtualGatewayMacAddress;
38
39     // All IP prefixes from the configuration are local
40     private List<LocalIpPrefixEntry> localIp4PrefixEntries =
41             Collections.emptyList();
42     private List<LocalIpPrefixEntry> localIp6PrefixEntries =
43             Collections.emptyList();
44
45     /**
46      * Default constructor.
47      */
48     public Configuration() {
49     }
50
51     /**
52      * Gets a list of bgpSpeakers in the system, represented by
53      * {@link BgpSpeaker} objects.
54      *
55      * @return the list of BGP speakers
56      */
57     public List<BgpSpeaker> getBgpSpeakers() {
58         return Collections.unmodifiableList(bgpSpeakers);
59     }
60
61     /**
62      * Sets a list of bgpSpeakers in the system.
63      *
64      * @param bgpSpeakers the list of BGP speakers
65      */
66     @JsonProperty("bgpSpeakers")
67     public void setBgpSpeakers(List<BgpSpeaker> bgpSpeakers) {
68         this.bgpSpeakers = bgpSpeakers;
69     }
70
71     /**
72      * Gets a list of BGP peers we are configured to peer with. Peers are
73      * represented by {@link BgpPeer} objects.
74      *
75      * @return the list of BGP peers
76      */
77     public List<BgpPeer> getPeers() {
78         return Collections.unmodifiableList(peers);
79     }
80
81     /**
82      * Sets a list of BGP peers we configured to peer with.
83      *
84      * @param peers the list of BGP peers
85      */
86     @JsonProperty("bgpPeers")
87     public void setPeers(List<BgpPeer> peers) {
88         this.peers = peers;
89     }
90
91     /**
92      * Gets the MAC address we configured for virtual gateway
93      * in SDN network.
94      *
95      * @return the MAC address of virtual gateway
96      */
97     public MacAddress getVirtualGatewayMacAddress() {
98         return virtualGatewayMacAddress;
99     }
100
101     /**
102      * Sets the MAC address for virtual gateway in SDN network.
103      *
104      * @param virtualGatewayMacAddress the MAC address of virtual gateway
105      */
106     @JsonProperty("virtualGatewayMacAddress")
107     public void setVirtualGatewayMacAddress(MacAddress virtualGatewayMacAddress) {
108         this.virtualGatewayMacAddress = virtualGatewayMacAddress;
109     }
110
111     /**
112      * Gets a list of local IPv4 prefix entries configured for local
113      * SDN network.
114      * <p>
115      * IP prefix entries are represented by {@link LocalIpPrefixEntry}
116      * objects.
117      * </p>
118      *
119      * @return the list of local IPv4 prefix entries
120      */
121     public List<LocalIpPrefixEntry> getLocalIp4PrefixEntries() {
122         return Collections.unmodifiableList(localIp4PrefixEntries);
123     }
124
125     /**
126      * Sets a list of IPv4 prefix entries configured for local SDN network.
127      *
128      * @param ip4PrefixEntries the list of Ipv4 prefix entries
129      */
130     @JsonProperty("ip4LocalPrefixes")
131     public void setLocalIp4PrefixEntries(List<LocalIpPrefixEntry> ip4PrefixEntries) {
132         this.localIp4PrefixEntries = ip4PrefixEntries;
133     }
134
135     /**
136      * Gets a list of IPv6 prefix entries configured for local SDN network.
137      * <p>
138      * IP prefix entries are represented by {@link LocalIpPrefixEntry}
139      * objects.
140      * </p>
141      *
142      * @return the list of IPv6 prefix entries
143      */
144     public List<LocalIpPrefixEntry> getLocalIp6PrefixEntries() {
145         return Collections.unmodifiableList(localIp6PrefixEntries);
146     }
147
148     /**
149      * Sets a list of IPv6 prefix entries configured for local SDN network.
150      *
151      * @param ip6PrefixEntries the list of Ipv6 prefix entries
152      */
153     @JsonProperty("ip6LocalPrefixes")
154     public void setLocalIp6PrefixEntries(List<LocalIpPrefixEntry> ip6PrefixEntries) {
155         this.localIp6PrefixEntries = ip6PrefixEntries;
156     }
157
158 }