blob: c58bc1b9be53f3f151cc13a5a1310a7b06958992 [file] [log] [blame]
Thomas Vachuska781d18b2014-10-27 10:31:25 -07001/*
Ray Milkey34c95902015-04-15 09:47:53 -07002 * Copyright 2014-2015 Open Networking Laboratory
Thomas Vachuska781d18b2014-10-27 10:31:25 -07003 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07004 * 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
Thomas Vachuska781d18b2014-10-27 10:31:25 -07007 *
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07008 * 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.
Thomas Vachuska781d18b2014-10-27 10:31:25 -070015 */
Jonathan Hart2da1e602015-02-18 19:09:24 -080016package org.onosproject.routing.config.impl;
Jonathan Hart90a02c22015-02-13 11:52:07 -080017
18import com.fasterxml.jackson.annotation.JsonProperty;
Pingping Line28ae4c2015-03-13 11:37:03 -070019
Pingping Linc9e16bf2015-04-10 14:42:41 -070020import org.onlab.packet.MacAddress;
Jonathan Hart2da1e602015-02-18 19:09:24 -080021import org.onosproject.routing.config.BgpPeer;
22import org.onosproject.routing.config.BgpSpeaker;
Pingping Line28ae4c2015-03-13 11:37:03 -070023import org.onosproject.routing.config.LocalIpPrefixEntry;
Jonathan Hartbac07a02014-10-13 21:29:54 -070024
25import java.util.Collections;
26import java.util.List;
27
Jonathan Hartbac07a02014-10-13 21:29:54 -070028/**
29 * Contains the configuration data for SDN-IP that has been read from a
30 * JSON-formatted configuration file.
31 */
32public 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.
Pingping Lin9b85c032015-10-05 18:16:27 -070035 private List<BgpSpeaker> bgpSpeakers = Collections.emptyList();
36 private List<BgpPeer> peers = Collections.emptyList();
Pingping Linc9e16bf2015-04-10 14:42:41 -070037 private MacAddress virtualGatewayMacAddress;
Jonathan Hartbac07a02014-10-13 21:29:54 -070038
Pingping Line28ae4c2015-03-13 11:37:03 -070039 // 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
Jonathan Hartbac07a02014-10-13 21:29:54 -070045 /**
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 /**
Pingping Linc9e16bf2015-04-10 14:42:41 -070082 * Sets a list of BGP peers we configured to peer with.
Jonathan Hartbac07a02014-10-13 21:29:54 -070083 *
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
Pingping Line28ae4c2015-03-13 11:37:03 -070091 /**
Pingping Linc9e16bf2015-04-10 14:42:41 -070092 * 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 /**
Pingping Line28ae4c2015-03-13 11:37:03 -0700112 * 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
Jonathan Hartbac07a02014-10-13 21:29:54 -0700158}