sunish vk | 30637eb | 2016-02-16 15:19:32 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 Open Networking Laboratory |
| 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.ospf.controller; |
| 17 | |
| 18 | import org.onlab.packet.Ip4Address; |
| 19 | |
| 20 | import java.util.HashMap; |
| 21 | |
| 22 | /** |
| 23 | * Represents an OSPF Interface. |
| 24 | */ |
| 25 | public interface OspfInterface { |
| 26 | |
| 27 | /** |
| 28 | * Gets network mask of the interface. |
| 29 | * |
| 30 | * @return network mask |
| 31 | */ |
| 32 | Ip4Address ipNetworkMask(); |
| 33 | |
| 34 | /** |
| 35 | * Sets area id, to which the interface belongs. |
| 36 | * |
| 37 | * @param areaId area identifier |
| 38 | */ |
| 39 | void setAreaId(int areaId); |
| 40 | |
| 41 | /** |
| 42 | * Sets the authentication key. |
| 43 | * Interface uses this to authenticate while establishing communication with other routers. |
| 44 | * |
| 45 | * @param authKey represents authentication key |
| 46 | */ |
| 47 | void setAuthKey(String authKey); |
| 48 | |
| 49 | /** |
| 50 | * Sets the authentication type, |
| 51 | * Interface uses this to authenticate while establishing communication with other routers. |
| 52 | * |
| 53 | * @param authType authType represents authentication type |
| 54 | */ |
| 55 | void setAuthType(String authType); |
| 56 | |
| 57 | /** |
| 58 | * Sets the value of BDR. |
| 59 | * The BDR is calculated during adjacency formation. |
| 60 | * |
| 61 | * @param bdr backup designated router's IP address |
| 62 | */ |
| 63 | void setBdr(Ip4Address bdr); |
| 64 | |
| 65 | /** |
| 66 | * Sets the value of DR. |
| 67 | * The DR is calculated during adjacency formation. |
| 68 | * |
| 69 | * @param dr designated router's IP address |
| 70 | */ |
| 71 | void setDr(Ip4Address dr); |
| 72 | |
| 73 | /** |
| 74 | * Sets the hello interval time. |
| 75 | * It is the interval at which a hello packet is sent out via this interface. |
| 76 | * |
| 77 | * @param helloIntervalTime an integer interval time |
| 78 | */ |
| 79 | void setHelloIntervalTime(int helloIntervalTime); |
| 80 | |
| 81 | /** |
| 82 | * Sets router dead interval time. |
| 83 | * This is the interval after which this interface will trigger a process to kill neighbor. |
| 84 | * |
| 85 | * @param routerDeadIntervalTime an integer interval time |
| 86 | */ |
| 87 | void setRouterDeadIntervalTime(int routerDeadIntervalTime); |
| 88 | |
| 89 | /** |
| 90 | * Sets the interface cost which is the cost of sending a data packet onto the network. |
| 91 | * |
| 92 | * @param interfaceCost an integer represents interface cost |
| 93 | */ |
| 94 | void setInterfaceCost(int interfaceCost); |
| 95 | |
| 96 | /** |
| 97 | * Sets interface type. |
| 98 | * This indicates whether the interface is on point to point mode or broadcast mode. |
| 99 | * |
| 100 | * @param interfaceType an integer represents interface type |
| 101 | */ |
| 102 | void setInterfaceType(int interfaceType); |
| 103 | |
| 104 | /** |
| 105 | * Sets IP Address of this interface. |
| 106 | * |
| 107 | * @param ipAddress IP address |
| 108 | */ |
| 109 | void setIpAddress(Ip4Address ipAddress); |
| 110 | |
| 111 | /** |
| 112 | * Sets IP network mask. |
| 113 | * |
| 114 | * @param ipNetworkMask network mask |
| 115 | */ |
| 116 | void setIpNetworkMask(Ip4Address ipNetworkMask); |
| 117 | |
| 118 | /** |
| 119 | * Sets the polling interval. |
| 120 | * Polling interval indicates the interval until when the Hello Packets are |
| 121 | * sent to a dead neighbor. |
| 122 | * |
| 123 | * @param pollInterval an integer represents poll interval |
| 124 | */ |
| 125 | void setPollInterval(int pollInterval); |
| 126 | |
| 127 | /** |
| 128 | * Sets transmission delay. |
| 129 | * |
| 130 | * @param transmitDelay an integer represents delay |
| 131 | */ |
| 132 | void setTransmitDelay(int transmitDelay); |
| 133 | |
| 134 | /** |
| 135 | * Sets retransmit interval which indicates the number of seconds between LSA retransmissions. |
| 136 | * |
| 137 | * @param reTransmitInterval an integer represents interval |
| 138 | */ |
| 139 | void setReTransmitInterval(int reTransmitInterval); |
| 140 | |
| 141 | /** |
| 142 | * Sets MTU. |
| 143 | * |
| 144 | * @param mtu an integer represents max transfer unit |
| 145 | */ |
| 146 | void setMtu(int mtu); |
| 147 | |
| 148 | /** |
| 149 | * Sets router priority. |
| 150 | * |
| 151 | * @param routerPriority value |
| 152 | */ |
| 153 | void setRouterPriority(int routerPriority); |
| 154 | |
| 155 | /** |
| 156 | * Gets the area id to which router belongs. |
| 157 | * |
| 158 | * @return areaId an integer value |
| 159 | */ |
| 160 | int areaId(); |
| 161 | |
| 162 | /** |
| 163 | * Gets the IP address. |
| 164 | * |
| 165 | * @return an string represents IP address |
| 166 | */ |
| 167 | Ip4Address ipAddress(); |
| 168 | |
| 169 | /** |
| 170 | * Gets the interface type. |
| 171 | * |
| 172 | * @return an integer represents interface type |
| 173 | */ |
| 174 | int interfaceType(); |
| 175 | |
| 176 | /** |
| 177 | * Gets the MTU. |
| 178 | * |
| 179 | * @return an integer representing max transfer unit |
| 180 | */ |
| 181 | int mtu(); |
| 182 | |
| 183 | /** |
| 184 | * Gets interface cost. |
| 185 | * |
| 186 | * @return an integer representing interface cost |
| 187 | */ |
| 188 | int interfaceCost(); |
| 189 | |
| 190 | /** |
| 191 | * Gets the list of neighbors associated with the interface. |
| 192 | * |
| 193 | * @return listOfNeighbors as key value pair |
| 194 | */ |
| 195 | HashMap<String, OspfNbr> listOfNeighbors(); |
| 196 | |
| 197 | /** |
| 198 | * Gets poll interval. |
| 199 | * |
| 200 | * @return pollInterval an integer representing poll interval |
| 201 | */ |
| 202 | int pollInterval(); |
| 203 | |
| 204 | /** |
| 205 | * Gets transmission delay. |
| 206 | * |
| 207 | * @return transmitDelay an integer representing delay |
| 208 | */ |
| 209 | int transmitDelay(); |
| 210 | |
| 211 | /** |
| 212 | * Gets the IP address of the BDR. |
| 213 | * |
| 214 | * @return bdr BDR's IP address |
| 215 | */ |
| 216 | Ip4Address bdr(); |
| 217 | |
| 218 | /** |
| 219 | * Gets the ip address of the DR.. |
| 220 | * |
| 221 | * @return dr DR's IP address |
| 222 | */ |
| 223 | Ip4Address dr(); |
| 224 | |
| 225 | /** |
| 226 | * Gets authentication key. |
| 227 | * |
| 228 | * @return authKey represents authentication key |
| 229 | */ |
| 230 | String authKey(); |
| 231 | |
| 232 | /** |
| 233 | * Gets authentication type. |
| 234 | * |
| 235 | * @return authType represents authentication type |
| 236 | */ |
| 237 | String authType(); |
| 238 | |
| 239 | /** |
| 240 | * Gets hello interval time in seconds, this defines how often we send the hello packet. |
| 241 | * |
| 242 | * @return hello interval time in seconds |
| 243 | */ |
| 244 | int helloIntervalTime(); |
| 245 | |
| 246 | /** |
| 247 | * Gets retransmit interval. |
| 248 | * |
| 249 | * @return reTransmitInterval an integer represents interval |
| 250 | */ |
| 251 | int reTransmitInterval(); |
| 252 | |
| 253 | /** |
| 254 | * Gets router dead interval time. |
| 255 | * This defines how long we should wait for hello packets before we declare the neighbor is dead. |
| 256 | * |
| 257 | * @return routerDeadIntervalTime an integer interval time |
| 258 | */ |
| 259 | int routerDeadIntervalTime(); |
| 260 | |
| 261 | /** |
| 262 | * Gets router priority. |
| 263 | * |
| 264 | * @return routerPriority value |
| 265 | */ |
| 266 | int routerPriority(); |
| 267 | |
| 268 | /** |
| 269 | * Adds the given neighboring router to the neighbor map. |
| 270 | * |
| 271 | * @param ospfNbr neighbor instance |
| 272 | */ |
| 273 | void addNeighbouringRouter(OspfNbr ospfNbr); |
| 274 | |
| 275 | /** |
| 276 | * Gets the neighbor instance from listOfNeighbors map for the given neighbor ID. |
| 277 | * |
| 278 | * @param neighborId neighbors id |
| 279 | * @return ospfNbr neighbor instance |
| 280 | */ |
| 281 | OspfNbr neighbouringRouter(String neighborId); |
| 282 | |
| 283 | /** |
| 284 | * Checks the given neighbor is in the neighbor list. |
| 285 | * |
| 286 | * @param neighborId neighbors id |
| 287 | * @return true if neighbor in list else false |
| 288 | */ |
| 289 | boolean isNeighborInList(String neighborId); |
| 290 | |
| 291 | /** |
| 292 | * Removes LSA headers from the map in which LSA headers are stored. |
| 293 | * |
| 294 | * @param lsaKey key used to store lsa in map |
| 295 | */ |
| 296 | void removeLsaFromNeighborMap(String lsaKey); |
| 297 | } |