Merge "Adding more feature to Jenkins file"
diff --git a/TestON/JenkinsFile/scripts/SCPFIntentInstallWithdrawRerouteLat.R b/TestON/JenkinsFile/scripts/SCPFIntentInstallWithdrawRerouteLat.R
index 186c1c2..98447ca 100644
--- a/TestON/JenkinsFile/scripts/SCPFIntentInstallWithdrawRerouteLat.R
+++ b/TestON/JenkinsFile/scripts/SCPFIntentInstallWithdrawRerouteLat.R
@@ -127,6 +127,8 @@
 
 dataFrame <- na.omit( dataFrame )   # Omit any data that doesn't exist
 
+
+
 print( "Data Frame Results:" )
 print( dataFrame )
 
@@ -166,10 +168,11 @@
 
 theme <- theme( plot.title=element_text( hjust = 0.5, size = 22, face='bold' ) )
 
+
+
 # Store plot configurations as 1 variable
 fundamentalGraphData <- mainPlot + xScaleConfig + xLabel + yLabel + fillLabel + theme
 
-
 # Create the bar graph with error bars.
 # geom_bar contains:
 #    - stat: data formatting (usually "identity")
@@ -177,9 +180,11 @@
 # geom_errorbar contains similar arguments as geom_bar.
 print( "Generating bar graph with error bars." )
 barGraphFormat <- geom_bar( stat = "identity", width = width, position = "dodge" )
-errorBarFormat <- geom_errorbar( width = width, position = "dodge" )
+errorBarFormat <- geom_errorbar( width = width, position = "dodge", color=rgb( 140, 140, 140, maxColorValue=255 ) )
 title <- ggtitle( chartTitle )
-result <- fundamentalGraphData + barGraphFormat + errorBarFormat + title
+values <- geom_text( aes( x=dataFrame$scale, y=dataFrame$ms + 0.035 * max( dataFrame$ms ), label = format( dataFrame$ms, digits=3, big.mark = ",", scientific = FALSE ) ), position=position_dodge( width=1.3 ), size = 3.2, fontface = "bold" )
+
+result <- fundamentalGraphData + barGraphFormat + errorBarFormat + title + values
 
 # Save graph to file
 print( paste( "Saving bar chart with error bars to", errBarOutputFile ) )
diff --git a/TestON/JenkinsFile/scripts/SCPFbatchFlowResp.R b/TestON/JenkinsFile/scripts/SCPFbatchFlowResp.R
index 3698afb..72f66c7 100644
--- a/TestON/JenkinsFile/scripts/SCPFbatchFlowResp.R
+++ b/TestON/JenkinsFile/scripts/SCPFbatchFlowResp.R
@@ -105,11 +105,13 @@
 fundamentalGraphData <- mainPlot + xScaleConfig + xLabel + yLabel + fillLabel + theme
 
 
-print( "Generating bar graph with error bars." )
+print( "Generating bar graph." )
 width <- 0.3
 barGraphFormat <- geom_bar( stat="identity", width = width )
+sum <- fileData[ 'posttoconfrm' ] + fileData[ 'elapsepost' ]
+values <- geom_text( aes( x=dataFrame$iterative, y=sum + 0.04 * max( sum ), label = format( sum, digits=3, big.mark = ",", scientific = FALSE ) ), size = 5, fontface = "bold" )
 title <- ggtitle( chartTitle )
-result <- fundamentalGraphData + barGraphFormat + title
+result <- fundamentalGraphData + barGraphFormat + title + values
 
 
 print( paste( "Saving bar chart to", errBarOutputFile ) )
@@ -161,12 +163,14 @@
 fundamentalGraphData <- mainPlot + xScaleConfig + xLabel + yLabel + fillLabel + theme
 
 
-print( "Generating bar graph with error bars." )
+print( "Generating bar graph." )
 width <- 0.3
 barGraphFormat <- geom_bar( stat="identity", width = width )
+sum <- fileData[ 'deltoconfrm' ] + fileData[ 'elapsedel' ]
+values <- geom_text( aes( x=dataFrame$iterative, y=sum + 0.04 * max( sum ), label = format( sum, digits=3, big.mark = ",", scientific = FALSE ) ), size = 5, fontface = "bold" )
 chartTitle <- paste( "Single Bench Flow Latency - Del", "Last 3 Builds", sep = "\n" )
 title <- ggtitle( chartTitle )
