blob: 1c05ad5302264e7d5df7d986ccb92c078882b3ae [file] [log] [blame]
sunish vk30637eb2016-02-16 15:19:32 +05301/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
sunish vk30637eb2016-02-16 15:19:32 +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.ospf.controller;
17
sunishvkf7c56552016-07-18 16:02:39 +053018import org.jboss.netty.channel.ChannelHandlerContext;
sunish vk30637eb2016-02-16 15:19:32 +053019import org.onlab.packet.Ip4Address;
20
sunishvkf7c56552016-07-18 16:02:39 +053021import java.util.Map;
sunish vk30637eb2016-02-16 15:19:32 +053022
23/**
24 * Represents an OSPF Interface.
25 */
26public interface OspfInterface {
27
28 /**
sunishvkf7c56552016-07-18 16:02:39 +053029 * Returns interface index.
30 *
31 * @return interface index
32 */
33 public int interfaceIndex();
34
35 /**
36 * Sets interface index.
37 *
38 * @param interfaceIndex interface index
39 */
40 public void setInterfaceIndex(int interfaceIndex);
41
42 /**
43 * Returns OSPF area instance.
44 *
45 * @return OSPF area instance
46 */
47 public OspfArea ospfArea();
48
49 /**
50 * Sets OSPF area instance.
51 *
52 * @param ospfArea OSPF area instance
53 */
54 public void setOspfArea(OspfArea ospfArea);
55
56 /**
sunish vk30637eb2016-02-16 15:19:32 +053057 * Gets network mask of the interface.
58 *
59 * @return network mask
60 */
61 Ip4Address ipNetworkMask();
62
63 /**
sunish vk30637eb2016-02-16 15:19:32 +053064 * Sets the value of BDR.
65 * The BDR is calculated during adjacency formation.
66 *
67 * @param bdr backup designated router's IP address
68 */
69 void setBdr(Ip4Address bdr);
70
71 /**
72 * Sets the value of DR.
73 * The DR is calculated during adjacency formation.
74 *
75 * @param dr designated router's IP address
76 */
77 void setDr(Ip4Address dr);
78
79 /**
80 * Sets the hello interval time.
81 * It is the interval at which a hello packet is sent out via this interface.
82 *
83 * @param helloIntervalTime an integer interval time
84 */
85 void setHelloIntervalTime(int helloIntervalTime);
86
87 /**
88 * Sets router dead interval time.
89 * This is the interval after which this interface will trigger a process to kill neighbor.
90 *
91 * @param routerDeadIntervalTime an integer interval time
92 */
93 void setRouterDeadIntervalTime(int routerDeadIntervalTime);
94
95 /**
sunish vk30637eb2016-02-16 15:19:32 +053096 * Sets interface type.
97 * This indicates whether the interface is on point to point mode or broadcast mode.
98 *
99 * @param interfaceType an integer represents interface type
100 */
101 void setInterfaceType(int interfaceType);
102
103 /**
104 * Sets IP Address of this interface.
105 *
106 * @param ipAddress IP address
107 */
108 void setIpAddress(Ip4Address ipAddress);
109
110 /**
111 * Sets IP network mask.
112 *
113 * @param ipNetworkMask network mask
114 */
115 void setIpNetworkMask(Ip4Address ipNetworkMask);
116
117 /**
sunish vk30637eb2016-02-16 15:19:32 +0530118 * Sets retransmit interval which indicates the number of seconds between LSA retransmissions.
119 *
120 * @param reTransmitInterval an integer represents interval
121 */
122 void setReTransmitInterval(int reTransmitInterval);
123
124 /**
125 * Sets MTU.
126 *
127 * @param mtu an integer represents max transfer unit
128 */
129 void setMtu(int mtu);
130
131 /**
132 * Sets router priority.
133 *
134 * @param routerPriority value
135 */
136 void setRouterPriority(int routerPriority);
137
138 /**
sunish vk30637eb2016-02-16 15:19:32 +0530139 * Gets the IP address.
140 *
141 * @return an string represents IP address
142 */
143 Ip4Address ipAddress();
144
145 /**
146 * Gets the interface type.
147 *
148 * @return an integer represents interface type
149 */
150 int interfaceType();
151
152 /**
153 * Gets the MTU.
154 *
155 * @return an integer representing max transfer unit
156 */
157 int mtu();
158
159 /**
sunish vk30637eb2016-02-16 15:19:32 +0530160 * Gets the list of neighbors associated with the interface.
161 *
162 * @return listOfNeighbors as key value pair
163 */
sunishvkf7c56552016-07-18 16:02:39 +0530164 Map<String, OspfNbr> listOfNeighbors();
sunish vk30637eb2016-02-16 15:19:32 +0530165
166 /**
167 * Gets the IP address of the BDR.
168 *
169 * @return bdr BDR's IP address
170 */
171 Ip4Address bdr();
172
173 /**
174 * Gets the ip address of the DR..
175 *
176 * @return dr DR's IP address
177 */
178 Ip4Address dr();
179
180 /**
sunish vk30637eb2016-02-16 15:19:32 +0530181 * Gets hello interval time in seconds, this defines how often we send the hello packet.
182 *
183 * @return hello interval time in seconds
184 */
185 int helloIntervalTime();
186
187 /**
188 * Gets retransmit interval.
189 *
190 * @return reTransmitInterval an integer represents interval
191 */
192 int reTransmitInterval();
193
194 /**
195 * Gets router dead interval time.
196 * This defines how long we should wait for hello packets before we declare the neighbor is dead.
197 *
198 * @return routerDeadIntervalTime an integer interval time
199 */
200 int routerDeadIntervalTime();
201
202 /**
203 * Gets router priority.
204 *
205 * @return routerPriority value
206 */
207 int routerPriority();
208
209 /**
210 * Adds the given neighboring router to the neighbor map.
211 *
212 * @param ospfNbr neighbor instance
213 */
214 void addNeighbouringRouter(OspfNbr ospfNbr);
215
216 /**
217 * Gets the neighbor instance from listOfNeighbors map for the given neighbor ID.
218 *
219 * @param neighborId neighbors id
220 * @return ospfNbr neighbor instance
221 */
222 OspfNbr neighbouringRouter(String neighborId);
223
224 /**
225 * Checks the given neighbor is in the neighbor list.
226 *
227 * @param neighborId neighbors id
228 * @return true if neighbor in list else false
229 */
230 boolean isNeighborInList(String neighborId);
231
232 /**
233 * Removes LSA headers from the map in which LSA headers are stored.
234 *
235 * @param lsaKey key used to store lsa in map
236 */
237 void removeLsaFromNeighborMap(String lsaKey);
sunishvkf7c56552016-07-18 16:02:39 +0530238
239 /**
240 * When an OSPF message received it is handed over to this method.
241 * Based on the type of the OSPF message received it will be handed over
242 * to corresponding message handler methods.
243 *
244 * @param ospfMessage received OSPF message
245 * @param ctx channel handler context instance.
sunishvkf7c56552016-07-18 16:02:39 +0530246 */
Ray Milkey019fba42018-01-31 14:07:47 -0800247 void processOspfMessage(OspfMessage ospfMessage, ChannelHandlerContext ctx);
sunishvkf7c56552016-07-18 16:02:39 +0530248
249 /**
250 * Represents an interface is up and connected.
sunishvkf7c56552016-07-18 16:02:39 +0530251 */
Ray Milkey019fba42018-01-31 14:07:47 -0800252 void interfaceUp();
sunishvkf7c56552016-07-18 16:02:39 +0530253
254 /**
255 * Starts the timer which waits for configured seconds and sends Delayed Ack Packet.
256 */
257 void startDelayedAckTimer();
258
259 /**
260 * Stops the delayed acknowledge timer.
261 */
262 void stopDelayedAckTimer();
263
264 /**
265 * Starts the hello timer which sends hello packet every configured seconds.
266 */
267 void startHelloTimer();
268
269 /**
270 * Stops the hello timer.
271 */
272 void stopHelloTimer();
273
274 /**
275 * Gets called when an interface is down.
276 * All interface variables are reset, and interface timers disabled.
277 * Also all neighbor connections associated with the interface are destroyed.
278 */
279 void interfaceDown();
280
281 /**
282 * Removes all the neighbors.
283 */
284 void removeNeighbors();
sunish vk30637eb2016-02-16 15:19:32 +0530285}