Committed by
Ray Milkey
NullLinkProvider has been rewritten to take a topology file.
Reference: ONOS-1214, ONOS-1033 Change-Id: Ia945e4c8555afd2d74f174e51e22e2fdf3dcb356
Showing
5 changed files
with
35 additions
and
12 deletions
providers/null/device/src/main/java/org/onosproject/provider/nil/device/impl/NullDeviceProvider.java
... | @@ -78,8 +78,6 @@ public class NullDeviceProvider extends AbstractProvider implements DeviceProvid | ... | @@ -78,8 +78,6 @@ public class NullDeviceProvider extends AbstractProvider implements DeviceProvid |
78 | private ExecutorService deviceBuilder = | 78 | private ExecutorService deviceBuilder = |
79 | Executors.newFixedThreadPool(1, groupedThreads("onos/null", "device-creator")); | 79 | Executors.newFixedThreadPool(1, groupedThreads("onos/null", "device-creator")); |
80 | 80 | ||
81 | - | ||
82 | - //currently hardcoded. will be made configurable via rest/cli. | ||
83 | private static final String SCHEME = "null"; | 81 | private static final String SCHEME = "null"; |
84 | private static final int DEF_NUMDEVICES = 10; | 82 | private static final int DEF_NUMDEVICES = 10; |
85 | private static final int DEF_NUMPORTS = 10; | 83 | private static final int DEF_NUMPORTS = 10; |
... | @@ -99,7 +97,6 @@ public class NullDeviceProvider extends AbstractProvider implements DeviceProvid | ... | @@ -99,7 +97,6 @@ public class NullDeviceProvider extends AbstractProvider implements DeviceProvid |
99 | 97 | ||
100 | private DeviceCreator creator; | 98 | private DeviceCreator creator; |
101 | 99 | ||
102 | - | ||
103 | /** | 100 | /** |
104 | * | 101 | * |
105 | * Creates a provider with the supplier identifier. | 102 | * Creates a provider with the supplier identifier. |
... | @@ -238,11 +235,10 @@ public class NullDeviceProvider extends AbstractProvider implements DeviceProvid | ... | @@ -238,11 +235,10 @@ public class NullDeviceProvider extends AbstractProvider implements DeviceProvid |
238 | ChassisId cid; | 235 | ChassisId cid; |
239 | 236 | ||
240 | // nodeIdHash takes into account for nodeID to avoid collisions when running multi-node providers. | 237 | // nodeIdHash takes into account for nodeID to avoid collisions when running multi-node providers. |
241 | - long nodeIdHash = clusterService.getLocalNode().hashCode() << 16; | 238 | + long nodeIdHash = clusterService.getLocalNode().id().hashCode() << 16; |
242 | 239 | ||
243 | for (int i = 0; i < numDevices; i++) { | 240 | for (int i = 0; i < numDevices; i++) { |
244 | - // mark 'last' device to facilitate chaining of islands together | 241 | + long id = nodeIdHash | i; |
245 | - long id = (i + 1 == numDevices) ? nodeIdHash | 0xffff : nodeIdHash | i; | ||
246 | 242 | ||
247 | did = DeviceId.deviceId(new URI(SCHEME, toHex(id), null)); | 243 | did = DeviceId.deviceId(new URI(SCHEME, toHex(id), null)); |
248 | cid = new ChassisId(i); | 244 | cid = new ChassisId(i); | ... | ... |
This diff is collapsed. Click to expand it.
tools/package/etc/samples/linkGraph.cfg
0 → 100644
1 | +# NullLinkProvider topology description (config file). | ||
2 | +# | ||
3 | +# Dot-style topology graph. Each controller's topology begins with | ||
4 | +# | ||
5 | +# graph <node ID>, followed by a list of links between braces. | ||
6 | +# | ||
7 | +# The links are either bidirectional (--) or directed (->). The directed | ||
8 | +# edges are used to connect together Null devices of different controllers. | ||
9 | +# The endpoint has the format: | ||
10 | +# | ||
11 | +# devID:port:NodeId | ||
12 | +# | ||
13 | +# The NodeId is only added if the destination is another node's device. | ||
14 | +# | ||
15 | +graph 192.168.56.20 { | ||
16 | + 0:0 -- 1:0 | ||
17 | + 1:1 -> 0:0:192.168.56.30 | ||
18 | + 1:2 -- 2:0 | ||
19 | + 2:1 -> 1:0:192.168.56.30 | ||
20 | +} | ||
21 | +graph 192.168.56.30 { | ||
22 | + 0:0 -> 1:1:192.168.56.20 | ||
23 | + 0:1 -- 1:1 | ||
24 | + 1:0 -> 2:1:192.168.56.20 | ||
25 | + 1:2 -- 2:0 | ||
26 | +} | ||
27 | +# Bugs: Comments cannot be appended to a line to be read. |
... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
2 | # Instance-specific configurations, in this case, the number of | 2 | # Instance-specific configurations, in this case, the number of |
3 | # devices per node. | 3 | # devices per node. |
4 | # | 4 | # |
5 | -devConfigs = 192.168.97.132:5,192.168.97.131:5 | 5 | +devConfigs = 192.168.56.20:3,192.168.56.30:3 |
6 | 6 | ||
7 | # | 7 | # |
8 | # Number of ports per device. This is global to all devices | 8 | # Number of ports per device. This is global to all devices | ... | ... |
... | @@ -4,13 +4,13 @@ | ... | @@ -4,13 +4,13 @@ |
4 | 4 | ||
5 | # | 5 | # |
6 | # If enabled, sets the time between LinkEvent generation, | 6 | # If enabled, sets the time between LinkEvent generation, |
7 | -# in milliseconds. | 7 | +# in microseconds. |
8 | # | 8 | # |
9 | 9 | ||
10 | -#eventRate = 100000 | 10 | +#eventRate = 1000000 |
11 | - | ||
12 | 11 | ||
13 | # | 12 | # |
14 | -# Set order of islands to chain together, in a line. | 13 | +# If enabled, points to the full path to the topology file. |
15 | # | 14 | # |
16 | -neighbors = 192.168.97.132,192.168.97.131 | 15 | + |
16 | +#cfgFile = /tmp/foo.cfg | ... | ... |
-
Please register or login to post a comment