option to not remove flows in flow-tester.py

Change-Id: I6d0be801b628cd6cf3678d5c846fb99cabf41ca3
diff --git a/apps/demo/src/main/java/org/onosproject/demo/DemoInstaller.java b/apps/demo/src/main/java/org/onosproject/demo/DemoInstaller.java
index 8323229..2be1e82 100644
--- a/apps/demo/src/main/java/org/onosproject/demo/DemoInstaller.java
+++ b/apps/demo/src/main/java/org/onosproject/demo/DemoInstaller.java
@@ -148,12 +148,14 @@
     public JsonNode flowTest(Optional<JsonNode> params) {
         int flowsPerDevice = 1000;
         int neighbours = 0;
+        boolean remove = true;
         if (params.isPresent()) {
             flowsPerDevice = params.get().get("flowsPerDevice").asInt();
             neighbours = params.get().get("neighbours").asInt();
+            remove = params.get().get("remove").asBoolean();
         }
 
-        Future<JsonNode> future = worker.submit(new FlowTest(flowsPerDevice, neighbours));
+        Future<JsonNode> future = worker.submit(new FlowTest(flowsPerDevice, neighbours, remove));
 
         try {
             return future.get(10, TimeUnit.SECONDS);
@@ -496,12 +498,14 @@
     private class FlowTest implements Callable<JsonNode> {
         private final int flowPerDevice;
         private final int neighbours;
+        private final boolean remove;
         private FlowRuleOperations.Builder adds;
         private FlowRuleOperations.Builder removes;
 
-        public FlowTest(int flowsPerDevice, int neighbours) {
+        public FlowTest(int flowsPerDevice, int neighbours, boolean remove) {
             this.flowPerDevice = flowsPerDevice;
             this.neighbours = neighbours;
+            this.remove = remove;
             prepareInstallation();
         }
 
@@ -574,7 +578,9 @@
             }));
 
             latch.await(10, TimeUnit.SECONDS);
-            flowService.apply(removes.build());
+            if (this.remove) {
+                flowService.apply(removes.build());
+            }
             return node;
         }
     }
diff --git a/tools/test/bin/flow-tester.py b/tools/test/bin/flow-tester.py
index fc6ad59..d77a861 100644
--- a/tools/test/bin/flow-tester.py
+++ b/tools/test/bin/flow-tester.py
@@ -7,11 +7,11 @@
     r = requests.post(url, data)
     return r
 
-def runTasks(flowPerDevice, neighbours, url, servers, doJson):
+def runTasks(flowPerDevice, neighbours, url, servers, doJson, remove):
     # We can use a with statement to ensure threads are cleaned up promptly
     with concurrent.futures.ThreadPoolExecutor(max_workers=2) as executor:
         # Start the load operations and mark each future with its URL
-        request = { "flowsPerDevice" : flowPerDevice, "neighbours" : neighbours }
+        request = { "flowsPerDevice" : flowPerDevice, "neighbours" : neighbours, "remove" : remove }
         future_to_url = {executor.submit(run, url % (server), request) for server in servers}
         for f in concurrent.futures.as_completed(future_to_url):
             try:
@@ -34,10 +34,12 @@
                             default=0, type="int")
     parser.add_option("-s", "--servers", dest="servers", help="List of servers to hit",
                             default=[], action="append")
+    parser.add_option("-r", "--remove", dest="remove", help="Do not remove flows after installation",
+                            default=True, action="store_false")
     parser.add_option("-j", "--json", dest="doJson", help="Print results in json",
                             default=False, action="store_true")
 
     (options, args) = parser.parse_args()
     if (len(options.servers) == 0):
         options.servers.append("localhost")
-    runTasks(options.flows, options.neighs, options.url, options.servers, options.doJson)
+    runTasks(options.flows, options.neighs, options.url, options.servers, options.doJson, options.remove)