-result <- fundamentalGraphData + barGraphFormat + title
+result <- fundamentalGraphData + barGraphFormat + title + values
 
 errBarOutputFile <- paste( args[ 7 ], args[ 5 ], sep="" )
 errBarOutputFile <- paste( errBarOutputFile, args[ 6 ], sep="_" )
diff --git a/TestON/JenkinsFile/scripts/SCPFcbench.R b/TestON/JenkinsFile/scripts/SCPFcbench.R
index bccfb38..c9a6c37 100644
--- a/TestON/JenkinsFile/scripts/SCPFcbench.R
+++ b/TestON/JenkinsFile/scripts/SCPFcbench.R
@@ -96,8 +96,8 @@
 theme_set( theme_grey( base_size = 20 ) )   # set the default text size of the graph.
 
 mainPlot <- ggplot( data = dataFrame, aes( x = iterative, y = ms, ymin = ms - std, ymax = ms + std ) )
-xScaleConfig <- scale_x_continuous( breaks = dataFrame$iterative, label = dataFrame$date )
-xLabel <- xlab( "date" )
+xScaleConfig <- scale_x_continuous( breaks = dataFrame$iterative,   label = dataFrame$date )
+xLabel <- xlab( "Build Date" )
 yLabel <- ylab( "Responses / sec" )
 fillLabel <- labs( fill="Type" )
 theme <- theme( plot.title=element_text( hjust = 0.5, size = 28, face='bold' ) )
@@ -108,9 +108,10 @@
 print( "Generating bar graph with error bars." )
 width <- 0.3
 barGraphFormat <- geom_bar( stat="identity", position = position_dodge(), width = width, fill="#00AA13" )
-errorBarFormat <- geom_errorbar( position=position_dodge( ), width = width )
+errorBarFormat <- geom_errorbar( width = width, color=rgb( 140, 140,140, maxColorValue=255 ) )
+values <- geom_text( aes( x=dataFrame$iterative, y=fileData[ 'avg' ] + 0.025 * max( fileData[ 'avg' ] ), label = format( fileData[ 'avg' ], digits=3, big.mark = ",", scientific = FALSE ) ), size = 4.5, fontface = "bold" )
 title <- ggtitle( chartTitle )
-result <- fundamentalGraphData + barGraphFormat + errorBarFormat + title
+result <- fundamentalGraphData + barGraphFormat + errorBarFormat + title + values
 
 
 print( paste( "Saving bar chart with error bars to", errBarOutputFile ) )
diff --git a/TestON/JenkinsFile/scripts/SCPFflowTp1g.R b/TestON/JenkinsFile/scripts/SCPFflowTp1g.R
index 89e2379..8ec053e 100644
--- a/TestON/JenkinsFile/scripts/SCPFflowTp1g.R
+++ b/TestON/JenkinsFile/scripts/SCPFflowTp1g.R
@@ -158,6 +158,7 @@
 
 theme <- theme( plot.title=element_text( hjust = 0.5, size = 28, face='bold' ) )
 
+
 # Store plot configurations as 1 variable
 fundamentalGraphData <- mainPlot + xScaleConfig + xLabel + yLabel + fillLabel + theme
 
@@ -169,9 +170,10 @@
 # geom_errorbar contains similar arguments as geom_bar.
 print( "Generating bar graph with error bars." )
 barGraphFormat <- geom_bar( stat = "identity", width = width, fill="#FFA94F" )
-errorBarFormat <- geom_errorbar( position=position_dodge( ), width = width )
+errorBarFormat <- geom_errorbar( width = width, position=position_dodge(), color=rgb( 140,140,140, maxColorValue=255 ) )
+values <- geom_text( aes( x=dataFrame$scale, y=dataFrame$throughput + 0.04 * max( dataFrame$throughput ), label = format( dataFrame$throughput, digits=3, big.mark = ",", scientific = FALSE ) ), size = 5, fontface = "bold" )
 title <- ggtitle( paste( chartTitle, "" ) )
-result <- fundamentalGraphData + barGraphFormat + errorBarFormat + title
+result <- fundamentalGraphData + barGraphFormat + errorBarFormat + title + values
 
 # Save graph to file
 print( paste( "Saving bar chart with error bars to", errBarOutputFile ) )
diff --git a/TestON/JenkinsFile/scripts/SCPFhostLat.R b/TestON/JenkinsFile/scripts/SCPFhostLat.R
index e17cedb..738765a 100644
--- a/TestON/JenkinsFile/scripts/SCPFhostLat.R
+++ b/TestON/JenkinsFile/scripts/SCPFhostLat.R
@@ -108,9 +108,10 @@
 print( "Generating bar graph with error bars." )
 width <- 0.9
 barGraphFormat <- geom_bar( stat="identity", position=position_dodge( ), width = width, fill="#E8BD00" )
