2 * Copyright 2014-2015 Open Networking Laboratory
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package org.onosproject.routing.config.impl;
18 import com.fasterxml.jackson.annotation.JsonProperty;
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;
25 import java.util.Collections;
26 import java.util.List;
29 * Contains the configuration data for SDN-IP that has been read from a
30 * JSON-formatted configuration file.
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;
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();
46 * Default constructor.
48 public Configuration() {
52 * Gets a list of bgpSpeakers in the system, represented by
53 * {@link BgpSpeaker} objects.
55 * @return the list of BGP speakers
57 public List<BgpSpeaker> getBgpSpeakers() {
58 return Collections.unmodifiableList(bgpSpeakers);
62 * Sets a list of bgpSpeakers in the system.
64 * @param bgpSpeakers the list of BGP speakers
66 @JsonProperty("bgpSpeakers")
67 public void setBgpSpeakers(List<BgpSpeaker> bgpSpeakers) {
68 this.bgpSpeakers = bgpSpeakers;
72 * Gets a list of BGP peers we are configured to peer with. Peers are
73 * represented by {@link BgpPeer} objects.
75 * @return the list of BGP peers
77 public List<BgpPeer> getPeers() {
78 return Collections.unmodifiableList(peers);
82 * Sets a list of BGP peers we configured to peer with.
84 * @param peers the list of BGP peers
86 @JsonProperty("bgpPeers")
87 public void setPeers(List<BgpPeer> peers) {
92 * Gets the MAC address we configured for virtual gateway
95 * @return the MAC address of virtual gateway
97 public MacAddress getVirtualGatewayMacAddress() {
98 return virtualGatewayMacAddress;
102 * Sets the MAC address for virtual gateway in SDN network.
104 * @param virtualGatewayMacAddress the MAC address of virtual gateway
106 @JsonProperty("virtualGatewayMacAddress")
107 public void setVirtualGatewayMacAddress(MacAddress virtualGatewayMacAddress) {
108 this.virtualGatewayMacAddress = virtualGatewayMacAddress;
112 * Gets a list of local IPv4 prefix entries configured for local
115 * IP prefix entries are represented by {@link LocalIpPrefixEntry}
119 * @return the list of local IPv4 prefix entries
121 public List<LocalIpPrefixEntry> getLocalIp4PrefixEntries() {
122 return Collections.unmodifiableList(localIp4PrefixEntries);
126 * Sets a list of IPv4 prefix entries configured for local SDN network.
128 * @param ip4PrefixEntries the list of Ipv4 prefix entries
130 @JsonProperty("ip4LocalPrefixes")
131 public void setLocalIp4PrefixEntries(List<LocalIpPrefixEntry> ip4PrefixEntries) {
132 this.localIp4PrefixEntries = ip4PrefixEntries;
136 * Gets a list of IPv6 prefix entries configured for local SDN network.
138 * IP prefix entries are represented by {@link LocalIpPrefixEntry}
142 * @return the list of IPv6 prefix entries
144 public List<LocalIpPrefixEntry> getLocalIp6PrefixEntries() {
145 return Collections.unmodifiableList(localIp6PrefixEntries);
149 * Sets a list of IPv6 prefix entries configured for local SDN network.
151 * @param ip6PrefixEntries the list of Ipv6 prefix entries
153 @JsonProperty("ip6LocalPrefixes")
154 public void setLocalIp6PrefixEntries(List<LocalIpPrefixEntry> ip6PrefixEntries) {
155 this.localIp6PrefixEntries = ip6PrefixEntries;