Ayaka Koshibe
Committed by Ray Milkey

NullLinkProvider has been rewritten to take a topology file.

Reference: ONOS-1214, ONOS-1033

Change-Id: Ia945e4c8555afd2d74f174e51e22e2fdf3dcb356
......@@ -78,8 +78,6 @@ public class NullDeviceProvider extends AbstractProvider implements DeviceProvid
private ExecutorService deviceBuilder =
Executors.newFixedThreadPool(1, groupedThreads("onos/null", "device-creator"));
//currently hardcoded. will be made configurable via rest/cli.
private static final String SCHEME = "null";
private static final int DEF_NUMDEVICES = 10;
private static final int DEF_NUMPORTS = 10;
......@@ -99,7 +97,6 @@ public class NullDeviceProvider extends AbstractProvider implements DeviceProvid
private DeviceCreator creator;
/**
*
* Creates a provider with the supplier identifier.
......@@ -238,11 +235,10 @@ public class NullDeviceProvider extends AbstractProvider implements DeviceProvid
ChassisId cid;
// nodeIdHash takes into account for nodeID to avoid collisions when running multi-node providers.
long nodeIdHash = clusterService.getLocalNode().hashCode() << 16;
long nodeIdHash = clusterService.getLocalNode().id().hashCode() << 16;
for (int i = 0; i < numDevices; i++) {
// mark 'last' device to facilitate chaining of islands together
long id = (i + 1 == numDevices) ? nodeIdHash | 0xffff : nodeIdHash | i;
long id = nodeIdHash | i;
did = DeviceId.deviceId(new URI(SCHEME, toHex(id), null));
cid = new ChassisId(i);
......
# NullLinkProvider topology description (config file).
#
# Dot-style topology graph. Each controller's topology begins with
#
# graph <node ID>, followed by a list of links between braces.
#
# The links are either bidirectional (--) or directed (->). The directed
# edges are used to connect together Null devices of different controllers.
# The endpoint has the format:
#
# devID:port:NodeId
#
# The NodeId is only added if the destination is another node's device.
#
graph 192.168.56.20 {
0:0 -- 1:0
1:1 -> 0:0:192.168.56.30
1:2 -- 2:0
2:1 -> 1:0:192.168.56.30
}
graph 192.168.56.30 {
0:0 -> 1:1:192.168.56.20
0:1 -- 1:1
1:0 -> 2:1:192.168.56.20
1:2 -- 2:0
}
# Bugs: Comments cannot be appended to a line to be read.
......@@ -2,7 +2,7 @@
# Instance-specific configurations, in this case, the number of
# devices per node.
#
devConfigs = 192.168.97.132:5,192.168.97.131:5
devConfigs = 192.168.56.20:3,192.168.56.30:3
#
# Number of ports per device. This is global to all devices
......
......@@ -4,13 +4,13 @@
#
# If enabled, sets the time between LinkEvent generation,
# in milliseconds.
# in microseconds.
#
#eventRate = 100000
#eventRate = 1000000
#
# Set order of islands to chain together, in a line.
# If enabled, points to the full path to the topology file.
#
neighbors = 192.168.97.132,192.168.97.131
#cfgFile = /tmp/foo.cfg
......