-errorBarFormat <- geom_errorbar( position=position_dodge( ), width = width )
+errorBarFormat <- geom_errorbar( position=position_dodge(), width = width, color=rgb( 140, 140, 140, maxColorValue=255 ) )
+values <- geom_text( aes( x=dataFrame$scale, y=dataFrame$ms + 0.08 * max( dataFrame$ms ), label = format( dataFrame$ms, digits=3, big.mark = ",", scientific = FALSE ) ), size = 5, fontface = "bold" )
 title <- ggtitle( paste( chartTitle, "with Standard Error Bars" ) )
-result <- fundamentalGraphData + barGraphFormat + errorBarFormat + title
+result <- fundamentalGraphData + barGraphFormat + errorBarFormat + title + values
 
 
 print( paste( "Saving bar chart with error bars to", errBarOutputFile ) )
diff --git a/TestON/JenkinsFile/scripts/SCPFintentEventTp.R b/TestON/JenkinsFile/scripts/SCPFintentEventTp.R
index 7a55371..420b444 100644
--- a/TestON/JenkinsFile/scripts/SCPFintentEventTp.R
+++ b/TestON/JenkinsFile/scripts/SCPFintentEventTp.R
@@ -120,7 +120,6 @@
 #    These are variables that apply to all of the graphs being generated, regardless of type.
 #
 # 2. Type specific graph data is generated.
-#     Data specific for the error bar and stacked bar graphs are generated.
 #
 # 3. Generate and save the graphs.
 #      Graphs are saved to the filename above, in the directory provided in command line args
@@ -156,16 +155,12 @@
 }
 
 theme <- theme( plot.title=element_text( hjust = 0.5, size = 28, face='bold' ) )
+values <- geom_text( aes( x=dataFrame$scale, y=dataFrame$throughput + 0.04 * max( dataFrame$throughput ), label = format( dataFrame$throughput, digits=3, big.mark = ",", scientific = FALSE ) ), size = 5, fontface = "bold" )
 
 # Store plot configurations as 1 variable
-fundamentalGraphData <- mainPlot + xScaleConfig + xLabel + yLabel + fillLabel + theme
+fundamentalGraphData <- mainPlot + xScaleConfig + xLabel + yLabel + fillLabel + theme + values
 
 
-# Create the stacked bar graph with error bars.
-# geom_bar contains:
-#    - stat: data formatting (usually "identity")
-#    - width: the width of the bar types (declared above)
-# geom_errorbar contains similar arguments as geom_bar.
 print( "Generating bar graph." )
 barGraphFormat <- geom_bar( stat = "identity", width = width, fill="#169EFF" )
 title <- ggtitle( paste( chartTitle, "" ) )
diff --git a/TestON/JenkinsFile/scripts/SCPFmastershipFailoverLat.R b/TestON/JenkinsFile/scripts/SCPFmastershipFailoverLat.R
index 09ac5cb..9eea330 100644
--- a/TestON/JenkinsFile/scripts/SCPFmastershipFailoverLat.R
+++ b/TestON/JenkinsFile/scripts/SCPFmastershipFailoverLat.R
@@ -125,10 +125,11 @@
 
 print( "Generating bar graph with error bars." )
 width <- 0.9
-barGraphFormat <- geom_bar( stat="identity", position=position_dodge( ), width = width )
-errorBarFormat <- geom_errorbar( position=position_dodge( ), width = width )
-title <- ggtitle( paste( chartTitle, "with Standard Error Bars" ) )
-result <- fundamentalGraphData + barGraphFormat + errorBarFormat + title
+barGraphFormat <- geom_bar( stat="identity", position=position_dodge(), width = width )
+errorBarFormat <- geom_errorbar( width = width, position=position_dodge(), color=rgb( 140, 140, 140, maxColorValue=255 ) )
+values <- geom_text( aes( x=avgData$scale, y=avgData$ms + 0.04 * max( avgData$ms ), label = format( avgData$ms, digits=3, big.mark = ",", scientific = FALSE ) ), size = 5, fontface = "bold", position=position_dodge( 0.9 ) )
+title <- ggtitle( paste( chartTitle, "" ) )
+result <- fundamentalGraphData + barGraphFormat + errorBarFormat + title + values
 
 
 print( paste( "Saving bar chart with error bars to", errBarOutputFile ) )
