Adding ability to balance load between different cell servers.
Adding ability to specify structure/size of the cell.
Change-Id: I2b721dac187cc1a73be2949bdb71709ad72cbb48
diff --git a/utils/warden/src/main/java/org/onlab/warden/Warden.java b/utils/warden/src/main/java/org/onlab/warden/Warden.java
index 8c8e3f96..8ce6037 100644
--- a/utils/warden/src/main/java/org/onlab/warden/Warden.java
+++ b/utils/warden/src/main/java/org/onlab/warden/Warden.java
@@ -216,7 +216,7 @@
new ServerInfo(info.hostName) : v.bumpLoad(info)));
List<ServerInfo> servers = new ArrayList<>(load.values());
- servers.sort((a, b) -> a.load - b.load);
+ servers.sort((a, b) -> b.load - a.load);
ServerInfo server = servers.get(0);
return server.cells.get(random.nextInt(server.cells.size())).cellName;
}
diff --git a/utils/warden/src/test/java/org/onlab/warden/WardenTest.java b/utils/warden/src/test/java/org/onlab/warden/WardenTest.java
index 20f1089..70a5960 100644
--- a/utils/warden/src/test/java/org/onlab/warden/WardenTest.java
+++ b/utils/warden/src/test/java/org/onlab/warden/WardenTest.java
@@ -85,9 +85,9 @@
validateCellState(doltCell);
validateSizes(4, 2);
- assertTrue("cells should not be on the same host",
- Objects.equals(warden.getCellHost(dudeCell.cellName),
- warden.getCellHost(doltCell.cellName)));
+ assertFalse("cells should not be on the same host",
+ Objects.equals(warden.getCellHost(dudeCell.cellName),
+ warden.getCellHost(doltCell.cellName)));
warden.returnCell("dude");
validateSizes(5, 1);