blob: 054bbde6347983228781a3fff3f448fea0305d10 [file] [log] [blame]
sunish vk30637eb2016-02-16 15:19:32 +05301/*
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 */
16package org.onosproject.ospf.controller;
17
18import org.jboss.netty.channel.Channel;
19import org.onlab.packet.Ip4Address;
20
21import java.util.Map;
22
23/**
24 * Represents an OSPF neighbor.
25 */
26public interface OspfNbr {
27
28 /**
29 * Gets neighbor's id.
30 *
31 * @return neighbor's id
32 */
33 public Ip4Address neighborId();
34
35 /**
36 * Gets router priority.
37 *
38 * @return router priority
39 */
40 public int routerPriority();
41
42 /**
43 * Gets the IP address of this neighbor.
44 *
45 * @return the IP address of this neighbor
46 */
47 public Ip4Address neighborIpAddr();
48
49 /**
50 * Gets the neighbor's DR address.
51 *
52 * @return neighbor's DR address
53 */
54 public Ip4Address neighborDr();
55
56 /**
57 * Gets the neighbor's BDR address.
58 *
59 * @return neighbor's BDR address
60 */
61 Ip4Address neighborBdr();
62
63 /**
64 * Determines whether an adjacency should be established/maintained with the neighbor.
65 *
66 * @param ch netty channel instance
67 */
68 void adjOk(Channel ch);
69
70 /**
71 * Gets the pending re transmit list as a map.
72 *
73 * @return pending re transmit list as a map
74 */
75 Map<String, OspfLsa> getPendingReTxList();
76
77 /**
78 * Sets the neighbor's id.
79 *
80 * @param neighborId neighbor's id
81 */
82 void setNeighborId(Ip4Address neighborId);
83
84 /**
85 * Sets the neighbor's BDR address.
86 *
87 * @param neighborBdr neighbor's BDR address
88 */
89 void setNeighborBdr(Ip4Address neighborBdr);
90
91 /**
92 * Sets the neighbor's DR address.
93 *
94 * @param neighborDr neighbor's DR address
95 */
96 void setNeighborDr(Ip4Address neighborDr);
97
98 /**
99 * Sets router priority.
100 *
101 * @param routerPriority router priority
102 */
103 void setRouterPriority(int routerPriority);
104
105 /**
106 * Sets the neighbor is opaque enabled or not.
107 *
108 * @param isOpaqueCapable true if the neighbor is opaque enabled else false
109 */
110 void setIsOpaqueCapable(boolean isOpaqueCapable);
111
112 /**
113 * Sets neighbor is master or not.
114 *
115 * @param isMaster neighbor is master or not
116 */
117 void setIsMaster(int isMaster);
118
119 /**
120 * Gets the DD sequence number.
121 *
122 * @return DD sequence number
123 */
124 long ddSeqNum();
125
126 /**
127 * Sets the DD sequence number.
128 *
129 * @param ddSeqNum DD sequence number
130 */
131 void setDdSeqNum(long ddSeqNum);
132
133 /**
134 * Gets neighbor is master or not.
135 *
136 * @return true if neighbor is master else false
137 */
138 int isMaster();
139
140 /**
141 * Gets the options value.
142 *
143 * @return options value
144 */
145 int options();
146
147 /**
148 * Sets the options value.
149 *
150 * @param options options value
151 */
152 void setOptions(int options);
153
154 /**
155 * An invalid request for LSA has been received.
156 * This indicates an error in the Database Exchange process. Actions to be performed
157 * are the same as in seqNumMismatch. In addition, stop the possibly activated
158 * retransmission timer.
159 *
160 * @param ch netty channel instance
161 * @throws Exception might throw exception
162 */
163 void badLSReq(Channel ch) throws Exception;
164
165 /**
166 * Gets the LS request list.
167 *
168 * @return LS request list
169 */
170 Map getLsReqList();
171
172 /**
173 * Gets the reTxList instance.
174 *
175 * @return reTxList instance
176 */
177 Map getReTxList();
178
179 /**
180 * Gets if the neighbor is opaque enabled or not.
181 *
182 * @return true if the neighbor is opaque enabled else false.
183 */
184 public boolean isOpaqueCapable();
185
186 /**
187 * Gets the neighbor's state.
188 *
189 * @return neighbor's state
190 */
191 OspfNeighborState getState();
192}