@@ -140,8 +141,10 @@
 
 print( "Generating stacked bar chart." )
 stackedBarFormat <- geom_bar( stat="identity", width=width )
-title <- ggtitle( paste( chartTitle, "Total Latency" ) )
-result <- fundamentalGraphData + stackedBarFormat + title
+title <- ggtitle( paste( chartTitle, "" ) )
+sum <- fileData[ 'deact_role_avg' ] + fileData[ 'kill_deact_avg' ]
+values <- geom_text( aes( x=avgData$scale, y=sum + 0.04 * max( sum ), label = format( sum, digits=3, big.mark = ",", scientific = FALSE ) ), size = 5, fontface = "bold" )
+result <- fundamentalGraphData + stackedBarFormat + title + values
 
 
 print( paste( "Saving stacked bar chart to", stackedBarOutputFile ) )
diff --git a/TestON/JenkinsFile/scripts/SCPFportLat.R b/TestON/JenkinsFile/scripts/SCPFportLat.R
index e4b9d4f..fd24c8d 100644
--- a/TestON/JenkinsFile/scripts/SCPFportLat.R
+++ b/TestON/JenkinsFile/scripts/SCPFportLat.R
@@ -124,10 +124,11 @@
 
 print( "Generating bar graph with error bars (Port Up Latency)." )
 barGraphFormat <- geom_bar( stat="identity", width = width )
-errorBarFormat <- geom_errorbar( width = width )
-
+errorBarFormat <- geom_errorbar( width = width, color=rgb( 140, 140, 140, maxColorValue=255 ) )
+sum <- fileData[ 'up_ofp_to_dev_avg' ] + fileData[ 'up_dev_to_link_avg' ] + fileData[ 'up_link_to_graph_avg' ]
+values <- geom_text( aes( x=upAvgsData$scale, y=sum + 0.04 * max( sum ), label = format( sum, digits=3, big.mark = ",", scientific = FALSE ) ), size = 5, fontface = "bold" )
 title <- ggtitle( "Port Up Latency" )
-result <- fundamentalGraphData + barGraphFormat + errorBarFormat + title
+result <- fundamentalGraphData + barGraphFormat + errorBarFormat + title + values
 
 
 print( paste( "Saving bar chart with error bars (Port Up Latency) to", errBarOutputFileUp ) )
@@ -146,10 +147,12 @@
 
 print( "Generating bar graph with error bars (Port Down Latency)." )
 barGraphFormat <- geom_bar( stat="identity", width = width )
-errorBarFormat <- geom_errorbar( width = width )
+errorBarFormat <- geom_errorbar( width = width, color=rgb( 140, 140, 140, maxColorValue=255 ) )
+sum <- fileData[ 'down_ofp_to_dev_avg' ] + fileData[ 'down_dev_to_link_avg' ] + fileData[ 'down_link_to_graph_avg' ]
+values <- geom_text( aes( x=downAvgsData$scale, y=sum + 0.04 * max( sum ), label = format( sum, digits=3, big.mark = ",", scientific = FALSE ) ), size = 5, fontface = "bold" )
 
 title <- ggtitle( "Port Down Latency" )
-result <- fundamentalGraphData + barGraphFormat + errorBarFormat + title
+result <- fundamentalGraphData + barGraphFormat + errorBarFormat + title + values
 
 
 print( paste( "Saving bar chart with error bars (Port Down Latency) to", errBarOutputFileDown ) )
diff --git a/TestON/JenkinsFile/scripts/SCPFscaleTopo.R b/TestON/JenkinsFile/scripts/SCPFscaleTopo.R
index de22c3a..195019d 100644
--- a/TestON/JenkinsFile/scripts/SCPFscaleTopo.R
+++ b/TestON/JenkinsFile/scripts/SCPFscaleTopo.R
@@ -85,11 +85,10 @@
 dataFrame$type <- factor( dataFrame$type, levels=unique( dataFrame$type ) )
 dataFrame$iterative <- seq( 1, nrow( fileData ), by = 1 )
 
-# Obtain the sum of the averages for the plot size and center of standard deviation bars.
-avgsSum <- fileData$total_time
-
 dataFrame <- na.omit( dataFrame )   # Omit any data that doesn't exist
 
+sum <- fileData[ 'last_role_request_to_last_topology' ] + fileData[ 'last_connection_to_last_role_request' ] + fileData[ 'first_connection_to_last_connection' ]
+
 print( "Data Frame Results:" )
 print( dataFrame )
 
@@ -103,7 +102,6 @@
 #    These are variables that apply to all of the graphs being generated, regardless of type.
 #
 # 2. Type specific graph data is generated.
-#     Data specific for the error bar and stacked bar graphs are generated.
 #
 # 3. Generate and save the graphs.
 #      Graphs are saved to the filename above, in the directory provided in command line args
@@ -129,21 +127,17 @@
 fillLabel <- labs( fill="Type" )
 chartTitle <- paste( "Scale Topology Latency Test" )
 theme <- theme( plot.title=element_text( hjust = 0.5, size = 28, face='bold' ) )
+values <- geom_text( aes( x=dataFrame$iterative, y=sum + 0.02 * max( sum ), label = format( sum, big.mark = ",", scientific = FALSE ), fontface = "bold" ) )
 
 # Store plot configurations as 1 variable
-fundamentalGraphData <- mainPlot + xScaleConfig + xLabel + yLabel + fillLabel + theme
+fundamentalGraphData <- mainPlot + xScaleConfig + xLabel + yLabel + fillLabel + theme + values
 
-# Create the stacked bar graph with error bars.
-# geom_bar contains:
-#    - stat: data formatting (usually "identity")
-#    - width: the width of the bar types (declared above)
-# geom_errorbar contains similar arguments as geom_bar.
-print( "Generating bar graph with error bars." )
+print( "Generating bar graph." )
 barGraphFormat <- geom_bar( stat = "identity", width = width )
 title <- ggtitle( paste( chartTitle, "" ) )
 result <- fundamentalGraphData + barGraphFormat + title
 
 # Save graph to file
-print( paste( "Saving bar chart with error bars to", outputFile ) )
+print( paste( "Saving bar chart to", outputFile ) )
 ggsave( outputFile, width = 10, height = 6, dpi = 200 )
-print( paste( "Successfully wrote bar chart with error bars out to", outputFile ) )
+print( paste( "Successfully wrote bar chart out to", outputFile ) )
diff --git a/TestON/JenkinsFile/scripts/SCPFscalingMaxIntents.R b/TestON/JenkinsFile/scripts/SCPFscalingMaxIntents.R
index bc90806..02f4f28 100644
--- a/TestON/JenkinsFile/scripts/SCPFscalingMaxIntents.R
+++ b/TestON/JenkinsFile/scripts/SCPFscalingMaxIntents.R
@@ -75,7 +75,7 @@
 fileData <- dbGetQuery( con, command )
 
 if ( args[ 1 ] == "y" ){
-    chartTitle <- "Number of Installed Intents & Flows w/ FlowObj"
+    chartTitle <- "Number of Installed Intents & Flows\n with Flow Objectives"
 } else {
     chartTitle <- "Number of Installed Intents & Flows"
 }
@@ -125,8 +125,9 @@
 print( "Generating bar graph bars." )
 width <- 1.3
 barGraphFormat <- geom_bar( stat="identity", position=position_dodge( ), width = width )
+values <- geom_text( aes( x=dataFrame$scale, y=dataFrame$ms + 0.02 * max( dataFrame$ms ), label = format( dataFrame$ms, digits=3, big.mark = ",", scientific = FALSE ) ), size = 3.2, fontface = "bold", position=position_dodge( width=1.25 ) )
 title <- ggtitle( chartTitle )
-result <- fundamentalGraphData + barGraphFormat + title
+result <- fundamentalGraphData + barGraphFormat + title + values
 
 
 print( paste( "Saving bar chart to", outputFile ) )
diff --git a/TestON/JenkinsFile/scripts/SCPFswitchLat.R b/TestON/JenkinsFile/scripts/SCPFswitchLat.R
index 0493859..8a03863 100644
--- a/TestON/JenkinsFile/scripts/SCPFswitchLat.R
+++ b/TestON/JenkinsFile/scripts/SCPFswitchLat.R
@@ -120,32 +120,36 @@
 
 print( "Generating bar graph with error bars (Switch Up Latency)." )
 barGraphFormat <- geom_bar( stat="identity", width = width )
