[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/SCPFIntentInstallWithdrawRerouteLat.R b/TestON/JenkinsFile/scripts/SCPFIntentInstallWithdrawRerouteLat.R
index 93e9e00..4a406cb 100644
--- a/TestON/JenkinsFile/scripts/SCPFIntentInstallWithdrawRerouteLat.R
+++ b/TestON/JenkinsFile/scripts/SCPFIntentInstallWithdrawRerouteLat.R
@@ -23,10 +23,19 @@
 # **********************************************************
 # STEP 1: Data management.
 # **********************************************************
-
 print( "**********************************************************" )
 print( "STEP 1: Data management." )
 print( "**********************************************************" )
+has_flow_obj = 1
+database_host = 2
+database_port = 3
+database_u_id = 4
+database_pw = 5
+test_name = 6
+branch_name = 7
+batch_size = 8
+old_flow = 9
+save_directory = 10
 
 # Command line arguments are read.
 print( "Reading commmand-line args." )
@@ -47,7 +56,7 @@
 
 print( "Verifying CLI args." )
 
-if ( is.na( args[ 9 ] ) ){
+if ( is.na( args[ save_directory ] ) ){
 
     print( paste( "Usage: Rscript SCPFIntentInstallWithdrawRerouteLat.R",
                                   "<isFlowObj>" ,
@@ -58,9 +67,9 @@
                                   "<test-name>",
                                   "<branch-name>",
                                   "<batch-size>",
+                                  "<using-old-flow>",
                                   "<directory-to-save-graphs>",
                                   sep=" " ) )
-
     q()  # basically exit(), but in R
 }
 
@@ -72,26 +81,31 @@
 
 chartTitle <- "Intent Install, Withdraw, & Reroute Latencies"
 flowObjFileModifier <- ""
-errBarOutputFile <- paste( args[ 9 ],
+errBarOutputFile <- paste( args[ save_directory ],
                     "SCPFIntentInstallWithdrawRerouteLat_",
-                    args[ 7 ],
+                    args[ branch_name ],
                     sep="" )
 
-if ( args[ 1 ] == "y" ){
+if ( args[ has_flow_obj ] == "y" ){
     errBarOutputFile <- paste( errBarOutputFile, "_fobj", sep="" )
     flowObjFileModifier <- "fobj_"
     chartTitle <- paste( chartTitle, "w/ FlowObj" )
 }
-
+if ( args[ old_flow ] == "y" ){
+    errBarOutputFile <- paste( errBarOutputFile, "_OldFlow", sep="" )
+    chartTitle <- paste( chartTitle,
+                         "With Old Flow",
+                         sep="\n" )
+}
 errBarOutputFile <- paste( errBarOutputFile,
                            "_",
-                           args[ 8 ],
+                           args[ batch_size ],
                            "-batchSize_graph.jpg",
                            sep="" )
 
 chartTitle <- paste( chartTitle,
                      "\nBatch Size =",
-                     args[ 8 ],
+                     args[ batch_size ],
                      sep=" " )
 
 # ------------------
@@ -102,10 +116,10 @@
 
 con <- dbConnect( dbDriver( "PostgreSQL" ),
                   dbname = "onostest",
-                  host = args[ 2 ],
-                  port = strtoi( args[ 3 ] ),
-                  user = args[ 4 ],
-                  password = args[ 5 ] )
+                  host = args[ database_host ],
+                  port = strtoi( args[ database_port ] ),
+                  user = args[ database_u_id ],
+                  password = args[ database_pw ] )
 
 # ---------------------------------------
 # Intent Install and Withdraw SQL Command
@@ -115,14 +129,17 @@
 installWithdrawSQLCommand <- paste( "SELECT * FROM intent_latency_",
                                     flowObjFileModifier,
                                     "tests WHERE batch_size=",
-                                    args[ 8 ],
+                                    args[ batch_size ],
                                     " AND branch = '",
-                                    args[ 7 ],
+                                    args[ branch_name ],
                                     "' AND date IN ( SELECT MAX( date ) FROM intent_latency_",
                                     flowObjFileModifier,
                                     "tests WHERE branch='",
-                                    args[ 7 ],
-                                    "')",
+                                    args[ branch_name ],
+                                    "' AND ",
+                                    ( if( args[ old_flow ] == 'y' ) "" else "NOT " ) ,
+                                    "is_old_flow",
+                                    ")",
                                     sep="" )
 
 print( "Sending Intent Install and Withdraw SQL command:" )
@@ -138,14 +155,17 @@
 rerouteSQLCommand <- paste( "SELECT * FROM intent_reroute_latency_",
                             flowObjFileModifier,
                             "tests WHERE batch_size=",
-                            args[ 8 ],
+                            args[ batch_size ],
                             " AND branch = '",
-                            args[ 7 ],
+                            args[ branch_name ],
                             "' AND date IN ( SELECT MAX( date ) FROM intent_reroute_latency_",
                             flowObjFileModifier,
                             "tests WHERE branch='",
-                            args[ 7 ],
-                            "')",
+                            args[ branch_name ],
+                            "' AND ",
+                            ( if( args[ old_flow ] == 'y' ) "" else "NOT " ) ,
+                            "is_old_flow",
+                            ")",
                             sep="" )
 
 print( "Sending Intent Reroute SQL command:" )
@@ -174,6 +194,7 @@
                                   "name",
                                   "date",
                                   "branch",
+                                  "is_old_flow",
                                   "commit",
                                   "scale",
                                   "batch_size",
diff --git a/TestON/JenkinsFile/scripts/SCPFLineGraph.R b/TestON/JenkinsFile/scripts/SCPFLineGraph.R
index f080a4d..93b3060 100644
--- a/TestON/JenkinsFile/scripts/SCPFLineGraph.R
+++ b/TestON/JenkinsFile/scripts/SCPFLineGraph.R
@@ -27,6 +27,18 @@
 # STEP 1: Data management.
 # **********************************************************
 
+database_host = 1
+database_port = 2
+database_u_id = 3
+database_pw = 4
+graph_title = 5
+branch_name = 6
+num_dates = 7
+sql_commands = 8
+y_axis = 9
+old_flow = 10
+save_directory = 11
+
 print( "**********************************************************" )
 print( "STEP 1: Data management." )
 print( "**********************************************************" )
@@ -51,7 +63,7 @@
 args <- commandArgs( trailingOnly=TRUE )
 
 # Check if sufficient args are provided.
-if ( is.na( args[ 10 ] ) ){
+if ( is.na( args[ save_directory ] ) ){
 
     print( paste( "Usage: Rscript testresultgraph.R",
                                     "<database-host>",
@@ -63,9 +75,9 @@
                                     "<#-dates>",        # part of the output filename
                                     "<SQL-command>",
                                     "<y-axis-title>",   # y-axis may be different among other SCPF graphs (ie: batch size, latency, etc. )
+                                    "<using-old-flow>",
                                     "<directory-to-save-graph>",
                   sep = " " ) )
-
     q()  # basically exit(), but in R
 }
 
@@ -76,19 +88,23 @@
 print( "Creating title of graph" )
 
 # Title of graph based on command line args.
-title <- args[ 5 ]
+
+title <- args[ graph_title ]
+title <- paste( title, if( args[ old_flow ] == "y" ) "\nWith Old Flow" else "" )
 
 print( "Creating graph filename." )
 
 # Filenames for the output graph include the testname, branch, and the graph type.
-outputFile <- paste( args[ 10 ],
+outputFile <- paste( args[ save_directory ],
                     "SCPF_Front_Page_",
-                    gsub( " ", "_", args[ 5 ] ),
+                    gsub( " ", "_", args[ graph_title ] ),
                     "_",
-                    args[ 6 ],
+                    args[ branch_name ],
                     "_",
-                    args[ 7 ],
-                    "-dates_graph.jpg",
+                    args[ num_dates ],
+                    "-dates",
+                    if( args[ old_flow ] == "y" ) "_OldFlow" else "",
+                    "_graph.jpg",
                     sep="" )
 
 # ------------------
@@ -98,15 +114,14 @@
 print( "Initializing SQL" )
 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 ] )
 
 print( "Sending SQL command:" )
-print( args[ 8 ] )
-fileData <- dbGetQuery( con, args[ 8 ] )
-
+print( args[ sql_commands ] )
+fileData <- dbGetQuery( con, args[ sql_commands ] )
 
 # **********************************************************
 # STEP 2: Organize data.
@@ -194,7 +209,7 @@
 
 theme_set( theme_grey( base_size = 22 ) )   # set the default text size of the graph.
 xLabel <- xlab( "Build" )
-yLabel <- ylab( args[ 9 ] )
+yLabel <- ylab( args[ y_axis ] )
 
 imageWidth <- 15
 imageHeight <- 10
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 ) )
diff --git a/TestON/JenkinsFile/scripts/SCPFcbench.R b/TestON/JenkinsFile/scripts/SCPFcbench.R
index fa59c55..b62fa0f 100644
--- a/TestON/JenkinsFile/scripts/SCPFcbench.R
+++ b/TestON/JenkinsFile/scripts/SCPFcbench.R
@@ -27,7 +27,13 @@
 print( "**********************************************************" )
 print( "STEP 1: Data management." )
 print( "**********************************************************" )
-
+database_host = 1
+database_port = 2
+database_u_id = 3
+database_pw = 4
+test_name = 5
+branch_name = 6
+save_directory = 7
 # Command line arguments are read.
 print( "Reading commmand-line args." )
 args <- commandArgs( trailingOnly=TRUE )
@@ -47,7 +53,7 @@
 
 print( "Verifying CLI args." )
 
-if ( is.na( args[ 7 ] ) ){
+if ( is.na( args[ save_directory ] ) ){
 
     print( paste( "Usage: Rscript SCPFcbench",
                                   "<database-host>",
@@ -68,10 +74,10 @@
 
 print( "Creating filenames and title of graph." )
 
-errBarOutputFile <- paste( args[ 7 ],
-                           args[ 5 ],
+errBarOutputFile <- paste( args[ save_directory ],
+                           args[ test_name ],
                            "_",
-                           args[ 6 ],
+                           args[ branch_name ],
                            "_errGraph.jpg",
                            sep="" )
 
@@ -85,10 +91,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 ] )
 
 # ------------------
 # Cbench SQL Command
@@ -97,7 +103,7 @@
 print( "Generating Scale Topology SQL Command" )
 
 command <- paste( "SELECT * FROM cbench_bm_tests WHERE branch='",
-                  args[ 6 ],
+                  args[ branch_name ],
                   "' ORDER BY date DESC LIMIT 3",
                   sep="" )
 
diff --git a/TestON/JenkinsFile/scripts/SCPFflowTp1g.R b/TestON/JenkinsFile/scripts/SCPFflowTp1g.R
index 9c79ac8..140d5f8 100644
--- a/TestON/JenkinsFile/scripts/SCPFflowTp1g.R
+++ b/TestON/JenkinsFile/scripts/SCPFflowTp1g.R
@@ -23,6 +23,16 @@
 # **********************************************************
 # STEP 1: Data management.
 # **********************************************************
+has_flow_obj = 1
+database_host = 2
+database_port = 3
+database_u_id = 4
+database_pw = 5
+test_name = 6
+branch_name = 7
+has_neighbors = 8
+old_flow = 9
+save_directory = 10
 
 print( "**********************************************************" )
 print( "STEP 1: Data management." )
@@ -47,7 +57,7 @@
 
 print( "Verifying CLI args." )
 
-if ( is.na( args[ 9 ] ) ){
+if ( is.na( args[ save_directory ] ) ){
 
     print( paste( "Usage: Rscript SCPFflowTp1g.R",
                                   "<has-flow-obj>",
@@ -58,6 +68,7 @@
                                   "<test-name>",
                                   "<branch-name>",
                                   "<has-neighbors>",
+                                  "<using-old-flow>",
                                   "<directory-to-save-graphs>",
                                   sep=" " ) )
 
@@ -75,7 +86,7 @@
 commandNeighborModifier <- ""
 fileFlowObjModifier <- ""
 sqlFlowObjModifier <- ""
-if ( args[ 1 ] == 'y' ){
+if ( args[ has_flow_obj ] == 'y' ){
     fileFlowObjModifier <- "_flowObj"
     sqlFlowObjModifier <- "_fobj"
     chartTitle <- paste( chartTitle, " with Flow Objectives", sep="" )
@@ -83,22 +94,27 @@
 
 chartTitle <- paste( chartTitle, "\nNeighbors =", sep="" )
 
-if ( args[ 8 ] == 'y' ){
+fileOldFlowModifier <- ""
+if ( args[ has_neighbors ] == 'y' ){
     fileNeighborsModifier <- "all"
     commandNeighborModifier <- "scale=1 OR NOT "
     chartTitle <- paste( chartTitle, "Cluster Size - 1" )
 } else {
     chartTitle <- paste( chartTitle, "0" )
 }
-
-errBarOutputFile <- paste( args[ 9 ],
-                           args[ 6 ],
+if ( args[ old_flow ] == 'y' ){
+    fileOldFlowModifier <- "_OldFlow"
+    chartTitle <- paste( chartTitle, "With Old Flow", sep="\n" )
+}
+errBarOutputFile <- paste( args[ save_directory ],
+                           args[ test_name ],
                            "_",
-                           args[ 7 ],
+                           args[ branch_name ],
                            "_",
                            fileNeighborsModifier,
                            "-neighbors",
                            fileFlowObjModifier,
+                           fileOldFlowModifier,
                            "_graph.jpg",
                            sep="" )
 # ------------------
@@ -109,10 +125,10 @@
 
 con <- dbConnect( dbDriver( "PostgreSQL" ),
                   dbname = "onostest",
-                  host = args[ 2 ],
-                  port = strtoi( args[ 3 ] ),
-                  user = args[ 4 ],
-                  password = args[ 5 ] )
+                  host = args[ database_host ],
+                  port = strtoi( args[ database_port ] ),
+                  user = args[ database_u_id ],
+                  password = args[ database_pw ] )
 
 # ---------------------------
 # Flow Throughput SQL Command
@@ -125,12 +141,15 @@
                   "_tests WHERE (",
                   commandNeighborModifier,
                   "neighbors = 0 ) AND branch = '",
-                  args[ 7 ],
+                  args[ branch_name ],
                   "' AND date IN ( SELECT max( date ) FROM flow_tp",
                   sqlFlowObjModifier,
                   "_tests WHERE branch='",
-                  args[ 7 ],
-                  "' ) GROUP BY scale ORDER BY scale",
+                  args[ branch_name ],
+                  "' AND ",
+                  ( if( args[ old_flow ] == 'y' ) "" else "NOT " ),
+                  "is_old_flow",
+                  " ) GROUP BY scale ORDER BY scale",
                   sep="" )
 
 print( "Sending SQL command:" )
diff --git a/TestON/JenkinsFile/scripts/SCPFhostLat.R b/TestON/JenkinsFile/scripts/SCPFhostLat.R
index 0ae64cf..56d0f11 100644
--- a/TestON/JenkinsFile/scripts/SCPFhostLat.R
+++ b/TestON/JenkinsFile/scripts/SCPFhostLat.R
@@ -22,11 +22,17 @@
 
 # **********************************************************
 # STEP 1: Data management.
-# **********************************************************
-
+# **********************************************************\
 print( "**********************************************************" )
 print( "STEP 1: Data management." )
 print( "**********************************************************" )
+database_host = 1
+database_port = 2
+database_u_id = 3
+database_pw = 4
+test_name = 5
+branch_name = 6
+save_directory = 7
 
 # Command line arguments are read.
 print( "Reading commmand-line args." )
@@ -47,7 +53,7 @@
 
 print( "Verifying CLI args." )
 
-if ( is.na( args[ 7 ] ) ){
+if ( is.na( args[ save_directory ] ) ){
 
     print( paste( "Usage: Rscript SCPFhostLat",
                                   "<database-host>",
@@ -68,15 +74,14 @@
 
 print( "Creating filenames and title of graph." )
 
-errBarOutputFile <- paste( args[ 7 ],
-                           args[ 5 ],
+errBarOutputFile <- paste( args[ save_directory ],
+                           args[ test_name ],
                            "_",
-                           args[ 6 ],
+                           args[ branch_name ],
                            "_errGraph.jpg",
                            sep="" )
 
 chartTitle <- "Host Latency"
-
 # ------------------
 # SQL Initialization
 # ------------------
@@ -85,10 +90,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 ] )
 
 # ------------------------
 # Host Latency SQL Command
@@ -97,9 +102,9 @@
 print( "Generating Host Latency SQL Command" )
 
 command  <- paste( "SELECT * FROM host_latency_tests WHERE branch = '",
-                   args[ 6 ],
+                   args[ branch_name ],
                    "' AND date IN ( SELECT MAX( date ) FROM host_latency_tests WHERE branch = '",
-                   args[ 6 ],
+                   args[ branch_name ],
                    "' ) ",
                    sep = "" )
 
@@ -230,4 +235,4 @@
         height = imageHeight,
         dpi = imageDPI )
 
-print( paste( "[SUCCESS] Successfully wrote bar chart out to", errBarOutputFile ) )
\ No newline at end of file
+print( paste( "[SUCCESS] Successfully wrote bar chart out to", errBarOutputFile ) )
diff --git a/TestON/JenkinsFile/scripts/SCPFintentEventTp.R b/TestON/JenkinsFile/scripts/SCPFintentEventTp.R
index 53fe2d4..c7578f5 100644
--- a/TestON/JenkinsFile/scripts/SCPFintentEventTp.R
+++ b/TestON/JenkinsFile/scripts/SCPFintentEventTp.R
@@ -27,6 +27,16 @@
 print( "**********************************************************" )
 print( "STEP 1: Data management." )
 print( "**********************************************************" )
+has_flow_obj = 1
+database_host = 2
+database_port = 3
+database_u_id = 4
+database_pw = 5
+test_name = 6
+branch_name = 7
+has_neighbors = 8
+old_flow = 9
+save_directory = 10
 
 # Command line arguments are read.
 print( "Reading commmand-line args." )
@@ -47,7 +57,7 @@
 
 print( "Verifying CLI args." )
 
-if ( is.na( args[ 9 ] ) ){
+if ( is.na( args[ save_directory ] ) ){
 
     print( paste( "Usage: Rscript SCPFIntentEventTp.R",
                                   "<has-flow-obj>",
@@ -58,6 +68,7 @@
                                   "<test-name>",
                                   "<branch-name>",
                                   "<has-neighbors>",
+                                  "<using-old-flow>",
                                   "<directory-to-save-graphs>",
                                   sep=" " ) )
 
@@ -76,7 +87,7 @@
 fileFlowObjModifier <- ""
 sqlFlowObjModifier <- ""
 
-if ( args[ 1 ] == 'y' ){
+if ( args[ has_flow_obj ] == 'y' ){
     fileFlowObjModifier <- "_flowObj"
     sqlFlowObjModifier <- "_fobj"
     chartTitle <- paste( chartTitle, " with Flow Objectives", sep="" )
@@ -84,22 +95,28 @@
 
 chartTitle <- paste( chartTitle, "\nevents/second with Neighbors =", sep="" )
 
-if ( args[ 8 ] == 'y' ){
+fileOldFlowModifier <- ""
+if ( args[ has_neighbors ] == 'y' ){
     fileNeighborsModifier <- "all"
     commandNeighborModifier <- "scale=1 OR NOT "
     chartTitle <- paste( chartTitle, "all" )
 } else {
     chartTitle <- paste( chartTitle, "0" )
 }
+if ( args[ old_flow ] == 'y' ){
+    fileOldFlowModifier <- "_OldFlow"
+    chartTitle <- paste( chartTitle, "With Old Flow", sep="\n" )
+}
 
-errBarOutputFile <- paste( args[ 9 ],
-                           args[ 6 ],
+errBarOutputFile <- paste( args[ save_directory ],
+                           args[ test_name ],
                            "_",
-                           args[ 7 ],
+                           args[ branch_name ],
                            "_",
                            fileNeighborsModifier,
                            "-neighbors",
                            fileFlowObjModifier,
+                           fileOldFlowModifier,
                            "_graph.jpg",
                            sep="" )
 
@@ -111,10 +128,10 @@
 
 con <- dbConnect( dbDriver( "PostgreSQL" ),
                   dbname = "onostest",
-                  host = args[ 2 ],
-                  port = strtoi( args[ 3 ] ),
-                  user = args[ 4 ],
-                  password = args[ 5 ] )
+                  host = args[ database_host ],
+                  port = strtoi( args[ database_port ] ),
+                  user = args[ database_u_id ],
+                  password = args[ database_pw ] )
 
 # -----------------------------------
 # Intent Event Throughput SQL Command
@@ -127,12 +144,15 @@
                   "_tests WHERE (",
                   commandNeighborModifier,
                   "neighbors = 0 ) AND branch = '",
-                  args[ 7 ],
+                  args[ branch_name ],
                   "' AND date IN ( SELECT max( date ) FROM intent_tp",
                   sqlFlowObjModifier,
                   "_tests WHERE branch='",
-                  args[ 7 ],
-                  "' ) GROUP BY scale ORDER BY scale",
+                  args[ branch_name ],
+                  "' AND ",
+                  ( if( args[ old_flow ] == 'y' ) "" else "NOT " ),
+                  "is_old_flow",
+                  " ) GROUP BY scale ORDER BY scale",
                   sep="" )
 
 print( "Sending SQL command:" )
diff --git a/TestON/JenkinsFile/scripts/SCPFmastershipFailoverLat.R b/TestON/JenkinsFile/scripts/SCPFmastershipFailoverLat.R
index 82638dc..8681f29 100644
--- a/TestON/JenkinsFile/scripts/SCPFmastershipFailoverLat.R
+++ b/TestON/JenkinsFile/scripts/SCPFmastershipFailoverLat.R
@@ -27,6 +27,13 @@
 print( "**********************************************************" )
 print( "STEP 1: Data management." )
 print( "**********************************************************" )
+database_host = 1
+database_port = 2
+database_u_id = 3
+database_pw = 4
+test_name = 5
+branch_name = 6
+save_directory = 7
 
 # Command line arguments are read.
 print( "Reading commmand-line args." )
@@ -46,9 +53,7 @@
 # -------------------
 
 print( "Verifying CLI args." )
-
-if ( is.na( args[ 7 ] ) ){
-
+if ( is.na( args[ save_directory ] ) ){
     print( paste( "Usage: Rscript SCPFmastershipFailoverLat",
                                   "<database-host>",
                                   "<database-port>",
@@ -70,17 +75,17 @@
 
 chartTitle <- "Mastership Failover Latency"
 
-errBarOutputFile <- paste( args[ 7 ],
-                           args[ 5 ],
+errBarOutputFile <- paste( args[ save_directory ],
+                           args[ test_name ],
                            "_",
-                           args[ 6 ],
+                           args[ branch_name ],
                            "_errGraph.jpg",
                            sep="" )
 
-stackedBarOutputFile <- paste( args[ 7 ],
-                        args[ 5 ],
+stackedBarOutputFile <- paste( args[ save_directory ],
+                        args[ test_name ],
                         "_",
-                        args[ 6 ],
+                        args[ branch_name ],
                         "_stackedGraph.jpg",
                         sep="" )
 
@@ -92,10 +97,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 ] )
 
 # ---------------------------------------
 # Mastership Failover Latency SQL Command
@@ -104,9 +109,9 @@
 print( "Generating Mastership Failover Latency SQL command" )
 
 command  <- paste( "SELECT * FROM mastership_failover_tests WHERE branch = '",
-                   args[ 6 ],
+                   args[ branch_name ],
                    "' AND date IN ( SELECT MAX( date ) FROM mastership_failover_tests WHERE branch = '",
-                   args[ 6 ],
+                   args[ branch_name ],
                    "' ) ",
                    sep = "" )
 
diff --git a/TestON/JenkinsFile/scripts/SCPFportLat.R b/TestON/JenkinsFile/scripts/SCPFportLat.R
index bb43248..254b718 100644
--- a/TestON/JenkinsFile/scripts/SCPFportLat.R
+++ b/TestON/JenkinsFile/scripts/SCPFportLat.R
@@ -23,10 +23,16 @@
 # **********************************************************
 # STEP 1: Data management.
 # **********************************************************
-
 print( "**********************************************************" )
 print( "STEP 1: Data management." )
 print( "**********************************************************" )
+database_host = 1
+database_port = 2
+database_u_id = 3
+database_pw = 4
+test_name = 5
+branch_name = 6
+save_directory = 7
 
 # Command line arguments are read.
 print( "Reading commmand-line args." )
@@ -47,7 +53,7 @@
 
 print( "Verifying CLI args." )
 
-if ( is.na( args[ 7 ] ) ){
+if ( is.na( args[ save_directory ] ) ){
 
     print( paste( "Usage: Rscript SCPFportLat",
                                   "<database-host>",
@@ -67,31 +73,29 @@
 # -----------------
 
 print( "Creating filenames and title of graph." )
-
-errBarOutputFileUp <- paste( args[ 7 ],
+errBarOutputFileUp <- paste( args[ save_directory ],
                              "SCPFportLat_",
-                             args[ 6 ],
+                             args[ branch_name ],
                              "_UpErrBarWithStack.jpg",
                              sep = "" )
 
-errBarOutputFileDown <- paste( args[ 7 ],
+errBarOutputFileDown <- paste( args[ save_directory ],
                              "SCPFportLat_",
-                             args[ 6 ],
+                             args[ branch_name ],
                              "_DownErrBarWithStack.jpg",
                              sep = "" )
 
 # ------------------
 # SQL Initialization
 # ------------------
-
 print( "Initializing SQL" )
 
 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 ] )
 
 # ------------------------
 # Port Latency SQL Command
@@ -100,9 +104,9 @@
 print( "Generating Port Latency SQL Command" )
 
 command <- paste( "SELECT * FROM port_latency_details WHERE branch = '",
-                  args[ 6 ],
+                  args[ branch_name ],
                   "' AND date IN ( SELECT MAX( date ) FROM port_latency_details WHERE branch = '",
-                  args[ 6 ],
+                  args[ branch_name ],
                   "' ) ",
                   sep = "" )
 
diff --git a/TestON/JenkinsFile/scripts/SCPFscaleTopo.R b/TestON/JenkinsFile/scripts/SCPFscaleTopo.R
index 8344efb..fdb39e4 100644
--- a/TestON/JenkinsFile/scripts/SCPFscaleTopo.R
+++ b/TestON/JenkinsFile/scripts/SCPFscaleTopo.R
@@ -23,10 +23,16 @@
 # **********************************************************
 # STEP 1: Data management.
 # **********************************************************
-
 print( "**********************************************************" )
 print( "STEP 1: Data management." )
 print( "**********************************************************" )
+database_host = 1
+database_port = 2
+database_u_id = 3
+database_pw = 4
+test_name = 5
+branch_name = 6
+save_directory = 7
 
 # Command line arguments are read.
 print( "Reading commmand-line args." )
@@ -47,7 +53,7 @@
 
 print( "Verifying CLI args." )
 
-if ( is.na( args[ 7 ] ) ){
+if ( is.na( args[ save_directory ] ) ){
 
     print( paste( "Usage: Rscript SCPFgraphGenerator",
                                   "<database-host>",
@@ -68,10 +74,10 @@
 
 print( "Creating filenames and title of graph." )
 
-outputFile <- paste( args[ 7 ],
-                     args[ 5 ],
+outputFile <- paste( args[ save_directory ],
+                     args[ test_name ],
                      "_",
-                     args[ 6 ],
+                     args[ branch_name ],
                      "_graph.jpg",
                      sep="" )
 
@@ -85,10 +91,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 ] )
 
 # --------------------------
 # Scale Topology SQL Command
@@ -97,9 +103,9 @@
 print( "Generating Scale Topology SQL Command" )
 
 command <- paste( "SELECT * FROM scale_topo_latency_details WHERE branch = '",
-                  args[ 6 ],
+                  args[ branch_name ],
                   "' AND date IN ( SELECT MAX( date ) FROM scale_topo_latency_details WHERE branch = '",
-                  args[ 6 ],
+                  args[ branch_name ],
                   "' ) ",
                   sep = "" )
 
diff --git a/TestON/JenkinsFile/scripts/SCPFscalingMaxIntents.R b/TestON/JenkinsFile/scripts/SCPFscalingMaxIntents.R
index 2ca0627..130e2dd 100644
--- a/TestON/JenkinsFile/scripts/SCPFscalingMaxIntents.R
+++ b/TestON/JenkinsFile/scripts/SCPFscalingMaxIntents.R
@@ -27,6 +27,15 @@
 print( "**********************************************************" )
 print( "STEP 1: Data management." )
 print( "**********************************************************" )
+has_flow_obj = 1
+database_host = 2
+database_port = 3
+database_u_id = 4
+database_pw = 5
+test_name = 6
+branch_name = 7
+old_flow = 8
+save_directory = 9
 
 print( "Reading commmand-line args." )
 args <- commandArgs( trailingOnly=TRUE )
@@ -46,8 +55,7 @@
 
 print( "Verifying CLI args." )
 
-if ( is.na( args[ 8 ] ) ){
-
+if ( is.na( args[ save_directory ] ) ){
     print( paste( "Usage: Rscript SCPFInstalledIntentsFlows",
                                   "<has-flowObj>",
                                   "<database-host>",
@@ -56,6 +64,7 @@
                                   "<database-password>",
                                   "<test-name>",
                                   "<branch-name>",
+                                  "<using-old-flow>",
                                   "<directory-to-save-graphs>",
                                   sep=" " ) )
 
@@ -72,17 +81,23 @@
 sqlFlowObjModifier <- ""
 chartTitle <- "Number of Installed Intents & Flows"
 
-if ( args[ 1 ] == "y" ){
+if ( args[ has_flow_obj ] == "y" ){
     fileFlowObjModifier <- "_flowObj"
     sqlFlowObjModifier <- "fobj_"
     chartTitle <- "Number of Installed Intents & Flows\n with Flow Objectives"
 }
+fileOldFlowModifier <- ""
+if ( args[ old_flow ] == 'y' ){
+    fileOldFlowModifier <- "_OldFlow"
+    chartTitle <- paste( chartTitle, "With Old Flow", sep="\n" )
+}
 
-outputFile <- paste( args[ 8 ],
-                     args[ 6 ],
+outputFile <- paste( args[ save_directory ],
+                     args[ test_name ],
                      fileFlowObjModifier,
+                     fileOldFlowModifier,
                      "_",
-                     args[ 7 ],
+                     args[ branch_name ],
                      "_errGraph.jpg",
                      sep="" )
 
@@ -94,10 +109,10 @@
 
 con <- dbConnect( dbDriver( "PostgreSQL" ),
                   dbname = "onostest",
-                  host = args[ 2 ],
-                  port = strtoi( args[ 3 ] ),
-                  user = args[ 4 ],
-                  password = args[ 5 ] )
+                  host = args[ database_host ],
+                  port = strtoi( args[ database_port ] ),
+                  user = args[ database_u_id ],
+                  password = args[ database_pw ] )
 
 # -------------------------------
 # Scaling Max Intents SQL Command
@@ -108,12 +123,15 @@
 command <- paste( "SELECT * FROM max_intents_",
                   sqlFlowObjModifier,
                   "tests WHERE branch = '",
-                  args[ 7 ],
+                  args[ branch_name ],
                   "' AND date IN ( SELECT MAX( date ) FROM max_intents_",
                   sqlFlowObjModifier,
                   "tests WHERE branch = '",
-                  args[ 7 ],
-                  "' ) ",
+                  args[ branch_name ],
+                  "' AND ",
+                  ( if( args[ old_flow ] == 'y' ) "" else "NOT " ),
+                  "is_old_flow",
+                  " ) ",
                   sep="" )
 
 print( "Sending SQL command:" )
diff --git a/TestON/JenkinsFile/scripts/SCPFswitchLat.R b/TestON/JenkinsFile/scripts/SCPFswitchLat.R
index 97b8d44..8a68e08 100644
--- a/TestON/JenkinsFile/scripts/SCPFswitchLat.R
+++ b/TestON/JenkinsFile/scripts/SCPFswitchLat.R
@@ -27,6 +27,13 @@
 print( "**********************************************************" )
 print( "STEP 1: Data management." )
 print( "**********************************************************" )
+database_host = 1
+database_port = 2
+database_u_id = 3
+database_pw = 4
+test_name = 5
+branch_name = 6
+save_directory = 7
 
 # Command line arguments are read.
 print( "Reading commmand-line args." )
@@ -47,7 +54,7 @@
 
 print( "Verifying CLI args." )
 
-if ( is.na( args[ 7 ] ) ){
+if ( is.na( args[ save_directory ] ) ){
 
     print( paste( "Usage: Rscript SCPFswitchLat",
                             "<database-host>",
@@ -68,15 +75,15 @@
 
 print( "Creating filenames and title of graph." )
 
-errBarOutputFileUp <- paste( args[ 7 ],
+errBarOutputFileUp <- paste( args[ save_directory ],
                              "SCPFswitchLat_",
-                             args[ 6 ],
+                             args[ branch_name ],
                              "_UpErrBarWithStack.jpg",
                              sep="" )
 
-errBarOutputFileDown <- paste( args[ 7 ],
+errBarOutputFileDown <- paste( args[ save_directory ],
                                "SCPFswitchLat_",
-                               args[ 6 ],
+                               args[ branch_name ],
                                "_DownErrBarWithStack.jpg",
                                sep="" )
 # ------------------
@@ -87,10 +94,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 ] )
 
 # --------------------------
 # Switch Latency SQL Command
@@ -99,9 +106,9 @@
 print( "Generating Switch Latency SQL Command" )
 
 command <- paste( "SELECT * FROM switch_latency_details WHERE branch = '",
-                  args[ 6 ],
+                  args[ branch_name ],
                   "' AND date IN ( SELECT MAX( date ) FROM switch_latency_details WHERE branch='",
-                  args[ 6 ],
+                  args[ branch_name ],
                   "' )",
                   sep="" )