blob: 76f1df0ba728890ac3d57d5c01bba9196d0fbcb2 [file] [log] [blame]
Thomas Vachuska781d18b2014-10-27 10:31:25 -07001/*
Thomas Vachuska4f1a60c2014-10-28 13:39:07 -07002 * Copyright 2014 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
Jonathan Hart2da1e602015-02-18 19:09:24 -080020import org.onosproject.routing.config.BgpPeer;
21import org.onosproject.routing.config.BgpSpeaker;
Pingping Line28ae4c2015-03-13 11:37:03 -070022import org.onosproject.routing.config.LocalIpPrefixEntry;
Jonathan Hartbac07a02014-10-13 21:29:54 -070023
24import java.util.Collections;
25import java.util.List;
26
Jonathan Hartbac07a02014-10-13 21:29:54 -070027/**
28 * Contains the configuration data for SDN-IP that has been read from a
29 * JSON-formatted configuration file.
30 */
31public class Configuration {
32 // We call the BGP routers in our SDN network the BGP speakers, and call
33 // the BGP routers outside our SDN network the BGP peers.
34 private List<BgpSpeaker> bgpSpeakers;
35 private List<BgpPeer> peers;
36
Pingping Line28ae4c2015-03-13 11:37:03 -070037 // All IP prefixes from the configuration are local
38 private List<LocalIpPrefixEntry> localIp4PrefixEntries =
39 Collections.emptyList();
40 private List<LocalIpPrefixEntry> localIp6PrefixEntries =
41 Collections.emptyList();
42
Jonathan Hartbac07a02014-10-13 21:29:54 -070043 /**
44 * Default constructor.
45 */
46 public Configuration() {
47 }
48
49 /**
50 * Gets a list of bgpSpeakers in the system, represented by
51 * {@link BgpSpeaker} objects.
52 *
53 * @return the list of BGP speakers
54 */
55 public List<BgpSpeaker> getBgpSpeakers() {
56 return Collections.unmodifiableList(bgpSpeakers);
57 }
58
59 /**
60 * Sets a list of bgpSpeakers in the system.
61 *
62 * @param bgpSpeakers the list of BGP speakers
63 */
64 @JsonProperty("bgpSpeakers")
65 public void setBgpSpeakers(List<BgpSpeaker> bgpSpeakers) {
66 this.bgpSpeakers = bgpSpeakers;
67 }
68
69 /**
70 * Gets a list of BGP peers we are configured to peer with. Peers are
71 * represented by {@link BgpPeer} objects.
72 *
73 * @return the list of BGP peers
74 */
75 public List<BgpPeer> getPeers() {
76 return Collections.unmodifiableList(peers);
77 }
78
79 /**
80 * Sets a list of BGP peers we are configured to peer with.
81 *
82 * @param peers the list of BGP peers
83 */
84 @JsonProperty("bgpPeers")
85 public void setPeers(List<BgpPeer> peers) {
86 this.peers = peers;
87 }
88
Pingping Line28ae4c2015-03-13 11:37:03 -070089 /**
90 * Gets a list of local IPv4 prefix entries configured for local
91 * SDN network.
92 * <p>
93 * IP prefix entries are represented by {@link LocalIpPrefixEntry}
94 * objects.
95 * </p>
96 *
97 * @return the list of local IPv4 prefix entries
98 */
99 public List<LocalIpPrefixEntry> getLocalIp4PrefixEntries() {
100 return Collections.unmodifiableList(localIp4PrefixEntries);
101 }
102
103 /**
104 * Sets a list of IPv4 prefix entries configured for local SDN network.
105 *
106 * @param ip4PrefixEntries the list of Ipv4 prefix entries
107 */
108 @JsonProperty("ip4LocalPrefixes")
109 public void setLocalIp4PrefixEntries(List<LocalIpPrefixEntry> ip4PrefixEntries) {
110 this.localIp4PrefixEntries = ip4PrefixEntries;
111 }
112
113 /**
114 * Gets a list of IPv6 prefix entries configured for local SDN network.
115 * <p>
116 * IP prefix entries are represented by {@link LocalIpPrefixEntry}
117 * objects.
118 * </p>
119 *
120 * @return the list of IPv6 prefix entries
121 */
122 public List<LocalIpPrefixEntry> getLocalIp6PrefixEntries() {
123 return Collections.unmodifiableList(localIp6PrefixEntries);
124 }
125
126 /**
127 * Sets a list of IPv6 prefix entries configured for local SDN network.
128 *
129 * @param ip6PrefixEntries the list of Ipv6 prefix entries
130 */
131 @JsonProperty("ip6LocalPrefixes")
132 public void setLocalIp6PrefixEntries(List<LocalIpPrefixEntry> ip6PrefixEntries) {
133 this.localIp6PrefixEntries = ip6PrefixEntries;
134 }
135
Jonathan Hartbac07a02014-10-13 21:29:54 -0700136}