Merge "BUG 2317 : StatisticsManager does not unregister from yang notifications on...
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / example / TestDriver.java
index fd6e192bf0497777de2643a1b3f28a2a76b72e42..f202a8bb1d6bc9c12b71c013fc0fd5e9daf990bf 100644 (file)
@@ -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<String, String> 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<String, ActorRef> newActorRefs = new HashMap<String, ActorRef>(num);
-        for (Map.Entry<String, String> 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<String,ActorRef> 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);