[ONOS-7196]Making a separate database, graph and Wiki page for the old flow rules result

Change-Id: Ifeeaa0d725d2cd39c9f276d5383f562f2a67be34
diff --git a/TestON/JenkinsFile/scripts/SCPFbatchFlowResp.R b/TestON/JenkinsFile/scripts/SCPFbatchFlowResp.R
index d63bce3..19e4a1f 100644
--- a/TestON/JenkinsFile/scripts/SCPFbatchFlowResp.R
+++ b/TestON/JenkinsFile/scripts/SCPFbatchFlowResp.R
@@ -23,6 +23,14 @@
 # **********************************************************
 # STEP 1: Data management.
 # **********************************************************
+database_host = 1
+database_port = 2
+database_u_id = 3
+database_pw = 4
+test_name = 5
+branch_name = 6
+old_flow = 7
+save_directory = 8
 
 print( "**********************************************************" )
 print( "STEP 1: Data management." )
@@ -47,7 +55,7 @@
 
 print( "Verifying CLI args." )
 
-if ( is.na( args[ 7 ] ) ){
+if ( is.na( args[ save_directory ] ) ){
 
     print( paste( "Usage: Rscript SCPFbatchFlowResp",
                                   "<database-host>",
@@ -56,6 +64,7 @@
                                   "<database-password>",
                                   "<test-name>",
                                   "<branch-name>",
+                                  "<using-old-flow>",
                                   "<directory-to-save-graphs>",
                                   sep=" " ) )
 
@@ -68,22 +77,30 @@
 
 print( "Creating filenames and title of graph." )
 
-postOutputFile <- paste( args[ 7 ],
-                         args[ 5 ],
+postOutputFile <- paste( args[ save_directory ],
+                         args[ test_name ],
                          "_",
-                         args[ 6 ],
+                         args[ branch_name ],
+                         if( args[ old_flow ] == "y" ) "_OldFlow" else "",
                          "_PostGraph.jpg",
                          sep="" )
 
-delOutputFile <- paste( args[ 7 ],
-                        args[ 5 ],
+delOutputFile <- paste( args[ save_directory ],
+                        args[ test_name ],
                         "_",
-                        args[ 6 ],
+                        args[ branch_name ],
+                        if( args[ old_flow ] == "y" ) "_OldFlow" else "",
                         "_DelGraph.jpg",
                         sep="" )
 
-postChartTitle <- paste( "Single Bench Flow Latency - Post", "Last 3 Builds", sep = "\n" )
-delChartTitle <- paste( "Single Bench Flow Latency - Del", "Last 3 Builds", sep = "\n" )
+postChartTitle <- paste( "Single Bench Flow Latency - Post\n",
+                         "Last 3 Builds",
+                         if( args[ old_flow ] == "y" ) " With Old Flow" else "",
+                         sep = "" )
+delChartTitle <- paste( "Single Bench Flow Latency - Del\n",
+                        "Last 3 Builds",
+                        if( args[ old_flow ] == "y" ) " With Old Flow" else "",
+                        sep = "" )
 
 # ------------------
 # SQL Initialization
@@ -93,10 +110,10 @@
 
 con <- dbConnect( dbDriver( "PostgreSQL" ),
                   dbname = "onostest",
-                  host = args[ 1 ],
-                  port = strtoi( args[ 2 ] ),
-                  user = args[ 3 ],
-                  password = args[ 4 ] )
+                  host = args[ database_host ],
+                  port = strtoi( args[ database_port ] ),
+                  user = args[ database_u_id ],
+                  password = args[ database_pw ] )
 
 # ---------------------------
 # Batch Flow Resp SQL Command
@@ -105,8 +122,11 @@
 print( "Generating Batch Flow Resp SQL Command" )
 
 command <- paste( "SELECT * FROM batch_flow_tests WHERE branch='",
-                  args[ 6 ],
-                  "' ORDER BY date DESC LIMIT 3",
+                  args[ branch_name ],
+                  "' AND " ,
+                  ( if( args[ old_flow ] == 'y' ) "" else "NOT " ) ,
+                  "is_old_flow",
+                  " ORDER BY date DESC LIMIT 3",
                   sep="" )
 
 print( "Sending SQL command:" )
@@ -354,4 +374,4 @@
         height = imageHeight,
         dpi = imageDPI )
 
-print( paste( "[SUCCESS] Successfully wrote stacked bar chart out to", delOutputFile ) )
\ No newline at end of file
+print( paste( "[SUCCESS] Successfully wrote stacked bar chart out to", delOutputFile ) )