-errorBarFormat <- geom_errorbar( width = width )
-
+errorBarFormat <- geom_errorbar( width = width, color=rgb( 140, 140, 140, maxColorValue=255 ) )
+sum <- fileData[ 'up_device_to_graph_avg' ] + fileData[ 'role_reply_to_device_avg' ] + fileData[ 'role_request_to_role_reply_avg' ] + fileData[ 'feature_reply_to_role_request_avg' ] + fileData[ 'tcp_to_feature_reply_avg' ]
+values <- geom_text( aes( x=upAvgsData$scale, y=sum + 0.04 * max( sum ), label = format( sum, digits=3, big.mark = ",", scientific = FALSE ) ), size = 5, fontface = "bold" )
 title <- ggtitle( "Switch Up Latency" )
-result <- fundamentalGraphData + barGraphFormat + errorBarFormat + title
+result <- fundamentalGraphData + barGraphFormat + errorBarFormat + title + values
 
 
 print( paste( "Saving bar chart with error bars (Switch Up Latency) to", errBarOutputFileUp ) )
 ggsave( errBarOutputFileUp, width = 10, height = 6, dpi = 200 )
 
-
 print( paste( "Successfully wrote bar chart with error bars (Switch Up Latency) out to", errBarOutputFileUp ) )
 
+# Generate switch down latency graph
 
 print( "Generating fundamental graph data (Switch Down Latency)." )
 
 mainPlot <- ggplot( data = downAvgsData, aes( x = scale, y = ms, fill = type, ymin = fileData[ 'down_end_to_end_avg' ] - stds, ymax = fileData[ 'down_end_to_end_avg' ] + stds ) )
 theme <- theme( plot.title=element_text( hjust = 0.5, size = 28, face='bold' ) )
 
+
 fundamentalGraphData <- mainPlot + xScaleConfig + xLabel + yLabel + fillLabel + theme
 
 print( "Generating bar graph with error bars (Switch Down Latency)." )
 barGraphFormat <- geom_bar( stat="identity", width = width )
-errorBarFormat <- geom_errorbar( width = width )
+errorBarFormat <- geom_errorbar( width = width, color=rgb( 140, 140, 140, maxColorValue=255 ) )
 
 title <- ggtitle( "Switch Down Latency" )
-result <- fundamentalGraphData + barGraphFormat + errorBarFormat + title
+sum <- fileData[ 'down_device_to_graph_avg' ] + fileData[ 'ack_to_device_avg' ] + fileData[ 'fin_ack_to_ack_avg' ]
+values <- geom_text( aes( x=downAvgsData$scale, y=sum + 0.04 * max( sum ), label = format( sum, digits=3, big.mark = ",", scientific = FALSE ) ), size = 5, fontface = "bold" )
+result <- fundamentalGraphData + barGraphFormat + errorBarFormat + title + values
 
 
 print( paste( "Saving bar chart with error bars (Switch Down Latency) to", errBarOutputFileDown ) )
diff --git a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
index 923f056..b0b8880 100644
--- a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
+++ b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
@@ -217,6 +217,7 @@
         # First capture
 
         main.postResult = True
+        main.step( "Grep information from the ONOS log" )
         for i in range( 3 ):
             # Calculate total time
             main.allinfo[ 0 ][ 'info' + str( i ) ][ 'totalTime' ] = main.scaleTopoFunction.getInfoFromLog( main, main.searchTerm[ 'start' ], 'first', main.searchTerm[ 'end' ], 'last', index=i, funcMode='TD' )
@@ -230,7 +231,10 @@
             main.allinfo[ 0 ][ 'info' + str( i ) ][ 'disconnectRate' ] = main.scaleTopoFunction.getInfoFromLog( main, main.searchTerm[ 'Disconnect' ], 'num', main.searchTerm[ 'start' ], 'num', index=i, funcMode='DR' )
         main.log.debug( "The data is " + str( main.allinfo[ 0 ] ) )
         if -1 in main.allinfo[ 0 ][ 'info0' ].values() or -1 in main.allinfo[ 0 ][ 'info1' ].values() or -1 in main.allinfo[ 0 ][ 'info2' ].values():
-            main.log.warn( "Something happened to ONOS. Skip the rest of the steps" )
+            utilities.assert_equals( expect=main.TRUE,
+                                     actual=main.FALSE,
+                                     onpass="Everything installed properly to the ONOS.",
+                                     onfail="Something happened to ONOS. Skip the rest of the steps." )
             main.postResult = False
         else:
             main.case( "Verifying topology: TORUS %sx%s" % ( main.currScale, main.currScale ) )
@@ -239,87 +243,102 @@
 
             main.log.info( "Gathering topology information" )
             time.sleep( main.MNSleep )
-            stepResult = main.TRUE
-            main.step( "Comparing MN topology to ONOS topology" )
+
             compareRetry = 0
