ISIS protocol manual merge from 1.6 due to cherry pick merge conflict
Change-Id: I6c3abf6a83ddaeba76293dc7864fcec88e9b4e7e
Showing
55 changed files
with
1765 additions
and
256 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 | ... | ... |
... | @@ -122,4 +122,11 @@ public interface IsisLsdb { | ... | @@ -122,4 +122,11 @@ public interface IsisLsdb { |
122 | * @param l2LspSeqNo link state sequence number | 122 | * @param l2LspSeqNo link state sequence number |
123 | */ | 123 | */ |
124 | void setL2LspSeqNo(int l2LspSeqNo); | 124 | void setL2LspSeqNo(int l2LspSeqNo); |
125 | + /** | ||
126 | + * Removes topology information when neighbor down. | ||
127 | + * | ||
128 | + * @param neighbor ISIS neighbor instance | ||
129 | + * @param isisInterface ISIS interface instance | ||
130 | + */ | ||
131 | + void removeTopology(IsisNeighbor neighbor, IsisInterface isisInterface); | ||
125 | } | 132 | } |
... | \ 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 |
... | @@ -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(); |
504 | + } | ||
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); | ||
485 | } | 542 | } |
486 | - this.connectExecutor.schedule(new ConnectionRetry(), retryDelay, TimeUnit.MINUTES); | 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 | /** | ... | ... |
... | @@ -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 | ||
116 | + /** | ||
117 | + * Notifier for internal ISIS device and link changes. | ||
118 | + */ | ||
119 | + private class InternalDeviceConfig implements IsisAgent { | ||
73 | @Override | 120 | @Override |
74 | - public void addRouterListener(IsisRouterListener isisRouterListener) { | 121 | + public boolean addConnectedRouter(IsisRouter isisRouter) { |
75 | - log.debug("IsisControllerImpl::addRouterListener..."); | 122 | + for (IsisRouterListener l : listener()) { |
123 | + l.routerAdded(isisRouter); | ||
124 | + } | ||
125 | + return true; | ||
76 | } | 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 | ... | ... |
protocols/isis/ctl/src/main/java/org/onosproject/isis/controller/impl/DefaultIsisNeighbor.java
100644 → 100755
... | @@ -356,6 +356,8 @@ public class DefaultIsisNeighbor implements IsisNeighbor { | ... | @@ -356,6 +356,8 @@ public class DefaultIsisNeighbor implements IsisNeighbor { |
356 | stopInactivityTimeCheck(); | 356 | stopInactivityTimeCheck(); |
357 | stopHoldingTimeCheck(); | 357 | stopHoldingTimeCheck(); |
358 | isisInterface.removeNeighbor(this); | 358 | isisInterface.removeNeighbor(this); |
359 | + | ||
360 | + isisInterface.isisLsdb().removeTopology(this, isisInterface); | ||
359 | } | 361 | } |
360 | 362 | ||
361 | /** | 363 | /** | ... | ... |
... | @@ -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 → 100755
This diff is collapsed. Click to expand it.
protocols/isis/ctl/src/main/java/org/onosproject/isis/controller/impl/lsdb/DefaultIsisLsdb.java
100644 → 100755
... | @@ -21,17 +21,24 @@ import org.onosproject.isis.controller.IsisLsdb; | ... | @@ -21,17 +21,24 @@ import org.onosproject.isis.controller.IsisLsdb; |
21 | import org.onosproject.isis.controller.IsisLsdbAge; | 21 | import org.onosproject.isis.controller.IsisLsdbAge; |
22 | import org.onosproject.isis.controller.IsisLspBin; | 22 | 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.IsisNeighbor; | ||
24 | import org.onosproject.isis.controller.IsisPduType; | 25 | import org.onosproject.isis.controller.IsisPduType; |
26 | +import org.onosproject.isis.controller.IsisRouterType; | ||
25 | import org.onosproject.isis.controller.LspWrapper; | 27 | import org.onosproject.isis.controller.LspWrapper; |
28 | +import org.onosproject.isis.controller.impl.Controller; | ||
29 | +import org.onosproject.isis.controller.impl.LspEventConsumer; | ||
26 | import org.onosproject.isis.io.isispacket.pdu.LsPdu; | 30 | import org.onosproject.isis.io.isispacket.pdu.LsPdu; |
27 | import org.onosproject.isis.io.util.IsisConstants; | 31 | import org.onosproject.isis.io.util.IsisConstants; |
28 | import org.onosproject.isis.io.util.IsisUtil; | 32 | import org.onosproject.isis.io.util.IsisUtil; |
29 | import org.slf4j.Logger; | 33 | import org.slf4j.Logger; |
30 | import org.slf4j.LoggerFactory; | 34 | import org.slf4j.LoggerFactory; |
31 | 35 | ||
36 | +import java.util.ArrayList; | ||
32 | import java.util.Iterator; | 37 | import java.util.Iterator; |
33 | import java.util.List; | 38 | import java.util.List; |
34 | import java.util.Map; | 39 | import java.util.Map; |
40 | +import java.util.concurrent.ArrayBlockingQueue; | ||
41 | +import java.util.concurrent.BlockingQueue; | ||
35 | import java.util.concurrent.ConcurrentHashMap; | 42 | import java.util.concurrent.ConcurrentHashMap; |
36 | import java.util.concurrent.CopyOnWriteArrayList; | 43 | import java.util.concurrent.CopyOnWriteArrayList; |
37 | 44 | ||
... | @@ -43,10 +50,14 @@ public class DefaultIsisLsdb implements IsisLsdb { | ... | @@ -43,10 +50,14 @@ public class DefaultIsisLsdb implements IsisLsdb { |
43 | private Map<String, LspWrapper> isisL1Db = new ConcurrentHashMap<>(); | 50 | private Map<String, LspWrapper> isisL1Db = new ConcurrentHashMap<>(); |
44 | private Map<String, LspWrapper> isisL2Db = new ConcurrentHashMap<>(); | 51 | private Map<String, LspWrapper> isisL2Db = new ConcurrentHashMap<>(); |
45 | private IsisLsdbAge lsdbAge = null; | 52 | private IsisLsdbAge lsdbAge = null; |
53 | + private Controller controller = null; | ||
54 | + private List<IsisInterface> isisInterfaceList = new ArrayList<>(); | ||
46 | 55 | ||
47 | 56 | ||
48 | private int l1LspSeqNo = IsisConstants.STARTLSSEQUENCENUM; | 57 | private int l1LspSeqNo = IsisConstants.STARTLSSEQUENCENUM; |
49 | private int l2LspSeqNo = IsisConstants.STARTLSSEQUENCENUM; | 58 | private int l2LspSeqNo = IsisConstants.STARTLSSEQUENCENUM; |
59 | + private LspEventConsumer queueConsumer = null; | ||
60 | + private BlockingQueue<LspWrapper> lspForProviderQueue = new ArrayBlockingQueue<>(1024); | ||
50 | 61 | ||
51 | /** | 62 | /** |
52 | * Creates an instance of ISIS LSDB. | 63 | * Creates an instance of ISIS LSDB. |
... | @@ -56,10 +67,30 @@ public class DefaultIsisLsdb implements IsisLsdb { | ... | @@ -56,10 +67,30 @@ public class DefaultIsisLsdb implements IsisLsdb { |
56 | } | 67 | } |
57 | 68 | ||
58 | /** | 69 | /** |
70 | + * Sets the controller instance. | ||
71 | + * | ||
72 | + * @param controller controller instance | ||
73 | + */ | ||
74 | + public void setController(Controller controller) { | ||
75 | + this.controller = controller; | ||
76 | + } | ||
77 | + | ||
78 | + /** | ||
79 | + * Sets the list of IsisInterface instance. | ||
80 | + * | ||
81 | + * @param isisInterfaceList isisInterface instance | ||
82 | + */ | ||
83 | + public void setIsisInterface(List<IsisInterface> isisInterfaceList) { | ||
84 | + this.isisInterfaceList = isisInterfaceList; | ||
85 | + } | ||
86 | + | ||
87 | + /** | ||
59 | * Initializes the link state database. | 88 | * Initializes the link state database. |
60 | */ | 89 | */ |
61 | public void initializeDb() { | 90 | public void initializeDb() { |
62 | lsdbAge.startDbAging(); | 91 | lsdbAge.startDbAging(); |
92 | + queueConsumer = new LspEventConsumer(lspForProviderQueue, controller); | ||
93 | + new Thread(queueConsumer).start(); | ||
63 | } | 94 | } |
64 | 95 | ||
65 | /** | 96 | /** |
... | @@ -96,7 +127,6 @@ public class DefaultIsisLsdb implements IsisLsdb { | ... | @@ -96,7 +127,6 @@ public class DefaultIsisLsdb implements IsisLsdb { |
96 | return lspKey.toString(); | 127 | return lspKey.toString(); |
97 | } | 128 | } |
98 | 129 | ||
99 | - | ||
100 | /** | 130 | /** |
101 | * Returns the neighbor L1 database information. | 131 | * Returns the neighbor L1 database information. |
102 | * | 132 | * |
... | @@ -236,6 +266,14 @@ public class DefaultIsisLsdb implements IsisLsdb { | ... | @@ -236,6 +266,14 @@ public class DefaultIsisLsdb implements IsisLsdb { |
236 | addLsp(lspWrapper, lspdu.lspId()); | 266 | addLsp(lspWrapper, lspdu.lspId()); |
237 | 267 | ||
238 | log.debug("Added LSp In LSDB: {}", lspWrapper); | 268 | log.debug("Added LSp In LSDB: {}", lspWrapper); |
269 | + try { | ||
270 | + if (!lspWrapper.isSelfOriginated()) { | ||
271 | + lspWrapper.setLspProcessing(IsisConstants.LSPADDED); | ||
272 | + lspForProviderQueue.put(lspWrapper); | ||
273 | + } | ||
274 | + } catch (Exception e) { | ||
275 | + log.debug("Added LSp In Blocking queue: {}", lspWrapper); | ||
276 | + } | ||
239 | return true; | 277 | return true; |
240 | } | 278 | } |
241 | 279 | ||
... | @@ -276,6 +314,7 @@ public class DefaultIsisLsdb implements IsisLsdb { | ... | @@ -276,6 +314,7 @@ public class DefaultIsisLsdb implements IsisLsdb { |
276 | lspWrapper.lsPdu().isisPduType(), | 314 | lspWrapper.lsPdu().isisPduType(), |
277 | binNumber, lspWrapper.remainingLifetime()); | 315 | binNumber, lspWrapper.remainingLifetime()); |
278 | } | 316 | } |
317 | + | ||
279 | return false; | 318 | return false; |
280 | } | 319 | } |
281 | 320 | ||
... | @@ -337,6 +376,7 @@ public class DefaultIsisLsdb implements IsisLsdb { | ... | @@ -337,6 +376,7 @@ public class DefaultIsisLsdb implements IsisLsdb { |
337 | public void deleteLsp(IsisMessage lspMessage) { | 376 | public void deleteLsp(IsisMessage lspMessage) { |
338 | LsPdu lsp = (LsPdu) lspMessage; | 377 | LsPdu lsp = (LsPdu) lspMessage; |
339 | String lspKey = lsp.lspId(); | 378 | String lspKey = lsp.lspId(); |
379 | + LspWrapper lspWrapper = findLsp(lspMessage.isisPduType(), lspKey); | ||
340 | switch (lsp.isisPduType()) { | 380 | switch (lsp.isisPduType()) { |
341 | case L1LSPDU: | 381 | case L1LSPDU: |
342 | isisL1Db.remove(lspKey); | 382 | isisL1Db.remove(lspKey); |
... | @@ -348,5 +388,47 @@ public class DefaultIsisLsdb implements IsisLsdb { | ... | @@ -348,5 +388,47 @@ public class DefaultIsisLsdb implements IsisLsdb { |
348 | log.debug("Unknown LSP type to remove..!!!"); | 388 | log.debug("Unknown LSP type to remove..!!!"); |
349 | break; | 389 | break; |
350 | } | 390 | } |
391 | + | ||
392 | + try { | ||
393 | + lspWrapper.setLspProcessing(IsisConstants.LSPREMOVED); | ||
394 | + lspForProviderQueue.put(lspWrapper); | ||
395 | + } catch (Exception e) { | ||
396 | + log.debug("Added LSp In Blocking queue: {}", lspWrapper); | ||
397 | + } | ||
398 | + } | ||
399 | + | ||
400 | + /** | ||
401 | + * Removes topology information when neighbor down. | ||
402 | + * | ||
403 | + * @param neighbor ISIS neighbor instance | ||
404 | + * @param isisInterface ISIS interface instance | ||
405 | + */ | ||
406 | + public void removeTopology(IsisNeighbor neighbor, IsisInterface isisInterface) { | ||
407 | + String lspKey = neighbor.neighborSystemId() + ".00-00"; | ||
408 | + LspWrapper lspWrapper = null; | ||
409 | + switch (IsisRouterType.get(isisInterface.reservedPacketCircuitType())) { | ||
410 | + case L1: | ||
411 | + lspWrapper = findLsp(IsisPduType.L1LSPDU, lspKey); | ||
412 | + break; | ||
413 | + case L2: | ||
414 | + lspWrapper = findLsp(IsisPduType.L2LSPDU, lspKey); | ||
415 | + break; | ||
416 | + case L1L2: | ||
417 | + lspWrapper = findLsp(IsisPduType.L1LSPDU, lspKey); | ||
418 | + if (lspWrapper == null) { | ||
419 | + lspWrapper = findLsp(IsisPduType.L2LSPDU, lspKey); | ||
420 | + } | ||
421 | + break; | ||
422 | + default: | ||
423 | + log.debug("Unknown type"); | ||
424 | + } | ||
425 | + try { | ||
426 | + if (lspWrapper != null) { | ||
427 | + lspWrapper.setLspProcessing(IsisConstants.LSPREMOVED); | ||
428 | + lspForProviderQueue.put(lspWrapper); | ||
429 | + } | ||
430 | + } catch (Exception e) { | ||
431 | + log.debug("Added LSp In Blocking queue: {}", lspWrapper); | ||
432 | + } | ||
351 | } | 433 | } |
352 | } | 434 | } |
... | \ 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
... | @@ -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 | } |
... | @@ -106,7 +105,6 @@ public class IsisLspQueueConsumer implements Runnable { | ... | @@ -106,7 +105,6 @@ public class IsisLspQueueConsumer implements Runnable { |
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 | ... | ... |
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.ArrayList; | ||
25 | +import java.util.List; | ||
26 | + | ||
27 | +/** | ||
28 | + * Representation of an ISIS device information. | ||
29 | + */ | ||
30 | +public class DefaultIsisLinkTed implements IsisLinkTed { | ||
31 | + private int administrativeGroup; | ||
32 | + private Ip4Address ipv4InterfaceAddress; | ||
33 | + private Ip4Address ipv4NeighborAddress; | ||
34 | + private Bandwidth maximumLinkBandwidth; | ||
35 | + private Bandwidth maximumReservableLinkBandwidth; | ||
36 | + private List<Bandwidth> unreservedBandwidth = new ArrayList<>(); | ||
37 | + private long teDefaultMetric; | ||
38 | + | ||
39 | + @Override | ||
40 | + public int administrativeGroup() { | ||
41 | + return administrativeGroup; | ||
42 | + } | ||
43 | + | ||
44 | + @Override | ||
45 | + public void setAdministrativeGroup(int administrativeGroup) { | ||
46 | + this.administrativeGroup = administrativeGroup; | ||
47 | + } | ||
48 | + | ||
49 | + @Override | ||
50 | + public Ip4Address ipv4InterfaceAddress() { | ||
51 | + return ipv4InterfaceAddress; | ||
52 | + } | ||
53 | + | ||
54 | + @Override | ||
55 | + public void setIpv4InterfaceAddress(Ip4Address interfaceAddress) { | ||
56 | + this.ipv4InterfaceAddress = interfaceAddress; | ||
57 | + } | ||
58 | + | ||
59 | + @Override | ||
60 | + public Ip4Address ipv4NeighborAddress() { | ||
61 | + return ipv4NeighborAddress; | ||
62 | + } | ||
63 | + | ||
64 | + @Override | ||
65 | + public void setIpv4NeighborAddress(Ip4Address neighborAddress) { | ||
66 | + this.ipv4NeighborAddress = neighborAddress; | ||
67 | + } | ||
68 | + | ||
69 | + @Override | ||
70 | + public Bandwidth maximumLinkBandwidth() { | ||
71 | + return maximumLinkBandwidth; | ||
72 | + } | ||
73 | + | ||
74 | + @Override | ||
75 | + public void setMaximumLinkBandwidth(Bandwidth bandwidth) { | ||
76 | + this.maximumLinkBandwidth = bandwidth; | ||
77 | + } | ||
78 | + | ||
79 | + @Override | ||
80 | + public Bandwidth maximumReservableLinkBandwidth() { | ||
81 | + return maximumReservableLinkBandwidth; | ||
82 | + } | ||
83 | + | ||
84 | + @Override | ||
85 | + public void setMaximumReservableLinkBandwidth(Bandwidth bandwidth) { | ||
86 | + this.maximumReservableLinkBandwidth = bandwidth; | ||
87 | + } | ||
88 | + | ||
89 | + @Override | ||
90 | + public List<Bandwidth> unreservedBandwidth() { | ||
91 | + return this.unreservedBandwidth; | ||
92 | + } | ||
93 | + | ||
94 | + @Override | ||
95 | + public void setUnreservedBandwidth(List<Bandwidth> bandwidth) { | ||
96 | + this.unreservedBandwidth.addAll(bandwidth); | ||
97 | + } | ||
98 | + | ||
99 | + @Override | ||
100 | + public long teDefaultMetric() { | ||
101 | + return teDefaultMetric; | ||
102 | + } | ||
103 | + | ||
104 | + @Override | ||
105 | + public void setTeDefaultMetric(long teMetric) { | ||
106 | + this.teDefaultMetric = teMetric; | ||
107 | + } | ||
108 | + | ||
109 | + @Override | ||
110 | + public String toString() { | ||
111 | + return MoreObjects.toStringHelper(getClass()) | ||
112 | + .omitNullValues() | ||
113 | + .add("administrativeGroup", administrativeGroup) | ||
114 | + .add("ipv4InterfaceAddress", ipv4InterfaceAddress) | ||
115 | + .add("ipv4NeighborAddress", ipv4NeighborAddress) | ||
116 | + .add("maximumLinkBandwidth", maximumLinkBandwidth) | ||
117 | + .add("maximumReservableLinkBandwidth", maximumReservableLinkBandwidth) | ||
118 | + .add("teDefaultMetric", teDefaultMetric) | ||
119 | + .toString(); | ||
120 | + } | ||
121 | + | ||
122 | + @Override | ||
123 | + public boolean equals(Object o) { | ||
124 | + if (this == o) { | ||
125 | + return true; | ||
126 | + } | ||
127 | + if (o == null || getClass() != o.getClass()) { | ||
128 | + return false; | ||
129 | + } | ||
130 | + DefaultIsisLinkTed that = (DefaultIsisLinkTed) o; | ||
131 | + return Objects.equal(administrativeGroup, that.administrativeGroup) && | ||
132 | + Objects.equal(ipv4InterfaceAddress, that.ipv4InterfaceAddress) && | ||
133 | + Objects.equal(ipv4NeighborAddress, that.ipv4NeighborAddress) && | ||
134 | + Objects.equal(maximumLinkBandwidth, that.maximumLinkBandwidth) && | ||
135 | + Objects.equal(maximumReservableLinkBandwidth, | ||
136 | + that.maximumReservableLinkBandwidth) && | ||
137 | + Objects.equal(teDefaultMetric, that.teDefaultMetric); | ||
138 | + } | ||
139 | + | ||
140 | + @Override | ||
141 | + public int hashCode() { | ||
142 | + return Objects.hashCode(administrativeGroup, ipv4InterfaceAddress, | ||
143 | + ipv4NeighborAddress, maximumLinkBandwidth, teDefaultMetric); | ||
144 | + } | ||
145 | +} | ||
... | \ 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 | ... | ... |
... | @@ -46,6 +46,15 @@ public class NeighborForExtendedIs { | ... | @@ -46,6 +46,15 @@ public class NeighborForExtendedIs { |
46 | } | 46 | } |
47 | 47 | ||
48 | /** | 48 | /** |
49 | + * Returns list of sub tlvs. | ||
50 | + * | ||
51 | + * @return teSubTlv list of sub tlvs | ||
52 | + */ | ||
53 | + public List<TrafficEngineeringSubTlv> teSubTlv() { | ||
54 | + return teSubTlv; | ||
55 | + } | ||
56 | + | ||
57 | + /** | ||
49 | * Sets neighbor ID. | 58 | * Sets neighbor ID. |
50 | * | 59 | * |
51 | * @param neighborId neighbor ID | 60 | * @param neighborId neighbor ID | ... | ... |
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 | } | ... | ... |
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 |
... | @@ -71,6 +71,11 @@ public final class SubTlvFinder { | ... | @@ -71,6 +71,11 @@ public final class SubTlvFinder { |
71 | ipInterfaceAddressTlv.readFrom(channelBuffer); | 71 | ipInterfaceAddressTlv.readFrom(channelBuffer); |
72 | subTlv = ipInterfaceAddressTlv; | 72 | subTlv = ipInterfaceAddressTlv; |
73 | break; | 73 | break; |
74 | + case NEIGHBORADDRESS: | ||
75 | + NeighborIpAddress ipNeighborAddressTlv = new NeighborIpAddress(tlvHeader); | ||
76 | + ipNeighborAddressTlv.readFrom(channelBuffer); | ||
77 | + subTlv = ipNeighborAddressTlv; | ||
78 | + break; | ||
74 | default: | 79 | default: |
75 | //TODO | 80 | //TODO |
76 | break; | 81 | 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); | ... | ... |
... | @@ -54,7 +54,7 @@ public class UnreservedBandwidth extends TlvHeader implements TrafficEngineering | ... | @@ -54,7 +54,7 @@ public class UnreservedBandwidth extends TlvHeader implements TrafficEngineering |
54 | * | 54 | * |
55 | * @return List of un reserved bandwidth | 55 | * @return List of un reserved bandwidth |
56 | */ | 56 | */ |
57 | - public List<Float> getUnReservedBandwidthValue() { | 57 | + public List<Float> unReservedBandwidthValue() { |
58 | return this.unReservedBandwidth; | 58 | return this.unReservedBandwidth; |
59 | } | 59 | } |
60 | 60 | ... | ... |
... | @@ -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 | ... | ... |
... | @@ -21,7 +21,8 @@ | ... | @@ -21,7 +21,8 @@ |
21 | <bundle>mvn:${project.groupId}/onos-isis-api/${project.version}</bundle> | 21 | <bundle>mvn:${project.groupId}/onos-isis-api/${project.version}</bundle> |
22 | <bundle>mvn:${project.groupId}/onos-isis-isisio/${project.version}</bundle> | 22 | <bundle>mvn:${project.groupId}/onos-isis-isisio/${project.version}</bundle> |
23 | <bundle>mvn:${project.groupId}/onos-isis-ctl/${project.version}</bundle> | 23 | <bundle>mvn:${project.groupId}/onos-isis-ctl/${project.version}</bundle> |
24 | - <bundle>mvn:${project.groupId}/onos-isis-provider-device/${project.version}</bundle> | 24 | + <bundle>mvn:${project.groupId}/onos-isis-provider-topology/${project.version}</bundle> |
25 | <bundle>mvn:${project.groupId}/onos-isis-provider-cfg/${project.version}</bundle> | 25 | <bundle>mvn:${project.groupId}/onos-isis-provider-cfg/${project.version}</bundle> |
26 | + <bundle>mvn:${project.groupId}/onos-isis-provider-cli/${project.version}</bundle> | ||
26 | </feature> | 27 | </feature> |
27 | </features> | 28 | </features> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -48,7 +48,7 @@ | ... | @@ -48,7 +48,7 @@ |
48 | </dependency> | 48 | </dependency> |
49 | <dependency> | 49 | <dependency> |
50 | <groupId>org.onosproject</groupId> | 50 | <groupId>org.onosproject</groupId> |
51 | - <artifactId>onos-isis-provider-device</artifactId> | 51 | + <artifactId>onos-isis-provider-topology</artifactId> |
52 | <version>${project.version}</version> | 52 | <version>${project.version}</version> |
53 | </dependency> | 53 | </dependency> |
54 | <dependency> | 54 | <dependency> |
... | @@ -56,5 +56,10 @@ | ... | @@ -56,5 +56,10 @@ |
56 | <artifactId>onos-isis-provider-cfg</artifactId> | 56 | <artifactId>onos-isis-provider-cfg</artifactId> |
57 | <version>${project.version}</version> | 57 | <version>${project.version}</version> |
58 | </dependency> | 58 | </dependency> |
59 | + <dependency> | ||
60 | + <groupId>org.onosproject</groupId> | ||
61 | + <artifactId>onos-isis-provider-cli</artifactId> | ||
62 | + <version>${project.version}</version> | ||
63 | + </dependency> | ||
59 | </dependencies> | 64 | </dependencies> |
60 | </project> | 65 | </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 | -} |
... | @@ -31,10 +31,10 @@ | ... | @@ -31,10 +31,10 @@ |
31 | <description>ONOS ISIS protocol adapters</description> | 31 | <description>ONOS ISIS protocol adapters</description> |
32 | 32 | ||
33 | <modules> | 33 | <modules> |
34 | - <module>device</module> | ||
35 | <module>app</module> | 34 | <module>app</module> |
36 | <module>cfg</module> | 35 | <module>cfg</module> |
37 | <module>cli</module> | 36 | <module>cli</module> |
37 | + <module>topology</module> | ||
38 | </modules> | 38 | </modules> |
39 | 39 | ||
40 | <dependencies> | 40 | <dependencies> | ... | ... |
1 | COMPILE_DEPS = [ | 1 | COMPILE_DEPS = [ |
2 | '//lib:CORE_DEPS', | 2 | '//lib:CORE_DEPS', |
3 | '//protocols/isis/api:onos-protocols-isis-api', | 3 | '//protocols/isis/api:onos-protocols-isis-api', |
4 | + '//protocols/isis/ctl:onos-protocols-isis-ctl', | ||
5 | +] | ||
6 | + | ||
7 | +TEST_DEPS = [ | ||
8 | + '//lib:TEST_ADAPTERS', | ||
4 | ] | 9 | ] |
5 | 10 | ||
6 | osgi_jar_with_tests ( | 11 | osgi_jar_with_tests ( |
7 | deps = COMPILE_DEPS, | 12 | deps = COMPILE_DEPS, |
13 | + test_deps = TEST_DEPS, | ||
8 | ) | 14 | ) |
9 | - | ... | ... |
... | @@ -25,7 +25,7 @@ | ... | @@ -25,7 +25,7 @@ |
25 | <version>1.7.0-SNAPSHOT</version> | 25 | <version>1.7.0-SNAPSHOT</version> |
26 | </parent> | 26 | </parent> |
27 | 27 | ||
28 | - <artifactId>onos-isis-provider-device</artifactId> | 28 | + <artifactId>onos-isis-provider-topology</artifactId> |
29 | <packaging>bundle</packaging> | 29 | <packaging>bundle</packaging> |
30 | 30 | ||
31 | <description>ONOS ISIS Providers</description> | 31 | <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; | ... | ... |
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment