X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fexample%2FTestDriver.java;h=f202a8bb1d6bc9c12b71c013fc0fd5e9daf990bf;hb=e316a0ef36279a72767703d190f38a39d7d49395;hp=fd6e192bf0497777de2643a1b3f28a2a76b72e42;hpb=4a8d4efda0828bc0c147dee3644c51baa6ff5a15;p=controller.git diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/TestDriver.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/TestDriver.java index fd6e192bf0..f202a8bb1d 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/TestDriver.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/example/TestDriver.java @@ -6,8 +6,6 @@ import com.google.common.base.Optional; import org.opendaylight.controller.cluster.example.messages.PrintRole; import org.opendaylight.controller.cluster.example.messages.PrintState; import org.opendaylight.controller.cluster.raft.ConfigParams; -import org.opendaylight.controller.cluster.raft.client.messages.AddRaftPeer; -import org.opendaylight.controller.cluster.raft.client.messages.RemoveRaftPeer; import java.io.BufferedReader; import java.io.InputStreamReader; @@ -36,7 +34,6 @@ public class TestDriver { * Commands * bye * createNodes:{num} - * addNodes:{num} * stopNode:{nodeName} * reinstateNode:{nodeName} * addClients:{num} @@ -67,11 +64,6 @@ public class TestDriver { int n = Integer.parseInt(arr[1]); td.createNodes(n); - } else if (command.startsWith("addNodes")) { - String[] arr = command.split(":"); - int n = Integer.parseInt(arr[1]); - td.addNodes(n); - } else if (command.startsWith("addClients")) { String[] arr = command.split(":"); int n = Integer.parseInt(arr[1]); @@ -109,6 +101,8 @@ public class TestDriver { td.printState(); } else if (command.startsWith("printNodes")) { td.printNodes(); + } else { + System.out.println("Invalid command:" + command); } } @@ -133,32 +127,6 @@ public class TestDriver { } } - // add new nodes , pass in the count - public void addNodes(int num) { - Map newPeers = new HashMap<>(); - for (int i=0; i < num; i++) { - nameCounter = nameCounter + 1; - newPeers.put("example-"+nameCounter, "akka://default/user/example-"+nameCounter); - allPeers.put("example-"+nameCounter, "akka://default/user/example-"+nameCounter); - - } - Map newActorRefs = new HashMap(num); - for (Map.Entry entry : newPeers.entrySet()) { - ActorRef exampleActor = createExampleActor(entry.getKey()); - newActorRefs.put(entry.getKey(), exampleActor); - - //now also add these new nodes as peers from the previous nodes - for (ActorRef actor : actorRefs.values()) { - actor.tell(new AddRaftPeer(entry.getKey(), entry.getValue()), null); - } - - System.out.println("Added node:" + entry); - } - - actorRefs.putAll(newActorRefs); - } - - // add num clients to all nodes in the system public void addClients(int num) { for(Map.Entry actorRefEntry : actorRefs.entrySet()) { @@ -194,11 +162,6 @@ public class TestDriver { actorSystem.stop(actorRef); actorRefs.remove(actorName); - - for (ActorRef actor : actorRefs.values()) { - actor.tell(new RemoveRaftPeer(actorName), null); - } - allPeers.remove(actorName); } @@ -207,11 +170,6 @@ public class TestDriver { allPeers.put(actorName, address); ActorRef exampleActor = createExampleActor(actorName); - - for (ActorRef actor : actorRefs.values()) { - actor.tell(new AddRaftPeer(actorName, address), null); - } - actorRefs.put(actorName, exampleActor); addClientsToNode(actorName, 1);