+            main.step( "Checking if ONOS is stable" )
+            main.scaleTopoFunction.checkingONOSStablility( main )
 
-            while compareRetry < 3:
-                currentDevicesResult = main.TRUE
-                currentLinksResult = main.TRUE
-                # While loop for retry
-                devices = main.topoRelated.getAll( "devices" )
-                ports = main.topoRelated.getAll( "ports" )
-                links = main.topoRelated.getAll( "links" )
-                mnSwitches = main.Mininet1.getSwitches( updateTimeout=main.basicMNTime + int( main.currScale ) * main.MNupdateTime )
-                main.log.info( "Comparing switches..." )
-                devicePool = []
-                for controller in range( len( main.Cluster.active() ) ):
-                    t = main.Thread( target=main.topoRelated.compareDevicePort,
-                                     threadID=main.threadID,
-                                     name="Compare-Device-Port",
-                                     args=[ main.Mininet1, controller,
-                                            mnSwitches,
-                                            devices, ports ] )
-                    devicePool.append( t )
-                    t.start()
-                    main.threadID = main.threadID + 1
+            if main.postResult:
+                main.step( "Comparing MN topology to ONOS topology" )
 
-                mnLinks = main.Mininet1.getLinks( timeout=main.basicMNTime + int( main.currScale ) * main.MNLinksTime,
-                                                  updateTimeout=main.basicMNTime + int(main.currScale) * main.MNupdateTime )
-                main.log.info( "Comparing links..." )
-                linkPool = []
-                for controller in range( len( main.Cluster.active() ) ):
-                    t = main.Thread( target=main.topoRelated.compareBase,
-                                     threadID=main.threadID,
-                                     name="Compare-Link-Result",
-                                     args=[ links, controller,
-                                            main.Mininet1.compareLinks,
-                                            [ mnSwitches, mnLinks ] ] )
-                    linkPool.append( t )
-                    t.start()
-                    main.threadID = main.threadID + 1
-
-                for t in devicePool:
-                    t.join()
-                    currentDevicesResult = currentDevicesResult and t.result
-                for t in linkPool:
-                    t.join()
-                    currentLinksResult = currentLinksResult and t.result
-                stepResult = stepResult and currentDevicesResult and currentLinksResult
-                if stepResult:
-                    break
-                compareRetry += 1
-            utilities.assert_equals( expect=main.TRUE,
-                                     actual=stepResult,
-                                     onpass=" Topology match Mininet",
-                                     onfail="ONOS Topology doesn't match Mininet" )
-
-            if stepResult:
-                if main.hostDiscover:
-                    hostList = []
-                    for i in range( 1, int( main.currScale ) + 1 ):
-                        for j in range( 1, int( main.currScale ) + 1 ):
-                            # Generate host list
-                            hoststr = "h" + str( i ) + "x" + str( j )
-                            hostList.append( hoststr )
-                    for i in range( len( hostList ) ):
-                        main.topo.sendArpPackage( main, hostList[ i ] )
-                    time.sleep( 20 )
-                    totalHost = main.topo.getHostNum( main )
-                    if totalHost == int( main.currScale ) * int( main.currScale ):
-                        main.log.info( "Discovered all hosts" )
-                        stepResult = stepResult and main.TRUE
-                    else:
-                        main.log.warn( "Some hosts ware not discovered by ONOS... Topology doesn't match!" )
+                compareRetry = 0
+                while compareRetry < 2:
+                    stepResult = main.TRUE
+                    currentDevicesResult = main.TRUE
+                    currentLinksResult = main.TRUE
+                    # While loop for retry
+                    devices = main.topoRelated.getAll( "devices" )
+                    ports = main.topoRelated.getAll( "ports" )
+                    links = main.topoRelated.getAll( "links" )
+                    if None in devices or None in ports or None in links:
+                        main.log.warn( "Something went wrong. Retrying..." )
+                        time.sleep( 20 )
                         stepResult = main.FALSE
