mohamed rahil
Committed by Gerrit Code Review

ONOS-4082:ISIS protocol API changes

Change-Id: I4cdd4a4811ec0ab0aba51d7d8085a3eac9b34b2c
Showing 19 changed files with 1203 additions and 22 deletions
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
15 */ 15 */
16 package org.onosproject.isis.controller; 16 package org.onosproject.isis.controller;
17 17
18 +import org.onosproject.isis.controller.topology.IsisRouterListener;
19 +
18 import java.util.List; 20 import java.util.List;
19 21
20 /** 22 /**
...@@ -25,14 +27,14 @@ public interface IsisController { ...@@ -25,14 +27,14 @@ public interface IsisController {
25 /** 27 /**
26 * Registers a listener for router meta events. 28 * Registers a listener for router meta events.
27 * 29 *
28 - * @param isisRouterListener isis router listener instance 30 + * @param isisRouterListener ISIS router listener instance
29 */ 31 */
30 void addRouterListener(IsisRouterListener isisRouterListener); 32 void addRouterListener(IsisRouterListener isisRouterListener);
31 33
32 /** 34 /**
33 * Unregisters a router listener. 35 * Unregisters a router listener.
34 * 36 *
35 - * @param isisRouterListener isis router listener instance 37 + * @param isisRouterListener ISIS router listener instance
36 */ 38 */
37 void removeRouterListener(IsisRouterListener isisRouterListener); 39 void removeRouterListener(IsisRouterListener isisRouterListener);
38 40
...@@ -47,7 +49,8 @@ public interface IsisController { ...@@ -47,7 +49,8 @@ public interface IsisController {
47 * Deletes configuration parameters. 49 * Deletes configuration parameters.
48 * 50 *
49 * @param processes list of process instance 51 * @param processes list of process instance
50 - * @param attribute attribute to delete 52 + * @param attribute string key which deletes the particular node or element
53 + * from the controller
51 */ 54 */
52 void deleteConfig(List<IsisProcess> processes, String attribute); 55 void deleteConfig(List<IsisProcess> processes, String attribute);
53 56
......
...@@ -15,12 +15,25 @@ ...@@ -15,12 +15,25 @@
15 */ 15 */
16 package org.onosproject.isis.controller; 16 package org.onosproject.isis.controller;
17 17
18 +import org.jboss.netty.channel.Channel;
19 +import org.onlab.packet.Ip4Address;
20 +import org.onlab.packet.MacAddress;
21 +
22 +import java.util.Set;
23 +
18 /** 24 /**
19 * Representation of an ISIS interface. 25 * Representation of an ISIS interface.
20 */ 26 */
21 public interface IsisInterface { 27 public interface IsisInterface {
22 28
23 /** 29 /**
30 + * Returns interface index.
31 + *
32 + * @return interface index
33 + */
34 + int interfaceIndex();
35 +
36 + /**
24 * Sets interface index. 37 * Sets interface index.
25 * 38 *
26 * @param interfaceIndex interface index 39 * @param interfaceIndex interface index
...@@ -28,6 +41,48 @@ public interface IsisInterface { ...@@ -28,6 +41,48 @@ public interface IsisInterface {
28 void setInterfaceIndex(int interfaceIndex); 41 void setInterfaceIndex(int interfaceIndex);
29 42
30 /** 43 /**
44 + * Returns the interface IP address.
45 + *
46 + * @return interface IP address
47 + */
48 + Ip4Address interfaceIpAddress();
49 +
50 + /**
51 + * Sets the interface IP address.
52 + *
53 + * @param interfaceIpAddress interface IP address interface IP address
54 + */
55 + void setInterfaceIpAddress(Ip4Address interfaceIpAddress);
56 +
57 + /**
58 + * Returns the network mask.
59 + *
60 + * @return network mask
61 + */
62 + byte[] networkMask();
63 +
64 + /**
65 + * Sets the network mask.
66 + *
67 + * @param networkMask network mask
68 + */
69 + void setNetworkMask(byte[] networkMask);
70 +
71 + /**
72 + * Sets the interface MAC address.
73 + *
74 + * @param interfaceMacAddress interface MAC address
75 + */
76 + void setInterfaceMacAddress(MacAddress interfaceMacAddress);
77 +
78 + /**
79 + * Returns the neighbors list.
80 + *
81 + * @return neighbors list
82 + */
83 + Set<MacAddress> neighbors();
84 +
85 + /**
31 * Sets intermediate system name. 86 * Sets intermediate system name.
32 * 87 *
33 * @param intermediateSystemName intermediate system name 88 * @param intermediateSystemName intermediate system name
...@@ -35,6 +90,13 @@ public interface IsisInterface { ...@@ -35,6 +90,13 @@ public interface IsisInterface {
35 void setIntermediateSystemName(String intermediateSystemName); 90 void setIntermediateSystemName(String intermediateSystemName);
36 91
37 /** 92 /**
93 + * Returns system ID.
94 + *
95 + * @return systemID system ID
96 + */
97 + String systemId();
98 +
99 + /**
38 * Sets system ID. 100 * Sets system ID.
39 * 101 *
40 * @param systemId system ID 102 * @param systemId system ID
...@@ -42,11 +104,32 @@ public interface IsisInterface { ...@@ -42,11 +104,32 @@ public interface IsisInterface {
42 void setSystemId(String systemId); 104 void setSystemId(String systemId);
43 105
44 /** 106 /**
107 + * Returns LAN ID.
108 + *
109 + * @return LAN ID
110 + */
111 + String l1LanId();
112 +
113 + /**
114 + * Sets LAN ID.
115 + *
116 + * @param lanId LAN ID
117 + */
118 + void setL1LanId(String lanId);
119 +
120 + /**
121 + * Returns LAN ID.
122 + *
123 + * @return LAN ID
124 + */
125 + String l2LanId();
126 +
127 + /**
45 * Sets LAN ID. 128 * Sets LAN ID.
46 * 129 *
47 * @param lanId LAN ID 130 * @param lanId LAN ID
48 */ 131 */
49 - void setLanId(String lanId); 132 + void setL2LanId(String lanId);
50 133
51 /** 134 /**
52 * Sets ID length. 135 * Sets ID length.
...@@ -63,6 +146,13 @@ public interface IsisInterface { ...@@ -63,6 +146,13 @@ public interface IsisInterface {
63 void setMaxAreaAddresses(int maxAreaAddresses); 146 void setMaxAreaAddresses(int maxAreaAddresses);
64 147
65 /** 148 /**
149 + * Returns reserved packet circuit type.
150 + *
151 + * @return reserved packet circuit type
152 + */
153 + int reservedPacketCircuitType();
154 +
155 + /**
66 * Sets reserved packet circuit type. 156 * Sets reserved packet circuit type.
67 * 157 *
68 * @param reservedPacketCircuitType reserved packet circuit type 158 * @param reservedPacketCircuitType reserved packet circuit type
...@@ -70,11 +160,25 @@ public interface IsisInterface { ...@@ -70,11 +160,25 @@ public interface IsisInterface {
70 void setReservedPacketCircuitType(int reservedPacketCircuitType); 160 void setReservedPacketCircuitType(int reservedPacketCircuitType);
71 161
72 /** 162 /**
163 + * Returns point to point or broadcast.
164 + *
165 + * @return 1 if point to point, 2 broadcast
166 + */
167 + IsisNetworkType networkType();
168 +
169 + /**
73 * Sets point to point. 170 * Sets point to point.
74 * 171 *
75 - * @param p2p point to point 172 + * @param networkType point to point
76 */ 173 */
77 - void setP2p(int p2p); 174 + void setNetworkType(IsisNetworkType networkType);
175 +
176 + /**
177 + * Returns area address.
178 + *
179 + * @return area address
180 + */
181 + String areaAddress();
78 182
79 /** 183 /**
80 * Sets area address. 184 * Sets area address.
...@@ -98,6 +202,13 @@ public interface IsisInterface { ...@@ -98,6 +202,13 @@ public interface IsisInterface {
98 void setLspId(String lspId); 202 void setLspId(String lspId);
99 203
100 /** 204 /**
205 + * Returns holding time.
206 + *
207 + * @return holding time
208 + */
209 + int holdingTime();
210 +
211 + /**
101 * Sets holding time. 212 * Sets holding time.
102 * 213 *
103 * @param holdingTime holding time 214 * @param holdingTime holding time
...@@ -105,6 +216,13 @@ public interface IsisInterface { ...@@ -105,6 +216,13 @@ public interface IsisInterface {
105 void setHoldingTime(int holdingTime); 216 void setHoldingTime(int holdingTime);
106 217
107 /** 218 /**
219 + * Returns priority.
220 + *
221 + * @return priority
222 + */
223 + int priority();
224 +
225 + /**
108 * Sets priority. 226 * Sets priority.
109 * 227 *
110 * @param priority priority 228 * @param priority priority
...@@ -117,4 +235,70 @@ public interface IsisInterface { ...@@ -117,4 +235,70 @@ public interface IsisInterface {
117 * @param helloInterval hello interval 235 * @param helloInterval hello interval
118 */ 236 */
119 void setHelloInterval(int helloInterval); 237 void setHelloInterval(int helloInterval);
120 -}
...\ No newline at end of file ...\ No newline at end of file
238 +
239 + /**
240 + * Starts the hello timer which sends hello packet every configured seconds.
241 + *
242 + * @param channel netty channel instance
243 + */
244 + void startHelloSender(Channel channel);
245 +
246 + /**
247 + * Processes an ISIS message which is received on this interface.
248 + *
249 + * @param isisMessage ISIS message instance
250 + * @param isisLsdb ISIS LSDB instance
251 + * @param channel channel instance
252 + */
253 + void processIsisMessage(IsisMessage isisMessage, IsisLsdb isisLsdb, Channel channel);
254 +
255 + /**
256 + * Returns the interface state.
257 + *
258 + * @return interface state
259 + */
260 + IsisInterfaceState interfaceState();
261 +
262 + /**
263 + * Sets the interface state.
264 + *
265 + * @param interfaceState the interface state
266 + */
267 + void setInterfaceState(IsisInterfaceState interfaceState);
268 +
269 + /**
270 + * Returns the LSDB instance.
271 + *
272 + * @return LSDB instance
273 + */
274 + IsisLsdb isisLsdb();
275 +
276 + /**
277 + * Returns intermediate system name.
278 + *
279 + * @return intermediate system name
280 + */
281 + String intermediateSystemName();
282 +
283 + /**
284 + * Returns the ISIS neighbor instance if exists.
285 + *
286 + * @param isisNeighborMac mac address of the neighbor router
287 + * @return ISIS neighbor instance if exists else null
288 + */
289 + IsisNeighbor lookup(MacAddress isisNeighborMac);
290 +
291 + /**
292 + * Returns circuit ID.
293 + *
294 + * @return circuit ID
295 + */
296 + String circuitId();
297 +
298 + /**
299 + * Sets circuit ID.
300 + *
301 + * @param circuitId circuit ID
302 + */
303 + void setCircuitId(String circuitId);
304 +}
......
1 +/*
2 + * Copyright 2016-present 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.isis.controller;
17 +
18 +import java.util.EnumSet;
19 +import java.util.HashMap;
20 +import java.util.Map;
21 +
22 +/**
23 + * Enum represents ISIS Interface state.
24 + */
25 +public enum IsisInterfaceState {
26 + /**
27 + * Represents interface is in "up" state.
28 + */
29 + UP(0),
30 + /**
31 + * Represents interface is in "initial" state.
32 + */
33 + INITIAL(1),
34 + /**
35 + * Represents interface is in "down" state.
36 + */
37 + DOWN(2);
38 +
39 + // Reverse lookup table
40 + private static final Map<Integer, IsisInterfaceState> LOOKUP = new HashMap<>();
41 +
42 + // Populate the lookup table on loading time
43 + static {
44 + for (IsisInterfaceState isisInterfaceState : EnumSet.allOf(IsisInterfaceState.class)) {
45 + LOOKUP.put(isisInterfaceState.value(), isisInterfaceState);
46 + }
47 + }
48 +
49 + private int value;
50 +
51 + /**
52 + * Creates an instance of ISIS interface type.
53 + *
54 + * @param value represents ISIS interface type
55 + */
56 + private IsisInterfaceState(int value) {
57 + this.value = value;
58 + }
59 +
60 + /**
61 + * Gets the enum instance from type value - reverse lookup purpose.
62 + *
63 + * @param interfaceStateTypeValue interface state type value
64 + * @return ISIS interface state type instance
65 + */
66 + public static IsisInterfaceState get(int interfaceStateTypeValue) {
67 + return LOOKUP.get(interfaceStateTypeValue);
68 + }
69 +
70 + /**
71 + * Gets the value representing interface state type.
72 + *
73 + * @return value represents interface state type
74 + */
75 + public int value() {
76 + return value;
77 + }
78 +}
...\ No newline at end of file ...\ No newline at end of file
...@@ -13,18 +13,84 @@ ...@@ -13,18 +13,84 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -
17 package org.onosproject.isis.controller; 16 package org.onosproject.isis.controller;
18 17
18 +import java.util.List;
19 +
19 /** 20 /**
20 * Representation of an ISIS link state database. 21 * Representation of an ISIS link state database.
21 */ 22 */
22 public interface IsisLsdb { 23 public interface IsisLsdb {
23 24
24 /** 25 /**
25 - * Gets the ISIS LSDB. 26 + * Returns the ISIS LSDB.
26 * 27 *
27 * @return ISIS LSDB 28 * @return ISIS LSDB
28 */ 29 */
29 IsisLsdb isisLsdb(); 30 IsisLsdb isisLsdb();
30 -}
...\ No newline at end of file ...\ No newline at end of file
31 +
32 + /**
33 + * Initializes LSDB.
34 + */
35 + void initializeDb();
36 +
37 + /**
38 + * Returns the LSDB LSP key.
39 + *
40 + * @param systemId system ID
41 + * @return LSP key
42 + */
43 + String lspKey(String systemId);
44 +
45 + /**
46 + * Returns the sequence number.
47 + *
48 + * @param lspType L1 or L2 LSP
49 + * @return sequence number
50 + */
51 + int lsSequenceNumber(IsisPduType lspType);
52 +
53 + /**
54 + * Finds the LSP from LSDB.
55 + *
56 + * @param pduType L1 or L2 LSP
57 + * @param lspId LSP ID
58 + * @return LSP wrapper object
59 + */
60 + LspWrapper findLsp(IsisPduType pduType, String lspId);
61 +
62 + /**
63 + * Installs a new self-originated LSA in LSDB.
64 + * Return true if installing was successful else false.
65 + *
66 + * @param lsPdu PDU instance
67 + * @param isSelfOriginated true if self originated else false
68 + * @param isisInterface ISIS interface instance
69 + * @return true if successfully added
70 + */
71 + boolean addLsp(IsisMessage lsPdu, boolean isSelfOriginated, IsisInterface isisInterface);
72 +
73 + /**
74 + * Checks received LSP is latest, same or old.
75 + *
76 + * @param receivedLsp received LSP
77 + * @param lspFromDb existing LSP
78 + * @return "latest", "old" or "same"
79 + */
80 + String isNewerOrSameLsp(IsisMessage receivedLsp, IsisMessage lspFromDb);
81 +
82 + /**
83 + * Returns all LSPs (L1 and L2).
84 + *
85 + * @param excludeMaxAgeLsp exclude the max age LSPs
86 + * @return List of LSPs
87 + */
88 + List<LspWrapper> allLspHeaders(boolean excludeMaxAgeLsp);
89 +
90 + /**
91 + * Deletes the given LSP.
92 + *
93 + * @param lsp LSP instance
94 + */
95 + void deleteLsp(IsisMessage lsp);
96 +}
......
1 +/*
2 + * Copyright 2016-present 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.isis.controller;
17 +
18 +/**
19 + * Representation of an ISIS link state database aging.
20 + */
21 +public interface IsisLsdbAge {
22 +
23 + /**
24 + * Starts the aging timer thread which gets invokes every second.
25 + */
26 + void startDbAging();
27 +
28 + /**
29 + * Returns the age counter.
30 + *
31 + * @return age counter
32 + */
33 + int ageCounter();
34 +
35 + /**
36 + * Returns the age counter rollover.
37 + *
38 + * @return age counter rollover
39 + */
40 + int ageCounterRollOver();
41 +
42 + /**
43 + * Returns the bin number.
44 + *
45 + * @param x can be either age or ageCounter
46 + * @return bin number
47 + */
48 + int age2Bin(int x);
49 +
50 + /**
51 + * Returns the LSP bin instance.
52 + *
53 + * @param binKey key to search
54 + * @return LSP bin instance
55 + */
56 + IsisLspBin getLspBin(int binKey);
57 +
58 + /**
59 + * Adds LSP to bin.
60 + *
61 + * @param binNumber key to store in bin
62 + * @param lspBin LSP bin instance
63 + */
64 + void addLspBin(int binNumber, IsisLspBin lspBin);
65 +
66 + /**
67 + * Removes LSP from bin.
68 + *
69 + * @param lspWrapper LSP wrapper instance
70 + */
71 + void removeLspFromBin(LspWrapper lspWrapper);
72 +}
1 +/*
2 + * Copyright 2016-present 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.isis.controller;
17 +
18 +import java.util.Map;
19 +
20 +/**
21 + * Representation of an ISIS LSP bin which is part of LSP aging process.
22 + */
23 +public interface IsisLspBin {
24 +
25 + /**
26 + * Returns all the LSPs in the bin.
27 + *
28 + * @return all LSPs in the bin
29 + */
30 + Map<String, LspWrapper> listOfLsp();
31 +
32 + /**
33 + * Adds LSP to bin for aging.
34 + *
35 + * @param lspKey key to add the LSP
36 + * @param lspWrapper LSP wrapper instance
37 + */
38 + void addIsisLsp(String lspKey, LspWrapper lspWrapper);
39 +
40 + /**
41 + * Removes LSP from bin.
42 + *
43 + * @param lspKey LSP key
44 + * @param lspWrapper LSP wrapper instance
45 + */
46 + void removeIsisLsp(String lspKey, LspWrapper lspWrapper);
47 +}
...@@ -13,18 +13,76 @@ ...@@ -13,18 +13,76 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -
17 package org.onosproject.isis.controller; 16 package org.onosproject.isis.controller;
18 17
18 +import org.jboss.netty.buffer.ChannelBuffer;
19 +import org.onlab.packet.MacAddress;
20 +
19 /** 21 /**
20 * Representation of an ISIS Message. 22 * Representation of an ISIS Message.
21 */ 23 */
22 public interface IsisMessage { 24 public interface IsisMessage {
23 25
24 /** 26 /**
25 - * Gets the type of ISIS PDU. 27 + * Returns the interface index on which the message received.
28 + *
29 + * @return interface index on which the message received
30 + */
31 + int interfaceIndex();
32 +
33 + /**
34 + * Sets the interface index on which the message received.
35 + *
36 + * @param interfaceIndex interface index on which the message received
37 + */
38 + void setInterfaceIndex(int interfaceIndex);
39 +
40 + /**
41 + * Returns the interface mac address on which the message received.
42 + *
43 + * @return interface mac address on which the message received
44 + */
45 + MacAddress interfaceMac();
46 +
47 + /**
48 + * Sets the interface mac address on which the message received.
49 + *
50 + * @param interfaceMac mac address on which the message received
51 + */
52 + void setInterfaceMac(MacAddress interfaceMac);
53 +
54 + /**
55 + * Returns the mac address of the message sender.
56 + *
57 + * @return mac address of the message sender
58 + */
59 + MacAddress sourceMac();
60 +
61 + /**
62 + * Sets the mac address of the message sender.
63 + *
64 + * @param sourceMac mac address of the message sender
65 + */
66 + void setSourceMac(MacAddress sourceMac);
67 +
68 + /**
69 + * Returns the type of ISIS PDU.
26 * 70 *
27 * @return ISIS PDU type instance 71 * @return ISIS PDU type instance
28 */ 72 */
29 IsisPduType isisPduType(); 73 IsisPduType isisPduType();
30 -}
...\ No newline at end of file ...\ No newline at end of file
74 +
75 + /**
76 + * Reads from channel buffer and initializes the type of PDU.
77 + *
78 + * @param channelBuffer channel buffer instance
79 + */
80 + void readFrom(ChannelBuffer channelBuffer);
81 +
82 + /**
83 + * Returns IsisMessage as byte array.
84 + *
85 + * @return ISIS message as bytes
86 + */
87 + byte[] asBytes();
88 +}
......
1 +/*
2 + * Copyright 2016-present 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.isis.controller;
17 +
18 +import org.onlab.packet.MacAddress;
19 +
20 +/**
21 + * Representation of an ISIS neighbor.
22 + */
23 +public interface IsisNeighbor {
24 +
25 + /**
26 + * Returns the MAC address of neighbor.
27 + *
28 + * @return MAC address of neighbor
29 + */
30 + MacAddress neighborMacAddress();
31 +
32 + /**
33 + * Returns the neighbor interface state.
34 + *
35 + * @return neighbor interface state
36 + */
37 + IsisInterfaceState interfaceState();
38 +
39 + /**
40 + * Sets the neighbor interface state.
41 + *
42 + * @param interfaceState the neighbor interface state
43 + */
44 + void setNeighborState(IsisInterfaceState interfaceState);
45 +
46 + /**
47 + * Sets the LAN ID.
48 + *
49 + * @param l1LanId LAN ID
50 + */
51 + void setL1LanId(String l1LanId);
52 +
53 + /**
54 + * Sets the LAN ID.
55 + *
56 + * @param l2LanId LAN ID
57 + */
58 + void setL2LanId(String l2LanId);
59 +
60 + /**
61 + * Returns neighbor system ID.
62 + *
63 + * @return neighbor system ID
64 + */
65 + String neighborSystemId();
66 +
67 + /**
68 + * Returns neighbor circuit ID.
69 + *
70 + * @return neighbor circuit ID
71 + */
72 + byte localCircuitId();
73 +
74 + /**
75 + * Returns neighbor extended circuit ID.
76 + *
77 + * @return neighbor extended circuit ID
78 + */
79 + int localExtendedCircuitId();
80 +
81 + /**
82 + * Sets neighbor extended circuit ID.
83 + *
84 + * @param localExtendedCircuitId neighbor extended circuit ID
85 + */
86 + void setLocalExtendedCircuitId(int localExtendedCircuitId);
87 +}
1 +/*
2 + * Copyright 2016-present 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.isis.controller;
17 +
18 +import java.util.EnumSet;
19 +import java.util.HashMap;
20 +import java.util.Map;
21 +
22 +/**
23 + * Represents ISIS network types.
24 + */
25 +public enum IsisNetworkType {
26 + /**
27 + * Represents point-to-point network.
28 + */
29 + P2P(1),
30 + /**
31 + * Represents broadcast network.
32 + */
33 + BROADCAST(2);
34 + // Reverse lookup table
35 + private static final Map<Integer, IsisNetworkType> LOOKUP = new HashMap<>();
36 +
37 + // Populate the lookup table on loading time
38 + static {
39 + for (IsisNetworkType isisNetworkType : EnumSet.allOf(IsisNetworkType.class)) {
40 + LOOKUP.put(isisNetworkType.value(), isisNetworkType);
41 + }
42 + }
43 +
44 + private int value;
45 +
46 +
47 + /**
48 + * Creates an instance of ISIS network type.
49 + *
50 + * @param value represents ISIS network type
51 + */
52 + private IsisNetworkType(int value) {
53 + this.value = value;
54 + }
55 +
56 + /**
57 + * Gets the enum instance from type value - reverse lookup purpose.
58 + *
59 + * @param isisNetworkTypeValue interface network type value
60 + * @return ISIS interface network type instance
61 + */
62 + public static IsisNetworkType get(int isisNetworkTypeValue) {
63 + return LOOKUP.get(isisNetworkTypeValue);
64 + }
65 +
66 + /**
67 + * Gets the value representing network type.
68 + *
69 + * @return value represents network type
70 + */
71 + public int value() {
72 + return value;
73 + }
74 +}
...\ No newline at end of file ...\ No newline at end of file
...@@ -13,9 +13,12 @@ ...@@ -13,9 +13,12 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -
17 package org.onosproject.isis.controller; 16 package org.onosproject.isis.controller;
18 17
18 +import java.util.EnumSet;
19 +import java.util.HashMap;
20 +import java.util.Map;
21 +
19 /** 22 /**
20 * Representation of ISIS PDU types. 23 * Representation of ISIS PDU types.
21 */ 24 */
...@@ -58,8 +61,17 @@ public enum IsisPduType { ...@@ -58,8 +61,17 @@ public enum IsisPduType {
58 */ 61 */
59 L2PSNP(27); 62 L2PSNP(27);
60 63
61 - private int value; 64 + // Reverse lookup table
65 + private static final Map<Integer, IsisPduType> LOOKUP = new HashMap<>();
62 66
67 + // Populate the lookup table on loading time
68 + static {
69 + for (IsisPduType isisPduType : EnumSet.allOf(IsisPduType.class)) {
70 + LOOKUP.put(isisPduType.value(), isisPduType);
71 + }
72 + }
73 +
74 + private int value;
63 75
64 /** 76 /**
65 * Creates an instance of ISIS PDU type. 77 * Creates an instance of ISIS PDU type.
...@@ -71,6 +83,16 @@ public enum IsisPduType { ...@@ -71,6 +83,16 @@ public enum IsisPduType {
71 } 83 }
72 84
73 /** 85 /**
86 + * Gets the enum instance from type value - reverse lookup purpose.
87 + *
88 + * @param pduTypeValue PDU type value
89 + * @return ISIS PDU type instance
90 + */
91 + public static IsisPduType get(int pduTypeValue) {
92 + return LOOKUP.get(pduTypeValue);
93 + }
94 +
95 + /**
74 * Gets the value representing PDU type. 96 * Gets the value representing PDU type.
75 * 97 *
76 * @return value represents PDU type 98 * @return value represents PDU type
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -
17 package org.onosproject.isis.controller; 16 package org.onosproject.isis.controller;
18 17
19 import java.util.List; 18 import java.util.List;
...@@ -36,4 +35,11 @@ public interface IsisProcess { ...@@ -36,4 +35,11 @@ public interface IsisProcess {
36 * @param isisInterfaceList list of ISIS interface details 35 * @param isisInterfaceList list of ISIS interface details
37 */ 36 */
38 void setIsisInterfaceList(List<IsisInterface> isisInterfaceList); 37 void setIsisInterfaceList(List<IsisInterface> isisInterfaceList);
39 -}
...\ No newline at end of file ...\ No newline at end of file
38 +
39 + /**
40 + * Returns list of ISIS interface details.
41 + *
42 + * @return list of ISIS interface details
43 + */
44 + List<IsisInterface> isisInterfaceList();
45 +}
......
1 +/*
2 + * Copyright 2016-present 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.isis.controller;
17 +
18 +import java.util.EnumSet;
19 +import java.util.HashMap;
20 +import java.util.Map;
21 +
22 +/**
23 + * Representation of ISIS router types.
24 + */
25 +public enum IsisRouterType {
26 + /**
27 + * Represents ISIS L1 router.
28 + */
29 + L1(1),
30 + /**
31 + * Represents ISIS L2 router.
32 + */
33 + L2(2),
34 + /**
35 + * Represents ISIS L1/L2 router.
36 + */
37 + L1L2(3);
38 + // Reverse lookup table
39 + private static final Map<Integer, IsisRouterType> LOOKUP = new HashMap<>();
40 +
41 + // Populate the lookup table on loading time
42 + static {
43 + for (IsisRouterType isisRouterType : EnumSet.allOf(IsisRouterType.class)) {
44 + LOOKUP.put(isisRouterType.value(), isisRouterType);
45 + }
46 + }
47 +
48 + private int value;
49 +
50 + /**
51 + * Creates an instance of ISIS router type.
52 + *
53 + * @param value represents ISIS router type
54 + */
55 + private IsisRouterType(int value) {
56 + this.value = value;
57 + }
58 +
59 + /**
60 + * Gets the enum instance from type value - reverse lookup purpose.
61 + *
62 + * @param routerTypeValue router type value
63 + * @return ISIS router type instance
64 + */
65 + public static IsisRouterType get(int routerTypeValue) {
66 + return LOOKUP.get(routerTypeValue);
67 + }
68 +
69 + /**
70 + * Gets the value representing router type.
71 + *
72 + * @return value represents router type
73 + */
74 + public int value() {
75 + return value;
76 + }
77 +}
...\ No newline at end of file ...\ No newline at end of file
1 +/*
2 + * Copyright 2016-present 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.isis.controller;
17 +
18 +/**
19 + * Representation of a LSP wrapper.
20 + */
21 +public interface LspWrapper {
22 +
23 + /**
24 + * Returns bin number into which the LSP wrapper is put for aging process.
25 + *
26 + * @return bin number
27 + */
28 + int binNumber();
29 +
30 + /**
31 + * Sets bin number into which the LSP wrapper is put for aging process.
32 + *
33 + * @param binNumber bin number
34 + */
35 + void setBinNumber(int binNumber);
36 +
37 + /**
38 + * Checks the contained LSP is self originated or not.
39 + *
40 + * @return true if self originated else false
41 + */
42 + boolean isSelfOriginated();
43 +
44 + /**
45 + * Sets the contained LSP is self originated or not.
46 + *
47 + * @param selfOriginated true if self originated else false
48 + */
49 + void setSelfOriginated(boolean selfOriginated);
50 +
51 + /**
52 + * Returns the LSP type.
53 + *
54 + * @return LSP type
55 + */
56 + IsisPduType lspType();
57 +
58 + /**
59 + * Returns the LSPs remaining life time.
60 + *
61 + * @return LSPs remaining life time.
62 + */
63 + int remainingLifetime();
64 +
65 + /**
66 + * Returns the age counter value when LSP was received.
67 + *
68 + * @return age counter value when LSP was received
69 + */
70 + int ageCounterWhenReceived();
71 +
72 + /**
73 + * Returns the age counter roll over value when LSP was added to wrapper instance.
74 + *
75 + * @return age counter roll over value when LSP was added to wrapper instance
76 + */
77 + int ageCounterRollOverWhenAdded();
78 +
79 + /**
80 + * Returns the LSP instance stored in wrapper.
81 + *
82 + * @return LSP instance stored in wrapper
83 + */
84 + IsisMessage lsPdu();
85 +
86 + /**
87 + * Sets LSPs remaining life time.
88 + *
89 + * @param remainingLifetime LSPs remaining life time
90 + */
91 + void setRemainingLifetime(int remainingLifetime);
92 +
93 + /**
94 + * Returns the age of LSP when received.
95 + *
96 + * @return age of LSP when received
97 + */
98 + int lspAgeReceived();
99 +
100 + /**
101 + * Returns the LSP processing string.
102 + *
103 + * @return lsp processing value for switch case
104 + */
105 + String lspProcessing();
106 +
107 + /**
108 + * Returns ISIS interface instance.
109 + *
110 + * @return ISIS interface instance
111 + */
112 + IsisInterface isisInterface();
113 +
114 + /**
115 + * Returns the current LSP age.
116 + *
117 + * @return LSP age
118 + */
119 + int currentAge();
120 +
121 + /**
122 + * Sets the LSP processing string based on LSP to process.
123 + *
124 + * @param lspProcessing "refreshLsp" or "maxageLsp" based on LSP to process
125 + */
126 + void setLspProcessing(String lspProcessing);
127 +}
1 +/*
2 + * Copyright 2016-present 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.isis.controller.topology;
17 +
18 +import org.onlab.packet.IpAddress;
19 +
20 +import java.util.List;
21 +
22 +/**
23 + * Abstraction of an ISIS Link.
24 + */
25 +public interface IsisLink {
26 +
27 + /**
28 + * Returns IP address of the Router.
29 + *
30 + * @return IP address of router
31 + */
32 + IpAddress remoteRouterId();
33 +
34 + /**
35 + * Returns the area ID for this device.
36 + *
37 + * @return the area ID
38 + */
39 + int areaIdOfInterface();
40 +
41 + /**
42 + * Returns IP address of the interface.
43 + *
44 + * @return IP address of the interface
45 + */
46 + IpAddress interfaceIp();
47 +
48 + /**
49 + * Returns the list of link TED details.
50 + *
51 + * @return linkTed list of link TED
52 + */
53 + List<IsisLinkTed> linkTed();
54 +
55 + /**
56 + * Sets IP address of the router.
57 + *
58 + * @param routerIp router's IP address
59 + */
60 + void setRouterIp(IpAddress routerIp);
61 +
62 + /**
63 + * Sets the area ID for this device.
64 + *
65 + * @param areaIdOfInterface area ID
66 + */
67 + void setAreaIdOfInterface(int areaIdOfInterface);
68 +
69 + /**
70 + * Sets IP address of the interface.
71 + *
72 + * @param interfaceIp IP address of the interface
73 + */
74 + void setInterfaceIp(IpAddress interfaceIp);
75 +
76 + /**
77 + * Sets the list of link TED.
78 + *
79 + * @param linkTed list of link TED
80 + */
81 + void setLinkTed(List<IsisLinkTed> linkTed);
82 +}
1 +/*
2 + * Copyright 2016-present 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.isis.controller.topology;
17 +
18 +/**
19 + * Abstraction of an ISIS link listener.
20 + */
21 +public interface IsisLinkListener {
22 +
23 + /**
24 + * Notifies that we got a link from network.
25 + *
26 + * @param isisRouter router instance
27 + * @param isisLinkTed link TED information of router
28 + */
29 + void addLink(IsisRouter isisRouter, IsisLinkTed isisLinkTed);
30 +
31 + /**
32 + * Notifies that a link got removed from network.
33 + *
34 + * @param isisRouter router instance
35 + * @param isisLinkTed isis link ted infromation
36 + */
37 + void deleteLink(IsisRouter isisRouter, IsisLinkTed isisLinkTed);
38 +}
...\ No newline at end of file ...\ No newline at end of file
1 +/*
2 + * Copyright 2016-present 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.isis.controller.topology;
17 +
18 +import org.onlab.packet.Ip4Address;
19 +import org.onlab.packet.Ip6Address;
20 +import org.onlab.util.Bandwidth;
21 +
22 +import java.util.List;
23 +
24 +/**
25 + * Representation of ISIS link traffic engineering parameters.
26 + */
27 +public interface IsisLinkTed {
28 +
29 + /**
30 + * Provides maximum bandwidth can be used on the link.
31 + *
32 + * @return maximum bandwidth
33 + */
34 + Bandwidth maximumLink();
35 +
36 + /**
37 + * Sets maximum band width.
38 + *
39 + * @param bandwidth maximum bandwidth
40 + */
41 + void setMaximumLink(Bandwidth bandwidth);
42 +
43 + /**
44 + * Amount of bandwidth reservable on the link.
45 + *
46 + * @return unreserved bandwidth
47 + */
48 + List<Bandwidth> maxUnResBandwidth();
49 +
50 + /**
51 + * Sets max bandwidth that is not reserved on the link.
52 + *
53 + * @param bandwidth max bandwidth that is not reserved on the link
54 + */
55 + void setMaxUnResBandwidth(Bandwidth bandwidth);
56 +
57 + /**
58 + * Provides max bandwidth that can be reserved on the link.
59 + *
60 + * @return max bandwidth reserved
61 + */
62 + Bandwidth maxReserved();
63 +
64 + /**
65 + * Sets max bandwidth that can be reserved on the link.
66 + *
67 + * @param bandwidth max bandwidth that can be reserved on the link
68 + */
69 + void setMaxReserved(Bandwidth bandwidth);
70 +
71 + /**
72 + * Provides Traffic Engineering metric for the link.
73 + *
74 + * @return Traffic Engineering metric
75 + */
76 + int teMetric();
77 +
78 + /**
79 + * Sets Traffic Engineering metric for the link.
80 + *
81 + * @param teMetric Traffic Engineering metric for the link
82 + */
83 + void setTeMetric(int teMetric);
84 +
85 + /**
86 + * Provides IPv4 router-Id of local node.
87 + *
88 + * @return IPv4 router-Id of local node
89 + */
90 + List<Ip4Address> ipv4LocRouterId();
91 +
92 + /**
93 + * Sets IPv4 router-Id of local node.
94 + *
95 + * @param routerIds IPv4 router-Id of local node
96 + */
97 + void setIpv4LocRouterId(List<Ip4Address> routerIds);
98 +
99 + /**
100 + * Provides IPv6 router-Id of local node.
101 + *
102 + * @return IPv6 router-Id of local node
103 + */
104 + List<Ip6Address> ipv6LocRouterId();
105 +
106 + /**
107 + * Sets IPv6 router-Id of local node.
108 + *
109 + * @param routerIds IPv6 router-Id of local node
110 + */
111 + void setIpv6LocRouterId(List<Ip6Address> routerIds);
112 +
113 + /**
114 + * Provides IPv4 router-Id of remote node.
115 + *
116 + * @return IPv4 router-Id of remote node
117 + */
118 + List<Ip4Address> ipv4RemRouterId();
119 +
120 + /**
121 + * Sets IPv4 router-Id of remote node.
122 + *
123 + * @param routerIds IPv4 router-Id of remote node
124 + */
125 + void setIpv4RemRouterId(List<Ip4Address> routerIds);
126 +
127 + /**
128 + * Provides IPv6 router-Id of remote node.
129 + *
130 + * @return IPv6 router-Id of remote node
131 + */
132 + List<Ip6Address> ipv6RemRouterId();
133 +
134 + /**
135 + * Sets IPv6 router-Id of remote node.
136 + *
137 + * @param routerIds IPv6 router-Id of remote node
138 + */
139 + void setIpv6RemRouterId(List<Ip6Address> routerIds);
140 +}
...\ No newline at end of file ...\ No newline at end of file
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.onosproject.isis.controller; 16 +package org.onosproject.isis.controller.topology;
17 17
18 import org.onlab.packet.Ip4Address; 18 import org.onlab.packet.Ip4Address;
19 19
...@@ -23,14 +23,14 @@ import org.onlab.packet.Ip4Address; ...@@ -23,14 +23,14 @@ import org.onlab.packet.Ip4Address;
23 public interface IsisRouter { 23 public interface IsisRouter {
24 24
25 /** 25 /**
26 - * Gets IP address of the router. 26 + * Returns IP address of the router.
27 * 27 *
28 * @return IP address of the router 28 * @return IP address of the router
29 */ 29 */
30 Ip4Address routerIp(); 30 Ip4Address routerIp();
31 31
32 /** 32 /**
33 - * Gets IP address of the interface. 33 + * Returns IP address of the interface.
34 * 34 *
35 * @return IP address of the interface 35 * @return IP address of the interface
36 */ 36 */
...@@ -42,4 +42,4 @@ public interface IsisRouter { ...@@ -42,4 +42,4 @@ public interface IsisRouter {
42 * @param routerIp IP address of the router 42 * @param routerIp IP address of the router
43 */ 43 */
44 void setRouterIp(Ip4Address routerIp); 44 void setRouterIp(Ip4Address routerIp);
45 -}
...\ No newline at end of file ...\ No newline at end of file
45 +}
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.onosproject.isis.controller; 16 +package org.onosproject.isis.controller.topology;
17 17
18 /** 18 /**
19 * Abstraction of an ISIS Router Listener. 19 * Abstraction of an ISIS Router Listener.
......
1 +/*
2 + * Copyright 2016-present 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 +
17 +/**
18 + * Implementation of the ISIS topology provider.
19 + */
20 +package org.onosproject.isis.controller.topology;
...\ No newline at end of file ...\ No newline at end of file