Committed by
Gerrit Code Review
ONOS-4107: Changes to provider
Change-Id: Ice1a5d49a66fc4f8e5033b47c0ee90601d55589e
Showing
50 changed files
with
1994 additions
and
284 deletions
... | @@ -16,9 +16,11 @@ | ... | @@ -16,9 +16,11 @@ |
16 | package org.onosproject.isis.controller; | 16 | package org.onosproject.isis.controller; |
17 | 17 | ||
18 | import com.fasterxml.jackson.databind.JsonNode; | 18 | import com.fasterxml.jackson.databind.JsonNode; |
19 | +import org.onosproject.isis.controller.topology.IsisLinkListener; | ||
19 | import org.onosproject.isis.controller.topology.IsisRouterListener; | 20 | import org.onosproject.isis.controller.topology.IsisRouterListener; |
20 | 21 | ||
21 | import java.util.List; | 22 | import java.util.List; |
23 | +import java.util.Set; | ||
22 | 24 | ||
23 | /** | 25 | /** |
24 | * Representation of an ISIS controller. | 26 | * Representation of an ISIS controller. |
... | @@ -52,4 +54,32 @@ public interface IsisController { | ... | @@ -52,4 +54,32 @@ public interface IsisController { |
52 | * @return list of process instances | 54 | * @return list of process instances |
53 | */ | 55 | */ |
54 | List<IsisProcess> allConfiguredProcesses(); | 56 | List<IsisProcess> allConfiguredProcesses(); |
57 | + | ||
58 | + /** | ||
59 | + * Registers a listener for ISIS message events. | ||
60 | + * | ||
61 | + * @param listener the listener to notify | ||
62 | + */ | ||
63 | + void addLinkListener(IsisLinkListener listener); | ||
64 | + | ||
65 | + /** | ||
66 | + * Unregisters a link listener. | ||
67 | + * | ||
68 | + * @param listener the listener to unregister | ||
69 | + */ | ||
70 | + void removeLinkListener(IsisLinkListener listener); | ||
71 | + | ||
72 | + /** | ||
73 | + * Gets the list of listeners registered for router events. | ||
74 | + * | ||
75 | + * @return list of listeners | ||
76 | + */ | ||
77 | + Set<IsisRouterListener> listener(); | ||
78 | + | ||
79 | + /** | ||
80 | + * Gets the list of listeners registered for link events. | ||
81 | + * | ||
82 | + * @return list of listeners | ||
83 | + */ | ||
84 | + Set<IsisLinkListener> linkListener(); | ||
55 | } | 85 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -318,4 +318,4 @@ public interface IsisInterface { | ... | @@ -318,4 +318,4 @@ public interface IsisInterface { |
318 | * Removes all the neighbors. | 318 | * Removes all the neighbors. |
319 | */ | 319 | */ |
320 | void removeNeighbors(); | 320 | void removeNeighbors(); |
321 | -} | 321 | +} |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -69,4 +69,4 @@ public interface IsisLsdbAge { | ... | @@ -69,4 +69,4 @@ public interface IsisLsdbAge { |
69 | * @param lspWrapper LSP wrapper instance | 69 | * @param lspWrapper LSP wrapper instance |
70 | */ | 70 | */ |
71 | void removeLspFromBin(LspWrapper lspWrapper); | 71 | void removeLspFromBin(LspWrapper lspWrapper); |
72 | -} | 72 | +} |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -44,4 +44,4 @@ public interface IsisLspBin { | ... | @@ -44,4 +44,4 @@ public interface IsisLspBin { |
44 | * @param lspWrapper LSP wrapper instance | 44 | * @param lspWrapper LSP wrapper instance |
45 | */ | 45 | */ |
46 | void removeIsisLsp(String lspKey, LspWrapper lspWrapper); | 46 | void removeIsisLsp(String lspKey, LspWrapper lspWrapper); |
47 | -} | 47 | +} |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -124,4 +124,4 @@ public interface LspWrapper { | ... | @@ -124,4 +124,4 @@ public interface LspWrapper { |
124 | * @param lspProcessing "refreshLsp" or "maxageLsp" based on LSP to process | 124 | * @param lspProcessing "refreshLsp" or "maxageLsp" based on LSP to process |
125 | */ | 125 | */ |
126 | void setLspProcessing(String lspProcessing); | 126 | void setLspProcessing(String lspProcessing); |
127 | -} | 127 | +} |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
protocols/isis/api/src/main/java/org/onosproject/isis/controller/topology/DeviceInformation.java
0 → 100644
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.isis.controller.topology; | ||
17 | + | ||
18 | +import org.onlab.packet.Ip4Address; | ||
19 | + | ||
20 | +/** | ||
21 | + * Representation of an ISIS device information. | ||
22 | + */ | ||
23 | +public interface DeviceInformation { | ||
24 | + | ||
25 | + /** | ||
26 | + * Gets system id. | ||
27 | + * | ||
28 | + * @return system id | ||
29 | + */ | ||
30 | + String systemId(); | ||
31 | + | ||
32 | + /** | ||
33 | + * Sets system id. | ||
34 | + * | ||
35 | + * @param systemId system id | ||
36 | + */ | ||
37 | + void setSystemId(String systemId); | ||
38 | + | ||
39 | + /** | ||
40 | + * Gets interface ids. | ||
41 | + * | ||
42 | + * @return interface ids | ||
43 | + */ | ||
44 | + Ip4Address interfaceId(); | ||
45 | + | ||
46 | + /** | ||
47 | + * Sets interface id. | ||
48 | + * | ||
49 | + * @param interfaceId interface id | ||
50 | + */ | ||
51 | + void setInterfaceId(Ip4Address interfaceId); | ||
52 | + | ||
53 | + /** | ||
54 | + * Gets area id. | ||
55 | + * | ||
56 | + * @return area id | ||
57 | + */ | ||
58 | + String areaId(); | ||
59 | + | ||
60 | + /** | ||
61 | + * Sets area id. | ||
62 | + * | ||
63 | + * @param areaId area id | ||
64 | + */ | ||
65 | + void setAreaId(String areaId); | ||
66 | + | ||
67 | + /** | ||
68 | + * Gets device information is already created or not. | ||
69 | + * | ||
70 | + * @return true if device information is already created else false | ||
71 | + */ | ||
72 | + boolean isAlreadyCreated(); | ||
73 | + | ||
74 | + /** | ||
75 | + * Sets device information is already created or not. | ||
76 | + * | ||
77 | + * @param alreadyCreated true if device information is already created else false | ||
78 | + */ | ||
79 | + void setAlreadyCreated(boolean alreadyCreated); | ||
80 | + | ||
81 | + /** | ||
82 | + * Gets device is dis or not. | ||
83 | + * | ||
84 | + * @return true if device is dis else false | ||
85 | + */ | ||
86 | + boolean isDis(); | ||
87 | + | ||
88 | + /** | ||
89 | + * Sets device is dis or not. | ||
90 | + * | ||
91 | + * @param dis true if device is dr else false | ||
92 | + */ | ||
93 | + void setDis(boolean dis); | ||
94 | + | ||
95 | + /** | ||
96 | + * Gets neighbor id. | ||
97 | + * | ||
98 | + * @return neighbor id | ||
99 | + */ | ||
100 | + String neighborId(); | ||
101 | + | ||
102 | + /** | ||
103 | + * Sets neighbor id. | ||
104 | + * | ||
105 | + * @param neighborId neighbor id | ||
106 | + */ | ||
107 | + void setNeighborId(String neighborId); | ||
108 | +} | ||
... | \ 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 | + | ||
17 | +package org.onosproject.isis.controller.topology; | ||
18 | + | ||
19 | +/** | ||
20 | + * Representation of an ISIS agent. | ||
21 | + * It is responsible for keeping track of the current set of routers | ||
22 | + * connected to the system. | ||
23 | + */ | ||
24 | +public interface IsisAgent { | ||
25 | + /** | ||
26 | + * Adds a router that has just connected to the system. | ||
27 | + * | ||
28 | + * @param isisRouter the router id to add | ||
29 | + * @return true if added, false otherwise | ||
30 | + */ | ||
31 | + boolean addConnectedRouter(IsisRouter isisRouter); | ||
32 | + | ||
33 | + /** | ||
34 | + * Removes the router which got disconnected from the system. | ||
35 | + * | ||
36 | + * @param isisRouter the router id to remove | ||
37 | + */ | ||
38 | + void removeConnectedRouter(IsisRouter isisRouter); | ||
39 | + | ||
40 | + /** | ||
41 | + * Notifies that got a packet of link from network and need do processing. | ||
42 | + * | ||
43 | + * @param isisLink link instance | ||
44 | + */ | ||
45 | + void addLink(IsisLink isisLink); | ||
46 | + | ||
47 | + /** | ||
48 | + * Notifies that got a packet of link from network and need do processing. | ||
49 | + * | ||
50 | + * @param isisLink link instance | ||
51 | + */ | ||
52 | + void deleteLink(IsisLink isisLink); | ||
53 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -15,9 +15,7 @@ | ... | @@ -15,9 +15,7 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.isis.controller.topology; | 16 | package org.onosproject.isis.controller.topology; |
17 | 17 | ||
18 | -import org.onlab.packet.IpAddress; | 18 | +import org.onlab.packet.Ip4Address; |
19 | - | ||
20 | -import java.util.List; | ||
21 | 19 | ||
22 | /** | 20 | /** |
23 | * Abstraction of an ISIS Link. | 21 | * Abstraction of an ISIS Link. |
... | @@ -25,58 +23,72 @@ import java.util.List; | ... | @@ -25,58 +23,72 @@ import java.util.List; |
25 | public interface IsisLink { | 23 | public interface IsisLink { |
26 | 24 | ||
27 | /** | 25 | /** |
28 | - * Returns IP address of the Router. | 26 | + * Returns the remote system ID. |
29 | * | 27 | * |
30 | - * @return IP address of router | 28 | + * @return remote system ID |
31 | */ | 29 | */ |
32 | - IpAddress remoteRouterId(); | 30 | + String remoteSystemId(); |
33 | 31 | ||
34 | /** | 32 | /** |
35 | - * Returns the area ID for this device. | 33 | + * Returns the local system ID. |
36 | * | 34 | * |
37 | - * @return the area ID | 35 | + * @return local system ID |
38 | */ | 36 | */ |
39 | - int areaIdOfInterface(); | 37 | + String localSystemId(); |
40 | 38 | ||
41 | /** | 39 | /** |
42 | * Returns IP address of the interface. | 40 | * Returns IP address of the interface. |
43 | * | 41 | * |
44 | * @return IP address of the interface | 42 | * @return IP address of the interface |
45 | */ | 43 | */ |
46 | - IpAddress interfaceIp(); | 44 | + Ip4Address interfaceIp(); |
45 | + | ||
46 | + /** | ||
47 | + * Returns IP address of the neighbor. | ||
48 | + * | ||
49 | + * @return IP address of the neighbor | ||
50 | + */ | ||
51 | + Ip4Address neighborIp(); | ||
47 | 52 | ||
48 | /** | 53 | /** |
49 | - * Returns the list of link TED details. | 54 | + * Returns the link TED details. |
50 | * | 55 | * |
51 | - * @return linkTed list of link TED | 56 | + * @return linkTed link TED |
52 | */ | 57 | */ |
53 | - List<IsisLinkTed> linkTed(); | 58 | + IsisLinkTed linkTed(); |
54 | 59 | ||
55 | /** | 60 | /** |
56 | - * Sets IP address of the router. | 61 | + * Sets remote system ID. |
57 | * | 62 | * |
58 | - * @param routerIp router's IP address | 63 | + * @param remoteSystemId remote system ID |
59 | */ | 64 | */ |
60 | - void setRouterIp(IpAddress routerIp); | 65 | + void setRemoteSystemId(String remoteSystemId); |
61 | 66 | ||
62 | /** | 67 | /** |
63 | - * Sets the area ID for this device. | 68 | + * Sets local system ID. |
64 | * | 69 | * |
65 | - * @param areaIdOfInterface area ID | 70 | + * @param localSystemId remote system ID |
66 | */ | 71 | */ |
67 | - void setAreaIdOfInterface(int areaIdOfInterface); | 72 | + void setLocalSystemId(String localSystemId); |
68 | 73 | ||
69 | /** | 74 | /** |
70 | * Sets IP address of the interface. | 75 | * Sets IP address of the interface. |
71 | * | 76 | * |
72 | * @param interfaceIp IP address of the interface | 77 | * @param interfaceIp IP address of the interface |
73 | */ | 78 | */ |
74 | - void setInterfaceIp(IpAddress interfaceIp); | 79 | + void setInterfaceIp(Ip4Address interfaceIp); |
80 | + | ||
81 | + /** | ||
82 | + * Sets IP address of the neighbor. | ||
83 | + * | ||
84 | + * @param neighborIp IP address of the neighbor | ||
85 | + */ | ||
86 | + void setNeighborIp(Ip4Address neighborIp); | ||
75 | 87 | ||
76 | /** | 88 | /** |
77 | - * Sets the list of link TED. | 89 | + * Sets the link TED information. |
78 | * | 90 | * |
79 | - * @param linkTed list of link TED | 91 | + * @param linkTed link TED |
80 | */ | 92 | */ |
81 | - void setLinkTed(List<IsisLinkTed> linkTed); | 93 | + void setLinkTed(IsisLinkTed linkTed); |
82 | } | 94 | } | ... | ... |
... | @@ -23,16 +23,14 @@ public interface IsisLinkListener { | ... | @@ -23,16 +23,14 @@ public interface IsisLinkListener { |
23 | /** | 23 | /** |
24 | * Notifies that we got a link from network. | 24 | * Notifies that we got a link from network. |
25 | * | 25 | * |
26 | - * @param isisRouter router instance | 26 | + * @param isisLink link instance |
27 | - * @param isisLinkTed link TED information of router | ||
28 | */ | 27 | */ |
29 | - void addLink(IsisRouter isisRouter, IsisLinkTed isisLinkTed); | 28 | + void addLink(IsisLink isisLink); |
30 | 29 | ||
31 | /** | 30 | /** |
32 | * Notifies that a link got removed from network. | 31 | * Notifies that a link got removed from network. |
33 | * | 32 | * |
34 | - * @param isisRouter router instance | 33 | + * @param isisLink link instance |
35 | - * @param isisLinkTed isis link ted infromation | ||
36 | */ | 34 | */ |
37 | - void deleteLink(IsisRouter isisRouter, IsisLinkTed isisLinkTed); | 35 | + void deleteLink(IsisLink isisLink); |
38 | } | 36 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -16,7 +16,6 @@ | ... | @@ -16,7 +16,6 @@ |
16 | package org.onosproject.isis.controller.topology; | 16 | package org.onosproject.isis.controller.topology; |
17 | 17 | ||
18 | import org.onlab.packet.Ip4Address; | 18 | import org.onlab.packet.Ip4Address; |
19 | -import org.onlab.packet.Ip6Address; | ||
20 | import org.onlab.util.Bandwidth; | 19 | import org.onlab.util.Bandwidth; |
21 | 20 | ||
22 | import java.util.List; | 21 | import java.util.List; |
... | @@ -27,114 +26,100 @@ import java.util.List; | ... | @@ -27,114 +26,100 @@ import java.util.List; |
27 | public interface IsisLinkTed { | 26 | public interface IsisLinkTed { |
28 | 27 | ||
29 | /** | 28 | /** |
30 | - * Provides maximum bandwidth can be used on the link. | 29 | + * Gets the administrative group. |
31 | * | 30 | * |
32 | - * @return maximum bandwidth | 31 | + * @return administrative group |
33 | */ | 32 | */ |
34 | - Bandwidth maximumLink(); | 33 | + int administrativeGroup(); |
35 | 34 | ||
36 | /** | 35 | /** |
37 | - * Sets maximum band width. | 36 | + * Sets the administrative group. |
38 | * | 37 | * |
39 | - * @param bandwidth maximum bandwidth | 38 | + * @param administrativeGroup administrative group |
40 | */ | 39 | */ |
41 | - void setMaximumLink(Bandwidth bandwidth); | 40 | + void setAdministrativeGroup(int administrativeGroup); |
42 | 41 | ||
43 | /** | 42 | /** |
44 | - * Amount of bandwidth reservable on the link. | 43 | + * Provides the IPv4 interface address. |
45 | * | 44 | * |
46 | - * @return unreserved bandwidth | 45 | + * @return IPv4 interface address |
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 | */ | 46 | */ |
62 | - Bandwidth maxReserved(); | 47 | + Ip4Address ipv4InterfaceAddress(); |
63 | 48 | ||
64 | /** | 49 | /** |
65 | - * Sets max bandwidth that can be reserved on the link. | 50 | + * Sets the IPv4 interface address. |
66 | * | 51 | * |
67 | - * @param bandwidth max bandwidth that can be reserved on the link | 52 | + * @param interfaceAddress IPv4 interface address |
68 | */ | 53 | */ |
69 | - void setMaxReserved(Bandwidth bandwidth); | 54 | + void setIpv4InterfaceAddress(Ip4Address interfaceAddress); |
70 | 55 | ||
71 | /** | 56 | /** |
72 | - * Provides Traffic Engineering metric for the link. | 57 | + * Provides the IPv4 neighbor address. |
73 | * | 58 | * |
74 | - * @return Traffic Engineering metric | 59 | + * @return IPv4 neighbor address |
75 | */ | 60 | */ |
76 | - int teMetric(); | 61 | + Ip4Address ipv4NeighborAddress(); |
77 | 62 | ||
78 | /** | 63 | /** |
79 | - * Sets Traffic Engineering metric for the link. | 64 | + * Sets the IPv4 neighbor address. |
80 | * | 65 | * |
81 | - * @param teMetric Traffic Engineering metric for the link | 66 | + * @param neighborAddress IPv4 neighbor address |
82 | */ | 67 | */ |
83 | - void setTeMetric(int teMetric); | 68 | + void setIpv4NeighborAddress(Ip4Address neighborAddress); |
84 | 69 | ||
85 | /** | 70 | /** |
86 | - * Provides IPv4 router-Id of local node. | 71 | + * Gets the maximum link bandwidth. |
87 | * | 72 | * |
88 | - * @return IPv4 router-Id of local node | 73 | + * @return maximum link bandwidth |
89 | */ | 74 | */ |
90 | - List<Ip4Address> ipv4LocRouterId(); | 75 | + Bandwidth maximumLinkBandwidth(); |
91 | 76 | ||
92 | /** | 77 | /** |
93 | - * Sets IPv4 router-Id of local node. | 78 | + * Sets the maximum link bandwidth. |
94 | * | 79 | * |
95 | - * @param routerIds IPv4 router-Id of local node | 80 | + * @param bandwidth maximum link bandwidth |
96 | */ | 81 | */ |
97 | - void setIpv4LocRouterId(List<Ip4Address> routerIds); | 82 | + void setMaximumLinkBandwidth(Bandwidth bandwidth); |
98 | 83 | ||
99 | /** | 84 | /** |
100 | - * Provides IPv6 router-Id of local node. | 85 | + * Provides max bandwidth that can be reservable on the link. |
101 | * | 86 | * |
102 | - * @return IPv6 router-Id of local node | 87 | + * @return max bandwidth reservable |
103 | */ | 88 | */ |
104 | - List<Ip6Address> ipv6LocRouterId(); | 89 | + Bandwidth maximumReservableLinkBandwidth(); |
105 | 90 | ||
106 | /** | 91 | /** |
107 | - * Sets IPv6 router-Id of local node. | 92 | + * Sets max bandwidth that can be reservable on the link. |
108 | * | 93 | * |
109 | - * @param routerIds IPv6 router-Id of local node | 94 | + * @param bandwidth max bandwidth that can be reservable on the link |
110 | */ | 95 | */ |
111 | - void setIpv6LocRouterId(List<Ip6Address> routerIds); | 96 | + void setMaximumReservableLinkBandwidth(Bandwidth bandwidth); |
112 | 97 | ||
113 | /** | 98 | /** |
114 | - * Provides IPv4 router-Id of remote node. | 99 | + * Amount of bandwidth unreserved on the link. |
115 | * | 100 | * |
116 | - * @return IPv4 router-Id of remote node | 101 | + * @return unreserved bandwidth |
117 | */ | 102 | */ |
118 | - List<Ip4Address> ipv4RemRouterId(); | 103 | + List<Bandwidth> unreservedBandwidth(); |
119 | 104 | ||
120 | /** | 105 | /** |
121 | - * Sets IPv4 router-Id of remote node. | 106 | + * Sets the bandwidth unreserved on the link. |
122 | * | 107 | * |
123 | - * @param routerIds IPv4 router-Id of remote node | 108 | + * @param bandwidth bandwidth unreserved |
124 | */ | 109 | */ |
125 | - void setIpv4RemRouterId(List<Ip4Address> routerIds); | 110 | + void setUnreservedBandwidth(List<Bandwidth> bandwidth); |
126 | 111 | ||
127 | /** | 112 | /** |
128 | - * Provides IPv6 router-Id of remote node. | 113 | + * Provides Traffic Engineering metric for the link. |
129 | * | 114 | * |
130 | - * @return IPv6 router-Id of remote node | 115 | + * @return Traffic Engineering Default metric |
131 | */ | 116 | */ |
132 | - List<Ip6Address> ipv6RemRouterId(); | 117 | + long teDefaultMetric(); |
133 | 118 | ||
134 | /** | 119 | /** |
135 | - * Sets IPv6 router-Id of remote node. | 120 | + * Sets Traffic Engineering metric for the link. |
136 | * | 121 | * |
137 | - * @param routerIds IPv6 router-Id of remote node | 122 | + * @param teMetric Traffic Engineering Default metric for the link |
138 | */ | 123 | */ |
139 | - void setIpv6RemRouterId(List<Ip6Address> routerIds); | 124 | + void setTeDefaultMetric(long teMetric); |
140 | } | 125 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -23,11 +23,11 @@ import org.onlab.packet.Ip4Address; | ... | @@ -23,11 +23,11 @@ import org.onlab.packet.Ip4Address; |
23 | public interface IsisRouter { | 23 | public interface IsisRouter { |
24 | 24 | ||
25 | /** | 25 | /** |
26 | - * Returns IP address of the router. | 26 | + * Returns system ID for the router. |
27 | * | 27 | * |
28 | - * @return IP address of the router | 28 | + * @return system ID of the router |
29 | */ | 29 | */ |
30 | - Ip4Address routerIp(); | 30 | + String systemId(); |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * Returns IP address of the interface. | 33 | * Returns IP address of the interface. |
... | @@ -37,9 +37,44 @@ public interface IsisRouter { | ... | @@ -37,9 +37,44 @@ public interface IsisRouter { |
37 | Ip4Address interfaceId(); | 37 | Ip4Address interfaceId(); |
38 | 38 | ||
39 | /** | 39 | /** |
40 | - * Sets IP address of the Router. | 40 | + * Gets IP address of the interface. |
41 | * | 41 | * |
42 | - * @param routerIp IP address of the router | 42 | + * @param interfaceId IP address of the interface |
43 | */ | 43 | */ |
44 | - void setRouterIp(Ip4Address routerIp); | 44 | + void setInterfaceId(Ip4Address interfaceId); |
45 | + | ||
46 | + /** | ||
47 | + * Sets system ID of the Router. | ||
48 | + * | ||
49 | + * @param systemId system ID of the router | ||
50 | + */ | ||
51 | + void setSystemId(String systemId); | ||
52 | + | ||
53 | + /** | ||
54 | + * Gets neighbours ID. | ||
55 | + * | ||
56 | + * @return neighbour ID | ||
57 | + */ | ||
58 | + Ip4Address neighborRouterId(); | ||
59 | + | ||
60 | + /** | ||
61 | + * Sets the neighbour Id. | ||
62 | + * | ||
63 | + * @param neighbourId neighbour Id | ||
64 | + */ | ||
65 | + void setNeighborRouterId(Ip4Address neighbourId); | ||
66 | + | ||
67 | + /** | ||
68 | + * Gets if the router id DIS or not. | ||
69 | + * | ||
70 | + * @return true if the router is DIS else false | ||
71 | + */ | ||
72 | + boolean isDis(); | ||
73 | + | ||
74 | + /** | ||
75 | + * Sets if the router id DIS or not. | ||
76 | + * | ||
77 | + * @param dis true if the router is DIS else false | ||
78 | + */ | ||
79 | + void setDis(boolean dis); | ||
45 | } | 80 | } | ... | ... |
protocols/isis/api/src/main/java/org/onosproject/isis/controller/topology/IsisRouterId.java
0 → 100644
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 | + | ||
17 | +package org.onosproject.isis.controller.topology; | ||
18 | + | ||
19 | +import java.net.URI; | ||
20 | +import java.net.URISyntaxException; | ||
21 | +import java.util.Objects; | ||
22 | + | ||
23 | +import static com.google.common.base.Preconditions.checkArgument; | ||
24 | + | ||
25 | +/** | ||
26 | + * Represents an ISIS router id. | ||
27 | + */ | ||
28 | +public class IsisRouterId { | ||
29 | + | ||
30 | + private static final String SCHEME = "l3"; | ||
31 | + private static final long UNKNOWN = 0; | ||
32 | + private final String ipAddress; | ||
33 | + | ||
34 | + /** | ||
35 | + * Creates an instance of ISIS router id. | ||
36 | + * | ||
37 | + * @param ipAddress IP address of the router | ||
38 | + */ | ||
39 | + public IsisRouterId(String ipAddress) { | ||
40 | + this.ipAddress = ipAddress; | ||
41 | + } | ||
42 | + | ||
43 | + /** | ||
44 | + * Creates an instance from ip address. | ||
45 | + * | ||
46 | + * @param ipAddress IP address | ||
47 | + * @return ISIS router id instance | ||
48 | + */ | ||
49 | + public static IsisRouterId isisRouterId(String ipAddress) { | ||
50 | + return new IsisRouterId(ipAddress); | ||
51 | + } | ||
52 | + | ||
53 | + /** | ||
54 | + * Creates ISIS router id instance from the URI. | ||
55 | + * | ||
56 | + * @param uri device URI | ||
57 | + * @return ISIS router id instance | ||
58 | + */ | ||
59 | + public static IsisRouterId isisRouterId(URI uri) { | ||
60 | + checkArgument(uri.getScheme().equals(SCHEME), "Unsupported URI scheme"); | ||
61 | + return new IsisRouterId(uri.getSchemeSpecificPart()); | ||
62 | + } | ||
63 | + | ||
64 | + /** | ||
65 | + * Returns device URI from the given router id. | ||
66 | + * | ||
67 | + * @param isisRouterId router id instance | ||
68 | + * @return device URI | ||
69 | + */ | ||
70 | + public static URI uri(IsisRouterId isisRouterId) { | ||
71 | + return uri(isisRouterId.ipAddress()); | ||
72 | + } | ||
73 | + | ||
74 | + /** | ||
75 | + * Returns device URI from the given IP address. | ||
76 | + * | ||
77 | + * @param ipAddress device IP address | ||
78 | + * @return device URI | ||
79 | + */ | ||
80 | + public static URI uri(String ipAddress) { | ||
81 | + try { | ||
82 | + return new URI(SCHEME, ipAddress, null); | ||
83 | + } catch (URISyntaxException e) { | ||
84 | + return null; | ||
85 | + } | ||
86 | + } | ||
87 | + | ||
88 | + /** | ||
89 | + * Returns the IP address. | ||
90 | + * | ||
91 | + * @return IP address | ||
92 | + */ | ||
93 | + public String ipAddress() { | ||
94 | + return ipAddress; | ||
95 | + } | ||
96 | + | ||
97 | + @Override | ||
98 | + public String toString() { | ||
99 | + return ipAddress; | ||
100 | + } | ||
101 | + | ||
102 | + @Override | ||
103 | + public boolean equals(Object other) { | ||
104 | + if (!(other instanceof IsisRouterId)) { | ||
105 | + return false; | ||
106 | + } | ||
107 | + | ||
108 | + IsisRouterId otherIsisRouterId = (IsisRouterId) other; | ||
109 | + return Objects.equals(ipAddress, otherIsisRouterId.ipAddress); | ||
110 | + } | ||
111 | + | ||
112 | + @Override | ||
113 | + public int hashCode() { | ||
114 | + return Objects.hash(ipAddress); | ||
115 | + } | ||
116 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -34,11 +34,4 @@ public interface IsisRouterListener { | ... | @@ -34,11 +34,4 @@ public interface IsisRouterListener { |
34 | * @param isisRouter ISIS router instance | 34 | * @param isisRouter ISIS router instance |
35 | */ | 35 | */ |
36 | void routerRemoved(IsisRouter isisRouter); | 36 | void routerRemoved(IsisRouter isisRouter); |
37 | - | ||
38 | - /** | ||
39 | - * Notifies that the router has changed in some way. | ||
40 | - * | ||
41 | - * @param isisRouter ISIS router instance | ||
42 | - */ | ||
43 | - void routerChanged(IsisRouter isisRouter); | ||
44 | } | 37 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
protocols/isis/api/src/main/java/org/onosproject/isis/controller/topology/LinkInformation.java
0 → 100644
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.isis.controller.topology; | ||
17 | + | ||
18 | +import org.onlab.packet.Ip4Address; | ||
19 | + | ||
20 | +/** | ||
21 | + * Representation of an ISIS link information. | ||
22 | + */ | ||
23 | +public interface LinkInformation { | ||
24 | + | ||
25 | + /** | ||
26 | + * Gets link id. | ||
27 | + * | ||
28 | + * @return link id | ||
29 | + */ | ||
30 | + String linkId(); | ||
31 | + | ||
32 | + /** | ||
33 | + * Sets link id. | ||
34 | + * | ||
35 | + * @param linkId link id | ||
36 | + */ | ||
37 | + void setLinkId(String linkId); | ||
38 | + | ||
39 | + /** | ||
40 | + * Gets whether link information is already created or not. | ||
41 | + * | ||
42 | + * @return true if link information is already created else false | ||
43 | + */ | ||
44 | + boolean isAlreadyCreated(); | ||
45 | + | ||
46 | + /** | ||
47 | + * Sets link information is already created or not. | ||
48 | + * | ||
49 | + * @param alreadyCreated true if link information is already created else false | ||
50 | + */ | ||
51 | + void setAlreadyCreated(boolean alreadyCreated); | ||
52 | + | ||
53 | + | ||
54 | + /** | ||
55 | + * Returns link destination ID. | ||
56 | + * | ||
57 | + * @return link destination ID | ||
58 | + */ | ||
59 | + String linkDestinationId(); | ||
60 | + | ||
61 | + /** | ||
62 | + * Sets link destination id. | ||
63 | + * | ||
64 | + * @param linkDestinationId link destination id | ||
65 | + */ | ||
66 | + void setLinkDestinationId(String linkDestinationId); | ||
67 | + | ||
68 | + /** | ||
69 | + * Gets link source id. | ||
70 | + * | ||
71 | + * @return link source id | ||
72 | + */ | ||
73 | + String linkSourceId(); | ||
74 | + | ||
75 | + /** | ||
76 | + * Sets link source id. | ||
77 | + * | ||
78 | + * @param linkSourceId link source id | ||
79 | + */ | ||
80 | + void setLinkSourceId(String linkSourceId); | ||
81 | + | ||
82 | + /** | ||
83 | + * Gets interface ip address. | ||
84 | + * | ||
85 | + * @return interface ip address | ||
86 | + */ | ||
87 | + Ip4Address interfaceIp(); | ||
88 | + | ||
89 | + /** | ||
90 | + * Sets interface ip address. | ||
91 | + * | ||
92 | + * @param interfaceIp interface ip address | ||
93 | + */ | ||
94 | + void setInterfaceIp(Ip4Address interfaceIp); | ||
95 | + | ||
96 | + /** | ||
97 | + * Gets neighbor ip address. | ||
98 | + * | ||
99 | + * @return neighbor ip address | ||
100 | + */ | ||
101 | + Ip4Address neighborIp(); | ||
102 | + | ||
103 | + /** | ||
104 | + * Sets neighbor ip address. | ||
105 | + * | ||
106 | + * @param neighborIp neighbor ip address | ||
107 | + */ | ||
108 | + void setNeighborIp(Ip4Address neighborIp); | ||
109 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
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.isis.controller.topology; | ||
17 | + | ||
18 | +import java.util.Map; | ||
19 | + | ||
20 | +/** | ||
21 | + * Represents IP topology for ISIS device and link details. | ||
22 | + */ | ||
23 | +public interface TopologyForDeviceAndLink { | ||
24 | + | ||
25 | + /** | ||
26 | + * Gets the device information. | ||
27 | + * | ||
28 | + * @return device information | ||
29 | + */ | ||
30 | + Map<String, DeviceInformation> deviceInformationMap(); | ||
31 | + | ||
32 | + /** | ||
33 | + * Sets the device information. | ||
34 | + * | ||
35 | + * @param key system ID of the device as key | ||
36 | + * @param deviceInformationMap device information instance | ||
37 | + */ | ||
38 | + void setDeviceInformationMap(String key, DeviceInformation deviceInformationMap); | ||
39 | + | ||
40 | + /** | ||
41 | + * Gets the link information. | ||
42 | + * | ||
43 | + * @return link information | ||
44 | + */ | ||
45 | + Map<String, LinkInformation> linkInformationMap(); | ||
46 | + | ||
47 | + /** | ||
48 | + * Sets link information. | ||
49 | + * | ||
50 | + * @param key system ID of the device as key | ||
51 | + * @param linkInformationMap link information instance | ||
52 | + */ | ||
53 | + void setLinkInformationMap(String key, LinkInformation linkInformationMap); | ||
54 | + | ||
55 | + /** | ||
56 | + * Removes link information. | ||
57 | + * | ||
58 | + * @param key key used to remove from map | ||
59 | + */ | ||
60 | + void removeLinkInformationMap(String key); | ||
61 | + | ||
62 | + /** | ||
63 | + * Removes device information. | ||
64 | + * | ||
65 | + * @param key key used to remove from map | ||
66 | + */ | ||
67 | + void removeDeviceInformationMap(String key); | ||
68 | + | ||
69 | + /** | ||
70 | + * Removes links from linkInformationMap. | ||
71 | + * | ||
72 | + * @param linkId ID | ||
73 | + */ | ||
74 | + void removeLinks(String linkId); | ||
75 | + | ||
76 | + /** | ||
77 | + * Gets deviceInformation as map. | ||
78 | + * | ||
79 | + * @return deviceInformationMap to delete from core | ||
80 | + */ | ||
81 | + Map<String, DeviceInformation> deviceInformationMapToDelete(); | ||
82 | + | ||
83 | + /** | ||
84 | + * Sets deviceInformation as map. | ||
85 | + * | ||
86 | + * @param key key used to add in map | ||
87 | + * @param deviceInformationMapToDelete device information to delete from map | ||
88 | + */ | ||
89 | + void setDeviceInformationMapToDelete(String key, DeviceInformation deviceInformationMapToDelete); | ||
90 | + | ||
91 | + /** | ||
92 | + * Removes Device Information from deviceInformationMapToDelete. | ||
93 | + * | ||
94 | + * @param key key to remove from map | ||
95 | + */ | ||
96 | + void removeDeviceInformationMapFromDeleteMap(String key); | ||
97 | + | ||
98 | + /** | ||
99 | + * Gets deviceInformation as map for Point-To-Point. | ||
100 | + * | ||
101 | + * @return deviceInformationMap | ||
102 | + */ | ||
103 | + Map<String, DeviceInformation> deviceInformationMapForPointToPoint(); | ||
104 | + | ||
105 | + /** | ||
106 | + * Sets deviceInformation as map for Point-To-Point.. | ||
107 | + * | ||
108 | + * @param key key to add to map | ||
109 | + * @param deviceInformationMap device information map | ||
110 | + */ | ||
111 | + void setDeviceInformationMapForPointToPoint(String key, DeviceInformation deviceInformationMap); | ||
112 | + | ||
113 | + /** | ||
114 | + * Gets linkInformation as map for PointToPoint. | ||
115 | + * | ||
116 | + * @return linkInformationMap | ||
117 | + */ | ||
118 | + Map<String, LinkInformation> linkInformationMapForPointToPoint(); | ||
119 | + | ||
120 | + /** | ||
121 | + * Sets linkInformation as map for PointToPoint. | ||
122 | + * | ||
123 | + * @param key key to add link information to map | ||
124 | + * @param linkInformationMap link information to add | ||
125 | + */ | ||
126 | + void setLinkInformationMapForPointToPoint(String key, LinkInformation linkInformationMap); | ||
127 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -30,6 +30,9 @@ import org.onosproject.isis.controller.IsisInterface; | ... | @@ -30,6 +30,9 @@ import org.onosproject.isis.controller.IsisInterface; |
30 | import org.onosproject.isis.controller.IsisNetworkType; | 30 | import org.onosproject.isis.controller.IsisNetworkType; |
31 | import org.onosproject.isis.controller.IsisProcess; | 31 | import org.onosproject.isis.controller.IsisProcess; |
32 | import org.onosproject.isis.controller.IsisRouterType; | 32 | import org.onosproject.isis.controller.IsisRouterType; |
33 | +import org.onosproject.isis.controller.topology.IsisAgent; | ||
34 | +import org.onosproject.isis.controller.topology.IsisLink; | ||
35 | +import org.onosproject.isis.controller.topology.IsisRouter; | ||
33 | import org.onosproject.isis.io.util.IsisConstants; | 36 | import org.onosproject.isis.io.util.IsisConstants; |
34 | import org.slf4j.Logger; | 37 | import org.slf4j.Logger; |
35 | import org.slf4j.LoggerFactory; | 38 | import org.slf4j.LoggerFactory; |
... | @@ -43,6 +46,7 @@ import java.util.Enumeration; | ... | @@ -43,6 +46,7 @@ import java.util.Enumeration; |
43 | import java.util.List; | 46 | import java.util.List; |
44 | import java.util.concurrent.Executors; | 47 | import java.util.concurrent.Executors; |
45 | import java.util.concurrent.ScheduledExecutorService; | 48 | import java.util.concurrent.ScheduledExecutorService; |
49 | +import java.util.concurrent.ScheduledFuture; | ||
46 | import java.util.concurrent.TimeUnit; | 50 | import java.util.concurrent.TimeUnit; |
47 | 51 | ||
48 | import static org.onlab.util.Tools.groupedThreads; | 52 | import static org.onlab.util.Tools.groupedThreads; |
... | @@ -64,15 +68,29 @@ public class Controller { | ... | @@ -64,15 +68,29 @@ public class Controller { |
64 | private ScheduledExecutorService connectExecutor = null; | 68 | private ScheduledExecutorService connectExecutor = null; |
65 | private int connectRetryCounter = 0; | 69 | private int connectRetryCounter = 0; |
66 | private int connectRetryTime; | 70 | private int connectRetryTime; |
71 | + private ScheduledFuture future = null; | ||
72 | + private IsisAgent agent; | ||
67 | 73 | ||
68 | /** | 74 | /** |
69 | * Deactivates ISIS controller. | 75 | * Deactivates ISIS controller. |
70 | */ | 76 | */ |
71 | public void isisDeactivate() { | 77 | public void isisDeactivate() { |
78 | + disconnectExecutor(); | ||
79 | + processes = null; | ||
72 | peerExecFactory.shutdown(); | 80 | peerExecFactory.shutdown(); |
73 | } | 81 | } |
74 | 82 | ||
75 | /** | 83 | /** |
84 | + * Sets ISIS agent. | ||
85 | + * | ||
86 | + * @param agent ISIS agent instance | ||
87 | + */ | ||
88 | + public void setAgent(IsisAgent agent) { | ||
89 | + this.agent = agent; | ||
90 | + } | ||
91 | + | ||
92 | + | ||
93 | + /** | ||
76 | * Updates the processes configuration. | 94 | * Updates the processes configuration. |
77 | * | 95 | * |
78 | * @param jsonNode json node instance | 96 | * @param jsonNode json node instance |
... | @@ -134,17 +152,17 @@ public class Controller { | ... | @@ -134,17 +152,17 @@ public class Controller { |
134 | peerBootstrap.setOption("keepAlive", true); | 152 | peerBootstrap.setOption("keepAlive", true); |
135 | peerBootstrap.setOption("receiveBufferSize", Controller.BUFFER_SIZE); | 153 | peerBootstrap.setOption("receiveBufferSize", Controller.BUFFER_SIZE); |
136 | peerBootstrap.setOption("receiveBufferSizePredictorFactory", | 154 | peerBootstrap.setOption("receiveBufferSizePredictorFactory", |
137 | - new FixedReceiveBufferSizePredictorFactory( | 155 | + new FixedReceiveBufferSizePredictorFactory( |
138 | - Controller.BUFFER_SIZE)); | 156 | + Controller.BUFFER_SIZE)); |
139 | peerBootstrap.setOption("receiveBufferSizePredictor", | 157 | peerBootstrap.setOption("receiveBufferSizePredictor", |
140 | - new AdaptiveReceiveBufferSizePredictor(64, 1024, 65536)); | 158 | + new AdaptiveReceiveBufferSizePredictor(64, 1024, 65536)); |
141 | peerBootstrap.setOption("child.keepAlive", true); | 159 | peerBootstrap.setOption("child.keepAlive", true); |
142 | peerBootstrap.setOption("child.tcpNoDelay", true); | 160 | peerBootstrap.setOption("child.tcpNoDelay", true); |
143 | peerBootstrap.setOption("child.sendBufferSize", Controller.BUFFER_SIZE); | 161 | peerBootstrap.setOption("child.sendBufferSize", Controller.BUFFER_SIZE); |
144 | peerBootstrap.setOption("child.receiveBufferSize", Controller.BUFFER_SIZE); | 162 | peerBootstrap.setOption("child.receiveBufferSize", Controller.BUFFER_SIZE); |
145 | peerBootstrap.setOption("child.receiveBufferSizePredictorFactory", | 163 | peerBootstrap.setOption("child.receiveBufferSizePredictorFactory", |
146 | - new FixedReceiveBufferSizePredictorFactory( | 164 | + new FixedReceiveBufferSizePredictorFactory( |
147 | - Controller.BUFFER_SIZE)); | 165 | + Controller.BUFFER_SIZE)); |
148 | peerBootstrap.setOption("child.reuseAddress", true); | 166 | peerBootstrap.setOption("child.reuseAddress", true); |
149 | 167 | ||
150 | isisChannelHandler = new IsisChannelHandler(this, processes); | 168 | isisChannelHandler = new IsisChannelHandler(this, processes); |
... | @@ -236,8 +254,8 @@ public class Controller { | ... | @@ -236,8 +254,8 @@ public class Controller { |
236 | continue; | 254 | continue; |
237 | } | 255 | } |
238 | isisInterface.setIntermediateSystemName(jsonNode1 | 256 | isisInterface.setIntermediateSystemName(jsonNode1 |
239 | - .path(IsisConstants.INTERMEDIATESYSTEMNAME) | 257 | + .path(IsisConstants.INTERMEDIATESYSTEMNAME) |
240 | - .asText()); | 258 | + .asText()); |
241 | String systemId = jsonNode1.path(IsisConstants.SYSTEMID).asText(); | 259 | String systemId = jsonNode1.path(IsisConstants.SYSTEMID).asText(); |
242 | if (isValidSystemId(systemId)) { | 260 | if (isValidSystemId(systemId)) { |
243 | isisInterface.setSystemId(systemId); | 261 | isisInterface.setSystemId(systemId); |
... | @@ -462,7 +480,8 @@ public class Controller { | ... | @@ -462,7 +480,8 @@ public class Controller { |
462 | */ | 480 | */ |
463 | public void disconnectExecutor() { | 481 | public void disconnectExecutor() { |
464 | if (connectExecutor != null) { | 482 | if (connectExecutor != null) { |
465 | - connectExecutor.shutdown(); | 483 | + future.cancel(true); |
484 | + connectExecutor.shutdownNow(); | ||
466 | connectExecutor = null; | 485 | connectExecutor = null; |
467 | } | 486 | } |
468 | } | 487 | } |
... | @@ -480,10 +499,55 @@ public class Controller { | ... | @@ -480,10 +499,55 @@ public class Controller { |
480 | * @param retryDelay retry delay | 499 | * @param retryDelay retry delay |
481 | */ | 500 | */ |
482 | private void scheduleConnectionRetry(long retryDelay) { | 501 | private void scheduleConnectionRetry(long retryDelay) { |
483 | - if (this.connectExecutor == null) { | 502 | + if (connectExecutor == null) { |
484 | - this.connectExecutor = Executors.newSingleThreadScheduledExecutor(); | 503 | + connectExecutor = Executors.newSingleThreadScheduledExecutor(); |
485 | } | 504 | } |
486 | - this.connectExecutor.schedule(new ConnectionRetry(), retryDelay, TimeUnit.MINUTES); | 505 | + future = connectExecutor.schedule(new ConnectionRetry(), retryDelay, TimeUnit.MINUTES); |
506 | + } | ||
507 | + | ||
508 | + /** | ||
509 | + * Adds device details. | ||
510 | + * | ||
511 | + * @param isisRouter ISIS router instance | ||
512 | + */ | ||
513 | + public void addDeviceDetails(IsisRouter isisRouter) { | ||
514 | + agent.addConnectedRouter(isisRouter); | ||
515 | + } | ||
516 | + | ||
517 | + /** | ||
518 | + * Removes device details. | ||
519 | + * | ||
520 | + * @param isisRouter Isis router instance | ||
521 | + */ | ||
522 | + public void removeDeviceDetails(IsisRouter isisRouter) { | ||
523 | + agent.removeConnectedRouter(isisRouter); | ||
524 | + } | ||
525 | + | ||
526 | + /** | ||
527 | + * Adds link details. | ||
528 | + * | ||
529 | + * @param isisLink ISIS link instance | ||
530 | + */ | ||
531 | + public void addLinkDetails(IsisLink isisLink) { | ||
532 | + agent.addLink(isisLink); | ||
533 | + } | ||
534 | + | ||
535 | + /** | ||
536 | + * Removes link details. | ||
537 | + * | ||
538 | + * @param isisLink ISIS link instance | ||
539 | + */ | ||
540 | + public void removeLinkDetails(IsisLink isisLink) { | ||
541 | + agent.deleteLink(isisLink); | ||
542 | + } | ||
543 | + | ||
544 | + /** | ||
545 | + * Returns the isisAgent instance. | ||
546 | + * | ||
547 | + * @return agent | ||
548 | + */ | ||
549 | + public IsisAgent agent() { | ||
550 | + return this.agent; | ||
487 | } | 551 | } |
488 | 552 | ||
489 | /** | 553 | /** |
... | @@ -503,7 +567,7 @@ public class Controller { | ... | @@ -503,7 +567,7 @@ public class Controller { |
503 | if (!future.isSuccess()) { | 567 | if (!future.isSuccess()) { |
504 | connectRetryCounter++; | 568 | connectRetryCounter++; |
505 | log.error("Connection failed, ConnectRetryCounter {} remote host {}", connectRetryCounter, | 569 | log.error("Connection failed, ConnectRetryCounter {} remote host {}", connectRetryCounter, |
506 | - IsisConstants.SHOST); | 570 | + IsisConstants.SHOST); |
507 | /* | 571 | /* |
508 | * Reconnect to peer on failure is exponential till 4 mins, later on retry after every 4 | 572 | * Reconnect to peer on failure is exponential till 4 mins, later on retry after every 4 |
509 | * mins. | 573 | * mins. |
... | @@ -517,7 +581,7 @@ public class Controller { | ... | @@ -517,7 +581,7 @@ public class Controller { |
517 | isisChannelHandler.sentConfigPacket(configPacket); | 581 | isisChannelHandler.sentConfigPacket(configPacket); |
518 | connectRetryCounter++; | 582 | connectRetryCounter++; |
519 | log.info("Connected to remote host {}, Connect Counter {}", IsisConstants.SHOST, | 583 | log.info("Connected to remote host {}, Connect Counter {}", IsisConstants.SHOST, |
520 | - connectRetryCounter); | 584 | + connectRetryCounter); |
521 | disconnectExecutor(); | 585 | disconnectExecutor(); |
522 | 586 | ||
523 | return; | 587 | return; | ... | ... |
... | @@ -16,6 +16,7 @@ | ... | @@ -16,6 +16,7 @@ |
16 | package org.onosproject.isis.controller.impl; | 16 | package org.onosproject.isis.controller.impl; |
17 | 17 | ||
18 | import com.fasterxml.jackson.databind.JsonNode; | 18 | import com.fasterxml.jackson.databind.JsonNode; |
19 | +import com.google.common.collect.Sets; | ||
19 | import org.apache.felix.scr.annotations.Activate; | 20 | import org.apache.felix.scr.annotations.Activate; |
20 | import org.apache.felix.scr.annotations.Component; | 21 | import org.apache.felix.scr.annotations.Component; |
21 | import org.apache.felix.scr.annotations.Deactivate; | 22 | import org.apache.felix.scr.annotations.Deactivate; |
... | @@ -24,12 +25,18 @@ import org.apache.felix.scr.annotations.ReferenceCardinality; | ... | @@ -24,12 +25,18 @@ import org.apache.felix.scr.annotations.ReferenceCardinality; |
24 | import org.apache.felix.scr.annotations.Service; | 25 | import org.apache.felix.scr.annotations.Service; |
25 | import org.onosproject.isis.controller.IsisController; | 26 | import org.onosproject.isis.controller.IsisController; |
26 | import org.onosproject.isis.controller.IsisProcess; | 27 | import org.onosproject.isis.controller.IsisProcess; |
28 | +import org.onosproject.isis.controller.topology.IsisAgent; | ||
29 | +import org.onosproject.isis.controller.topology.IsisLink; | ||
30 | +import org.onosproject.isis.controller.topology.IsisLinkListener; | ||
31 | +import org.onosproject.isis.controller.topology.IsisRouter; | ||
27 | import org.onosproject.isis.controller.topology.IsisRouterListener; | 32 | import org.onosproject.isis.controller.topology.IsisRouterListener; |
28 | import org.onosproject.net.driver.DriverService; | 33 | import org.onosproject.net.driver.DriverService; |
29 | import org.slf4j.Logger; | 34 | import org.slf4j.Logger; |
30 | import org.slf4j.LoggerFactory; | 35 | import org.slf4j.LoggerFactory; |
31 | 36 | ||
37 | +import java.util.HashSet; | ||
32 | import java.util.List; | 38 | import java.util.List; |
39 | +import java.util.Set; | ||
33 | 40 | ||
34 | /** | 41 | /** |
35 | * Represents ISIS controller implementation. | 42 | * Represents ISIS controller implementation. |
... | @@ -42,10 +49,14 @@ public class DefaultIsisController implements IsisController { | ... | @@ -42,10 +49,14 @@ public class DefaultIsisController implements IsisController { |
42 | private final Controller controller = new Controller(); | 49 | private final Controller controller = new Controller(); |
43 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 50 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
44 | protected DriverService driverService; | 51 | protected DriverService driverService; |
52 | + protected Set<IsisRouterListener> isisRouterListener = new HashSet<>(); | ||
53 | + protected Set<IsisLinkListener> isisLinkListener = Sets.newHashSet(); | ||
54 | + protected IsisAgent agent = new InternalDeviceConfig(); | ||
45 | 55 | ||
46 | @Activate | 56 | @Activate |
47 | public void activate() { | 57 | public void activate() { |
48 | log.debug("ISISControllerImpl activate"); | 58 | log.debug("ISISControllerImpl activate"); |
59 | + controller.setAgent(agent); | ||
49 | } | 60 | } |
50 | 61 | ||
51 | @Deactivate | 62 | @Deactivate |
... | @@ -55,6 +66,38 @@ public class DefaultIsisController implements IsisController { | ... | @@ -55,6 +66,38 @@ public class DefaultIsisController implements IsisController { |
55 | } | 66 | } |
56 | 67 | ||
57 | @Override | 68 | @Override |
69 | + public void addRouterListener(IsisRouterListener listener) { | ||
70 | + if (!isisRouterListener.contains(listener)) { | ||
71 | + this.isisRouterListener.add(listener); | ||
72 | + } | ||
73 | + } | ||
74 | + | ||
75 | + @Override | ||
76 | + public void removeRouterListener(IsisRouterListener listener) { | ||
77 | + this.isisRouterListener.remove(listener); | ||
78 | + } | ||
79 | + | ||
80 | + @Override | ||
81 | + public void addLinkListener(IsisLinkListener listener) { | ||
82 | + isisLinkListener.add(listener); | ||
83 | + } | ||
84 | + | ||
85 | + @Override | ||
86 | + public void removeLinkListener(IsisLinkListener listener) { | ||
87 | + isisLinkListener.remove(listener); | ||
88 | + } | ||
89 | + | ||
90 | + @Override | ||
91 | + public Set<IsisRouterListener> listener() { | ||
92 | + return isisRouterListener; | ||
93 | + } | ||
94 | + | ||
95 | + @Override | ||
96 | + public Set<IsisLinkListener> linkListener() { | ||
97 | + return isisLinkListener; | ||
98 | + } | ||
99 | + | ||
100 | + @Override | ||
58 | public List<IsisProcess> allConfiguredProcesses() { | 101 | public List<IsisProcess> allConfiguredProcesses() { |
59 | List<IsisProcess> processes = controller.getAllConfiguredProcesses(); | 102 | List<IsisProcess> processes = controller.getAllConfiguredProcesses(); |
60 | return processes; | 103 | return processes; |
... | @@ -70,13 +113,37 @@ public class DefaultIsisController implements IsisController { | ... | @@ -70,13 +113,37 @@ public class DefaultIsisController implements IsisController { |
70 | } | 113 | } |
71 | } | 114 | } |
72 | 115 | ||
73 | - @Override | 116 | + /** |
74 | - public void addRouterListener(IsisRouterListener isisRouterListener) { | 117 | + * Notifier for internal ISIS device and link changes. |
75 | - log.debug("IsisControllerImpl::addRouterListener..."); | 118 | + */ |
76 | - } | 119 | + private class InternalDeviceConfig implements IsisAgent { |
120 | + @Override | ||
121 | + public boolean addConnectedRouter(IsisRouter isisRouter) { | ||
122 | + for (IsisRouterListener l : listener()) { | ||
123 | + l.routerAdded(isisRouter); | ||
124 | + } | ||
125 | + return true; | ||
126 | + } | ||
77 | 127 | ||
78 | - @Override | 128 | + @Override |
79 | - public void removeRouterListener(IsisRouterListener isisRouterListener) { | 129 | + public void removeConnectedRouter(IsisRouter isisRouter) { |
80 | - log.debug("IsisControllerImpl::removeRouterListener..."); | 130 | + for (IsisRouterListener l : listener()) { |
131 | + l.routerRemoved(isisRouter); | ||
132 | + } | ||
133 | + } | ||
134 | + | ||
135 | + @Override | ||
136 | + public void addLink(IsisLink isisLink) { | ||
137 | + for (IsisLinkListener l : linkListener()) { | ||
138 | + l.addLink(isisLink); | ||
139 | + } | ||
140 | + } | ||
141 | + | ||
142 | + @Override | ||
143 | + public void deleteLink(IsisLink isisLink) { | ||
144 | + for (IsisLinkListener l : linkListener()) { | ||
145 | + l.deleteLink(isisLink); | ||
146 | + } | ||
147 | + } | ||
81 | } | 148 | } |
82 | } | 149 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -68,6 +68,16 @@ public class IsisChannelHandler extends IdleStateAwareChannelHandler { | ... | @@ -68,6 +68,16 @@ public class IsisChannelHandler extends IdleStateAwareChannelHandler { |
68 | public IsisChannelHandler(Controller controller, List<IsisProcess> processes) { | 68 | public IsisChannelHandler(Controller controller, List<IsisProcess> processes) { |
69 | this.controller = controller; | 69 | this.controller = controller; |
70 | this.processes = processes; | 70 | this.processes = processes; |
71 | + ((DefaultIsisLsdb) isisLsdb).setController(this.controller); | ||
72 | + ((DefaultIsisLsdb) isisLsdb).setIsisInterface(isisInterfaceList()); | ||
73 | + } | ||
74 | + | ||
75 | + private List<IsisInterface> isisInterfaceList() { | ||
76 | + List<IsisInterface> isisInterfaceList = new ArrayList<>(); | ||
77 | + for (Integer key : isisInterfaceMap.keySet()) { | ||
78 | + isisInterfaceList.add(isisInterfaceMap.get(key)); | ||
79 | + } | ||
80 | + return isisInterfaceList; | ||
71 | } | 81 | } |
72 | 82 | ||
73 | /** | 83 | /** |
... | @@ -178,30 +188,25 @@ public class IsisChannelHandler extends IdleStateAwareChannelHandler { | ... | @@ -178,30 +188,25 @@ public class IsisChannelHandler extends IdleStateAwareChannelHandler { |
178 | 188 | ||
179 | @Override | 189 | @Override |
180 | public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception { | 190 | public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception { |
181 | - log.info("[exceptionCaught]: " + e.toString()); | ||
182 | if (e.getCause() instanceof ReadTimeoutException) { | 191 | if (e.getCause() instanceof ReadTimeoutException) { |
183 | - log.error("Disconnecting device {} due to read timeout", e.getChannel().getRemoteAddress()); | 192 | + log.debug("Disconnecting device {} due to read timeout", e.getChannel().getRemoteAddress()); |
184 | return; | 193 | return; |
185 | } else if (e.getCause() instanceof ClosedChannelException) { | 194 | } else if (e.getCause() instanceof ClosedChannelException) { |
186 | log.debug("Channel for ISIS {} already closed", e.getChannel().getRemoteAddress()); | 195 | log.debug("Channel for ISIS {} already closed", e.getChannel().getRemoteAddress()); |
187 | } else if (e.getCause() instanceof IOException) { | 196 | } else if (e.getCause() instanceof IOException) { |
188 | - log.error("Disconnecting ISIS {} due to IO Error: {}", e.getChannel().getRemoteAddress(), | 197 | + log.debug("Disconnecting ISIS {} due to IO Error: {}", e.getChannel().getRemoteAddress(), |
189 | e.getCause().getMessage()); | 198 | e.getCause().getMessage()); |
190 | - if (log.isDebugEnabled()) { | ||
191 | - log.debug("StackTrace for previous Exception: {}", e.getCause()); | ||
192 | - } | ||
193 | } else if (e.getCause() instanceof IsisParseException) { | 199 | } else if (e.getCause() instanceof IsisParseException) { |
194 | IsisParseException errMsg = (IsisParseException) e.getCause(); | 200 | IsisParseException errMsg = (IsisParseException) e.getCause(); |
195 | byte errorCode = errMsg.errorCode(); | 201 | byte errorCode = errMsg.errorCode(); |
196 | byte errorSubCode = errMsg.errorSubCode(); | 202 | byte errorSubCode = errMsg.errorSubCode(); |
197 | - log.error("Error while parsing message from ISIS {}, ErrorCode {}", | 203 | + log.debug("Error while parsing message from ISIS {}, ErrorCode {}", |
198 | e.getChannel().getRemoteAddress(), errorCode); | 204 | e.getChannel().getRemoteAddress(), errorCode); |
199 | } else if (e.getCause() instanceof RejectedExecutionException) { | 205 | } else if (e.getCause() instanceof RejectedExecutionException) { |
200 | - log.warn("Could not process message: queue full"); | 206 | + log.debug("Could not process message: queue full"); |
201 | } else { | 207 | } else { |
202 | - log.error("Error while processing message from ISIS {}, {}", | 208 | + log.debug("Error while processing message from ISIS {}, {}", |
203 | e.getChannel().getRemoteAddress(), e.getCause().getMessage()); | 209 | e.getChannel().getRemoteAddress(), e.getCause().getMessage()); |
204 | - e.getCause().printStackTrace(); | ||
205 | } | 210 | } |
206 | } | 211 | } |
207 | 212 | ||
... | @@ -274,7 +279,7 @@ public class IsisChannelHandler extends IdleStateAwareChannelHandler { | ... | @@ -274,7 +279,7 @@ public class IsisChannelHandler extends IdleStateAwareChannelHandler { |
274 | * @param configPacket interface configuration | 279 | * @param configPacket interface configuration |
275 | */ | 280 | */ |
276 | public void sentConfigPacket(byte[] configPacket) { | 281 | public void sentConfigPacket(byte[] configPacket) { |
277 | - if (channel != null) { | 282 | + if (channel != null && channel.isConnected() && channel.isOpen()) { |
278 | channel.write(configPacket); | 283 | channel.write(configPacket); |
279 | log.debug("IsisChannelHandler sentConfigPacket packet sent..!!!"); | 284 | log.debug("IsisChannelHandler sentConfigPacket packet sent..!!!"); |
280 | } else { | 285 | } else { | ... | ... |
protocols/isis/ctl/src/main/java/org/onosproject/isis/controller/impl/LspEventConsumer.java
0 → 100644
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.impl; | ||
17 | + | ||
18 | +import org.onosproject.isis.controller.IsisNetworkType; | ||
19 | +import org.onosproject.isis.controller.LspWrapper; | ||
20 | +import org.onosproject.isis.controller.impl.topology.DefaultIsisLink; | ||
21 | +import org.onosproject.isis.controller.impl.topology.DefaultIsisRouter; | ||
22 | +import org.onosproject.isis.controller.impl.topology.TopologyForDeviceAndLinkImpl; | ||
23 | +import org.onosproject.isis.controller.topology.IsisLink; | ||
24 | +import org.onosproject.isis.controller.topology.IsisLinkTed; | ||
25 | +import org.onosproject.isis.controller.topology.IsisRouter; | ||
26 | +import org.onosproject.isis.controller.topology.LinkInformation; | ||
27 | +import org.onosproject.isis.io.isispacket.pdu.LsPdu; | ||
28 | +import org.onosproject.isis.io.isispacket.tlv.IpExtendedReachabilityTlv; | ||
29 | +import org.onosproject.isis.io.isispacket.tlv.IsExtendedReachability; | ||
30 | +import org.onosproject.isis.io.isispacket.tlv.IsisTlv; | ||
31 | +import org.onosproject.isis.io.isispacket.tlv.NeighborForExtendedIs; | ||
32 | +import org.onosproject.isis.io.util.IsisConstants; | ||
33 | +import org.onosproject.isis.io.util.IsisUtil; | ||
34 | +import org.slf4j.Logger; | ||
35 | +import org.slf4j.LoggerFactory; | ||
36 | + | ||
37 | +import java.util.ArrayList; | ||
38 | +import java.util.List; | ||
39 | +import java.util.Map; | ||
40 | +import java.util.concurrent.BlockingQueue; | ||
41 | + | ||
42 | +/** | ||
43 | + * Representation of LSP event consumer. | ||
44 | + */ | ||
45 | +public class LspEventConsumer implements Runnable { | ||
46 | + private static final Logger log = LoggerFactory.getLogger(LspEventConsumer.class); | ||
47 | + public static List<LsPdu> lsPdus = new ArrayList<>(); | ||
48 | + private String lspAdded = "LSP_ADDED"; | ||
49 | + private String lspRemoved = "LSP_REMOVED"; | ||
50 | + private BlockingQueue queue = null; | ||
51 | + private Controller controller = null; | ||
52 | + private TopologyForDeviceAndLinkImpl deviceAndLink = new TopologyForDeviceAndLinkImpl(); | ||
53 | + | ||
54 | + /** | ||
55 | + * Creates an instance of this. | ||
56 | + * | ||
57 | + * @param queue blocking queue instance | ||
58 | + * @param controller controller instance | ||
59 | + */ | ||
60 | + public LspEventConsumer(BlockingQueue queue, Controller controller) { | ||
61 | + this.queue = queue; | ||
62 | + this.controller = controller; | ||
63 | + } | ||
64 | + | ||
65 | + @Override | ||
66 | + public void run() { | ||
67 | + log.debug("LspsForProvider:run...!!!"); | ||
68 | + try { | ||
69 | + while (true) { | ||
70 | + if (!queue.isEmpty()) { | ||
71 | + LspWrapper wrapper = (LspWrapper) queue.take(); | ||
72 | + LsPdu lsPdu = (LsPdu) wrapper.lsPdu(); | ||
73 | + for (IsisTlv isisTlv : lsPdu.tlvs()) { | ||
74 | + if ((isisTlv instanceof IpExtendedReachabilityTlv) || | ||
75 | + (isisTlv instanceof IsExtendedReachability)) { | ||
76 | + lsPdus.add(lsPdu); | ||
77 | + if (wrapper.lspProcessing().equals(lspAdded)) { | ||
78 | + callTopologyToSendInfo(lsPdu, wrapper.isisInterface().networkType(), | ||
79 | + wrapper.isisInterface().systemId() + ".00"); | ||
80 | + } | ||
81 | + if (wrapper.lspProcessing().equals(lspRemoved)) { | ||
82 | + callTopologyToRemoveInfo(lsPdu); | ||
83 | + } | ||
84 | + break; | ||
85 | + } | ||
86 | + } | ||
87 | + } | ||
88 | + } | ||
89 | + } catch (Exception e) { | ||
90 | + log.debug("Error::LspsForProvider::{}", e.getMessage()); | ||
91 | + } | ||
92 | + } | ||
93 | + | ||
94 | + /** | ||
95 | + * Sends topology information to core. | ||
96 | + * | ||
97 | + * @param lsPdu ls pdu instance | ||
98 | + * @param isisNetworkType ISIS network type | ||
99 | + */ | ||
100 | + private void callTopologyToSendInfo(LsPdu lsPdu, IsisNetworkType isisNetworkType, | ||
101 | + String ownSystemId) { | ||
102 | + if (isisNetworkType.equals(IsisNetworkType.BROADCAST)) { | ||
103 | + sendDeviceInfo(lsPdu); | ||
104 | + boolean isDis = IsisUtil.checkIsDis(lsPdu.lspId()); | ||
105 | + if (isDis) { | ||
106 | + sendLinkInfo(lsPdu, ownSystemId); | ||
107 | + } | ||
108 | + } else if (isisNetworkType.equals(IsisNetworkType.P2P)) { | ||
109 | + | ||
110 | + sendDeviceInfo(lsPdu); | ||
111 | + | ||
112 | + for (LsPdu wrapper : lsPdus) { | ||
113 | + LsPdu lsPduStored = wrapper; | ||
114 | + List<String> neStringList = neighborList(lsPduStored, ownSystemId); | ||
115 | + String lspId = IsisUtil.removeTailingZeros(lsPdu.lspId()); | ||
116 | + if (neStringList.contains(lspId)) { | ||
117 | + sendLinkInfo(lsPduStored, ownSystemId); | ||
118 | + } | ||
119 | + } | ||
120 | + | ||
121 | + List<String> neStringList = neighborList(lsPdu, ownSystemId); | ||
122 | + Map<String, IsisRouter> routerPresence = deviceAndLink.isisDeviceList(); | ||
123 | + for (String neighbor : neStringList) { | ||
124 | + IsisRouter isisRouter = routerPresence.get(neighbor); | ||
125 | + if (isisRouter != null) { | ||
126 | + sendLinkInfo(lsPdu, ownSystemId); | ||
127 | + } else { | ||
128 | + lsPdus.add(lsPdu); | ||
129 | + } | ||
130 | + } | ||
131 | + } | ||
132 | + } | ||
133 | + | ||
134 | + /** | ||
135 | + * Removes topology information from core. | ||
136 | + * | ||
137 | + * @param lsPdu ls pdu instance | ||
138 | + */ | ||
139 | + private void callTopologyToRemoveInfo(LsPdu lsPdu) { | ||
140 | + removeDeviceInfo(lsPdu); | ||
141 | + removeLinkInfo(lsPdu); | ||
142 | + } | ||
143 | + | ||
144 | + /** | ||
145 | + * Sends the device information to topology provider. | ||
146 | + * | ||
147 | + * @param lsPdu ls pdu instance | ||
148 | + */ | ||
149 | + private void sendDeviceInfo(LsPdu lsPdu) { | ||
150 | + IsisRouter isisRouter = deviceAndLink.createDeviceInfo(lsPdu); | ||
151 | + if (isisRouter.systemId() != null) { | ||
152 | + controller.addDeviceDetails(isisRouter); | ||
153 | + } | ||
154 | + } | ||
155 | + | ||
156 | + /** | ||
157 | + * Returns the list of neighbors. | ||
158 | + * | ||
159 | + * @param lsPdu link state Pdu | ||
160 | + * @return neighbor list | ||
161 | + */ | ||
162 | + private List<String> neighborList(LsPdu lsPdu, String ownSystemId) { | ||
163 | + List<String> neighbourList = new ArrayList<>(); | ||
164 | + for (IsisTlv isisTlv : lsPdu.tlvs()) { | ||
165 | + if (isisTlv instanceof IsExtendedReachability) { | ||
166 | + IsExtendedReachability isExtendedReachability = (IsExtendedReachability) isisTlv; | ||
167 | + List<NeighborForExtendedIs> neighborForExtendedIsList = isExtendedReachability.neighbours(); | ||
168 | + for (NeighborForExtendedIs neighbor : neighborForExtendedIsList) { | ||
169 | + String neighbourId = neighbor.neighborId(); | ||
170 | + if (!(neighbourId.equals(ownSystemId))) { | ||
171 | + neighbourList.add(neighbourId); | ||
172 | + } | ||
173 | + | ||
174 | + } | ||
175 | + } | ||
176 | + } | ||
177 | + return neighbourList; | ||
178 | + } | ||
179 | + | ||
180 | + /** | ||
181 | + * Creates ISIS router instance. | ||
182 | + * | ||
183 | + * @param systemId system ID | ||
184 | + * @return isisRouter instance | ||
185 | + */ | ||
186 | + private IsisRouter createIsisRouterDummy(String systemId) { | ||
187 | + IsisRouter isisRouter = new DefaultIsisRouter(); | ||
188 | + isisRouter.setSystemId(systemId); | ||
189 | + isisRouter.setDis(false); | ||
190 | + isisRouter.setInterfaceId(IsisConstants.DEFAULTIP); | ||
191 | + isisRouter.setNeighborRouterId(IsisConstants.DEFAULTIP); | ||
192 | + return isisRouter; | ||
193 | + } | ||
194 | + | ||
195 | + /** | ||
196 | + * Removes the device information from topology provider. | ||
197 | + * | ||
198 | + * @param lsPdu ls pdu instance | ||
199 | + */ | ||
200 | + private void removeDeviceInfo(LsPdu lsPdu) { | ||
201 | + IsisRouter isisRouter = deviceAndLink.removeDeviceAndLinkInfo(lsPdu); | ||
202 | + if (isisRouter.systemId() != null) { | ||
203 | + controller.removeDeviceDetails(isisRouter); | ||
204 | + } | ||
205 | + } | ||
206 | + | ||
207 | + /** | ||
208 | + * Sends the link information to topology provider. | ||
209 | + * | ||
210 | + * @param lsPdu ls pdu instance | ||
211 | + */ | ||
212 | + private void sendLinkInfo(LsPdu lsPdu, String ownSystemId) { | ||
213 | + Map<String, LinkInformation> linkInformationList = deviceAndLink.createLinkInfo(lsPdu, ownSystemId); | ||
214 | + for (String key : linkInformationList.keySet()) { | ||
215 | + LinkInformation linkInformation = linkInformationList.get(key); | ||
216 | + if (linkInformation.isAlreadyCreated()) { | ||
217 | + controller.addDeviceDetails(createIsisRouterDummy(linkInformation.linkDestinationId())); | ||
218 | + controller.addLinkDetails(createIsisLink(linkInformation, lsPdu)); | ||
219 | + } else { | ||
220 | + controller.addLinkDetails(createIsisLink(linkInformation, lsPdu)); | ||
221 | + } | ||
222 | + } | ||
223 | + } | ||
224 | + | ||
225 | + /** | ||
226 | + * Removes the link information from topology provider. | ||
227 | + * | ||
228 | + * @param lsPdu ls pdu instance | ||
229 | + */ | ||
230 | + private void removeLinkInfo(LsPdu lsPdu) { | ||
231 | + Map<String, LinkInformation> linkInformationList = deviceAndLink.removeLinkInfo(lsPdu); | ||
232 | + for (String key : linkInformationList.keySet()) { | ||
233 | + LinkInformation linkInformation = linkInformationList.get(key); | ||
234 | + controller.removeLinkDetails(createIsisLink(linkInformation, lsPdu)); | ||
235 | + } | ||
236 | + } | ||
237 | + | ||
238 | + /** | ||
239 | + * Creates ISIS link instance. | ||
240 | + * | ||
241 | + * @param linkInformation link information instance | ||
242 | + * @return isisLink instance | ||
243 | + */ | ||
244 | + private IsisLink createIsisLink(LinkInformation linkInformation, LsPdu lsPdu) { | ||
245 | + IsisLink isisLink = new DefaultIsisLink(); | ||
246 | + isisLink.setLocalSystemId(linkInformation.linkSourceId()); | ||
247 | + isisLink.setRemoteSystemId(linkInformation.linkDestinationId()); | ||
248 | + isisLink.setInterfaceIp(linkInformation.interfaceIp()); | ||
249 | + isisLink.setNeighborIp(linkInformation.neighborIp()); | ||
250 | + isisLink.setLinkTed(createLinkTedInfo(lsPdu)); | ||
251 | + return isisLink; | ||
252 | + } | ||
253 | + | ||
254 | + /** | ||
255 | + * Creates the link TED information. | ||
256 | + * | ||
257 | + * @param lsPdu link state PDU | ||
258 | + * @return isisLinkTed | ||
259 | + */ | ||
260 | + private IsisLinkTed createLinkTedInfo(LsPdu lsPdu) { | ||
261 | + IsisLinkTed isisLinkTed = deviceAndLink.createIsisLinkTedInfo(lsPdu); | ||
262 | + return isisLinkTed; | ||
263 | + } | ||
264 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -23,15 +23,20 @@ import org.onosproject.isis.controller.IsisLspBin; | ... | @@ -23,15 +23,20 @@ import org.onosproject.isis.controller.IsisLspBin; |
23 | import org.onosproject.isis.controller.IsisMessage; | 23 | import org.onosproject.isis.controller.IsisMessage; |
24 | import org.onosproject.isis.controller.IsisPduType; | 24 | import org.onosproject.isis.controller.IsisPduType; |
25 | import org.onosproject.isis.controller.LspWrapper; | 25 | import org.onosproject.isis.controller.LspWrapper; |
26 | +import org.onosproject.isis.controller.impl.Controller; | ||
27 | +import org.onosproject.isis.controller.impl.LspEventConsumer; | ||
26 | import org.onosproject.isis.io.isispacket.pdu.LsPdu; | 28 | import org.onosproject.isis.io.isispacket.pdu.LsPdu; |
27 | import org.onosproject.isis.io.util.IsisConstants; | 29 | import org.onosproject.isis.io.util.IsisConstants; |
28 | import org.onosproject.isis.io.util.IsisUtil; | 30 | import org.onosproject.isis.io.util.IsisUtil; |
29 | import org.slf4j.Logger; | 31 | import org.slf4j.Logger; |
30 | import org.slf4j.LoggerFactory; | 32 | import org.slf4j.LoggerFactory; |
31 | 33 | ||
34 | +import java.util.ArrayList; | ||
32 | import java.util.Iterator; | 35 | import java.util.Iterator; |
33 | import java.util.List; | 36 | import java.util.List; |
34 | import java.util.Map; | 37 | import java.util.Map; |
38 | +import java.util.concurrent.ArrayBlockingQueue; | ||
39 | +import java.util.concurrent.BlockingQueue; | ||
35 | import java.util.concurrent.ConcurrentHashMap; | 40 | import java.util.concurrent.ConcurrentHashMap; |
36 | import java.util.concurrent.CopyOnWriteArrayList; | 41 | import java.util.concurrent.CopyOnWriteArrayList; |
37 | 42 | ||
... | @@ -43,10 +48,14 @@ public class DefaultIsisLsdb implements IsisLsdb { | ... | @@ -43,10 +48,14 @@ public class DefaultIsisLsdb implements IsisLsdb { |
43 | private Map<String, LspWrapper> isisL1Db = new ConcurrentHashMap<>(); | 48 | private Map<String, LspWrapper> isisL1Db = new ConcurrentHashMap<>(); |
44 | private Map<String, LspWrapper> isisL2Db = new ConcurrentHashMap<>(); | 49 | private Map<String, LspWrapper> isisL2Db = new ConcurrentHashMap<>(); |
45 | private IsisLsdbAge lsdbAge = null; | 50 | private IsisLsdbAge lsdbAge = null; |
51 | + private Controller controller = null; | ||
52 | + private List<IsisInterface> isisInterfaceList = new ArrayList<>(); | ||
46 | 53 | ||
47 | 54 | ||
48 | private int l1LspSeqNo = IsisConstants.STARTLSSEQUENCENUM; | 55 | private int l1LspSeqNo = IsisConstants.STARTLSSEQUENCENUM; |
49 | private int l2LspSeqNo = IsisConstants.STARTLSSEQUENCENUM; | 56 | private int l2LspSeqNo = IsisConstants.STARTLSSEQUENCENUM; |
57 | + private LspEventConsumer queueConsumer = null; | ||
58 | + private BlockingQueue<LspWrapper> lspForProviderQueue = new ArrayBlockingQueue<>(1024); | ||
50 | 59 | ||
51 | /** | 60 | /** |
52 | * Creates an instance of ISIS LSDB. | 61 | * Creates an instance of ISIS LSDB. |
... | @@ -56,10 +65,30 @@ public class DefaultIsisLsdb implements IsisLsdb { | ... | @@ -56,10 +65,30 @@ public class DefaultIsisLsdb implements IsisLsdb { |
56 | } | 65 | } |
57 | 66 | ||
58 | /** | 67 | /** |
68 | + * Sets the controller instance. | ||
69 | + * | ||
70 | + * @param controller controller instance | ||
71 | + */ | ||
72 | + public void setController(Controller controller) { | ||
73 | + this.controller = controller; | ||
74 | + } | ||
75 | + | ||
76 | + /** | ||
77 | + * Sets the list of IsisInterface instance. | ||
78 | + * | ||
79 | + * @param isisInterfaceList isisInterface instance | ||
80 | + */ | ||
81 | + public void setIsisInterface(List<IsisInterface> isisInterfaceList) { | ||
82 | + this.isisInterfaceList = isisInterfaceList; | ||
83 | + } | ||
84 | + | ||
85 | + /** | ||
59 | * Initializes the link state database. | 86 | * Initializes the link state database. |
60 | */ | 87 | */ |
61 | public void initializeDb() { | 88 | public void initializeDb() { |
62 | lsdbAge.startDbAging(); | 89 | lsdbAge.startDbAging(); |
90 | + queueConsumer = new LspEventConsumer(lspForProviderQueue, controller); | ||
91 | + new Thread(queueConsumer).start(); | ||
63 | } | 92 | } |
64 | 93 | ||
65 | /** | 94 | /** |
... | @@ -96,7 +125,6 @@ public class DefaultIsisLsdb implements IsisLsdb { | ... | @@ -96,7 +125,6 @@ public class DefaultIsisLsdb implements IsisLsdb { |
96 | return lspKey.toString(); | 125 | return lspKey.toString(); |
97 | } | 126 | } |
98 | 127 | ||
99 | - | ||
100 | /** | 128 | /** |
101 | * Returns the neighbor L1 database information. | 129 | * Returns the neighbor L1 database information. |
102 | * | 130 | * |
... | @@ -215,7 +243,7 @@ public class DefaultIsisLsdb implements IsisLsdb { | ... | @@ -215,7 +243,7 @@ public class DefaultIsisLsdb implements IsisLsdb { |
215 | byte[] lspBytes = lspdu.asBytes(); | 243 | byte[] lspBytes = lspdu.asBytes(); |
216 | lspdu.setPduLength(lspBytes.length); | 244 | lspdu.setPduLength(lspBytes.length); |
217 | lspBytes = IsisUtil.addChecksum(lspBytes, IsisConstants.CHECKSUMPOSITION, | 245 | lspBytes = IsisUtil.addChecksum(lspBytes, IsisConstants.CHECKSUMPOSITION, |
218 | - IsisConstants.CHECKSUMPOSITION + 1); | 246 | + IsisConstants.CHECKSUMPOSITION + 1); |
219 | byte[] checkSum = {lspBytes[IsisConstants.CHECKSUMPOSITION], lspBytes[IsisConstants.CHECKSUMPOSITION + 1]}; | 247 | byte[] checkSum = {lspBytes[IsisConstants.CHECKSUMPOSITION], lspBytes[IsisConstants.CHECKSUMPOSITION + 1]}; |
220 | lspdu.setCheckSum(ChannelBuffers.copiedBuffer(checkSum).readUnsignedShort()); | 248 | lspdu.setCheckSum(ChannelBuffers.copiedBuffer(checkSum).readUnsignedShort()); |
221 | } | 249 | } |
... | @@ -236,6 +264,14 @@ public class DefaultIsisLsdb implements IsisLsdb { | ... | @@ -236,6 +264,14 @@ public class DefaultIsisLsdb implements IsisLsdb { |
236 | addLsp(lspWrapper, lspdu.lspId()); | 264 | addLsp(lspWrapper, lspdu.lspId()); |
237 | 265 | ||
238 | log.debug("Added LSp In LSDB: {}", lspWrapper); | 266 | log.debug("Added LSp In LSDB: {}", lspWrapper); |
267 | + try { | ||
268 | + if (!lspWrapper.isSelfOriginated()) { | ||
269 | + lspWrapper.setLspProcessing(IsisConstants.LSPADDED); | ||
270 | + lspForProviderQueue.put(lspWrapper); | ||
271 | + } | ||
272 | + } catch (Exception e) { | ||
273 | + log.debug("Added LSp In Blocking queue: {}", lspWrapper); | ||
274 | + } | ||
239 | return true; | 275 | return true; |
240 | } | 276 | } |
241 | 277 | ||
... | @@ -273,9 +309,10 @@ public class DefaultIsisLsdb implements IsisLsdb { | ... | @@ -273,9 +309,10 @@ public class DefaultIsisLsdb implements IsisLsdb { |
273 | lspBin.addIsisLsp(key, lspWrapper); | 309 | lspBin.addIsisLsp(key, lspWrapper); |
274 | lsdbAge.addLspBin(binNumber, lspBin); | 310 | lsdbAge.addLspBin(binNumber, lspBin); |
275 | log.debug("Added Type {} LSP to LSDB and LSABin[{}], Remaining life time of LSA {}", | 311 | log.debug("Added Type {} LSP to LSDB and LSABin[{}], Remaining life time of LSA {}", |
276 | - lspWrapper.lsPdu().isisPduType(), | 312 | + lspWrapper.lsPdu().isisPduType(), |
277 | - binNumber, lspWrapper.remainingLifetime()); | 313 | + binNumber, lspWrapper.remainingLifetime()); |
278 | } | 314 | } |
315 | + | ||
279 | return false; | 316 | return false; |
280 | } | 317 | } |
281 | 318 | ||
... | @@ -337,6 +374,7 @@ public class DefaultIsisLsdb implements IsisLsdb { | ... | @@ -337,6 +374,7 @@ public class DefaultIsisLsdb implements IsisLsdb { |
337 | public void deleteLsp(IsisMessage lspMessage) { | 374 | public void deleteLsp(IsisMessage lspMessage) { |
338 | LsPdu lsp = (LsPdu) lspMessage; | 375 | LsPdu lsp = (LsPdu) lspMessage; |
339 | String lspKey = lsp.lspId(); | 376 | String lspKey = lsp.lspId(); |
377 | + LspWrapper lspWrapper = findLsp(lspMessage.isisPduType(), lspKey); | ||
340 | switch (lsp.isisPduType()) { | 378 | switch (lsp.isisPduType()) { |
341 | case L1LSPDU: | 379 | case L1LSPDU: |
342 | isisL1Db.remove(lspKey); | 380 | isisL1Db.remove(lspKey); |
... | @@ -348,5 +386,12 @@ public class DefaultIsisLsdb implements IsisLsdb { | ... | @@ -348,5 +386,12 @@ public class DefaultIsisLsdb implements IsisLsdb { |
348 | log.debug("Unknown LSP type to remove..!!!"); | 386 | log.debug("Unknown LSP type to remove..!!!"); |
349 | break; | 387 | break; |
350 | } | 388 | } |
389 | + | ||
390 | + try { | ||
391 | + lspWrapper.setLspProcessing(IsisConstants.LSPREMOVED); | ||
392 | + lspForProviderQueue.put(lspWrapper); | ||
393 | + } catch (Exception e) { | ||
394 | + log.debug("Added LSp In Blocking queue: {}", lspWrapper); | ||
395 | + } | ||
351 | } | 396 | } |
352 | } | 397 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -231,7 +231,6 @@ public class DefaultIsisLsdbAge implements IsisLsdbAge { | ... | @@ -231,7 +231,6 @@ public class DefaultIsisLsdbAge implements IsisLsdbAge { |
231 | } | 231 | } |
232 | } | 232 | } |
233 | 233 | ||
234 | - | ||
235 | /** | 234 | /** |
236 | * Runnable task which runs every second and calls aging process. | 235 | * Runnable task which runs every second and calls aging process. |
237 | */ | 236 | */ | ... | ... |
protocols/isis/ctl/src/main/java/org/onosproject/isis/controller/impl/lsdb/IsisLspQueueConsumer.java
... | @@ -58,12 +58,12 @@ public class IsisLspQueueConsumer implements Runnable { | ... | @@ -58,12 +58,12 @@ public class IsisLspQueueConsumer implements Runnable { |
58 | switch (lspProcessing) { | 58 | switch (lspProcessing) { |
59 | case IsisConstants.REFRESHLSP: | 59 | case IsisConstants.REFRESHLSP: |
60 | log.debug("LSPQueueConsumer: Message - " + IsisConstants.REFRESHLSP + | 60 | log.debug("LSPQueueConsumer: Message - " + IsisConstants.REFRESHLSP + |
61 | - " consumed."); | 61 | + " consumed."); |
62 | processRefreshLsp(wrapper); | 62 | processRefreshLsp(wrapper); |
63 | break; | 63 | break; |
64 | case IsisConstants.MAXAGELSP: | 64 | case IsisConstants.MAXAGELSP: |
65 | log.debug("LSPQueueConsumer: Message - " + IsisConstants.MAXAGELSP + | 65 | log.debug("LSPQueueConsumer: Message - " + IsisConstants.MAXAGELSP + |
66 | - " consumed."); | 66 | + " consumed."); |
67 | processMaxAgeLsa(wrapper); | 67 | processMaxAgeLsa(wrapper); |
68 | break; | 68 | break; |
69 | default: | 69 | default: |
... | @@ -72,7 +72,6 @@ public class IsisLspQueueConsumer implements Runnable { | ... | @@ -72,7 +72,6 @@ public class IsisLspQueueConsumer implements Runnable { |
72 | } | 72 | } |
73 | } | 73 | } |
74 | } | 74 | } |
75 | - | ||
76 | } catch (Exception e) { | 75 | } catch (Exception e) { |
77 | log.debug("Error::LSPQueueConsumer::{}", e.getMessage()); | 76 | log.debug("Error::LSPQueueConsumer::{}", e.getMessage()); |
78 | } | 77 | } |
... | @@ -94,19 +93,18 @@ public class IsisLspQueueConsumer implements Runnable { | ... | @@ -94,19 +93,18 @@ public class IsisLspQueueConsumer implements Runnable { |
94 | lsPdu.setRemainingLifeTime(IsisConstants.LSPMAXAGE); | 93 | lsPdu.setRemainingLifeTime(IsisConstants.LSPMAXAGE); |
95 | byte[] lspBytes = lsPdu.asBytes(); | 94 | byte[] lspBytes = lsPdu.asBytes(); |
96 | lspBytes = IsisUtil.addLengthAndMarkItInReserved(lspBytes, IsisConstants.LENGTHPOSITION, | 95 | lspBytes = IsisUtil.addLengthAndMarkItInReserved(lspBytes, IsisConstants.LENGTHPOSITION, |
97 | - IsisConstants.LENGTHPOSITION + 1, | 96 | + IsisConstants.LENGTHPOSITION + 1, |
98 | - IsisConstants.RESERVEDPOSITION); | 97 | + IsisConstants.RESERVEDPOSITION); |
99 | lspBytes = IsisUtil.addChecksum(lspBytes, IsisConstants.CHECKSUMPOSITION, | 98 | lspBytes = IsisUtil.addChecksum(lspBytes, IsisConstants.CHECKSUMPOSITION, |
100 | - IsisConstants.CHECKSUMPOSITION + 1); | 99 | + IsisConstants.CHECKSUMPOSITION + 1); |
101 | //write to the channel | 100 | //write to the channel |
102 | channel.write(IsisUtil.framePacket(lspBytes, isisInterface.interfaceIndex())); | 101 | channel.write(IsisUtil.framePacket(lspBytes, isisInterface.interfaceIndex())); |
103 | // Updating the database with resetting remaining life time to default. | 102 | // Updating the database with resetting remaining life time to default. |
104 | IsisLsdb isisDb = isisInterface.isisLsdb(); | 103 | IsisLsdb isisDb = isisInterface.isisLsdb(); |
105 | isisDb.addLsp(lsPdu, true, isisInterface); | 104 | isisDb.addLsp(lsPdu, true, isisInterface); |
106 | log.debug("LSPQueueConsumer: processRefreshLsp - Flooded SelfOriginated LSP {}", | 105 | log.debug("LSPQueueConsumer: processRefreshLsp - Flooded SelfOriginated LSP {}", |
107 | - wrapper.lsPdu()); | 106 | + wrapper.lsPdu()); |
108 | } | 107 | } |
109 | - | ||
110 | } | 108 | } |
111 | } | 109 | } |
112 | 110 | ||
... | @@ -124,7 +122,7 @@ public class IsisLspQueueConsumer implements Runnable { | ... | @@ -124,7 +122,7 @@ public class IsisLspQueueConsumer implements Runnable { |
124 | IsisLsdb isisDb = isisInterface.isisLsdb(); | 122 | IsisLsdb isisDb = isisInterface.isisLsdb(); |
125 | isisDb.deleteLsp(lsPdu); | 123 | isisDb.deleteLsp(lsPdu); |
126 | log.debug("LSPQueueConsumer: processMaxAgeLsp - Removed-Max Age LSP {}", | 124 | log.debug("LSPQueueConsumer: processMaxAgeLsp - Removed-Max Age LSP {}", |
127 | - wrapper.lsPdu()); | 125 | + wrapper.lsPdu()); |
128 | } | 126 | } |
129 | } | 127 | } |
130 | } | 128 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
protocols/isis/ctl/src/main/java/org/onosproject/isis/controller/impl/topology/DefaultIsisLink.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2015 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 | +package org.onosproject.isis.controller.impl.topology; | ||
18 | + | ||
19 | +import com.google.common.base.MoreObjects; | ||
20 | +import com.google.common.base.Objects; | ||
21 | +import org.onlab.packet.Ip4Address; | ||
22 | +import org.onosproject.isis.controller.topology.IsisLink; | ||
23 | +import org.onosproject.isis.controller.topology.IsisLinkTed; | ||
24 | + | ||
25 | +/** | ||
26 | + * Representation of an ISIS Link. | ||
27 | + */ | ||
28 | +public class DefaultIsisLink implements IsisLink { | ||
29 | + | ||
30 | + private String remoteSystemId; | ||
31 | + private String localSystemId; | ||
32 | + private Ip4Address interfaceIp; | ||
33 | + private Ip4Address neighborIp; | ||
34 | + private IsisLinkTed linkTed; | ||
35 | + | ||
36 | + @Override | ||
37 | + public String remoteSystemId() { | ||
38 | + return this.remoteSystemId; | ||
39 | + } | ||
40 | + | ||
41 | + @Override | ||
42 | + public String localSystemId() { | ||
43 | + return this.localSystemId; | ||
44 | + } | ||
45 | + | ||
46 | + @Override | ||
47 | + public Ip4Address interfaceIp() { | ||
48 | + return this.interfaceIp; | ||
49 | + } | ||
50 | + | ||
51 | + @Override | ||
52 | + public Ip4Address neighborIp() { | ||
53 | + return this.neighborIp; | ||
54 | + } | ||
55 | + | ||
56 | + @Override | ||
57 | + public IsisLinkTed linkTed() { | ||
58 | + return this.linkTed; | ||
59 | + } | ||
60 | + | ||
61 | + @Override | ||
62 | + public void setRemoteSystemId(String remoteSystemId) { | ||
63 | + this.remoteSystemId = remoteSystemId; | ||
64 | + } | ||
65 | + | ||
66 | + @Override | ||
67 | + public void setLocalSystemId(String localSystemId) { | ||
68 | + this.localSystemId = localSystemId; | ||
69 | + } | ||
70 | + | ||
71 | + @Override | ||
72 | + public void setInterfaceIp(Ip4Address interfaceIp) { | ||
73 | + this.interfaceIp = interfaceIp; | ||
74 | + } | ||
75 | + | ||
76 | + @Override | ||
77 | + public void setNeighborIp(Ip4Address neighborIp) { | ||
78 | + this.neighborIp = neighborIp; | ||
79 | + } | ||
80 | + | ||
81 | + @Override | ||
82 | + public void setLinkTed(IsisLinkTed linkTed) { | ||
83 | + this.linkTed = linkTed; | ||
84 | + } | ||
85 | + | ||
86 | + @Override | ||
87 | + public String toString() { | ||
88 | + return MoreObjects.toStringHelper(getClass()) | ||
89 | + .omitNullValues() | ||
90 | + .add("remoteSystemId", remoteSystemId) | ||
91 | + .add("localSystemId", localSystemId) | ||
92 | + .add("interfaceIp", interfaceIp) | ||
93 | + .add("neighborIp", neighborIp) | ||
94 | + .add("linkTed", linkTed) | ||
95 | + .toString(); | ||
96 | + } | ||
97 | + | ||
98 | + @Override | ||
99 | + public boolean equals(Object o) { | ||
100 | + if (this == o) { | ||
101 | + return true; | ||
102 | + } | ||
103 | + if (o == null || getClass() != o.getClass()) { | ||
104 | + return false; | ||
105 | + } | ||
106 | + DefaultIsisLink that = (DefaultIsisLink) o; | ||
107 | + return Objects.equal(remoteSystemId, that.remoteSystemId) && | ||
108 | + Objects.equal(localSystemId, that.localSystemId) && | ||
109 | + Objects.equal(interfaceIp, that.interfaceIp) && | ||
110 | + Objects.equal(neighborIp, that.neighborIp) && | ||
111 | + Objects.equal(linkTed, that.linkTed); | ||
112 | + } | ||
113 | + | ||
114 | + @Override | ||
115 | + public int hashCode() { | ||
116 | + return Objects.hashCode(remoteSystemId, localSystemId, interfaceIp, neighborIp, linkTed); | ||
117 | + } | ||
118 | +} | ||
... | \ 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.impl.topology; | ||
17 | + | ||
18 | +import com.google.common.base.MoreObjects; | ||
19 | +import com.google.common.base.Objects; | ||
20 | +import org.onlab.packet.Ip4Address; | ||
21 | +import org.onosproject.isis.controller.topology.LinkInformation; | ||
22 | + | ||
23 | +/** | ||
24 | + * Representation of an ISIS link information.. | ||
25 | + */ | ||
26 | +public class DefaultIsisLinkInformation implements LinkInformation { | ||
27 | + | ||
28 | + String linkId; | ||
29 | + String linkSourceId; | ||
30 | + String linkDestinationId; | ||
31 | + Ip4Address interfaceIp; | ||
32 | + Ip4Address neighborIp; | ||
33 | + boolean alreadyCreated; | ||
34 | + | ||
35 | + /** | ||
36 | + * Gets link id. | ||
37 | + * | ||
38 | + * @return link id | ||
39 | + */ | ||
40 | + public String linkId() { | ||
41 | + return linkId; | ||
42 | + } | ||
43 | + | ||
44 | + /** | ||
45 | + * Sets link id.DefaultIsisDeviceInformation. | ||
46 | + * | ||
47 | + * @param linkId link id | ||
48 | + */ | ||
49 | + public void setLinkId(String linkId) { | ||
50 | + this.linkId = linkId; | ||
51 | + } | ||
52 | + | ||
53 | + /** | ||
54 | + * Gets is already created or not. | ||
55 | + * | ||
56 | + * @return true if already created else false | ||
57 | + */ | ||
58 | + public boolean isAlreadyCreated() { | ||
59 | + return alreadyCreated; | ||
60 | + } | ||
61 | + | ||
62 | + /** | ||
63 | + * Sets is already created or not. | ||
64 | + * | ||
65 | + * @param alreadyCreated true or false | ||
66 | + */ | ||
67 | + public void setAlreadyCreated(boolean alreadyCreated) { | ||
68 | + this.alreadyCreated = alreadyCreated; | ||
69 | + } | ||
70 | + | ||
71 | + /** | ||
72 | + * Gets link destination id. | ||
73 | + * | ||
74 | + * @return link destination id | ||
75 | + */ | ||
76 | + public String linkDestinationId() { | ||
77 | + return linkDestinationId; | ||
78 | + } | ||
79 | + | ||
80 | + /** | ||
81 | + * Sets link destination id. | ||
82 | + * | ||
83 | + * @param linkDestinationId link destination id | ||
84 | + */ | ||
85 | + public void setLinkDestinationId(String linkDestinationId) { | ||
86 | + this.linkDestinationId = linkDestinationId; | ||
87 | + } | ||
88 | + | ||
89 | + /** | ||
90 | + * Gets link source id. | ||
91 | + * | ||
92 | + * @return link source id | ||
93 | + */ | ||
94 | + public String linkSourceId() { | ||
95 | + return linkSourceId; | ||
96 | + } | ||
97 | + | ||
98 | + /** | ||
99 | + * Sets link source id. | ||
100 | + * | ||
101 | + * @param linkSourceId link source id | ||
102 | + */ | ||
103 | + public void setLinkSourceId(String linkSourceId) { | ||
104 | + this.linkSourceId = linkSourceId; | ||
105 | + } | ||
106 | + | ||
107 | + /** | ||
108 | + * Gets interface IP address. | ||
109 | + * | ||
110 | + * @return interface IP address | ||
111 | + */ | ||
112 | + public Ip4Address interfaceIp() { | ||
113 | + return interfaceIp; | ||
114 | + } | ||
115 | + | ||
116 | + /** | ||
117 | + * Sets interface IP address. | ||
118 | + * | ||
119 | + * @param interfaceIp interface IP address | ||
120 | + */ | ||
121 | + public void setInterfaceIp(Ip4Address interfaceIp) { | ||
122 | + this.interfaceIp = interfaceIp; | ||
123 | + } | ||
124 | + | ||
125 | + @Override | ||
126 | + public Ip4Address neighborIp() { | ||
127 | + return this.neighborIp; | ||
128 | + } | ||
129 | + | ||
130 | + @Override | ||
131 | + public void setNeighborIp(Ip4Address neighborIp) { | ||
132 | + this.neighborIp = neighborIp; | ||
133 | + } | ||
134 | + | ||
135 | + @Override | ||
136 | + public String toString() { | ||
137 | + return MoreObjects.toStringHelper(getClass()) | ||
138 | + .omitNullValues() | ||
139 | + .add("linkId", linkId) | ||
140 | + .add("linkSourceId", linkSourceId) | ||
141 | + .add("linkDestinationId", linkDestinationId) | ||
142 | + .add("interfaceIp", interfaceIp) | ||
143 | + .toString(); | ||
144 | + } | ||
145 | + | ||
146 | + @Override | ||
147 | + public boolean equals(Object o) { | ||
148 | + if (this == o) { | ||
149 | + return true; | ||
150 | + } | ||
151 | + if (o == null || getClass() != o.getClass()) { | ||
152 | + return false; | ||
153 | + } | ||
154 | + DefaultIsisLinkInformation that = (DefaultIsisLinkInformation) o; | ||
155 | + return Objects.equal(linkId, that.linkId) && | ||
156 | + Objects.equal(linkSourceId, that.linkSourceId) && | ||
157 | + Objects.equal(linkDestinationId, that.linkDestinationId) && | ||
158 | + Objects.equal(interfaceIp, that.interfaceIp); | ||
159 | + } | ||
160 | + | ||
161 | + @Override | ||
162 | + public int hashCode() { | ||
163 | + return Objects.hashCode(linkId, linkSourceId, linkDestinationId, | ||
164 | + interfaceIp); | ||
165 | + } | ||
166 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
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.isis.controller.impl.topology; | ||
17 | + | ||
18 | +import com.google.common.base.MoreObjects; | ||
19 | +import com.google.common.base.Objects; | ||
20 | +import org.onlab.packet.Ip4Address; | ||
21 | +import org.onlab.util.Bandwidth; | ||
22 | +import org.onosproject.isis.controller.topology.IsisLinkTed; | ||
23 | + | ||
24 | +import java.util.List; | ||
25 | + | ||
26 | +/** | ||
27 | + * Representation of an ISIS device information. | ||
28 | + */ | ||
29 | +public class DefaultIsisLinkTed implements IsisLinkTed { | ||
30 | + | ||
31 | + | ||
32 | + private int administrativeGroup; | ||
33 | + private Ip4Address ipv4InterfaceAddress; | ||
34 | + private Ip4Address ipv4NeighborAddress; | ||
35 | + private Bandwidth maximumLinkBandwidth; | ||
36 | + private Bandwidth maximumReservableLinkBandwidth; | ||
37 | + private List<Bandwidth> unreservedBandwidth; | ||
38 | + private long teDefaultMetric; | ||
39 | + | ||
40 | + @Override | ||
41 | + public int administrativeGroup() { | ||
42 | + return administrativeGroup; | ||
43 | + } | ||
44 | + | ||
45 | + @Override | ||
46 | + public void setAdministrativeGroup(int administrativeGroup) { | ||
47 | + this.administrativeGroup = administrativeGroup; | ||
48 | + } | ||
49 | + | ||
50 | + @Override | ||
51 | + public Ip4Address ipv4InterfaceAddress() { | ||
52 | + return ipv4InterfaceAddress; | ||
53 | + } | ||
54 | + | ||
55 | + @Override | ||
56 | + public void setIpv4InterfaceAddress(Ip4Address interfaceAddress) { | ||
57 | + this.ipv4InterfaceAddress = interfaceAddress; | ||
58 | + } | ||
59 | + | ||
60 | + @Override | ||
61 | + public Ip4Address ipv4NeighborAddress() { | ||
62 | + return ipv4NeighborAddress; | ||
63 | + } | ||
64 | + | ||
65 | + @Override | ||
66 | + public void setIpv4NeighborAddress(Ip4Address neighborAddress) { | ||
67 | + this.ipv4NeighborAddress = neighborAddress; | ||
68 | + } | ||
69 | + | ||
70 | + @Override | ||
71 | + public Bandwidth maximumLinkBandwidth() { | ||
72 | + return maximumLinkBandwidth; | ||
73 | + } | ||
74 | + | ||
75 | + @Override | ||
76 | + public void setMaximumLinkBandwidth(Bandwidth bandwidth) { | ||
77 | + this.maximumLinkBandwidth = bandwidth; | ||
78 | + } | ||
79 | + | ||
80 | + @Override | ||
81 | + public Bandwidth maximumReservableLinkBandwidth() { | ||
82 | + return maximumReservableLinkBandwidth; | ||
83 | + } | ||
84 | + | ||
85 | + @Override | ||
86 | + public void setMaximumReservableLinkBandwidth(Bandwidth bandwidth) { | ||
87 | + this.maximumReservableLinkBandwidth = bandwidth; | ||
88 | + } | ||
89 | + | ||
90 | + @Override | ||
91 | + public List<Bandwidth> unreservedBandwidth() { | ||
92 | + return this.unreservedBandwidth; | ||
93 | + } | ||
94 | + | ||
95 | + @Override | ||
96 | + public void setUnreservedBandwidth(List<Bandwidth> bandwidth) { | ||
97 | + this.unreservedBandwidth.addAll(bandwidth); | ||
98 | + } | ||
99 | + | ||
100 | + @Override | ||
101 | + public long teDefaultMetric() { | ||
102 | + return teDefaultMetric; | ||
103 | + } | ||
104 | + | ||
105 | + @Override | ||
106 | + public void setTeDefaultMetric(long teMetric) { | ||
107 | + this.teDefaultMetric = teMetric; | ||
108 | + } | ||
109 | + | ||
110 | + @Override | ||
111 | + public String toString() { | ||
112 | + return MoreObjects.toStringHelper(getClass()) | ||
113 | + .omitNullValues() | ||
114 | + .add("administrativeGroup", administrativeGroup) | ||
115 | + .add("ipv4InterfaceAddress", ipv4InterfaceAddress) | ||
116 | + .add("ipv4NeighborAddress", ipv4NeighborAddress) | ||
117 | + .add("maximumLinkBandwidth", maximumLinkBandwidth) | ||
118 | + .add("maximumReservableLinkBandwidth", maximumReservableLinkBandwidth) | ||
119 | + .add("teDefaultMetric", teDefaultMetric) | ||
120 | + .toString(); | ||
121 | + } | ||
122 | + | ||
123 | + @Override | ||
124 | + public boolean equals(Object o) { | ||
125 | + if (this == o) { | ||
126 | + return true; | ||
127 | + } | ||
128 | + if (o == null || getClass() != o.getClass()) { | ||
129 | + return false; | ||
130 | + } | ||
131 | + DefaultIsisLinkTed that = (DefaultIsisLinkTed) o; | ||
132 | + return Objects.equal(administrativeGroup, that.administrativeGroup) && | ||
133 | + Objects.equal(ipv4InterfaceAddress, that.ipv4InterfaceAddress) && | ||
134 | + Objects.equal(ipv4NeighborAddress, that.ipv4NeighborAddress) && | ||
135 | + Objects.equal(maximumLinkBandwidth, that.maximumLinkBandwidth) && | ||
136 | + Objects.equal(maximumReservableLinkBandwidth, | ||
137 | + that.maximumReservableLinkBandwidth) && | ||
138 | + Objects.equal(teDefaultMetric, that.teDefaultMetric); | ||
139 | + } | ||
140 | + | ||
141 | + @Override | ||
142 | + public int hashCode() { | ||
143 | + return Objects.hashCode(administrativeGroup, ipv4InterfaceAddress, | ||
144 | + ipv4NeighborAddress, maximumLinkBandwidth, teDefaultMetric); | ||
145 | + } | ||
146 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 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 | +package org.onosproject.isis.controller.impl.topology; | ||
18 | + | ||
19 | +import com.google.common.base.MoreObjects; | ||
20 | +import com.google.common.base.Objects; | ||
21 | +import org.onlab.packet.Ip4Address; | ||
22 | +import org.onosproject.isis.controller.topology.IsisRouter; | ||
23 | + | ||
24 | +/** | ||
25 | + * Representation of an ISIS Router. | ||
26 | + */ | ||
27 | +public class DefaultIsisRouter implements IsisRouter { | ||
28 | + | ||
29 | + private String systemId; | ||
30 | + private Ip4Address neighborRouterId; | ||
31 | + private Ip4Address interfaceId; | ||
32 | + private boolean isDis; | ||
33 | + | ||
34 | + /** | ||
35 | + * Gets the system ID. | ||
36 | + * | ||
37 | + * @return systemId system ID | ||
38 | + */ | ||
39 | + public String systemId() { | ||
40 | + return systemId; | ||
41 | + } | ||
42 | + | ||
43 | + /** | ||
44 | + * Sets IP address of the Router. | ||
45 | + */ | ||
46 | + public void setSystemId(String systemId) { | ||
47 | + this.systemId = systemId; | ||
48 | + } | ||
49 | + | ||
50 | + /** | ||
51 | + * Gets IP address of the interface. | ||
52 | + * | ||
53 | + * @return IP address of the interface | ||
54 | + */ | ||
55 | + public Ip4Address interfaceId() { | ||
56 | + return interfaceId; | ||
57 | + } | ||
58 | + | ||
59 | + /** | ||
60 | + * Gets IP address of the interface. | ||
61 | + * | ||
62 | + * @param interfaceId IP address of the interface | ||
63 | + */ | ||
64 | + public void setInterfaceId(Ip4Address interfaceId) { | ||
65 | + this.interfaceId = interfaceId; | ||
66 | + } | ||
67 | + | ||
68 | + /** | ||
69 | + * Gets neighbor's Router id. | ||
70 | + * | ||
71 | + * @return neighbor's Router id | ||
72 | + */ | ||
73 | + public Ip4Address neighborRouterId() { | ||
74 | + return neighborRouterId; | ||
75 | + } | ||
76 | + | ||
77 | + /** | ||
78 | + * Sets neighbor's Router id. | ||
79 | + * | ||
80 | + * @param advertisingRouterId neighbor's Router id | ||
81 | + */ | ||
82 | + public void setNeighborRouterId(Ip4Address advertisingRouterId) { | ||
83 | + this.neighborRouterId = advertisingRouterId; | ||
84 | + } | ||
85 | + | ||
86 | + /** | ||
87 | + * Gets if DR or not. | ||
88 | + * | ||
89 | + * @return true if DR else false | ||
90 | + */ | ||
91 | + public boolean isDis() { | ||
92 | + return isDis; | ||
93 | + } | ||
94 | + | ||
95 | + /** | ||
96 | + * Sets dis or not. | ||
97 | + * | ||
98 | + * @param dis true if DIS else false | ||
99 | + */ | ||
100 | + public void setDis(boolean dis) { | ||
101 | + isDis = dis; | ||
102 | + } | ||
103 | + | ||
104 | + @Override | ||
105 | + public String toString() { | ||
106 | + return MoreObjects.toStringHelper(getClass()) | ||
107 | + .omitNullValues() | ||
108 | + .add("systemId", systemId) | ||
109 | + .add("neighborRouterId", neighborRouterId) | ||
110 | + .add("interfaceId", interfaceId) | ||
111 | + .toString(); | ||
112 | + } | ||
113 | + | ||
114 | + @Override | ||
115 | + public boolean equals(Object o) { | ||
116 | + if (this == o) { | ||
117 | + return true; | ||
118 | + } | ||
119 | + if (o == null || getClass() != o.getClass()) { | ||
120 | + return false; | ||
121 | + } | ||
122 | + DefaultIsisRouter that = (DefaultIsisRouter) o; | ||
123 | + return Objects.equal(systemId, that.systemId) && | ||
124 | + Objects.equal(neighborRouterId, that.neighborRouterId) && | ||
125 | + Objects.equal(interfaceId, that.interfaceId); | ||
126 | + } | ||
127 | + | ||
128 | + @Override | ||
129 | + public int hashCode() { | ||
130 | + return Objects.hashCode(systemId, neighborRouterId, interfaceId); | ||
131 | + } | ||
132 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
This diff is collapsed. Click to expand it.
protocols/isis/ctl/src/main/java/org/onosproject/isis/controller/impl/topology/package-info.java
0 → 100644
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 controller topology. | ||
19 | + */ | ||
20 | +package org.onosproject.isis.controller.impl.topology; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -90,7 +90,6 @@ public class LsPdu extends IsisHeader { | ... | @@ -90,7 +90,6 @@ public class LsPdu extends IsisHeader { |
90 | 90 | ||
91 | /** | 91 | /** |
92 | * Creates an instance of Link State packet. | 92 | * Creates an instance of Link State packet. |
93 | - * Parameterized constructor which populate | ||
94 | * | 93 | * |
95 | * @param isisHeader isis header details | 94 | * @param isisHeader isis header details |
96 | */ | 95 | */ |
... | @@ -99,6 +98,15 @@ public class LsPdu extends IsisHeader { | ... | @@ -99,6 +98,15 @@ public class LsPdu extends IsisHeader { |
99 | } | 98 | } |
100 | 99 | ||
101 | /** | 100 | /** |
101 | + * Returns the ISIS tlvs. | ||
102 | + * | ||
103 | + * @return tlvs | ||
104 | + */ | ||
105 | + public List<IsisTlv> tlvs() { | ||
106 | + return this.variableLengths; | ||
107 | + } | ||
108 | + | ||
109 | + /** | ||
102 | * Adds the isis tlv to the list for the link state PDU. | 110 | * Adds the isis tlv to the list for the link state PDU. |
103 | * | 111 | * |
104 | * @param isisTlv isis tlv | 112 | * @param isisTlv isis tlv | ... | ... |
... | @@ -52,6 +52,15 @@ public class IpExtendedReachabilityTlv extends TlvHeader implements IsisTlv { | ... | @@ -52,6 +52,15 @@ public class IpExtendedReachabilityTlv extends TlvHeader implements IsisTlv { |
52 | } | 52 | } |
53 | 53 | ||
54 | /** | 54 | /** |
55 | + * Returns list of traffic engineering sub tlvs. | ||
56 | + * | ||
57 | + * @return trafEnginSubTlv | ||
58 | + */ | ||
59 | + public List<TrafficEngineeringSubTlv> teTlvs() { | ||
60 | + return this.trafEnginSubTlv; | ||
61 | + } | ||
62 | + | ||
63 | + /** | ||
55 | * Returns the prefix of IP external reachability TLV. | 64 | * Returns the prefix of IP external reachability TLV. |
56 | * | 65 | * |
57 | * @return prefix | 66 | * @return prefix | ... | ... |
... | @@ -41,6 +41,15 @@ public class IsExtendedReachability extends TlvHeader implements IsisTlv { | ... | @@ -41,6 +41,15 @@ public class IsExtendedReachability extends TlvHeader implements IsisTlv { |
41 | } | 41 | } |
42 | 42 | ||
43 | /** | 43 | /** |
44 | + * Returns neighbor list. | ||
45 | + * | ||
46 | + * @return neighbor list | ||
47 | + */ | ||
48 | + public List<NeighborForExtendedIs> neighbours() { | ||
49 | + return neighbors; | ||
50 | + } | ||
51 | + | ||
52 | + /** | ||
44 | * Adds the neighbor for extended IS instance to IS extended reachability TLV. | 53 | * Adds the neighbor for extended IS instance to IS extended reachability TLV. |
45 | * | 54 | * |
46 | * @param neighbor neighbor for extended IS instance | 55 | * @param neighbor neighbor for extended IS instance | ... | ... |
1 | /* | 1 | /* |
2 | - * Copyright 2016-present Open Networking Laboratory | 2 | +* Copyright 2016-present Open Networking Laboratory |
3 | - * | 3 | +* |
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | 4 | +* Licensed under the Apache License, Version 2.0 (the "License"); |
5 | - * you may not use this file except in compliance with 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 | 6 | +* You may obtain a copy of the License at |
7 | - * | 7 | +* |
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | 8 | +* http://www.apache.org/licenses/LICENSE-2.0 |
9 | - * | 9 | +* |
10 | - * Unless required by applicable law or agreed to in writing, software | 10 | +* Unless required by applicable law or agreed to in writing, software |
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | 11 | +* distributed under the License is distributed on an "AS IS" BASIS, |
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 12 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
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.io.isispacket.tlv.subtlv; | 16 | package org.onosproject.isis.io.isispacket.tlv.subtlv; |
17 | 17 | ||
18 | import com.google.common.base.MoreObjects; | 18 | import com.google.common.base.MoreObjects; |
... | @@ -32,8 +32,8 @@ import java.util.List; | ... | @@ -32,8 +32,8 @@ import java.util.List; |
32 | */ | 32 | */ |
33 | public class InterfaceIpAddress extends TlvHeader implements TrafficEngineeringSubTlv { | 33 | public class InterfaceIpAddress extends TlvHeader implements TrafficEngineeringSubTlv { |
34 | private static final Logger log = | 34 | private static final Logger log = |
35 | - LoggerFactory.getLogger(InterfaceIpAddress.class); | 35 | + LoggerFactory.getLogger(NeighborIpAddress.class); |
36 | - private List<Ip4Address> localInterfaceIPAddress = new ArrayList<>(); | 36 | + private Ip4Address localInterfaceIPAddress; |
37 | 37 | ||
38 | /** | 38 | /** |
39 | * Creates an instance of local interface ip address. | 39 | * Creates an instance of local interface ip address. |
... | @@ -50,16 +50,16 @@ public class InterfaceIpAddress extends TlvHeader implements TrafficEngineeringS | ... | @@ -50,16 +50,16 @@ public class InterfaceIpAddress extends TlvHeader implements TrafficEngineeringS |
50 | * | 50 | * |
51 | * @param localAddress ip address | 51 | * @param localAddress ip address |
52 | */ | 52 | */ |
53 | - public void addLocalInterfaceIPAddress(Ip4Address localAddress) { | 53 | + public void setIpAddress(Ip4Address localAddress) { |
54 | - localInterfaceIPAddress.add(localAddress); | 54 | + this.localInterfaceIPAddress = localAddress; |
55 | } | 55 | } |
56 | 56 | ||
57 | /** | 57 | /** |
58 | - * Returns local interface ip address. | 58 | + * Gets local interface ip address. |
59 | * | 59 | * |
60 | * @return localAddress ip address | 60 | * @return localAddress ip address |
61 | */ | 61 | */ |
62 | - public List<Ip4Address> getLocalInterfaceIPAddress() { | 62 | + public Ip4Address localInterfaceIPAddress() { |
63 | return localInterfaceIPAddress; | 63 | return localInterfaceIPAddress; |
64 | } | 64 | } |
65 | 65 | ||
... | @@ -72,17 +72,19 @@ public class InterfaceIpAddress extends TlvHeader implements TrafficEngineeringS | ... | @@ -72,17 +72,19 @@ public class InterfaceIpAddress extends TlvHeader implements TrafficEngineeringS |
72 | while (channelBuffer.readableBytes() >= IsisUtil.FOUR_BYTES) { | 72 | while (channelBuffer.readableBytes() >= IsisUtil.FOUR_BYTES) { |
73 | byte[] tempByteArray = new byte[IsisUtil.FOUR_BYTES]; | 73 | byte[] tempByteArray = new byte[IsisUtil.FOUR_BYTES]; |
74 | channelBuffer.readBytes(tempByteArray, 0, IsisUtil.FOUR_BYTES); | 74 | channelBuffer.readBytes(tempByteArray, 0, IsisUtil.FOUR_BYTES); |
75 | - this.addLocalInterfaceIPAddress(Ip4Address.valueOf(tempByteArray)); | 75 | + this.setIpAddress(Ip4Address.valueOf(tempByteArray)); |
76 | + | ||
76 | } | 77 | } |
77 | } | 78 | } |
78 | 79 | ||
79 | /** | 80 | /** |
80 | - * Returns local interface ip address as byte array. | 81 | + * Gets local interface ip address as byte array. |
81 | * | 82 | * |
82 | * @return local interface ip address as byte array | 83 | * @return local interface ip address as byte array |
83 | */ | 84 | */ |
84 | public byte[] asBytes() { | 85 | public byte[] asBytes() { |
85 | byte[] linkSubType = null; | 86 | byte[] linkSubType = null; |
87 | + | ||
86 | byte[] linkSubTlvHeader = tlvHeaderAsByteArray(); | 88 | byte[] linkSubTlvHeader = tlvHeaderAsByteArray(); |
87 | byte[] linkSubTlvBody = tlvBodyAsBytes(); | 89 | byte[] linkSubTlvBody = tlvBodyAsBytes(); |
88 | linkSubType = Bytes.concat(linkSubTlvHeader, linkSubTlvBody); | 90 | linkSubType = Bytes.concat(linkSubTlvHeader, linkSubTlvBody); |
... | @@ -91,15 +93,16 @@ public class InterfaceIpAddress extends TlvHeader implements TrafficEngineeringS | ... | @@ -91,15 +93,16 @@ public class InterfaceIpAddress extends TlvHeader implements TrafficEngineeringS |
91 | } | 93 | } |
92 | 94 | ||
93 | /** | 95 | /** |
94 | - * Returns byte array of local interface ip address. | 96 | + * Gets byte array of local interface ip address. |
95 | * | 97 | * |
96 | * @return byte array of local interface ip address | 98 | * @return byte array of local interface ip address |
97 | */ | 99 | */ |
98 | public byte[] tlvBodyAsBytes() { | 100 | public byte[] tlvBodyAsBytes() { |
101 | + | ||
99 | List<Byte> linkSubTypeBody = new ArrayList<>(); | 102 | List<Byte> linkSubTypeBody = new ArrayList<>(); |
100 | - for (Ip4Address remoteAddress : this.localInterfaceIPAddress) { | 103 | + |
101 | - linkSubTypeBody.addAll(Bytes.asList(remoteAddress.toOctets())); | 104 | + linkSubTypeBody.addAll(Bytes.asList(this.localInterfaceIPAddress.toOctets())); |
102 | - } | 105 | + |
103 | 106 | ||
104 | return Bytes.toArray(linkSubTypeBody); | 107 | return Bytes.toArray(linkSubTypeBody); |
105 | } | 108 | } |
... | @@ -111,4 +114,4 @@ public class InterfaceIpAddress extends TlvHeader implements TrafficEngineeringS | ... | @@ -111,4 +114,4 @@ public class InterfaceIpAddress extends TlvHeader implements TrafficEngineeringS |
111 | .add("localInterfaceIPAddress", localInterfaceIPAddress) | 114 | .add("localInterfaceIPAddress", localInterfaceIPAddress) |
112 | .toString(); | 115 | .toString(); |
113 | } | 116 | } |
114 | -} | 117 | +} |
... | \ 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.io.isispacket.tlv.subtlv; | ||
17 | + | ||
18 | +import com.google.common.base.MoreObjects; | ||
19 | +import com.google.common.base.Objects; | ||
20 | +import com.google.common.primitives.Bytes; | ||
21 | +import org.jboss.netty.buffer.ChannelBuffer; | ||
22 | +import org.onlab.packet.Ip4Address; | ||
23 | +import org.onosproject.isis.io.isispacket.tlv.TlvHeader; | ||
24 | +import org.onosproject.isis.io.util.IsisUtil; | ||
25 | +import org.slf4j.Logger; | ||
26 | +import org.slf4j.LoggerFactory; | ||
27 | + | ||
28 | +import java.util.ArrayList; | ||
29 | +import java.util.List; | ||
30 | + | ||
31 | +/** | ||
32 | + * Representation of neighbor ip address TE value. | ||
33 | + */ | ||
34 | +public class NeighborIpAddress extends TlvHeader implements TrafficEngineeringSubTlv { | ||
35 | + private static final Logger log = | ||
36 | + LoggerFactory.getLogger(NeighborIpAddress.class); | ||
37 | + private Ip4Address neighborIPAddress; | ||
38 | + | ||
39 | + /** | ||
40 | + * Creates an instance of neighbor ip address. | ||
41 | + * | ||
42 | + * @param header tlv header instance | ||
43 | + */ | ||
44 | + public NeighborIpAddress(TlvHeader header) { | ||
45 | + this.setTlvType(header.tlvType()); | ||
46 | + this.setTlvLength(header.tlvLength()); | ||
47 | + } | ||
48 | + | ||
49 | + /** | ||
50 | + * Sets the neighbor ip address. | ||
51 | + * | ||
52 | + * @param neighborIPAddress ip address | ||
53 | + */ | ||
54 | + public void setIpAddress(Ip4Address neighborIPAddress) { | ||
55 | + this.neighborIPAddress = neighborIPAddress; | ||
56 | + } | ||
57 | + | ||
58 | + /** | ||
59 | + * Gets the neighbor ip address. | ||
60 | + * | ||
61 | + * @return neighbor ip address | ||
62 | + */ | ||
63 | + public Ip4Address neighborIPAddress() { | ||
64 | + return neighborIPAddress; | ||
65 | + } | ||
66 | + | ||
67 | + /** | ||
68 | + * Reads bytes from channel buffer. | ||
69 | + * | ||
70 | + * @param channelBuffer channel buffer instance | ||
71 | + */ | ||
72 | + public void readFrom(ChannelBuffer channelBuffer) { | ||
73 | + while (channelBuffer.readableBytes() >= IsisUtil.FOUR_BYTES) { | ||
74 | + byte[] tempByteArray = new byte[IsisUtil.FOUR_BYTES]; | ||
75 | + channelBuffer.readBytes(tempByteArray, 0, IsisUtil.FOUR_BYTES); | ||
76 | + this.setIpAddress(Ip4Address.valueOf(tempByteArray)); | ||
77 | + | ||
78 | + } | ||
79 | + } | ||
80 | + | ||
81 | + /** | ||
82 | + * Gets the neighbor ip address as byte array. | ||
83 | + * | ||
84 | + * @return neighbor ip address as byte array | ||
85 | + */ | ||
86 | + public byte[] asBytes() { | ||
87 | + byte[] linkSubType = null; | ||
88 | + | ||
89 | + byte[] linkSubTlvHeader = tlvHeaderAsByteArray(); | ||
90 | + byte[] linkSubTlvBody = tlvBodyAsBytes(); | ||
91 | + linkSubType = Bytes.concat(linkSubTlvHeader, linkSubTlvBody); | ||
92 | + | ||
93 | + return linkSubType; | ||
94 | + } | ||
95 | + | ||
96 | + /** | ||
97 | + * Gets byte array of neighborIPAddress. | ||
98 | + * | ||
99 | + * @return byte array of neighborIPAddress | ||
100 | + */ | ||
101 | + public byte[] tlvBodyAsBytes() { | ||
102 | + | ||
103 | + List<Byte> linkSubTypeBody = new ArrayList<>(); | ||
104 | + | ||
105 | + linkSubTypeBody.addAll(Bytes.asList(this.neighborIPAddress.toOctets())); | ||
106 | + | ||
107 | + | ||
108 | + return Bytes.toArray(linkSubTypeBody); | ||
109 | + } | ||
110 | + | ||
111 | + @Override | ||
112 | + public boolean equals(Object o) { | ||
113 | + if (this == o) { | ||
114 | + return true; | ||
115 | + } | ||
116 | + if (o == null || getClass() != o.getClass()) { | ||
117 | + return false; | ||
118 | + } | ||
119 | + NeighborIpAddress that = (NeighborIpAddress) o; | ||
120 | + return Objects.equal(neighborIPAddress, that.neighborIPAddress); | ||
121 | + } | ||
122 | + | ||
123 | + @Override | ||
124 | + public int hashCode() { | ||
125 | + return Objects.hashCode(neighborIPAddress); | ||
126 | + } | ||
127 | + | ||
128 | + @Override | ||
129 | + public String toString() { | ||
130 | + return MoreObjects.toStringHelper(getClass()) | ||
131 | + .omitNullValues() | ||
132 | + .add("localInterfaceIPAddress", neighborIPAddress) | ||
133 | + .toString(); | ||
134 | + } | ||
135 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -67,7 +67,7 @@ public final class SubTlvFinder { | ... | @@ -67,7 +67,7 @@ public final class SubTlvFinder { |
67 | subTlv = unreservedBandwidth; | 67 | subTlv = unreservedBandwidth; |
68 | break; | 68 | break; |
69 | case INTERFACEADDRESS: | 69 | case INTERFACEADDRESS: |
70 | - InterfaceIpAddress ipInterfaceAddressTlv = new InterfaceIpAddress(tlvHeader); | 70 | + NeighborIpAddress ipInterfaceAddressTlv = new NeighborIpAddress(tlvHeader); |
71 | ipInterfaceAddressTlv.readFrom(channelBuffer); | 71 | ipInterfaceAddressTlv.readFrom(channelBuffer); |
72 | subTlv = ipInterfaceAddressTlv; | 72 | subTlv = ipInterfaceAddressTlv; |
73 | break; | 73 | break; | ... | ... |
protocols/isis/isisio/src/main/java/org/onosproject/isis/io/isispacket/tlv/subtlv/SubTlvToBytes.java
... | @@ -60,8 +60,8 @@ public final class SubTlvToBytes { | ... | @@ -60,8 +60,8 @@ public final class SubTlvToBytes { |
60 | } else if (subTlv instanceof UnreservedBandwidth) { | 60 | } else if (subTlv instanceof UnreservedBandwidth) { |
61 | UnreservedBandwidth unreservedBandwidth = (UnreservedBandwidth) subTlv; | 61 | UnreservedBandwidth unreservedBandwidth = (UnreservedBandwidth) subTlv; |
62 | subTlvBytes.addAll(Bytes.asList(unreservedBandwidth.asBytes())); | 62 | subTlvBytes.addAll(Bytes.asList(unreservedBandwidth.asBytes())); |
63 | - } else if (subTlv instanceof InterfaceIpAddress) { | 63 | + } else if (subTlv instanceof NeighborIpAddress) { |
64 | - InterfaceIpAddress interfaceIpAddress = (InterfaceIpAddress) subTlv; | 64 | + NeighborIpAddress interfaceIpAddress = (NeighborIpAddress) subTlv; |
65 | subTlvBytes.addAll(Bytes.asList(interfaceIpAddress.asBytes())); | 65 | subTlvBytes.addAll(Bytes.asList(interfaceIpAddress.asBytes())); |
66 | } else { | 66 | } else { |
67 | log.debug("TlvsToBytes::UNKNOWN TLV TYPE ::TlvsToBytes "); | 67 | log.debug("TlvsToBytes::UNKNOWN TLV TYPE ::TlvsToBytes "); | ... | ... |
... | @@ -44,6 +44,10 @@ public enum SubTlvType { | ... | @@ -44,6 +44,10 @@ public enum SubTlvType { |
44 | */ | 44 | */ |
45 | INTERFACEADDRESS(6), | 45 | INTERFACEADDRESS(6), |
46 | /** | 46 | /** |
47 | + * Represents traffic engineering neighbor address TLV. | ||
48 | + */ | ||
49 | + NEIGHBORADDRESS(8), | ||
50 | + /** | ||
47 | * Represents traffic engineering unreserved bandwidth TLV. | 51 | * Represents traffic engineering unreserved bandwidth TLV. |
48 | */ | 52 | */ |
49 | UNRESERVEDBANDWIDTH(11); | 53 | UNRESERVEDBANDWIDTH(11); | ... | ... |
... | @@ -65,6 +65,9 @@ public final class IsisConstants { | ... | @@ -65,6 +65,9 @@ public final class IsisConstants { |
65 | public static final String AREAADDRESS = "areaAddress"; | 65 | public static final String AREAADDRESS = "areaAddress"; |
66 | public static final String HOLDINGTIME = "holdingTime"; | 66 | public static final String HOLDINGTIME = "holdingTime"; |
67 | public static final String HELLOINTERVAL = "helloInterval"; | 67 | public static final String HELLOINTERVAL = "helloInterval"; |
68 | + public static final int PORT = 7000; | ||
69 | + public static final String LSPADDED = "LSP_ADDED"; | ||
70 | + public static final String LSPREMOVED = "LSP_REMOVED"; | ||
68 | 71 | ||
69 | /** | 72 | /** |
70 | * Non parameterized constructor. | 73 | * Non parameterized constructor. | ... | ... |
... | @@ -726,4 +726,37 @@ public final class IsisUtil { | ... | @@ -726,4 +726,37 @@ public final class IsisUtil { |
726 | } | 726 | } |
727 | return Bytes.toArray(byteList); | 727 | return Bytes.toArray(byteList); |
728 | } | 728 | } |
729 | + | ||
730 | + /** | ||
731 | + * Return the DIS value from the systemId. | ||
732 | + * | ||
733 | + * @param systemId system Id. | ||
734 | + * @return return true if DIS else false | ||
735 | + */ | ||
736 | + public static boolean checkIsDis(String systemId) { | ||
737 | + StringTokenizer stringTokenizer = new StringTokenizer(systemId, "." + "-"); | ||
738 | + int count = 0; | ||
739 | + while (stringTokenizer.hasMoreTokens()) { | ||
740 | + String str = stringTokenizer.nextToken(); | ||
741 | + if (count == 3) { | ||
742 | + int x = Integer.parseInt(str); | ||
743 | + if (x > 0) { | ||
744 | + return true; | ||
745 | + } | ||
746 | + } | ||
747 | + count++; | ||
748 | + } | ||
749 | + return false; | ||
750 | + } | ||
751 | + | ||
752 | + /** | ||
753 | + * Return the systemId. | ||
754 | + * | ||
755 | + * @param systemId system Id. | ||
756 | + * @return return system ID | ||
757 | + */ | ||
758 | + public static String removeTailingZeros(String systemId) { | ||
759 | + StringTokenizer stringTokenizer = new StringTokenizer(systemId, "-"); | ||
760 | + return stringTokenizer.nextToken(); | ||
761 | + } | ||
729 | } | 762 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -33,7 +33,7 @@ import static org.hamcrest.Matchers.notNullValue; | ... | @@ -33,7 +33,7 @@ import static org.hamcrest.Matchers.notNullValue; |
33 | public class InterfaceIpAddressTest { | 33 | public class InterfaceIpAddressTest { |
34 | private final byte[] packet = {1, 1, 1, 1}; | 34 | private final byte[] packet = {1, 1, 1, 1}; |
35 | private final byte[] packet1 = {}; | 35 | private final byte[] packet1 = {}; |
36 | - private InterfaceIpAddress interfaceIpAddress; | 36 | + private NeighborIpAddress interfaceIpAddress; |
37 | private TlvHeader tlvHeader; | 37 | private TlvHeader tlvHeader; |
38 | private Ip4Address ip4Address = Ip4Address.valueOf("1.1.1.1"); | 38 | private Ip4Address ip4Address = Ip4Address.valueOf("1.1.1.1"); |
39 | private byte[] result; | 39 | private byte[] result; |
... | @@ -41,7 +41,7 @@ public class InterfaceIpAddressTest { | ... | @@ -41,7 +41,7 @@ public class InterfaceIpAddressTest { |
41 | 41 | ||
42 | @Before | 42 | @Before |
43 | public void setUp() throws Exception { | 43 | public void setUp() throws Exception { |
44 | - interfaceIpAddress = new InterfaceIpAddress(new TlvHeader()); | 44 | + interfaceIpAddress = new NeighborIpAddress(new TlvHeader()); |
45 | } | 45 | } |
46 | 46 | ||
47 | @After | 47 | @After |
... | @@ -61,15 +61,6 @@ public class InterfaceIpAddressTest { | ... | @@ -61,15 +61,6 @@ public class InterfaceIpAddressTest { |
61 | } | 61 | } |
62 | 62 | ||
63 | /** | 63 | /** |
64 | - * Tests addLocalInterfaceIPAddress() method. | ||
65 | - */ | ||
66 | - @Test | ||
67 | - public void testAddLocalInterfaceIPAddress() throws Exception { | ||
68 | - interfaceIpAddress.addLocalInterfaceIPAddress(ip4Address); | ||
69 | - assertThat(interfaceIpAddress, is(notNullValue())); | ||
70 | - } | ||
71 | - | ||
72 | - /** | ||
73 | * Tests readFrom() method. | 64 | * Tests readFrom() method. |
74 | */ | 65 | */ |
75 | @Test | 66 | @Test |
... | @@ -77,7 +68,7 @@ public class InterfaceIpAddressTest { | ... | @@ -77,7 +68,7 @@ public class InterfaceIpAddressTest { |
77 | tlvHeader = new TlvHeader(); | 68 | tlvHeader = new TlvHeader(); |
78 | tlvHeader.setTlvType(3); | 69 | tlvHeader.setTlvType(3); |
79 | tlvHeader.setTlvLength(4); | 70 | tlvHeader.setTlvLength(4); |
80 | - interfaceIpAddress = new InterfaceIpAddress(tlvHeader); | 71 | + interfaceIpAddress = new NeighborIpAddress(tlvHeader); |
81 | channelBuffer = ChannelBuffers.copiedBuffer(packet); | 72 | channelBuffer = ChannelBuffers.copiedBuffer(packet); |
82 | interfaceIpAddress.readFrom(channelBuffer); | 73 | interfaceIpAddress.readFrom(channelBuffer); |
83 | assertThat(interfaceIpAddress, is(notNullValue())); | 74 | assertThat(interfaceIpAddress, is(notNullValue())); |
... | @@ -91,27 +82,11 @@ public class InterfaceIpAddressTest { | ... | @@ -91,27 +82,11 @@ public class InterfaceIpAddressTest { |
91 | tlvHeader = new TlvHeader(); | 82 | tlvHeader = new TlvHeader(); |
92 | tlvHeader.setTlvType(3); | 83 | tlvHeader.setTlvType(3); |
93 | tlvHeader.setTlvLength(4); | 84 | tlvHeader.setTlvLength(4); |
94 | - interfaceIpAddress = new InterfaceIpAddress(tlvHeader); | 85 | + interfaceIpAddress = new NeighborIpAddress(tlvHeader); |
95 | channelBuffer = ChannelBuffers.copiedBuffer(packet1); | 86 | channelBuffer = ChannelBuffers.copiedBuffer(packet1); |
96 | interfaceIpAddress.readFrom(channelBuffer); | 87 | interfaceIpAddress.readFrom(channelBuffer); |
97 | assertThat(interfaceIpAddress, is(notNullValue())); | 88 | assertThat(interfaceIpAddress, is(notNullValue())); |
98 | } | 89 | } |
99 | 90 | ||
100 | - /** | ||
101 | - * Tests asBytes() method. | ||
102 | - */ | ||
103 | - @Test | ||
104 | - public void testAsBytes() throws Exception { | ||
105 | - result = interfaceIpAddress.asBytes(); | ||
106 | - assertThat(result, is(notNullValue())); | ||
107 | - } | ||
108 | 91 | ||
109 | - /** | ||
110 | - * Tests getLinkSubTypeTlvBodyAsByteArray() method. | ||
111 | - */ | ||
112 | - @Test | ||
113 | - public void testGetLinkSubTypeTlvBodyAsByteArray() throws Exception { | ||
114 | - result = interfaceIpAddress.tlvBodyAsBytes(); | ||
115 | - assertThat(result, is(notNullValue())); | ||
116 | - } | ||
117 | } | 92 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -3,7 +3,7 @@ BUNDLES = [ | ... | @@ -3,7 +3,7 @@ BUNDLES = [ |
3 | '//protocols/isis/ctl:onos-protocols-isis-ctl', | 3 | '//protocols/isis/ctl:onos-protocols-isis-ctl', |
4 | '//protocols/isis/isisio:onos-protocols-isis-isisio', | 4 | '//protocols/isis/isisio:onos-protocols-isis-isisio', |
5 | '//providers/isis/cfg:onos-providers-isis-cfg', | 5 | '//providers/isis/cfg:onos-providers-isis-cfg', |
6 | - '//providers/isis/device:onos-providers-isis-device', | 6 | + '//providers/isis/topology:onos-providers-isis-topology', |
7 | ] | 7 | ] |
8 | 8 | ||
9 | onos_app ( | 9 | onos_app ( | ... | ... |
... | @@ -21,6 +21,7 @@ | ... | @@ -21,6 +21,7 @@ |
21 | <artifact>mvn:${project.groupId}/onos-isis-api/${project.version}</artifact> | 21 | <artifact>mvn:${project.groupId}/onos-isis-api/${project.version}</artifact> |
22 | <artifact>mvn:${project.groupId}/onos-isis-isisio/${project.version}</artifact> | 22 | <artifact>mvn:${project.groupId}/onos-isis-isisio/${project.version}</artifact> |
23 | <artifact>mvn:${project.groupId}/onos-isis-ctl/${project.version}</artifact> | 23 | <artifact>mvn:${project.groupId}/onos-isis-ctl/${project.version}</artifact> |
24 | - <artifact>mvn:${project.groupId}/onos-isis-provider-device/${project.version}</artifact> | 24 | + <artifact>mvn:${project.groupId}/onos-isis-provider-topology/${project.version}</artifact> |
25 | <artifact>mvn:${project.groupId}/onos-isis-provider-cfg/${project.version}</artifact> | 25 | <artifact>mvn:${project.groupId}/onos-isis-provider-cfg/${project.version}</artifact> |
26 | + <artifact>mvn:${project.groupId}/onos-isis-provider-cli/${project.version}</artifact> | ||
26 | </app> | 27 | </app> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -15,13 +15,15 @@ | ... | @@ -15,13 +15,15 @@ |
15 | ~ limitations under the License. | 15 | ~ limitations under the License. |
16 | --> | 16 | --> |
17 | <features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}"> | 17 | <features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0" name="${project.artifactId}-${project.version}"> |
18 | + <repository>mvn:${project.groupId}/${project.artifactId}/${project.version}/xml/features</repository> | ||
18 | <feature name="${project.artifactId}" version="${project.version}" | 19 | <feature name="${project.artifactId}" version="${project.version}" |
19 | description="${project.description}"> | 20 | description="${project.description}"> |
20 | <feature>onos-api</feature> | 21 | <feature>onos-api</feature> |
21 | <bundle>mvn:${project.groupId}/onos-isis-api/${project.version}</bundle> | 22 | <bundle>mvn:${project.groupId}/onos-isis-api/${project.version}</bundle> |
22 | <bundle>mvn:${project.groupId}/onos-isis-isisio/${project.version}</bundle> | 23 | <bundle>mvn:${project.groupId}/onos-isis-isisio/${project.version}</bundle> |
23 | <bundle>mvn:${project.groupId}/onos-isis-ctl/${project.version}</bundle> | 24 | <bundle>mvn:${project.groupId}/onos-isis-ctl/${project.version}</bundle> |
24 | - <bundle>mvn:${project.groupId}/onos-isis-provider-device/${project.version}</bundle> | 25 | + <bundle>mvn:${project.groupId}/onos-isis-provider-topology/${project.version}</bundle> |
25 | <bundle>mvn:${project.groupId}/onos-isis-provider-cfg/${project.version}</bundle> | 26 | <bundle>mvn:${project.groupId}/onos-isis-provider-cfg/${project.version}</bundle> |
27 | + <bundle>mvn:${project.groupId}/onos-isis-provider-cli/${project.version}</bundle> | ||
26 | </feature> | 28 | </feature> |
27 | -</features> | 29 | +</features> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -49,7 +49,7 @@ | ... | @@ -49,7 +49,7 @@ |
49 | </dependency> | 49 | </dependency> |
50 | <dependency> | 50 | <dependency> |
51 | <groupId>org.onosproject</groupId> | 51 | <groupId>org.onosproject</groupId> |
52 | - <artifactId>onos-isis-provider-device</artifactId> | 52 | + <artifactId>onos-isis-provider-topology</artifactId> |
53 | <version>${project.version}</version> | 53 | <version>${project.version}</version> |
54 | </dependency> | 54 | </dependency> |
55 | <dependency> | 55 | <dependency> |
... | @@ -57,5 +57,10 @@ | ... | @@ -57,5 +57,10 @@ |
57 | <artifactId>onos-isis-provider-cfg</artifactId> | 57 | <artifactId>onos-isis-provider-cfg</artifactId> |
58 | <version>${project.version}</version> | 58 | <version>${project.version}</version> |
59 | </dependency> | 59 | </dependency> |
60 | + <dependency> | ||
61 | + <groupId>org.onosproject</groupId> | ||
62 | + <artifactId>onos-isis-provider-cli</artifactId> | ||
63 | + <version>${project.version}</version> | ||
64 | + </dependency> | ||
60 | </dependencies> | 65 | </dependencies> |
61 | -</project> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
66 | +</project> | ... | ... |
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 | -package org.onosproject.provider.isis.device.impl; | ||
18 | - | ||
19 | -import org.apache.felix.scr.annotations.Activate; | ||
20 | -import org.apache.felix.scr.annotations.Component; | ||
21 | -import org.apache.felix.scr.annotations.Deactivate; | ||
22 | -import org.apache.felix.scr.annotations.Reference; | ||
23 | -import org.apache.felix.scr.annotations.ReferenceCardinality; | ||
24 | -import org.onosproject.isis.controller.IsisController; | ||
25 | -import org.onosproject.net.provider.AbstractProvider; | ||
26 | -import org.onosproject.net.provider.ProviderId; | ||
27 | -import org.slf4j.Logger; | ||
28 | - | ||
29 | -import static org.slf4j.LoggerFactory.getLogger; | ||
30 | - | ||
31 | -/** | ||
32 | - * Provider which advertises device descriptions to the core. | ||
33 | - */ | ||
34 | -@Component(immediate = true) | ||
35 | -public class IsisTopologyProvider extends AbstractProvider { | ||
36 | - | ||
37 | - private static final Logger log = getLogger(IsisTopologyProvider.class); | ||
38 | - final InternalDeviceProvider listener = new InternalDeviceProvider(); | ||
39 | - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | ||
40 | - private IsisController isisController; | ||
41 | - | ||
42 | - | ||
43 | - /** | ||
44 | - * Creates an ISIS device provider. | ||
45 | - */ | ||
46 | - public IsisTopologyProvider() { | ||
47 | - super(new ProviderId("isis", "org.onosproject.provider.isis")); | ||
48 | - } | ||
49 | - | ||
50 | - @Activate | ||
51 | - public void activate() { | ||
52 | - log.debug("Activate...!!!"); | ||
53 | - } | ||
54 | - | ||
55 | - @Deactivate | ||
56 | - public void deactivate() { | ||
57 | - log.debug("Deactivate...!!!"); | ||
58 | - } | ||
59 | - | ||
60 | - /** | ||
61 | - * Internal device provider implementation. | ||
62 | - */ | ||
63 | - private class InternalDeviceProvider { | ||
64 | - | ||
65 | - } | ||
66 | -} |
... | @@ -32,10 +32,10 @@ | ... | @@ -32,10 +32,10 @@ |
32 | <description>ONOS ISIS protocol adapters</description> | 32 | <description>ONOS ISIS protocol adapters</description> |
33 | 33 | ||
34 | <modules> | 34 | <modules> |
35 | - <module>device</module> | ||
36 | <module>app</module> | 35 | <module>app</module> |
37 | <module>cfg</module> | 36 | <module>cfg</module> |
38 | <module>cli</module> | 37 | <module>cli</module> |
38 | + <module>topology</module> | ||
39 | </modules> | 39 | </modules> |
40 | 40 | ||
41 | <dependencies> | 41 | <dependencies> | ... | ... |
... | @@ -26,7 +26,7 @@ | ... | @@ -26,7 +26,7 @@ |
26 | <relativePath>../pom.xml</relativePath> | 26 | <relativePath>../pom.xml</relativePath> |
27 | </parent> | 27 | </parent> |
28 | 28 | ||
29 | - <artifactId>onos-isis-provider-device</artifactId> | 29 | + <artifactId>onos-isis-provider-topology</artifactId> |
30 | <packaging>bundle</packaging> | 30 | <packaging>bundle</packaging> |
31 | 31 | ||
32 | <description>ONOS ISIS Providers</description> | 32 | <description>ONOS ISIS Providers</description> | ... | ... |
This diff is collapsed. Click to expand it.
... | @@ -17,4 +17,4 @@ | ... | @@ -17,4 +17,4 @@ |
17 | /** | 17 | /** |
18 | * Provider that uses ISIS request as a means of infrastructure device discovery. | 18 | * Provider that uses ISIS request as a means of infrastructure device discovery. |
19 | */ | 19 | */ |
20 | -package org.onosproject.provider.isis.device.impl; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
20 | +package org.onosproject.provider.isis.topology.impl; | ... | ... |
-
Please register or login to post a comment