Formalized TopologyStore in preparation for separating managers and stores.
Showing
7 changed files
with
219 additions
and
138 deletions
1 | +package org.onlab.onos.net.topology; | ||
2 | + | ||
3 | +import org.onlab.onos.event.Event; | ||
4 | +import org.onlab.onos.net.ConnectPoint; | ||
5 | +import org.onlab.onos.net.DeviceId; | ||
6 | +import org.onlab.onos.net.Link; | ||
7 | +import org.onlab.onos.net.Path; | ||
8 | +import org.onlab.onos.net.provider.ProviderId; | ||
9 | + | ||
10 | +import java.util.List; | ||
11 | +import java.util.Set; | ||
12 | + | ||
13 | +/** | ||
14 | + * Manages inventory of topology snapshots. It may do so using whatever | ||
15 | + * means appropriate. | ||
16 | + */ | ||
17 | +public interface TopologyStore { | ||
18 | + | ||
19 | + /** | ||
20 | + * Returns the current topology snapshot. | ||
21 | + * | ||
22 | + * @return current topology descriptor | ||
23 | + */ | ||
24 | + Topology currentTopology(); | ||
25 | + | ||
26 | + /** | ||
27 | + * Indicates whether the topology is the latest. | ||
28 | + * | ||
29 | + * @param topology topology descriptor | ||
30 | + * @return true if topology is the most recent one | ||
31 | + */ | ||
32 | + boolean isLatest(Topology topology); | ||
33 | + | ||
34 | + /** | ||
35 | + * Returns the immutable graph view of the current topology. | ||
36 | + * | ||
37 | + * @param topology topology descriptor | ||
38 | + * @return graph view | ||
39 | + */ | ||
40 | + TopologyGraph getGraph(Topology topology); | ||
41 | + | ||
42 | + /** | ||
43 | + * Returns the set of topology SCC clusters. | ||
44 | + * | ||
45 | + * @param topology topology descriptor | ||
46 | + * @return set of clusters | ||
47 | + */ | ||
48 | + Set<TopologyCluster> getClusters(Topology topology); | ||
49 | + | ||
50 | + /** | ||
51 | + * Returns the cluster of the specified topology. | ||
52 | + * | ||
53 | + * @param topology topology descriptor | ||
54 | + * @param clusterId cluster identity | ||
55 | + * @return topology cluster | ||
56 | + */ | ||
57 | + TopologyCluster getCluster(Topology topology, ClusterId clusterId); | ||
58 | + | ||
59 | + /** | ||
60 | + * Returns the cluster of the specified topology. | ||
61 | + * | ||
62 | + * @param topology topology descriptor | ||
63 | + * @param cluster topology cluster | ||
64 | + * @return set of cluster links | ||
65 | + */ | ||
66 | + Set<DeviceId> getClusterDevices(Topology topology, TopologyCluster cluster); | ||
67 | + | ||
68 | + /** | ||
69 | + * Returns the cluster of the specified topology. | ||
70 | + * | ||
71 | + * @param topology topology descriptor | ||
72 | + * @param cluster topology cluster | ||
73 | + * @return set of cluster links | ||
74 | + */ | ||
75 | + Set<Link> getClusterLinks(Topology topology, TopologyCluster cluster); | ||
76 | + | ||
77 | + /** | ||
78 | + * Returns the set of pre-computed shortest paths between src and dest. | ||
79 | + * | ||
80 | + * @param topology topology descriptor | ||
81 | + * @param src source device | ||
82 | + * @param dst destination device | ||
83 | + * @return set of shortest paths | ||
84 | + */ | ||
85 | + Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst); | ||
86 | + | ||
87 | + /** | ||
88 | + * Computes and returns the set of shortest paths between src and dest. | ||
89 | + * | ||
90 | + * @param topology topology descriptor | ||
91 | + * @param src source device | ||
92 | + * @param dst destination device | ||
93 | + * @param weight link weight function | ||
94 | + * @return set of shortest paths | ||
95 | + */ | ||
96 | + Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst, | ||
97 | + LinkWeight weight); | ||
98 | + | ||
99 | + /** | ||
100 | + * Indicates whether the given connect point is part of the network fabric. | ||
101 | + * | ||
102 | + * @param topology topology descriptor | ||
103 | + * @param connectPoint connection point | ||
104 | + * @return true if infrastructure; false otherwise | ||
105 | + */ | ||
106 | + boolean isInfrastructure(Topology topology, ConnectPoint connectPoint); | ||
107 | + | ||
108 | + /** | ||
109 | + * Indicates whether broadcast is allowed for traffic received on the | ||
110 | + * given connection point. | ||
111 | + * | ||
112 | + * @param topology topology descriptor | ||
113 | + * @param connectPoint connection point | ||
114 | + * @return true if broadcast allowed; false otherwise | ||
115 | + */ | ||
116 | + boolean isBroadcastPoint(Topology topology, ConnectPoint connectPoint); | ||
117 | + | ||
118 | + /** | ||
119 | + * Generates a new topology snapshot from the specified description. | ||
120 | + * | ||
121 | + * @param providerId provider identification | ||
122 | + * @param graphDescription topology graph description | ||
123 | + * @param reasons list of events that triggered the update | ||
124 | + * @return topology update event or null if the description is old | ||
125 | + */ | ||
126 | + TopologyEvent updateTopology(ProviderId providerId, | ||
127 | + GraphDescription graphDescription, | ||
128 | + List<Event> reasons); | ||
129 | +} |
... | @@ -41,7 +41,7 @@ import static org.slf4j.LoggerFactory.getLogger; | ... | @@ -41,7 +41,7 @@ import static org.slf4j.LoggerFactory.getLogger; |
41 | */ | 41 | */ |
42 | @Component(immediate = true) | 42 | @Component(immediate = true) |
43 | @Service | 43 | @Service |
44 | -public class SimplePathManager implements PathService { | 44 | +public class PathManager implements PathService { |
45 | 45 | ||
46 | private static final String ELEMENT_ID_NULL = "Element ID cannot be null"; | 46 | private static final String ELEMENT_ID_NULL = "Element ID cannot be null"; |
47 | 47 | ... | ... |
1 | package org.onlab.onos.net.trivial.topology.impl; | 1 | package org.onlab.onos.net.trivial.topology.impl; |
2 | 2 | ||
3 | +import org.apache.felix.scr.annotations.Activate; | ||
4 | +import org.apache.felix.scr.annotations.Component; | ||
5 | +import org.apache.felix.scr.annotations.Deactivate; | ||
6 | +import org.apache.felix.scr.annotations.Service; | ||
3 | import org.onlab.onos.event.Event; | 7 | import org.onlab.onos.event.Event; |
4 | import org.onlab.onos.net.ConnectPoint; | 8 | import org.onlab.onos.net.ConnectPoint; |
5 | import org.onlab.onos.net.DeviceId; | 9 | import org.onlab.onos.net.DeviceId; |
... | @@ -13,151 +17,96 @@ import org.onlab.onos.net.topology.Topology; | ... | @@ -13,151 +17,96 @@ import org.onlab.onos.net.topology.Topology; |
13 | import org.onlab.onos.net.topology.TopologyCluster; | 17 | import org.onlab.onos.net.topology.TopologyCluster; |
14 | import org.onlab.onos.net.topology.TopologyEvent; | 18 | import org.onlab.onos.net.topology.TopologyEvent; |
15 | import org.onlab.onos.net.topology.TopologyGraph; | 19 | import org.onlab.onos.net.topology.TopologyGraph; |
20 | +import org.onlab.onos.net.topology.TopologyStore; | ||
21 | +import org.slf4j.Logger; | ||
16 | 22 | ||
17 | import java.util.List; | 23 | import java.util.List; |
18 | import java.util.Set; | 24 | import java.util.Set; |
19 | 25 | ||
26 | +import static org.slf4j.LoggerFactory.getLogger; | ||
27 | + | ||
20 | /** | 28 | /** |
21 | * Manages inventory of topology snapshots using trivial in-memory | 29 | * Manages inventory of topology snapshots using trivial in-memory |
22 | * structures implementation. | 30 | * structures implementation. |
23 | */ | 31 | */ |
24 | -class SimpleTopologyStore { | 32 | +@Component(immediate = true) |
33 | +@Service | ||
34 | +public class SimpleTopologyStore implements TopologyStore { | ||
35 | + | ||
36 | + private final Logger log = getLogger(getClass()); | ||
25 | 37 | ||
26 | private volatile DefaultTopology current; | 38 | private volatile DefaultTopology current; |
27 | 39 | ||
28 | - /** | 40 | + @Activate |
29 | - * Returns the current topology snapshot. | 41 | + public void activate() { |
30 | - * | 42 | + log.info("Started"); |
31 | - * @return current topology descriptor | 43 | + } |
32 | - */ | 44 | + |
33 | - Topology currentTopology() { | 45 | + @Deactivate |
46 | + public void deactivate() { | ||
47 | + log.info("Stopped"); | ||
48 | + } | ||
49 | + @Override | ||
50 | + public Topology currentTopology() { | ||
34 | return current; | 51 | return current; |
35 | } | 52 | } |
36 | 53 | ||
37 | - /** | 54 | + @Override |
38 | - * Indicates whether the topology is the latest. | 55 | + public boolean isLatest(Topology topology) { |
39 | - * | ||
40 | - * @param topology topology descriptor | ||
41 | - * @return true if topology is the most recent one | ||
42 | - */ | ||
43 | - boolean isLatest(Topology topology) { | ||
44 | // Topology is current only if it is the same as our current topology | 56 | // Topology is current only if it is the same as our current topology |
45 | return topology == current; | 57 | return topology == current; |
46 | } | 58 | } |
47 | 59 | ||
48 | - /** | 60 | + @Override |
49 | - * Returns the immutable graph view of the current topology. | 61 | + public TopologyGraph getGraph(Topology topology) { |
50 | - * | 62 | + return defaultTopology(topology).getGraph(); |
51 | - * @param topology topology descriptor | ||
52 | - * @return graph view | ||
53 | - */ | ||
54 | - TopologyGraph getGraph(DefaultTopology topology) { | ||
55 | - return topology.getGraph(); | ||
56 | } | 63 | } |
57 | 64 | ||
58 | - /** | 65 | + @Override |
59 | - * Returns the set of topology SCC clusters. | 66 | + public Set<TopologyCluster> getClusters(Topology topology) { |
60 | - * | 67 | + return defaultTopology(topology).getClusters(); |
61 | - * @param topology topology descriptor | ||
62 | - * @return set of clusters | ||
63 | - */ | ||
64 | - Set<TopologyCluster> getClusters(DefaultTopology topology) { | ||
65 | - return topology.getClusters(); | ||
66 | } | 68 | } |
67 | 69 | ||
68 | - /** | 70 | + @Override |
69 | - * Returns the cluster of the specified topology. | 71 | + public TopologyCluster getCluster(Topology topology, ClusterId clusterId) { |
70 | - * | 72 | + return defaultTopology(topology).getCluster(clusterId); |
71 | - * @param topology topology descriptor | ||
72 | - * @param clusterId cluster identity | ||
73 | - * @return topology cluster | ||
74 | - */ | ||
75 | - TopologyCluster getCluster(DefaultTopology topology, ClusterId clusterId) { | ||
76 | - return topology.getCluster(clusterId); | ||
77 | } | 73 | } |
78 | 74 | ||
79 | - /** | 75 | + @Override |
80 | - * Returns the cluster of the specified topology. | 76 | + public Set<DeviceId> getClusterDevices(Topology topology, TopologyCluster cluster) { |
81 | - * | 77 | + return defaultTopology(topology).getClusterDevices(cluster); |
82 | - * @param topology topology descriptor | ||
83 | - * @param cluster topology cluster | ||
84 | - * @return set of cluster links | ||
85 | - */ | ||
86 | - Set<DeviceId> getClusterDevices(DefaultTopology topology, TopologyCluster cluster) { | ||
87 | - return topology.getClusterDevices(cluster); | ||
88 | } | 78 | } |
89 | 79 | ||
90 | - /** | 80 | + @Override |
91 | - * Returns the cluster of the specified topology. | 81 | + public Set<Link> getClusterLinks(Topology topology, TopologyCluster cluster) { |
92 | - * | 82 | + return defaultTopology(topology).getClusterLinks(cluster); |
93 | - * @param topology topology descriptor | ||
94 | - * @param cluster topology cluster | ||
95 | - * @return set of cluster links | ||
96 | - */ | ||
97 | - Set<Link> getClusterLinks(DefaultTopology topology, TopologyCluster cluster) { | ||
98 | - return topology.getClusterLinks(cluster); | ||
99 | } | 83 | } |
100 | 84 | ||
101 | - /** | 85 | + @Override |
102 | - * Returns the set of pre-computed shortest paths between src and dest. | 86 | + public Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst) { |
103 | - * | 87 | + return defaultTopology(topology).getPaths(src, dst); |
104 | - * @param topology topology descriptor | ||
105 | - * @param src source device | ||
106 | - * @param dst destination device | ||
107 | - * @return set of shortest paths | ||
108 | - */ | ||
109 | - Set<Path> getPaths(DefaultTopology topology, DeviceId src, DeviceId dst) { | ||
110 | - return topology.getPaths(src, dst); | ||
111 | } | 88 | } |
112 | 89 | ||
113 | - /** | 90 | + @Override |
114 | - * Computes and returns the set of shortest paths between src and dest. | 91 | + public Set<Path> getPaths(Topology topology, DeviceId src, DeviceId dst, |
115 | - * | 92 | + LinkWeight weight) { |
116 | - * @param topology topology descriptor | 93 | + return defaultTopology(topology).getPaths(src, dst, weight); |
117 | - * @param src source device | ||
118 | - * @param dst destination device | ||
119 | - * @param weight link weight function | ||
120 | - * @return set of shortest paths | ||
121 | - */ | ||
122 | - Set<Path> getPaths(DefaultTopology topology, DeviceId src, DeviceId dst, | ||
123 | - LinkWeight weight) { | ||
124 | - return topology.getPaths(src, dst, weight); | ||
125 | } | 94 | } |
126 | 95 | ||
127 | - /** | 96 | + @Override |
128 | - * Indicates whether the given connect point is part of the network fabric. | 97 | + public boolean isInfrastructure(Topology topology, ConnectPoint connectPoint) { |
129 | - * | 98 | + return defaultTopology(topology).isInfrastructure(connectPoint); |
130 | - * @param topology topology descriptor | ||
131 | - * @param connectPoint connection point | ||
132 | - * @return true if infrastructure; false otherwise | ||
133 | - */ | ||
134 | - boolean isInfrastructure(DefaultTopology topology, ConnectPoint connectPoint) { | ||
135 | - return topology.isInfrastructure(connectPoint); | ||
136 | } | 99 | } |
137 | 100 | ||
138 | - /** | 101 | + @Override |
139 | - * Indicates whether broadcast is allowed for traffic received on the | 102 | + public boolean isBroadcastPoint(Topology topology, ConnectPoint connectPoint) { |
140 | - * given connection point. | 103 | + return defaultTopology(topology).isBroadcastPoint(connectPoint); |
141 | - * | ||
142 | - * @param topology topology descriptor | ||
143 | - * @param connectPoint connection point | ||
144 | - * @return true if broadcast allowed; false otherwise | ||
145 | - */ | ||
146 | - boolean isBroadcastPoint(DefaultTopology topology, ConnectPoint connectPoint) { | ||
147 | - return topology.isBroadcastPoint(connectPoint); | ||
148 | } | 104 | } |
149 | 105 | ||
150 | - /** | 106 | + @Override |
151 | - * Generates a new topology snapshot from the specified description. | 107 | + public TopologyEvent updateTopology(ProviderId providerId, |
152 | - * | 108 | + GraphDescription graphDescription, |
153 | - * @param providerId provider identification | 109 | + List<Event> reasons) { |
154 | - * @param graphDescription topology graph description | ||
155 | - * @param reasons list of events that triggered the update | ||
156 | - * @return topology update event or null if the description is old | ||
157 | - */ | ||
158 | - TopologyEvent updateTopology(ProviderId providerId, | ||
159 | - GraphDescription graphDescription, | ||
160 | - List<Event> reasons) { | ||
161 | // First off, make sure that what we're given is indeed newer than | 110 | // First off, make sure that what we're given is indeed newer than |
162 | // what we already have. | 111 | // what we already have. |
163 | if (current != null && graphDescription.timestamp() < current.time()) { | 112 | if (current != null && graphDescription.timestamp() < current.time()) { |
... | @@ -175,4 +124,13 @@ class SimpleTopologyStore { | ... | @@ -175,4 +124,13 @@ class SimpleTopologyStore { |
175 | } | 124 | } |
176 | } | 125 | } |
177 | 126 | ||
127 | + // Validates the specified topology and returns it as a default | ||
128 | + private DefaultTopology defaultTopology(Topology topology) { | ||
129 | + if (topology instanceof DefaultTopology) { | ||
130 | + return (DefaultTopology) topology; | ||
131 | + } | ||
132 | + throw new IllegalArgumentException("Topology class " + topology.getClass() + | ||
133 | + " not supported"); | ||
134 | + } | ||
135 | + | ||
178 | } | 136 | } | ... | ... |
... | @@ -27,6 +27,7 @@ import org.onlab.onos.net.topology.TopologyProvider; | ... | @@ -27,6 +27,7 @@ import org.onlab.onos.net.topology.TopologyProvider; |
27 | import org.onlab.onos.net.topology.TopologyProviderRegistry; | 27 | import org.onlab.onos.net.topology.TopologyProviderRegistry; |
28 | import org.onlab.onos.net.topology.TopologyProviderService; | 28 | import org.onlab.onos.net.topology.TopologyProviderService; |
29 | import org.onlab.onos.net.topology.TopologyService; | 29 | import org.onlab.onos.net.topology.TopologyService; |
30 | +import org.onlab.onos.net.topology.TopologyStore; | ||
30 | import org.slf4j.Logger; | 31 | import org.slf4j.Logger; |
31 | 32 | ||
32 | import java.util.List; | 33 | import java.util.List; |
... | @@ -40,7 +41,7 @@ import static org.slf4j.LoggerFactory.getLogger; | ... | @@ -40,7 +41,7 @@ import static org.slf4j.LoggerFactory.getLogger; |
40 | */ | 41 | */ |
41 | @Component(immediate = true) | 42 | @Component(immediate = true) |
42 | @Service | 43 | @Service |
43 | -public class SimpleTopologyManager | 44 | +public class TopologyManager |
44 | extends AbstractProviderRegistry<TopologyProvider, TopologyProviderService> | 45 | extends AbstractProviderRegistry<TopologyProvider, TopologyProviderService> |
45 | implements TopologyService, TopologyProviderRegistry { | 46 | implements TopologyService, TopologyProviderRegistry { |
46 | 47 | ||
... | @@ -55,7 +56,8 @@ public class SimpleTopologyManager | ... | @@ -55,7 +56,8 @@ public class SimpleTopologyManager |
55 | private final AbstractListenerRegistry<TopologyEvent, TopologyListener> | 56 | private final AbstractListenerRegistry<TopologyEvent, TopologyListener> |
56 | listenerRegistry = new AbstractListenerRegistry<>(); | 57 | listenerRegistry = new AbstractListenerRegistry<>(); |
57 | 58 | ||
58 | - private final SimpleTopologyStore store = new SimpleTopologyStore(); | 59 | + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
60 | + protected TopologyStore store; | ||
59 | 61 | ||
60 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 62 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
61 | protected EventDeliveryService eventDispatcher; | 63 | protected EventDeliveryService eventDispatcher; |
... | @@ -81,49 +83,40 @@ public class SimpleTopologyManager | ... | @@ -81,49 +83,40 @@ public class SimpleTopologyManager |
81 | @Override | 83 | @Override |
82 | public boolean isLatest(Topology topology) { | 84 | public boolean isLatest(Topology topology) { |
83 | checkNotNull(topology, TOPOLOGY_NULL); | 85 | checkNotNull(topology, TOPOLOGY_NULL); |
84 | - return store.isLatest(defaultTopology(topology)); | 86 | + return store.isLatest(topology); |
85 | - } | ||
86 | - | ||
87 | - // Validates the specified topology and returns it as a default | ||
88 | - private DefaultTopology defaultTopology(Topology topology) { | ||
89 | - if (topology instanceof DefaultTopology) { | ||
90 | - return (DefaultTopology) topology; | ||
91 | - } | ||
92 | - throw new IllegalArgumentException("Topology class " + topology.getClass() + | ||
93 | - " not supported"); | ||
94 | } | 87 | } |
95 | 88 | ||
96 | @Override | 89 | @Override |
97 | public Set<TopologyCluster> getClusters(Topology topology) { | 90 | public Set<TopologyCluster> getClusters(Topology topology) { |
98 | checkNotNull(topology, TOPOLOGY_NULL); | 91 | checkNotNull(topology, TOPOLOGY_NULL); |
99 | - return store.getClusters(defaultTopology(topology)); | 92 | + return store.getClusters(topology); |
100 | } | 93 | } |
101 | 94 | ||
102 | @Override | 95 | @Override |
103 | public TopologyCluster getCluster(Topology topology, ClusterId clusterId) { | 96 | public TopologyCluster getCluster(Topology topology, ClusterId clusterId) { |
104 | checkNotNull(topology, TOPOLOGY_NULL); | 97 | checkNotNull(topology, TOPOLOGY_NULL); |
105 | checkNotNull(topology, CLUSTER_ID_NULL); | 98 | checkNotNull(topology, CLUSTER_ID_NULL); |
106 | - return store.getCluster(defaultTopology(topology), clusterId); | 99 | + return store.getCluster(topology, clusterId); |
107 | } | 100 | } |
108 | 101 | ||
109 | @Override | 102 | @Override |
110 | public Set<DeviceId> getClusterDevices(Topology topology, TopologyCluster cluster) { | 103 | public Set<DeviceId> getClusterDevices(Topology topology, TopologyCluster cluster) { |
111 | checkNotNull(topology, TOPOLOGY_NULL); | 104 | checkNotNull(topology, TOPOLOGY_NULL); |
112 | checkNotNull(topology, CLUSTER_NULL); | 105 | checkNotNull(topology, CLUSTER_NULL); |
113 | - return store.getClusterDevices(defaultTopology(topology), cluster); | 106 | + return store.getClusterDevices(topology, cluster); |
114 | } | 107 | } |
115 | 108 | ||
116 | @Override | 109 | @Override |
117 | public Set<Link> getClusterLinks(Topology topology, TopologyCluster cluster) { | 110 | public Set<Link> getClusterLinks(Topology topology, TopologyCluster cluster) { |
118 | checkNotNull(topology, TOPOLOGY_NULL); | 111 | checkNotNull(topology, TOPOLOGY_NULL); |
119 | checkNotNull(topology, CLUSTER_NULL); | 112 | checkNotNull(topology, CLUSTER_NULL); |
120 | - return store.getClusterLinks(defaultTopology(topology), cluster); | 113 | + return store.getClusterLinks(topology, cluster); |
121 | } | 114 | } |
122 | 115 | ||
123 | @Override | 116 | @Override |
124 | public TopologyGraph getGraph(Topology topology) { | 117 | public TopologyGraph getGraph(Topology topology) { |
125 | checkNotNull(topology, TOPOLOGY_NULL); | 118 | checkNotNull(topology, TOPOLOGY_NULL); |
126 | - return store.getGraph(defaultTopology(topology)); | 119 | + return store.getGraph(topology); |
127 | } | 120 | } |
128 | 121 | ||
129 | @Override | 122 | @Override |
... | @@ -131,7 +124,7 @@ public class SimpleTopologyManager | ... | @@ -131,7 +124,7 @@ public class SimpleTopologyManager |
131 | checkNotNull(topology, TOPOLOGY_NULL); | 124 | checkNotNull(topology, TOPOLOGY_NULL); |
132 | checkNotNull(src, DEVICE_ID_NULL); | 125 | checkNotNull(src, DEVICE_ID_NULL); |
133 | checkNotNull(dst, DEVICE_ID_NULL); | 126 | checkNotNull(dst, DEVICE_ID_NULL); |
134 | - return store.getPaths(defaultTopology(topology), src, dst); | 127 | + return store.getPaths(topology, src, dst); |
135 | } | 128 | } |
136 | 129 | ||
137 | @Override | 130 | @Override |
... | @@ -140,21 +133,21 @@ public class SimpleTopologyManager | ... | @@ -140,21 +133,21 @@ public class SimpleTopologyManager |
140 | checkNotNull(src, DEVICE_ID_NULL); | 133 | checkNotNull(src, DEVICE_ID_NULL); |
141 | checkNotNull(dst, DEVICE_ID_NULL); | 134 | checkNotNull(dst, DEVICE_ID_NULL); |
142 | checkNotNull(weight, "Link weight cannot be null"); | 135 | checkNotNull(weight, "Link weight cannot be null"); |
143 | - return store.getPaths(defaultTopology(topology), src, dst, weight); | 136 | + return store.getPaths(topology, src, dst, weight); |
144 | } | 137 | } |
145 | 138 | ||
146 | @Override | 139 | @Override |
147 | public boolean isInfrastructure(Topology topology, ConnectPoint connectPoint) { | 140 | public boolean isInfrastructure(Topology topology, ConnectPoint connectPoint) { |
148 | checkNotNull(topology, TOPOLOGY_NULL); | 141 | checkNotNull(topology, TOPOLOGY_NULL); |
149 | checkNotNull(connectPoint, CONNECTION_POINT_NULL); | 142 | checkNotNull(connectPoint, CONNECTION_POINT_NULL); |
150 | - return store.isInfrastructure(defaultTopology(topology), connectPoint); | 143 | + return store.isInfrastructure(topology, connectPoint); |
151 | } | 144 | } |
152 | 145 | ||
153 | @Override | 146 | @Override |
154 | public boolean isBroadcastPoint(Topology topology, ConnectPoint connectPoint) { | 147 | public boolean isBroadcastPoint(Topology topology, ConnectPoint connectPoint) { |
155 | checkNotNull(topology, TOPOLOGY_NULL); | 148 | checkNotNull(topology, TOPOLOGY_NULL); |
156 | checkNotNull(connectPoint, CONNECTION_POINT_NULL); | 149 | checkNotNull(connectPoint, CONNECTION_POINT_NULL); |
157 | - return store.isBroadcastPoint(defaultTopology(topology), connectPoint); | 150 | + return store.isBroadcastPoint(topology, connectPoint); |
158 | } | 151 | } |
159 | 152 | ||
160 | @Override | 153 | @Override | ... | ... |
core/trivial/src/test/java/org/onlab/onos/net/trivial/topology/impl/DefaultTopologyProviderTest.java
... | @@ -27,8 +27,8 @@ import static org.junit.Assert.assertNotNull; | ... | @@ -27,8 +27,8 @@ import static org.junit.Assert.assertNotNull; |
27 | import static org.onlab.junit.TestTools.assertAfter; | 27 | import static org.onlab.junit.TestTools.assertAfter; |
28 | import static org.onlab.onos.net.device.DeviceEvent.Type.DEVICE_ADDED; | 28 | import static org.onlab.onos.net.device.DeviceEvent.Type.DEVICE_ADDED; |
29 | import static org.onlab.onos.net.link.LinkEvent.Type.LINK_ADDED; | 29 | import static org.onlab.onos.net.link.LinkEvent.Type.LINK_ADDED; |
30 | -import static org.onlab.onos.net.trivial.topology.impl.SimpleTopologyManagerTest.device; | 30 | +import static org.onlab.onos.net.trivial.topology.impl.TopologyManagerTest.device; |
31 | -import static org.onlab.onos.net.trivial.topology.impl.SimpleTopologyManagerTest.link; | 31 | +import static org.onlab.onos.net.trivial.topology.impl.TopologyManagerTest.link; |
32 | 32 | ||
33 | /** | 33 | /** |
34 | * Test of the default topology provider implementation. | 34 | * Test of the default topology provider implementation. | ... | ... |
... | @@ -21,8 +21,8 @@ import static com.google.common.collect.ImmutableSet.of; | ... | @@ -21,8 +21,8 @@ import static com.google.common.collect.ImmutableSet.of; |
21 | import static org.junit.Assert.*; | 21 | import static org.junit.Assert.*; |
22 | import static org.onlab.onos.net.DeviceId.deviceId; | 22 | import static org.onlab.onos.net.DeviceId.deviceId; |
23 | import static org.onlab.onos.net.PortNumber.portNumber; | 23 | import static org.onlab.onos.net.PortNumber.portNumber; |
24 | -import static org.onlab.onos.net.trivial.topology.impl.SimpleTopologyManagerTest.device; | 24 | +import static org.onlab.onos.net.trivial.topology.impl.TopologyManagerTest.device; |
25 | -import static org.onlab.onos.net.trivial.topology.impl.SimpleTopologyManagerTest.link; | 25 | +import static org.onlab.onos.net.trivial.topology.impl.TopologyManagerTest.link; |
26 | 26 | ||
27 | /** | 27 | /** |
28 | * Test of the default topology implementation. | 28 | * Test of the default topology implementation. | ... | ... |
... | @@ -41,11 +41,11 @@ import static org.onlab.onos.net.topology.TopologyEvent.Type.TOPOLOGY_CHANGED; | ... | @@ -41,11 +41,11 @@ import static org.onlab.onos.net.topology.TopologyEvent.Type.TOPOLOGY_CHANGED; |
41 | /** | 41 | /** |
42 | * Test of the topology subsystem. | 42 | * Test of the topology subsystem. |
43 | */ | 43 | */ |
44 | -public class SimpleTopologyManagerTest { | 44 | +public class TopologyManagerTest { |
45 | 45 | ||
46 | private static final ProviderId PID = new ProviderId("of", "foo"); | 46 | private static final ProviderId PID = new ProviderId("of", "foo"); |
47 | 47 | ||
48 | - private SimpleTopologyManager mgr; | 48 | + private TopologyManager mgr; |
49 | 49 | ||
50 | protected TopologyService service; | 50 | protected TopologyService service; |
51 | protected TopologyProviderRegistry registry; | 51 | protected TopologyProviderRegistry registry; |
... | @@ -55,10 +55,11 @@ public class SimpleTopologyManagerTest { | ... | @@ -55,10 +55,11 @@ public class SimpleTopologyManagerTest { |
55 | 55 | ||
56 | @Before | 56 | @Before |
57 | public void setUp() { | 57 | public void setUp() { |
58 | - mgr = new SimpleTopologyManager(); | 58 | + mgr = new TopologyManager(); |
59 | service = mgr; | 59 | service = mgr; |
60 | registry = mgr; | 60 | registry = mgr; |
61 | 61 | ||
62 | + mgr.store = new SimpleTopologyStore(); | ||
62 | mgr.eventDispatcher = new TestEventDispatcher(); | 63 | mgr.eventDispatcher = new TestEventDispatcher(); |
63 | mgr.activate(); | 64 | mgr.activate(); |
64 | 65 | ... | ... |
-
Please register or login to post a comment