janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2017-present Open Networking Foundation |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 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.l3vpn.netl3vpn; |
| 17 | |
| 18 | import java.util.LinkedList; |
| 19 | import 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 | */ |
| 25 | public 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 b | 35f6cbc | 2017-03-24 21:56:58 +0530 | [diff] [blame] | 68 | public RouteProtocol routeProtocol() { |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 69 | return routeProtocol; |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * Sets the route protocol. |
| 74 | * |
| 75 | * @param routeProtocol route protocol |
| 76 | */ |
janani b | 35f6cbc | 2017-03-24 21:56:58 +0530 | [diff] [blame] | 77 | public void routeProtocol(RouteProtocol routeProtocol) { |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 78 | this.routeProtocol = routeProtocol; |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * Returns the process id. |
| 83 | * |
| 84 | * @return process id |
| 85 | */ |
janani b | 35f6cbc | 2017-03-24 21:56:58 +0530 | [diff] [blame] | 86 | public String processId() { |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 87 | return processId; |
| 88 | } |
| 89 | |
| 90 | /** |
| 91 | * Sets the process id. |
| 92 | * |
| 93 | * @param processId process id. |
| 94 | */ |
janani b | 35f6cbc | 2017-03-24 21:56:58 +0530 | [diff] [blame] | 95 | public void processId(String processId) { |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 96 | 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 b | 35f6cbc | 2017-03-24 21:56:58 +0530 | [diff] [blame] | 105 | public boolean isIpv4Af() { |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 106 | 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 b | 35f6cbc | 2017-03-24 21:56:58 +0530 | [diff] [blame] | 115 | public void ipv4Af(boolean ipv4Af) { |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 116 | 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 b | 35f6cbc | 2017-03-24 21:56:58 +0530 | [diff] [blame] | 125 | public boolean isIpv6Af() { |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 126 | 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 b | 35f6cbc | 2017-03-24 21:56:58 +0530 | [diff] [blame] | 135 | public void ipv6Af(boolean ipv6Af) { |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 136 | this.ipv6Af = ipv6Af; |
| 137 | } |
| 138 | |
| 139 | /** |
| 140 | * Returns the list of IPV4 network access information. |
| 141 | * |
| 142 | * @return IPV4 network accesses |
| 143 | */ |
janani b | 35f6cbc | 2017-03-24 21:56:58 +0530 | [diff] [blame] | 144 | public List<AccessInfo> v4Accesses() { |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 145 | return v4Accesses; |
| 146 | } |
| 147 | |
| 148 | /** |
| 149 | * Sets the list of IPV4 network access information. |
| 150 | * |
| 151 | * @param v4Accesses IPV4 network accesses |
| 152 | */ |
janani b | 35f6cbc | 2017-03-24 21:56:58 +0530 | [diff] [blame] | 153 | public void v4Accesses(List<AccessInfo> v4Accesses) { |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 154 | 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 b | 35f6cbc | 2017-03-24 21:56:58 +0530 | [diff] [blame] | 162 | public void addV4Access(AccessInfo info) { |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 163 | 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 b | 35f6cbc | 2017-03-24 21:56:58 +0530 | [diff] [blame] | 174 | public List<AccessInfo> v6Accesses() { |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 175 | return v6Accesses; |
| 176 | } |
| 177 | |
| 178 | /** |
| 179 | * Sets the list of IPV6 network access information. |
| 180 | * |
| 181 | * @param v6Accesses IPV6 network accesses |
| 182 | */ |
janani b | 35f6cbc | 2017-03-24 21:56:58 +0530 | [diff] [blame] | 183 | public void v6Accesses(List<AccessInfo> v6Accesses) { |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 184 | this.v4Accesses = v6Accesses; |
| 185 | } |
| 186 | |
| 187 | /** |
| 188 | * Adds a access info to the IPV6 network accesses. |
| 189 | * @param info IPV4 network access |
| 190 | */ |
janani b | 35f6cbc | 2017-03-24 21:56:58 +0530 | [diff] [blame] | 191 | public void addV6Access(AccessInfo info) { |
janani b | f41dec3 | 2017-03-24 18:44:07 +0530 | [diff] [blame] | 192 | if (v6Accesses == null) { |
| 193 | v6Accesses = new LinkedList<>(); |
| 194 | } |
| 195 | v6Accesses.add(info); |
| 196 | } |
| 197 | } |