Jeremy Ronquillo | b407649 | 2018-05-11 13:04:16 -0700 | [diff] [blame] | 1 | # Copyright 2017 Open Networking Foundation (ONF) |
| 2 | # |
| 3 | # Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>, |
| 4 | # the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>, |
| 5 | # or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg> |
| 6 | # |
| 7 | # TestON is free software: you can redistribute it and/or modify |
| 8 | # it under the terms of the GNU General Public License as published by |
| 9 | # the Free Software Foundation, either version 2 of the License, or |
| 10 | # (at your option) any later version. |
| 11 | # |
| 12 | # TestON is distributed in the hope that it will be useful, |
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | # GNU General Public License for more details. |
| 16 | # |
| 17 | # You should have received a copy of the GNU General Public License |
| 18 | # along with TestON. If not, see <http://www.gnu.org/licenses/>. |
| 19 | # |
| 20 | # Example script: |
| 21 | # Rscript trendCHO event.csv failure.csv error.csv master 60 /path/to/save/directory/ |
| 22 | |
Jeremy Ronquillo | b407649 | 2018-05-11 13:04:16 -0700 | [diff] [blame] | 23 | # ********************************************************** |
| 24 | # STEP 1: Data management. |
| 25 | # ********************************************************** |
| 26 | |
| 27 | print( "**********************************************************" ) |
| 28 | print( "STEP 1: Data management." ) |
| 29 | print( "**********************************************************" ) |
| 30 | |
| 31 | # Command line arguments are read. Args include the database credentials, test name, branch name, and the directory to output files. |
| 32 | print( "Reading commmand-line args." ) |
| 33 | args <- commandArgs( trailingOnly=TRUE ) |
| 34 | |
Jeremy Ronquillo | 75c8a05 | 2018-05-11 15:59:40 -0700 | [diff] [blame] | 35 | |
| 36 | limitToDisplayIndividually <- 37 # must be less than this number to display individually |
| 37 | |
Jeremy Ronquillo | b407649 | 2018-05-11 13:04:16 -0700 | [diff] [blame] | 38 | event_input_file <- 1 |
| 39 | failure_input_file <- 2 |
| 40 | error_input_file <- 3 |
| 41 | branch_name <- 4 |
| 42 | time_quantum <- 5 |
Jeremy Ronquillo | 75c8a05 | 2018-05-11 15:59:40 -0700 | [diff] [blame] | 43 | maxDataToDisplayParam <- 6 # the maximum amount of data to display on the graph. Last data point is most recent |
| 44 | save_directory <- 7 |
Jeremy Ronquillo | b407649 | 2018-05-11 13:04:16 -0700 | [diff] [blame] | 45 | |
| 46 | # ---------------- |
| 47 | # Import Libraries |
| 48 | # ---------------- |
| 49 | |
| 50 | print( "Importing libraries." ) |
| 51 | library( ggplot2 ) |
| 52 | library( reshape2 ) |
| 53 | library( RPostgreSQL ) |
Devin Lim | 324806b | 2018-05-11 15:36:52 -0700 | [diff] [blame] | 54 | source( "~/OnosSystemTest/TestON/JenkinsFile/wikiGraphRScripts/dependencies/saveGraph.R" ) |
| 55 | source( "~/OnosSystemTest/TestON/JenkinsFile/wikiGraphRScripts/dependencies/fundamentalGraphData.R" ) |
Jeremy Ronquillo | b407649 | 2018-05-11 13:04:16 -0700 | [diff] [blame] | 56 | |
| 57 | # ------------------- |
| 58 | # Check CLI Arguments |
| 59 | # ------------------- |
| 60 | |
| 61 | print( "Verifying CLI args." ) |
| 62 | |
| 63 | if ( length( args ) != save_directory ){ |
Jeremy Ronquillo | 75c8a05 | 2018-05-11 15:59:40 -0700 | [diff] [blame] | 64 | print( "Usage: Rscript trendCHO.R <events-input-file> <failures-input-file> <errors-input-file> <branch-name> <time_quantum> <max-data-to-display> <directory-to-save-graph>" ) |
Jeremy Ronquillo | b407649 | 2018-05-11 13:04:16 -0700 | [diff] [blame] | 65 | quit( status = 1 ) |
| 66 | } |
| 67 | |
| 68 | # ---------------------- |
| 69 | # Read From File: Events |
| 70 | # ---------------------- |
| 71 | |
| 72 | print( "Reading from file for 'events' input." ) |
| 73 | |
| 74 | event_fileData <- read.delim2( args[ event_input_file ], |
| 75 | header = TRUE, |
| 76 | sep = ",", |
| 77 | dec = "." ) |
| 78 | print( "Event File Data:" ) |
| 79 | print( event_fileData ) |
| 80 | |
| 81 | # ------------------------ |
| 82 | # Read From File: Failures |
| 83 | # ------------------------ |
| 84 | |
| 85 | print( "Reading from file for 'failure' input." ) |
| 86 | |
| 87 | failure_fileData <- read.delim2( args[ failure_input_file ], |
| 88 | header = TRUE, |
| 89 | sep = ",", |
| 90 | dec = "." ) |
| 91 | print( "Failure File Data:" ) |
| 92 | print( failure_fileData ) |
| 93 | |
| 94 | # ---------------------- |
| 95 | # Read From File: Errors |
| 96 | # ---------------------- |
| 97 | |
| 98 | print( "Reading from file for 'errors' input." ) |
| 99 | |
| 100 | error_fileData <- read.delim2( args[ error_input_file ], |
| 101 | header = TRUE, |
| 102 | sep = ",", |
| 103 | dec = "." ) |
| 104 | print( "Error File Data:" ) |
| 105 | print( error_fileData ) |
| 106 | |
| 107 | # ------------------------------- |
| 108 | # Create Title and Graph Filename |
| 109 | # ------------------------------- |
| 110 | |
| 111 | print( "Creating titles of graphs." ) |
| 112 | |
| 113 | failedChecksTitle <- paste( "Failed Checks - ", |
| 114 | args[ branch_name ], |
Jeremy Ronquillo | 75c8a05 | 2018-05-11 15:59:40 -0700 | [diff] [blame] | 115 | "\nFrequency per ", |
Jeremy Ronquillo | b407649 | 2018-05-11 13:04:16 -0700 | [diff] [blame] | 116 | args[ time_quantum ], |
Jeremy Ronquillo | 75c8a05 | 2018-05-11 15:59:40 -0700 | [diff] [blame] | 117 | " Minutes - Last ", |
| 118 | args[ maxDataToDisplayParam ], |
| 119 | " Hours", |
Jeremy Ronquillo | b407649 | 2018-05-11 13:04:16 -0700 | [diff] [blame] | 120 | sep="" ) |
| 121 | |
| 122 | eventsTitle <- paste( "Network, Application, and ONOS Events - ", |
| 123 | args[ branch_name ], |
Jeremy Ronquillo | 75c8a05 | 2018-05-11 15:59:40 -0700 | [diff] [blame] | 124 | "\nFrequency per ", |
Jeremy Ronquillo | b407649 | 2018-05-11 13:04:16 -0700 | [diff] [blame] | 125 | args[ time_quantum ], |
Jeremy Ronquillo | 75c8a05 | 2018-05-11 15:59:40 -0700 | [diff] [blame] | 126 | " Minutes - Last ", |
| 127 | args[ maxDataToDisplayParam ], |
| 128 | " Hours", |
Jeremy Ronquillo | b407649 | 2018-05-11 13:04:16 -0700 | [diff] [blame] | 129 | sep="" ) |
| 130 | |
| 131 | errorsTitle <- paste( "Warnings, Errors, and Exceptions from Logs - ", |
| 132 | args[ branch_name ], |
Jeremy Ronquillo | 75c8a05 | 2018-05-11 15:59:40 -0700 | [diff] [blame] | 133 | "\nFrequency per ", |
Jeremy Ronquillo | b407649 | 2018-05-11 13:04:16 -0700 | [diff] [blame] | 134 | args[ time_quantum ], |
Jeremy Ronquillo | 75c8a05 | 2018-05-11 15:59:40 -0700 | [diff] [blame] | 135 | " Minutes - Last ", |
| 136 | args[ maxDataToDisplayParam ], |
| 137 | " Hours", |
Jeremy Ronquillo | b407649 | 2018-05-11 13:04:16 -0700 | [diff] [blame] | 138 | sep="" ) |
| 139 | |
| 140 | print( "Creating graph filenames." ) |
| 141 | |
| 142 | failedChecksFilename <- paste( args[ save_directory ], |
| 143 | "CHO_Failure-Check_", |
| 144 | args[ branch_name ], |
Jeremy Ronquillo | 75c8a05 | 2018-05-11 15:59:40 -0700 | [diff] [blame] | 145 | "_", |
| 146 | args[ maxDataToDisplayParam ], |
| 147 | "-maxData_graph.jpg", |
Jeremy Ronquillo | b407649 | 2018-05-11 13:04:16 -0700 | [diff] [blame] | 148 | sep="" ) |
| 149 | |
| 150 | eventsFilename <- paste( args[ save_directory ], |
| 151 | "CHO_Events_", |
| 152 | args[ branch_name ], |
Jeremy Ronquillo | 75c8a05 | 2018-05-11 15:59:40 -0700 | [diff] [blame] | 153 | "_", |
| 154 | args[ maxDataToDisplayParam ], |
| 155 | "-maxData_graph.jpg", |
Jeremy Ronquillo | b407649 | 2018-05-11 13:04:16 -0700 | [diff] [blame] | 156 | sep="" ) |
| 157 | |
| 158 | errorsFilename <- paste( args[ save_directory ], |
| 159 | "CHO_Errors_", |
| 160 | args[ branch_name ], |
Jeremy Ronquillo | 75c8a05 | 2018-05-11 15:59:40 -0700 | [diff] [blame] | 161 | "_", |
| 162 | args[ maxDataToDisplayParam ], |
| 163 | "-maxData_graph.jpg", |
Jeremy Ronquillo | b407649 | 2018-05-11 13:04:16 -0700 | [diff] [blame] | 164 | sep="" ) |
| 165 | |
| 166 | # ********************************************************** |
| 167 | # STEP 2: Organize data. |
| 168 | # ********************************************************** |
| 169 | |
| 170 | print( "**********************************************************" ) |
| 171 | print( "STEP 2: Organize Data." ) |
| 172 | print( "**********************************************************" ) |
| 173 | |
| 174 | # ------------------------------------------------------- |
| 175 | # Verifying all required columns are present. |
| 176 | # ------------------------------------------------------- |
| 177 | |
| 178 | # ------------------ |
| 179 | # Verifying 'Events' |
| 180 | # ------------------ |
| 181 | |
| 182 | print( "Verifying all required columns are present for 'events'." ) |
| 183 | |
| 184 | requiredColumns <- c( "Link.Down", |
| 185 | "Link.Up", |
| 186 | "Device.Down", |
| 187 | "Device.Up", |
| 188 | "Add.Host.Intent", |
| 189 | "Delete.Host.Intent", |
| 190 | "Add.Point.Intent", |
| 191 | "Delete.Point.Intent", |
| 192 | "ONOS.Down", |
| 193 | "ONOS.Up" ) |
| 194 | |
| 195 | tryCatch( eventsCombined <- c( event_fileData[ requiredColumns] ), |
| 196 | error = function( e ) { |
| 197 | print( "[ERROR] One or more expected columns are missing from 'events'. Please check that the data and file are valid, then try again." ) |
| 198 | print( "Required columns: " ) |
| 199 | print( requiredColumns ) |
| 200 | print( "Actual columns: " ) |
| 201 | print( names( event_fileData ) ) |
| 202 | print( "Error dump:" ) |
| 203 | print( e ) |
| 204 | quit( status = 1 ) |
| 205 | } |
| 206 | ) |
| 207 | |
| 208 | # -------------------- |
| 209 | # Verifying 'Failures' |
| 210 | # -------------------- |
| 211 | |
| 212 | print( "Verifying all required columns are present for 'failures'." ) |
| 213 | |
| 214 | requiredColumns <- c( "Intent.Check.Failure", |
| 215 | "Flow.Check.Failure", |
| 216 | "Traffic.Check.Failure", |
| 217 | "Topo.Check.Failure", |
| 218 | "ONOS.Check.Failure" ) |
| 219 | |
| 220 | tryCatch( failureCombined <- c( failure_fileData[ requiredColumns] ), |
| 221 | error = function( e ) { |
| 222 | print( "[ERROR] One or more expected columns are missing from 'failures'. Please check that the data and file are valid, then try again." ) |
| 223 | print( "Required columns: " ) |
| 224 | print( requiredColumns ) |
| 225 | print( "Actual columns: " ) |
| 226 | print( names( failure_fileData ) ) |
| 227 | print( "Error dump:" ) |
| 228 | print( e ) |
| 229 | quit( status = 1 ) |
| 230 | } |
| 231 | ) |
| 232 | |
| 233 | # ------------------ |
| 234 | # Verifying 'Errors' |
| 235 | # ------------------ |
| 236 | |
| 237 | print( "Verifying all required columns are present for 'errors'." ) |
| 238 | |
| 239 | requiredColumns <- c( "Test.Warnings", |
| 240 | "ONOS.Warnings", |
| 241 | "ONOS.Errors", |
| 242 | "Exceptions" ) |
| 243 | |
| 244 | tryCatch( errorCombined <- c( error_fileData[ requiredColumns] ), |
| 245 | error = function( e ) { |
| 246 | print( "[ERROR] One or more expected columns are missing from 'errors'. Please check that the data and file are valid, then try again." ) |
| 247 | print( "Required columns: " ) |
| 248 | print( requiredColumns ) |
| 249 | print( "Actual columns: " ) |
| 250 | print( names( error_fileData ) ) |
| 251 | print( "Error dump:" ) |
| 252 | print( e ) |
| 253 | quit( status = 1 ) |
| 254 | } |
| 255 | ) |
| 256 | |
| 257 | # ------------------------------- |
| 258 | # Create Events Data Frame |
| 259 | # ------------------------------- |
| 260 | |
Jeremy Ronquillo | 75c8a05 | 2018-05-11 15:59:40 -0700 | [diff] [blame] | 261 | maxDataToDisplay <- strtoi( args[ maxDataToDisplayParam ] ) |
| 262 | |
Jeremy Ronquillo | b407649 | 2018-05-11 13:04:16 -0700 | [diff] [blame] | 263 | # ------------------- |
| 264 | # 'Events' Data Frame |
| 265 | # ------------------- |
| 266 | |
| 267 | print( "Constructing data frame for 'events'." ) |
| 268 | |
| 269 | events_dataFrame <- melt( eventsCombined ) |
| 270 | |
| 271 | # Rename column names in events_dataFrame |
| 272 | colnames( events_dataFrame ) <- c( "Events", |
| 273 | "Type" ) |
| 274 | |
| 275 | # Format data frame so that the data is in the same order as it appeared in the file. |
| 276 | events_dataFrame$Type <- as.character( events_dataFrame$Type ) |
| 277 | events_dataFrame$Type <- factor( events_dataFrame$Type, levels = unique( events_dataFrame$Type ) ) |
| 278 | |
| 279 | events_dataFrame$timeStamps <- rev( gsub('^(.{11})(.*)$', '\\1\n\\2', event_fileData$Time ) ) |
| 280 | |
| 281 | # Adding a temporary reversed iterative list to the events_dataFrame so that there are no gaps in-between build numbers. |
| 282 | events_dataFrame$iterative <- rev( seq( 1, nrow( event_fileData ), by = 1 ) ) |
| 283 | |
| 284 | # Omit any data that doesn't exist |
| 285 | events_dataFrame <- na.omit( events_dataFrame ) |
| 286 | |
Jeremy Ronquillo | 75c8a05 | 2018-05-11 15:59:40 -0700 | [diff] [blame] | 287 | |
| 288 | dataLength <- nrow( event_fileData ) |
| 289 | moduloFactor <- floor( dataLength / limitToDisplayIndividually ) + 1 |
| 290 | |
| 291 | if ( dataLength > maxDataToDisplay ){ |
| 292 | events_dataFrame <- events_dataFrame[ events_dataFrame$iterative >= dataLength - maxDataToDisplay, ] |
| 293 | } |
| 294 | |
| 295 | if ( moduloFactor > 1 ){ |
| 296 | events_dataFrame[ events_dataFrame$iterative %% moduloFactor != dataLength %% moduloFactor, ]$timeStamps <- "" |
| 297 | } |
| 298 | |
Jeremy Ronquillo | b407649 | 2018-05-11 13:04:16 -0700 | [diff] [blame] | 299 | print( "'Events' Data Frame Results:" ) |
| 300 | print( events_dataFrame ) |
| 301 | |
| 302 | # --------------------- |
| 303 | # 'Failures' Data Frame |
| 304 | # --------------------- |
| 305 | |
| 306 | print( "Constructing data frame for 'failures'." ) |
| 307 | |
| 308 | failures_dataFrame <- melt( failureCombined ) |
| 309 | |
| 310 | # Rename column names in failures_dataFrame |
| 311 | colnames( failures_dataFrame ) <- c( "Failures", |
| 312 | "Type" ) |
| 313 | |
| 314 | # Format data frame so that the data is in the same order as it appeared in the file. |
| 315 | failures_dataFrame$Type <- as.character( failures_dataFrame$Type ) |
| 316 | failures_dataFrame$Type <- factor( failures_dataFrame$Type, levels = unique( failures_dataFrame$Type ) ) |
| 317 | |
| 318 | failures_dataFrame$timeStamps <- rev( gsub('^(.{11})(.*)$', '\\1\n\\2', failure_fileData$Time ) ) |
| 319 | |
| 320 | # Adding a temporary reversed iterative list to the failures_dataFrame so that there are no gaps in-between build numbers. |
| 321 | failures_dataFrame$iterative <- rev( seq( 1, nrow( failure_fileData ), by = 1 ) ) |
| 322 | |
| 323 | # Omit any data that doesn't exist |
| 324 | failures_dataFrame <- na.omit( failures_dataFrame ) |
| 325 | |
Jeremy Ronquillo | 75c8a05 | 2018-05-11 15:59:40 -0700 | [diff] [blame] | 326 | if ( dataLength > maxDataToDisplay ){ |
| 327 | failures_dataFrame <- failures_dataFrame[ failures_dataFrame$iterative >= dataLength - maxDataToDisplay, ] |
| 328 | } |
| 329 | |
| 330 | if ( moduloFactor > 1 ){ |
| 331 | failures_dataFrame[ failures_dataFrame$iterative %% moduloFactor != dataLength %% moduloFactor, ]$timeStamps <- "" |
| 332 | } |
| 333 | |
Jeremy Ronquillo | b407649 | 2018-05-11 13:04:16 -0700 | [diff] [blame] | 334 | print( "'Failures' Data Frame Results:" ) |
| 335 | print( failures_dataFrame ) |
| 336 | |
| 337 | # ------------------- |
| 338 | # 'Errors' Data Frame |
| 339 | # ------------------- |
| 340 | |
| 341 | print( "Constructing data frame for 'errors'." ) |
| 342 | |
| 343 | errors_dataFrame <- melt( errorCombined ) |
| 344 | |
| 345 | # Rename column names in errors_dataFrame |
| 346 | colnames( errors_dataFrame ) <- c( "Errors", |
| 347 | "Type" ) |
| 348 | |
| 349 | # Format data frame so that the data is in the same order as it appeared in the file. |
| 350 | errors_dataFrame$Type <- as.character( errors_dataFrame$Type ) |
| 351 | errors_dataFrame$Type <- factor( errors_dataFrame$Type, levels = unique( errors_dataFrame$Type ) ) |
| 352 | |
| 353 | errors_dataFrame$timeStamps <- gsub('^(.{11})(.*)$', '\\1\n\\2', error_fileData$Time ) |
| 354 | |
| 355 | # Adding a temporary reversed iterative list to the errors_dataFrame so that there are no gaps in-between build numbers. |
| 356 | errors_dataFrame$iterative <- seq( 1, nrow( error_fileData ), by = 1 ) |
| 357 | |
| 358 | # Omit any data that doesn't exist |
| 359 | errors_dataFrame <- na.omit( errors_dataFrame ) |
| 360 | |
Jeremy Ronquillo | 75c8a05 | 2018-05-11 15:59:40 -0700 | [diff] [blame] | 361 | if ( dataLength > maxDataToDisplay ){ |
| 362 | errors_dataFrame <- errors_dataFrame[ errors_dataFrame$iterative >= dataLength - maxDataToDisplay, ] |
| 363 | } |
| 364 | |
| 365 | if ( moduloFactor > 1 ){ |
| 366 | errors_dataFrame[ errors_dataFrame$iterative %% moduloFactor != dataLength %% moduloFactor, ]$timeStamps <- "" |
| 367 | } |
| 368 | |
Jeremy Ronquillo | b407649 | 2018-05-11 13:04:16 -0700 | [diff] [blame] | 369 | print( "'Errors' Data Frame Results:" ) |
| 370 | print( errors_dataFrame ) |
| 371 | |
| 372 | # ********************************************************** |
| 373 | # STEP 3: Generate graphs. |
| 374 | # ********************************************************** |
| 375 | |
| 376 | print( "**********************************************************" ) |
| 377 | print( "STEP 3: Generate Graph." ) |
| 378 | print( "**********************************************************" ) |
| 379 | |
| 380 | # ------------------- |
| 381 | # Main Plot Generated |
| 382 | # ------------------- |
| 383 | |
| 384 | print( "Creating main plots." ) |
| 385 | |
| 386 | eventsPlot <- ggplot( data = events_dataFrame, aes( x = iterative, |
| 387 | y = Events, |
| 388 | color = Type ) ) |
| 389 | |
| 390 | failuresPlot <- ggplot( data = failures_dataFrame, aes( x = iterative, |
| 391 | y = Failures, |
| 392 | color = Type ) ) |
| 393 | |
| 394 | errorsPlot <- ggplot( data = errors_dataFrame, aes( x = iterative, |
| 395 | y = Errors, |
| 396 | color = Type ) ) |
| 397 | |
| 398 | # ------------------------------ |
| 399 | # Fundamental Variables Assigned |
| 400 | # ------------------------------ |
| 401 | |
| 402 | print( "Generating fundamental graph data used in all 3 graphs." ) |
| 403 | |
| 404 | defaultTextSize() |
| 405 | |
| 406 | yAxisTicksExponents <- seq( -1, floor( max( c( max( events_dataFrame$Events ), max( failures_dataFrame$Failures ), max( errors_dataFrame$Errors ) ) ) ^ 0.1 ) + 1, by=1 ) |
| 407 | yAxisTicks <- 10 ^ yAxisTicksExponents |
| 408 | yAxisTicksLabels <- floor( yAxisTicks ) |
| 409 | |
| 410 | yScaleConfig <- scale_y_log10( breaks = yAxisTicks, |
| 411 | labels = yAxisTicksLabels ) |
| 412 | xLabel <- xlab( "Time" ) |
| 413 | |
| 414 | print( "Generating line graph." ) |
| 415 | |
Jeremy Ronquillo | 75c8a05 | 2018-05-11 15:59:40 -0700 | [diff] [blame] | 416 | lineGraphFormat <- geom_line( size = 0.5 ) |
| 417 | pointFormat <- geom_point( size = 0 ) |
Jeremy Ronquillo | b407649 | 2018-05-11 13:04:16 -0700 | [diff] [blame] | 418 | |
Jeremy Ronquillo | 75c8a05 | 2018-05-11 15:59:40 -0700 | [diff] [blame] | 419 | graphTheme <- graphTheme() + theme( axis.text.x = element_text( angle = 90, hjust = 1.0, vjust = 0.5, size = 11 ), |
Jeremy Ronquillo | b407649 | 2018-05-11 13:04:16 -0700 | [diff] [blame] | 420 | axis.text.y = element_text( size = 17 ) ) |
| 421 | |
| 422 | # ------------------- |
| 423 | # 'Events' Graph Data |
| 424 | # ------------------- |
| 425 | |
| 426 | print( "Generating 'events' graph data." ) |
| 427 | |
| 428 | yLabel <- ylab( "Events" ) |
| 429 | |
| 430 | xScaleConfig <- scale_x_continuous( breaks = events_dataFrame$iterative, |
| 431 | label = events_dataFrame$timeStamps ) |
| 432 | |
| 433 | lineColorsAndLabels <- scale_color_manual( values=c( webColor( "light_blue" ), |
| 434 | webColor( "red" ), |
| 435 | webColor( "purple" ), |
| 436 | webColor( "yellow" ), |
| 437 | webColor( "orange" ), |
| 438 | webColor( "blue" ), |
| 439 | webColor( "magenta" ), |
| 440 | webColor( "green" ), |
| 441 | webColor( "brown" ), |
| 442 | webColor( "black" ) |
| 443 | ), |
| 444 | labels = c( "Link Down", |
| 445 | "Link Up", |
| 446 | "Device Down", |
| 447 | "Device Up", |
| 448 | "Add Host Intent", |
| 449 | "Delete Host Intent", |
| 450 | "Add Point Intent", |
| 451 | "Delete Point Intent", |
| 452 | "ONOS Down", |
| 453 | "ONOS Up" ) |
| 454 | ) |
| 455 | |
| 456 | title <- labs( title = eventsTitle, subtitle = lastUpdatedLabel() ) |
| 457 | |
| 458 | result <- eventsPlot + |
| 459 | xScaleConfig + |
| 460 | yScaleConfig + |
| 461 | xLabel + |
| 462 | yLabel + |
| 463 | graphTheme + |
| 464 | title + |
| 465 | lineGraphFormat + |
| 466 | lineColorsAndLabels + |
| 467 | pointFormat |
| 468 | |
| 469 | # ----------------------- |
| 470 | # Exporting Graph to File |
| 471 | # ----------------------- |
| 472 | |
| 473 | saveGraph( eventsFilename ) # from saveGraph.R |
| 474 | |
| 475 | # --------------------- |
| 476 | # 'Failures' Graph Data |
| 477 | # --------------------- |
| 478 | |
| 479 | print( "Generating 'failures' graph data." ) |
| 480 | |
| 481 | yLabel <- ylab( "Failures" ) |
| 482 | |
| 483 | xScaleConfig <- scale_x_continuous( breaks = failures_dataFrame$iterative, |
| 484 | label = failures_dataFrame$timeStamps ) |
| 485 | |
| 486 | lineColorsAndLabels <- scale_color_manual( values=c( webColor( "red" ), |
| 487 | webColor( "yellow" ), |
| 488 | webColor( "green" ), |
| 489 | webColor( "blue" ), |
| 490 | webColor( "magenta" ) |
| 491 | ), |
| 492 | labels = c( "Intent Check Failure", |
| 493 | "Flow Check Failure", |
| 494 | "Traffic Check Failure", |
| 495 | "Topo Check Failure", |
| 496 | "ONOS Check Failure" ) |
| 497 | ) |
| 498 | |
| 499 | title <- labs( title = failedChecksTitle, subtitle = lastUpdatedLabel() ) |
| 500 | |
| 501 | result <- failuresPlot + |
| 502 | xScaleConfig + |
| 503 | yScaleConfig + |
| 504 | xLabel + |
| 505 | yLabel + |
| 506 | graphTheme + |
| 507 | title + |
| 508 | lineGraphFormat + |
| 509 | lineColorsAndLabels + wrapLegend(byrow=FALSE) + |
| 510 | pointFormat |
| 511 | |
| 512 | |
| 513 | # ----------------------- |
| 514 | # Exporting Graph to File |
| 515 | # ----------------------- |
| 516 | |
| 517 | saveGraph( failedChecksFilename ) # from saveGraph.R |
| 518 | |
| 519 | # --------------------- |
| 520 | # 'Errors' Graph Data |
| 521 | # --------------------- |
| 522 | |
| 523 | print( "Generating 'errors' graph data." ) |
| 524 | |
| 525 | yLabel <- ylab( "Errors" ) |
| 526 | |
| 527 | xScaleConfig <- scale_x_continuous( breaks = errors_dataFrame$iterative, |
| 528 | label = errors_dataFrame$timeStamps ) |
| 529 | |
| 530 | lineColorsAndLabels <- scale_color_manual( values=c( webColor( "magenta" ), |
| 531 | webColor( "yellow" ), |
| 532 | webColor( "orange" ), |
| 533 | webColor( "red" ) |
| 534 | ), |
| 535 | labels = c( "Test Warnings", |
| 536 | "ONOS Warnings", |
| 537 | "ONOS Errors", |
| 538 | "Exceptions" ) |
| 539 | ) |
| 540 | |
| 541 | title <- labs( title = errorsTitle, subtitle = lastUpdatedLabel() ) |
| 542 | |
| 543 | result <- errorsPlot + |
| 544 | xScaleConfig + |
| 545 | yScaleConfig + |
| 546 | xLabel + |
| 547 | yLabel + |
| 548 | graphTheme + |
| 549 | title + |
| 550 | lineGraphFormat + |
| 551 | lineColorsAndLabels + |
| 552 | pointFormat |
| 553 | |
| 554 | # ----------------------- |
| 555 | # Exporting Graph to File |
| 556 | # ----------------------- |
| 557 | |
Devin Lim | 324806b | 2018-05-11 15:36:52 -0700 | [diff] [blame] | 558 | saveGraph( errorsFilename ) # from saveGraph.R |