blob: 0efad3350659986c8becce4e3d421b9512ce180f [file] [log] [blame]
janani bf41dec32017-03-24 18:44:07 +05301/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2017-present Open Networking Foundation
janani bf41dec32017-03-24 18:44:07 +05303 *
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 */
16package org.onosproject.l3vpn.netl3vpn;
17
18import java.util.LinkedList;
19import java.util.List;
20
21/**
22 * Representation of protocol info of the BGP info. It contains the route
23 * protocol and the interfaces which are associated with the information.
24 */
25public class ProtocolInfo {
26
27 /**
28 * Route protocol.
29 */
30 private RouteProtocol routeProtocol;
31
32 /**
33 * Interface details which uses this protocol with respect to IPV4 address.
34 */
35 private List<AccessInfo> v4Accesses;
36
37 /**
38 * Interface details which uses this protocol with respect to IPV6 address.
39 */
40 private List<AccessInfo> v6Accesses;
41
42 /**
43 * Status of IPV4 address family available.
44 */
45 private boolean ipv4Af;
46
47 /**
48 * Status of IPV6 address family available.
49 */
50 private boolean ipv6Af;
51
52 /**
53 * Process id of the protocol info.
54 */
55 private String processId;
56
57 /**
58 * Constructs protocol info.
59 */
60 public ProtocolInfo() {
61 }
62
63 /**
64 * Returns the route protocol.
65 *
66 * @return route protocol
67 */
janani b35f6cbc2017-03-24 21:56:58 +053068 public RouteProtocol routeProtocol() {
janani bf41dec32017-03-24 18:44:07 +053069 return routeProtocol;
70 }
71
72 /**
73 * Sets the route protocol.
74 *
75 * @param routeProtocol route protocol
76 */
janani b35f6cbc2017-03-24 21:56:58 +053077 public void routeProtocol(RouteProtocol routeProtocol) {
janani bf41dec32017-03-24 18:44:07 +053078 this.routeProtocol = routeProtocol;
79 }
80
81 /**
82 * Returns the process id.
83 *
84 * @return process id
85 */
janani b35f6cbc2017-03-24 21:56:58 +053086 public String processId() {
janani bf41dec32017-03-24 18:44:07 +053087 return processId;
88 }
89
90 /**
91 * Sets the process id.
92 *
93 * @param processId process id.
94 */
janani b35f6cbc2017-03-24 21:56:58 +053095 public void processId(String processId) {
janani bf41dec32017-03-24 18:44:07 +053096 this.processId = processId;
97 }
98
99 /**
100 * Returns true if the IPV4 address family uses the protocol info; false
101 * otherwise.
102 *
103 * @return true if IPV4 address family uses; false otherwise
104 */
janani b35f6cbc2017-03-24 21:56:58 +0530105 public boolean isIpv4Af() {
janani bf41dec32017-03-24 18:44:07 +0530106 return ipv4Af;
107 }
108
109 /**
110 * Sets true if the IPV4 address family uses the protocol info; false
111 * otherwise.
112 *
113 * @param ipv4Af true if IPV4 interface uses; false otherwise
114 */
janani b35f6cbc2017-03-24 21:56:58 +0530115 public void ipv4Af(boolean ipv4Af) {
janani bf41dec32017-03-24 18:44:07 +0530116 this.ipv4Af = ipv4Af;
117 }
118
119 /**
120 * Returns true if the IPV6 address family uses the protocol info; false
121 * otherwise.
122 *
123 * @return true if IPV6 address family uses; false otherwise
124 */
janani b35f6cbc2017-03-24 21:56:58 +0530125 public boolean isIpv6Af() {
janani bf41dec32017-03-24 18:44:07 +0530126 return ipv6Af;
127 }
128
129 /**
130 * Sets true if the IPV6 address family uses the protocol info; false
131 * otherwise.
132 *
133 * @param ipv6Af true if IPV6 interface uses; false otherwise
134 */
janani b35f6cbc2017-03-24 21:56:58 +0530135 public void ipv6Af(boolean ipv6Af) {
janani bf41dec32017-03-24 18:44:07 +0530136 this.ipv6Af = ipv6Af;
137 }
138
139 /**
140 * Returns the list of IPV4 network access information.
141 *
142 * @return IPV4 network accesses
143 */
janani b35f6cbc2017-03-24 21:56:58 +0530144 public List<AccessInfo> v4Accesses() {
janani bf41dec32017-03-24 18:44:07 +0530145 return v4Accesses;
146 }
147
148 /**
149 * Sets the list of IPV4 network access information.
150 *
151 * @param v4Accesses IPV4 network accesses
152 */
janani b35f6cbc2017-03-24 21:56:58 +0530153 public void v4Accesses(List<AccessInfo> v4Accesses) {
janani bf41dec32017-03-24 18:44:07 +0530154 this.v4Accesses = v4Accesses;
155 }
156
157 /**
158 * Adds a access info to the IPV4 network accesses.
159 *
160 * @param info IPV4 network access
161 */
janani b35f6cbc2017-03-24 21:56:58 +0530162 public void addV4Access(AccessInfo info) {
janani bf41dec32017-03-24 18:44:07 +0530163 if (v4Accesses == null) {
164 v4Accesses = new LinkedList<>();
165 }
166 v4Accesses.add(info);
167 }
168
169 /**
170 * Returns the list of IPV6 network access information.
171 *
172 * @return IPV6 network accesses
173 */
janani b35f6cbc2017-03-24 21:56:58 +0530174 public List<AccessInfo> v6Accesses() {
janani bf41dec32017-03-24 18:44:07 +0530175 return v6Accesses;
176 }
177
178 /**
179 * Sets the list of IPV6 network access information.
180 *
181 * @param v6Accesses IPV6 network accesses
182 */
janani b35f6cbc2017-03-24 21:56:58 +0530183 public void v6Accesses(List<AccessInfo> v6Accesses) {
janani bf41dec32017-03-24 18:44:07 +0530184 this.v4Accesses = v6Accesses;
185 }
186
187 /**
188 * Adds a access info to the IPV6 network accesses.
189 * @param info IPV4 network access
190 */
janani b35f6cbc2017-03-24 21:56:58 +0530191 public void addV6Access(AccessInfo info) {
janani bf41dec32017-03-24 18:44:07 +0530192 if (v6Accesses == null) {
193 v6Accesses = new LinkedList<>();
194 }
195 v6Accesses.add(info);
196 }
197}