+                        compareRetry += 1
+                        continue
+                    mnSwitches = main.Mininet1.getSwitches( updateTimeout=main.basicMNTime + int( main.currScale ) * main.MNupdateTime )
+                    main.log.info( "Comparing switches..." )
+                    devicePool = []
+                    for controller in range( len( main.Cluster.active() ) ):
+                        t = main.Thread( target=main.topoRelated.compareDevicePort,
+                                         threadID=main.threadID,
+                                         name="Compare-Device-Port",
+                                         args=[ main.Mininet1, controller,
+                                                mnSwitches,
+                                                devices, ports ] )
+                        devicePool.append( t )
+                        t.start()
+                        main.threadID = main.threadID + 1
+
+                    mnLinks = main.Mininet1.getLinks( timeout=main.basicMNTime + int( main.currScale ) * main.MNLinksTime,
+                                                      updateTimeout=main.basicMNTime + int(main.currScale) * main.MNupdateTime )
+                    main.log.info( "Comparing links..." )
+                    linkPool = []
+                    for controller in range( len( main.Cluster.active() ) ):
+                        t = main.Thread( target=main.topoRelated.compareBase,
+                                         threadID=main.threadID,
+                                         name="Compare-Link-Result",
+                                         args=[ links, controller,
+                                                main.Mininet1.compareLinks,
+                                                [ mnSwitches, mnLinks ] ] )
+                        linkPool.append( t )
+                        t.start()
+                        main.threadID = main.threadID + 1
+
+                    for t in devicePool:
+                        t.join()
+                        currentDevicesResult = currentDevicesResult and t.result
+                    for t in linkPool:
+                        t.join()
+                        currentLinksResult = currentLinksResult and t.result
+                    stepResult = stepResult and currentDevicesResult and currentLinksResult
+                    if stepResult:
+                        break
+                    compareRetry += 1
+                utilities.assert_equals( expect=main.TRUE,
+                                         actual=stepResult,
+                                         onpass=" Topology match Mininet",
+                                         onfail="ONOS Topology doesn't match Mininet" )
+                main.scaleTopoFunction.checkingONOSStablility( main )
+                if stepResult and main.postResult:
+                    if main.hostDiscover:
+                        hostList = []
+                        for i in range( 1, int( main.currScale ) + 1 ):
+                            for j in range( 1, int( main.currScale ) + 1 ):
+                                # Generate host list
+                                hoststr = "h" + str( i ) + "x" + str( j )
+                                hostList.append( hoststr )
+                        for i in range( len( hostList ) ):
+                            main.topo.sendArpPackage( main, hostList[ i ] )
+                        time.sleep( 20 )
+                        totalHost = main.topo.getHostNum( main )
+                        if totalHost == int( main.currScale ) * int( main.currScale ):
+                            main.log.info( "Discovered all hosts" )
+                            stepResult = stepResult and main.TRUE
+                        else:
+                            main.log.warn( "Some hosts ware not discovered by ONOS... Topology doesn't match!" )
+                            stepResult = main.FALSE
+                        utilities.assert_equals( expect=main.TRUE,
+                                                 actual=stepResult,
+                                                 onpass=" Topology match Mininet",
+                                                 onfail="ONOS Topology doesn't match Mininet" )
+                    main.log.info( "Finished this iteration, continue to scale next topology." )
+                else:
                     utilities.assert_equals( expect=main.TRUE,
-                                             actual=stepResult,
-                                             onpass=" Topology match Mininet",
-                                             onfail="ONOS Topology doesn't match Mininet" )
-                main.log.info( "Finished this iteration, continue to scale next topology." )
-            else:
-                main.log.info( "Clean up and exit TestON. Finished this test." )
-                main.cleanAndExit()
+                                             actual=main.FALSE,
+                                             onpass="ONOS is stable.",
+                                             onfail="Something happened to ONOS. Skip the rest of the steps." )
+                    main.postResult = False
 
     def CASE100( self, main ):
         """
diff --git a/TestON/tests/SCPF/SCPFscaleTopo/dependencies/scaleTopoFunction.py b/TestON/tests/SCPF/SCPFscaleTopo/dependencies/scaleTopoFunction.py
index 964f0c2..a48ddf7 100644
--- a/TestON/tests/SCPF/SCPFscaleTopo/dependencies/scaleTopoFunction.py
+++ b/TestON/tests/SCPF/SCPFscaleTopo/dependencies/scaleTopoFunction.py
@@ -440,3 +440,15 @@
         restartResult = main.FALSE
 
     return restartResult
+
+def checkingONOSStablility( main ):
+    compareRetry = 0
+    while compareRetry < 3 and main.postResult:
+        for controller in main.Cluster.active():
+            if controller.CLI.summary() is None:
+                main.info.error( "Something happened to ONOS. Skip the rest of the steps" )
+                main.postResult = False
+                break
+            time.sleep( 5 )
+        compareRetry += 1
+        time.sleep( 10 )