Thomas Vachuska

Simplifying addition of simulated hosts to the null provider.

Change-Id: I83e4c348e502ad891a427b36a4a02172fa27e6c2
...@@ -56,7 +56,7 @@ public class CustomTopologySimulator extends TopologySimulator { ...@@ -56,7 +56,7 @@ public class CustomTopologySimulator extends TopologySimulator {
56 * @return the next host id 56 * @return the next host id
57 */ 57 */
58 public HostId nextHostId() { 58 public HostId nextHostId() {
59 - return HostId.hostId(MacAddress.valueOf(nextHostId), VlanId.NONE); 59 + return HostId.hostId(MacAddress.valueOf(++nextHostId), VlanId.NONE);
60 } 60 }
61 61
62 /** 62 /**
......
...@@ -45,19 +45,15 @@ public class CreateNullHost extends AbstractShellCommand { ...@@ -45,19 +45,15 @@ public class CreateNullHost extends AbstractShellCommand {
45 required = true, multiValued = false) 45 required = true, multiValued = false)
46 String deviceName = null; 46 String deviceName = null;
47 47
48 - @Argument(index = 1, name = "hostId", description = "Host identifier", 48 + @Argument(index = 1, name = "hostIp", description = "Host IP address",
49 - required = true, multiValued = false)
50 - String hostId = null;
51 -
52 - @Argument(index = 2, name = "hostIp", description = "Host IP address",
53 required = true, multiValued = false) 49 required = true, multiValued = false)
54 String hostIp = null; 50 String hostIp = null;
55 51
56 - @Argument(index = 3, name = "latitude", description = "Geo latitude", 52 + @Argument(index = 2, name = "latitude", description = "Geo latitude",
57 required = true, multiValued = false) 53 required = true, multiValued = false)
58 Double latitude = null; 54 Double latitude = null;
59 55
60 - @Argument(index = 4, name = "longitude", description = "Geo longitude", 56 + @Argument(index = 3, name = "longitude", description = "Geo longitude",
61 required = true, multiValued = false) 57 required = true, multiValued = false)
62 Double longitude = null; 58 Double longitude = null;
63 59
...@@ -74,8 +70,8 @@ public class CreateNullHost extends AbstractShellCommand { ...@@ -74,8 +70,8 @@ public class CreateNullHost extends AbstractShellCommand {
74 70
75 CustomTopologySimulator sim = (CustomTopologySimulator) simulator; 71 CustomTopologySimulator sim = (CustomTopologySimulator) simulator;
76 DeviceId deviceId = sim.deviceId(deviceName); 72 DeviceId deviceId = sim.deviceId(deviceName);
73 + HostId id = sim.nextHostId();
77 HostLocation location = findAvailablePort(deviceId); 74 HostLocation location = findAvailablePort(deviceId);
78 - HostId id = HostId.hostId(hostId);
79 BasicHostConfig cfg = cfgService.addConfig(id, BasicHostConfig.class); 75 BasicHostConfig cfg = cfgService.addConfig(id, BasicHostConfig.class);
80 cfg.latitude(latitude); 76 cfg.latitude(latitude);
81 cfg.longitude(longitude); 77 cfg.longitude(longitude);
......