YPZhang | 737d001 | 2016-03-24 13:56:24 -0700 | [diff] [blame] | 1 | import sys |
| 2 | import json |
| 3 | import time |
| 4 | import os |
| 5 | ''' |
| 6 | SCPFscalingMaxIntentsWithFlowObj |
| 7 | Push test Intents to onos |
| 8 | CASE10: set up Null Provider |
| 9 | CASE11: set up Open Flows |
| 10 | Scale up when reach the Limited |
| 11 | Start from 1 nodes, 8 devices. Then Scale up to 3,5,7 nodes |
| 12 | Recommand batch size: 100, check interval: 100 |
| 13 | ''' |
| 14 | class SCPFscalingMaxIntentsWithFlowObj: |
| 15 | def __init__( self ): |
| 16 | self.default = '' |
| 17 | |
| 18 | def CASE0( self, main): |
| 19 | import sys |
| 20 | import json |
| 21 | import time |
| 22 | import os |
| 23 | import imp |
| 24 | |
| 25 | main.case( "Constructing test variables and building ONOS package" ) |
| 26 | main.step( "Constructing test variables" ) |
| 27 | stepResult = main.FALSE |
| 28 | |
| 29 | # Test variables |
| 30 | main.testOnDirectory = os.path.dirname( os.getcwd ( ) ) |
| 31 | main.dependencyPath = main.testOnDirectory + \ |
| 32 | main.params['DEPENDENCY']['path'] |
| 33 | main.cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 34 | main.apps = main.params[ 'ENV' ][ 'cellApps' ] |
| 35 | main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ] |
| 36 | main.scale = ( main.params[ 'SCALE' ] ).split( "," ) |
| 37 | main.ONOSport = main.params[ 'CTRL' ][ 'port' ] |
| 38 | main.timeout = int(main.params['SLEEP']['timeout']) |
| 39 | main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] ) |
| 40 | main.installSleep = int( main.params[ 'SLEEP' ][ 'install' ] ) |
| 41 | main.verifySleep = int( main.params[ 'SLEEP' ][ 'verify' ] ) |
| 42 | main.rerouteSleep = int ( main.params['SLEEP']['reroute'] ) |
| 43 | main.verifyAttempts = int( main.params['ATTEMPTS']['verify'] ) |
| 44 | main.ingress = main.params['LINK']['ingress'] |
| 45 | main.egress = main.params['LINK']['egress'] |
| 46 | main.dbFileName = main.params['DATABASE']['file'] |
| 47 | main.cellData = {} # for creating cell file |
| 48 | main.reroute = main.params['reroute'] |
| 49 | main.threadID = 0 |
| 50 | |
| 51 | if main.reroute == "True": |
| 52 | main.reroute = True |
| 53 | else: |
| 54 | main.reroute = False |
| 55 | |
| 56 | main.CLIs = [] |
| 57 | main.ONOSip = [] |
| 58 | main.maxNumBatch = 0 |
| 59 | main.ONOSip = main.ONOSbench.getOnosIps() |
| 60 | main.log.info(main.ONOSip) |
| 61 | main.setupSkipped = False |
| 62 | |
| 63 | wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ] |
| 64 | gitBranch = main.params[ 'GIT' ][ 'branch' ] |
| 65 | gitPull = main.params[ 'GIT' ][ 'pull' ] |
| 66 | nic = main.params['DATABASE']['nic'] |
| 67 | node = main.params['DATABASE']['node'] |
| 68 | nic = main.params['DATABASE']['nic'] |
| 69 | node = main.params['DATABASE']['node'] |
| 70 | stepResult = main.TRUE |
| 71 | |
| 72 | main.log.info("Cresting DB file") |
| 73 | with open(main.dbFileName, "w+") as dbFile: |
| 74 | dbFile.write("") |
| 75 | |
| 76 | utilities.assert_equals( expect=main.TRUE, |
| 77 | actual=stepResult, |
| 78 | onpass="environment set up successfull", |
| 79 | onfail="environment set up Failed" ) |
| 80 | |
| 81 | def CASE1( self ): |
| 82 | # main.scale[ 0 ] determines the current number of ONOS controller |
| 83 | main.CLIs = [] |
| 84 | main.numCtrls = int( main.scale[ 0 ] ) |
| 85 | main.log.info( "Creating list of ONOS cli handles" ) |
| 86 | for i in range(main.numCtrls): |
| 87 | main.CLIs.append( getattr( main, 'ONOScli%s' % (i+1) ) ) |
| 88 | |
| 89 | main.log.info(main.CLIs) |
| 90 | if not main.CLIs: |
| 91 | main.log.error( "Failed to create the list of ONOS cli handles" ) |
| 92 | main.cleanup() |
| 93 | main.exit() |
| 94 | |
| 95 | main.log.info( "Loading wrapper files" ) |
| 96 | main.startUp = imp.load_source( wrapperFile1, |
| 97 | main.dependencyPath + |
| 98 | wrapperFile1 + |
| 99 | ".py" ) |
| 100 | |
| 101 | copyResult = main.ONOSbench.copyMininetFile( main.topology, |
| 102 | main.dependencyPath, |
| 103 | main.Mininet1.user_name, |
| 104 | main.Mininet1.ip_address ) |
| 105 | |
| 106 | commit = main.ONOSbench.getVersion(report=True) |
| 107 | commit = commit.split(" ")[1] |
| 108 | |
| 109 | if gitPull == 'True': |
| 110 | if not main.startUp.onosBuild( main, gitBranch ): |
| 111 | main.log.error( "Failed to build ONOS" ) |
| 112 | main.cleanup() |
| 113 | main.exit() |
| 114 | else: |
| 115 | main.log.warn( "Did not pull new code so skipping mvn " + |
| 116 | "clean install" ) |
| 117 | with open(main.dbFileName, "a") as dbFile: |
| 118 | temp = "'" + commit + "'," |
| 119 | temp += "'" + nic + "'," |
| 120 | dbFile.write(temp) |
| 121 | |
| 122 | def CASE2( self, main ): |
| 123 | """ |
| 124 | - Uninstall ONOS cluster |
| 125 | - Verify ONOS start up |
| 126 | - Install ONOS cluster |
| 127 | - Connect to cli |
| 128 | """ |
| 129 | main.log.info( "Starting up %s node(s) ONOS cluster" % main.numCtrls) |
| 130 | main.log.info( "Safety check, killing all ONOS processes" + |
| 131 | " before initiating environment setup" ) |
| 132 | |
| 133 | for i in range( main.numCtrls ): |
| 134 | main.ONOSbench.onosDie( main.ONOSip[ i ] ) |
| 135 | |
| 136 | main.log.info( "NODE COUNT = %s" % main.numCtrls) |
| 137 | |
| 138 | tempOnosIp = [] |
| 139 | for i in range( main.numCtrls ): |
| 140 | tempOnosIp.append( main.ONOSip[i] ) |
| 141 | |
| 142 | main.ONOSbench.createCellFile( main.ONOSbench.ip_address, |
| 143 | "temp", |
| 144 | main.Mininet1.ip_address, |
| 145 | main.apps, |
| 146 | tempOnosIp ) |
| 147 | |
| 148 | main.step( "Apply cell to environment" ) |
| 149 | cellResult = main.ONOSbench.setCell( "temp" ) |
| 150 | verifyResult = main.ONOSbench.verifyCell() |
| 151 | stepResult = cellResult and verifyResult |
| 152 | utilities.assert_equals( expect=main.TRUE, |
| 153 | actual=stepResult, |
| 154 | onpass="Successfully applied cell to " + \ |
| 155 | "environment", |
| 156 | onfail="Failed to apply cell to environment " ) |
| 157 | |
| 158 | main.step( "Creating ONOS package" ) |
| 159 | packageResult = main.ONOSbench.onosPackage() |
| 160 | stepResult = packageResult |
| 161 | utilities.assert_equals( expect=main.TRUE, |
| 162 | actual=stepResult, |
| 163 | onpass="Successfully created ONOS package", |
| 164 | onfail="Failed to create ONOS package" ) |
| 165 | |
| 166 | main.step( "Uninstall ONOS package on all Nodes" ) |
| 167 | uninstallResult = main.TRUE |
| 168 | for i in range( int( main.numCtrls ) ): |
| 169 | main.log.info( "Uninstalling package on ONOS Node IP: " + main.ONOSip[i] ) |
| 170 | u_result = main.ONOSbench.onosUninstall( main.ONOSip[i] ) |
| 171 | utilities.assert_equals( expect=main.TRUE, actual=u_result, |
| 172 | onpass="Test step PASS", |
| 173 | onfail="Test step FAIL" ) |
| 174 | uninstallResult = ( uninstallResult and u_result ) |
| 175 | |
| 176 | main.step( "Install ONOS package on all Nodes" ) |
| 177 | installResult = main.TRUE |
| 178 | for i in range( int( main.numCtrls ) ): |
| 179 | main.log.info( "Installing package on ONOS Node IP: " + main.ONOSip[i] ) |
| 180 | i_result = main.ONOSbench.onosInstall( node=main.ONOSip[i] ) |
| 181 | utilities.assert_equals( expect=main.TRUE, actual=i_result, |
| 182 | onpass="Test step PASS", |
| 183 | onfail="Test step FAIL" ) |
| 184 | installResult = installResult and i_result |
| 185 | |
| 186 | main.step( "Verify ONOS nodes UP status" ) |
| 187 | statusResult = main.TRUE |
| 188 | for i in range( int( main.numCtrls ) ): |
| 189 | main.log.info( "ONOS Node " + main.ONOSip[i] + " status:" ) |
| 190 | onos_status = main.ONOSbench.onosStatus( node=main.ONOSip[i] ) |
| 191 | utilities.assert_equals( expect=main.TRUE, actual=onos_status, |
| 192 | onpass="Test step PASS", |
| 193 | onfail="Test step FAIL" ) |
| 194 | statusResult = ( statusResult and onos_status ) |
| 195 | |
| 196 | main.step( "Start ONOS CLI on all nodes" ) |
| 197 | cliResult = main.TRUE |
| 198 | main.log.step(" Start ONOS cli using thread ") |
| 199 | startCliResult = main.TRUE |
| 200 | pool = [] |
| 201 | |
| 202 | for i in range( int( main.numCtrls) ): |
| 203 | t = main.Thread( target=main.CLIs[i].startOnosCli, |
| 204 | threadID=main.threadID, |
| 205 | name="startOnosCli", |
| 206 | args=[ main.ONOSip[i] ], |
| 207 | kwargs = {"onosStartTimeout":main.timeout} ) |
| 208 | pool.append(t) |
| 209 | t.start() |
| 210 | main.threadID = main.threadID + 1 |
| 211 | for t in pool: |
| 212 | t.join() |
| 213 | startCliResult = startCliResult and t.result |
| 214 | time.sleep( main.startUpSleep ) |
| 215 | |
| 216 | def CASE10( self, main ): |
| 217 | """ |
| 218 | Setting up null-provider |
| 219 | """ |
| 220 | import json |
| 221 | # Activate apps |
| 222 | main.step("Activating null-provider") |
| 223 | appStatus = utilities.retry( main.CLIs[0].activateApp, |
| 224 | main.FALSE, |
| 225 | ['org.onosproject.null'], |
| 226 | sleep=main.verifySleep, |
| 227 | attempts=main.verifyAttempts ) |
| 228 | utilities.assert_equals( expect=main.TRUE, |
| 229 | actual=appStatus, |
| 230 | onpass="Successfully activated null-provider", |
| 231 | onfail="Failed activate null-provider" ) |
| 232 | |
| 233 | # Setup the null-provider |
| 234 | main.step("Configuring null-provider") |
| 235 | cfgStatus = utilities.retry( main.ONOSbench.onosCfgSet, |
| 236 | main.FALSE, |
| 237 | [ main.ONOSip[0], |
| 238 | 'org.onosproject.provider.nil.NullProviders', 'deviceCount 8'], |
| 239 | sleep=main.verifySleep, |
| 240 | attempts = main.verifyAttempts ) |
| 241 | cfgStatus = cfgStatus and utilities.retry( main.ONOSbench.onosCfgSet, |
| 242 | main.FALSE, |
| 243 | [ main.ONOSip[0], |
| 244 | 'org.onosproject.provider.nil.NullProviders', 'topoShape reroute'], |
| 245 | sleep=main.verifySleep, |
| 246 | attempts = main.verifyAttempts ) |
| 247 | |
| 248 | cfgStatus = cfgStatus and utilities.retry( main.ONOSbench.onosCfgSet, |
| 249 | main.FALSE, |
| 250 | [ main.ONOSip[0], |
| 251 | 'org.onosproject.provider.nil.NullProviders', 'enabled true'], |
| 252 | sleep=main.verifySleep, |
| 253 | attempts = main.verifyAttempts ) |
| 254 | |
| 255 | |
| 256 | utilities.assert_equals( expect=main.TRUE, |
| 257 | actual=cfgStatus, |
| 258 | onpass="Successfully configured null-provider", |
| 259 | onfail="Failed to configure null-provider" ) |
| 260 | |
| 261 | # give onos some time to settle |
| 262 | time.sleep(main.startUpSleep) |
| 263 | |
| 264 | main.log.info("Setting default flows to zero") |
| 265 | main.defaultFlows = 0 |
| 266 | |
| 267 | main.step("Check status of null-provider setup") |
| 268 | caseResult = appStatus and cfgStatus |
| 269 | utilities.assert_equals( expect=main.TRUE, |
| 270 | actual=caseResult, |
| 271 | onpass="Setting up null-provider was successfull", |
| 272 | onfail="Failed to setup null-provider" ) |
| 273 | |
| 274 | # This tells the following cases if we are using the null-provider or ovs |
| 275 | main.switchType = "null:" |
| 276 | |
| 277 | # If the null-provider setup was unsuccessfull, then there is no point to |
| 278 | # run the subsequent cases |
| 279 | |
| 280 | time.sleep(main.startUpSleep) |
| 281 | main.step( "Balancing Masters" ) |
| 282 | |
| 283 | stepResult = main.FALSE |
| 284 | stepResult = utilities.retry( main.CLIs[0].balanceMasters, |
| 285 | main.FALSE, |
| 286 | [], |
| 287 | sleep=3, |
| 288 | attempts=3 ) |
| 289 | |
| 290 | utilities.assert_equals( expect=main.TRUE, |
| 291 | actual=stepResult, |
| 292 | onpass="Balance masters was successfull", |
| 293 | onfail="Failed to balance masters") |
| 294 | |
| 295 | time.sleep( 5 ) |
| 296 | if not caseResult: |
| 297 | main.setupSkipped = True |
| 298 | |
| 299 | def CASE11( self, main): |
| 300 | ''' |
| 301 | Setting up mininet |
| 302 | ''' |
| 303 | import json |
| 304 | import time |
| 305 | |
| 306 | time.sleep(main.startUpSleep) |
| 307 | |
| 308 | main.step("Activating openflow") |
| 309 | appStatus = utilities.retry( main.ONOSrest1.activateApp, |
| 310 | main.FALSE, |
| 311 | ['org.onosproject.openflow'], |
| 312 | sleep=3, |
| 313 | attempts=3 ) |
| 314 | utilities.assert_equals( expect=main.TRUE, |
| 315 | actual=appStatus, |
| 316 | onpass="Successfully activated openflow", |
| 317 | onfail="Failed activate openflow" ) |
| 318 | |
| 319 | time.sleep(main.startUpSleep) |
| 320 | main.log.info("Set Intent Compiler use Flow Object") |
| 321 | main.CLIs[0].setCfg( "org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator", "useFlowObjectives", "true" ) |
| 322 | |
| 323 | main.step('Starting mininet topology') |
| 324 | mnStatus = main.Mininet1.startNet(topoFile='~/mininet/custom/rerouteTopo.py') |
| 325 | utilities.assert_equals( expect=main.TRUE, |
| 326 | actual=mnStatus, |
| 327 | onpass="Successfully started Mininet", |
| 328 | onfail="Failed to activate Mininet" ) |
| 329 | |
| 330 | main.step("Assinging masters to switches") |
| 331 | switches = main.Mininet1.getSwitches() |
| 332 | swStatus = main.Mininet1.assignSwController( sw=switches.keys(), ip=main.ONOSip ) |
| 333 | utilities.assert_equals( expect=main.TRUE, |
| 334 | actual=swStatus, |
| 335 | onpass="Successfully assigned switches to masters", |
| 336 | onfail="Failed assign switches to masters" ) |
| 337 | |
| 338 | time.sleep(main.startUpSleep) |
| 339 | |
| 340 | main.log.info("Getting default flows") |
| 341 | jsonSum = json.loads(main.CLIs[0].summary()) |
| 342 | main.defaultFlows = jsonSum["flows"] |
| 343 | |
| 344 | main.step("Check status of Mininet setup") |
| 345 | caseResult = appStatus and mnStatus and swStatus |
| 346 | utilities.assert_equals( expect=main.TRUE, |
| 347 | actual=caseResult, |
| 348 | onpass="Successfully setup Mininet", |
| 349 | onfail="Failed setup Mininet" ) |
| 350 | |
| 351 | # This tells the following cases if we are using the null-provider or ovs |
| 352 | main.switchType = "of:" |
| 353 | |
| 354 | time.sleep(main.startUpSleep) |
| 355 | main.step( "Balancing Masters" ) |
| 356 | |
| 357 | stepResult = main.FALSE |
| 358 | stepResult = utilities.retry( main.CLIs[0].balanceMasters, |
| 359 | main.FALSE, |
| 360 | [], |
| 361 | sleep=3, |
| 362 | attempts=3 ) |
| 363 | |
| 364 | utilities.assert_equals( expect=main.TRUE, |
| 365 | actual=stepResult, |
| 366 | onpass="Balance masters was successfull", |
| 367 | onfail="Failed to balance masters") |
| 368 | |
| 369 | time.sleep(5) |
| 370 | if not caseResult: |
| 371 | main.setupSkipped = True |
| 372 | |
| 373 | |
| 374 | |
| 375 | def CASE20( self, main ): |
| 376 | if main.reroute: |
| 377 | main.minIntents = int(main.params['NULL']['REROUTE']['min_intents']) |
| 378 | main.maxIntents = int(main.params['NULL']['REROUTE']['max_intents']) |
| 379 | main.checkInterval = int(main.params['NULL']['REROUTE']['check_interval']) |
| 380 | main.batchSize = int(main.params['NULL']['REROUTE']['batch_size']) |
| 381 | else: |
| 382 | main.minIntents = int(main.params['NULL']['PUSH']['min_intents']) |
| 383 | main.maxIntents = int(main.params['NULL']['PUSH']['max_intents']) |
| 384 | main.checkInterval = int(main.params['NULL']['PUSH']['check_interval']) |
| 385 | main.batchSize = int(main.params['NULL']['PUSH']['batch_size']) |
| 386 | |
| 387 | # check if the case needs to be skipped |
| 388 | if main.setupSkipped: |
| 389 | main.setupSkipped = False |
| 390 | main.skipCase() |
| 391 | |
| 392 | # the index where the next intents will be installed |
| 393 | offfset = 0 |
| 394 | # keeps track of how many intents have been installed |
| 395 | currIntents = 0 |
| 396 | # keeps track of how many flows have been installed, set to 0 at start |
| 397 | currFlows = 0 |
| 398 | # limit for the number of intents that can be installed |
| 399 | limit = main.maxIntents / main.batchSize |
| 400 | # total intents installed |
| 401 | totalIntents = 0 |
| 402 | |
| 403 | intentsState = None |
| 404 | |
| 405 | offtmp = 0 |
| 406 | main.step( "Pushing intents" ) |
| 407 | stepResult = main.TRUE |
| 408 | # temp variable to contain the number of flows |
| 409 | flowsNum = 0 |
| 410 | |
| 411 | for i in range(limit): |
| 412 | |
| 413 | # Threads pool |
| 414 | pool = [] |
| 415 | |
| 416 | for j in range( int( main.numCtrls) ): |
| 417 | if main.numCtrls > 1: |
| 418 | time.sleep( 1 ) |
| 419 | offtmp = offfset + main.maxIntents * j |
| 420 | # Push intents by using threads |
| 421 | t = main.Thread( target=main.CLIs[j].pushTestIntents, |
| 422 | threadID=main.threadID, |
| 423 | name="Push-Test-Intents", |
| 424 | args=[ main.switchType + main.ingress, |
| 425 | main.switchType + main.egress, |
| 426 | main.batchSize ], |
| 427 | kwargs={ "offset": offtmp, |
| 428 | "options": "-i", |
| 429 | "timeout": main.timeout, |
| 430 | "background":False } ) |
| 431 | pool.append(t) |
| 432 | t.start() |
| 433 | main.threadID = main.threadID + 1 |
| 434 | for t in pool: |
| 435 | t.join() |
| 436 | stepResult = stepResult and t.result |
| 437 | offfset = offfset + main.batchSize |
| 438 | |
| 439 | totalIntents = main.batchSize * main.numCtrls + totalIntents |
| 440 | if totalIntents >= main.minIntents and totalIntents % main.checkInterval == 0: |
| 441 | # if reach to minimum number and check interval, verify Intetns and flows |
| 442 | time.sleep( main.verifySleep * main.numCtrls ) |
| 443 | |
| 444 | main.log.info("Verify Intents states") |
| 445 | # k is a control variable for verify retry attempts |
| 446 | k = 1 |
| 447 | intentVerify = main.FALSE |
| 448 | |
| 449 | while k <= main.verifyAttempts: |
| 450 | # while loop for check intents by using REST api |
| 451 | time.sleep(5) |
| 452 | temp = 0 |
| 453 | intentsState = json.loads( main.ONOSrest1.intents() ) |
| 454 | for f in intentsState: |
| 455 | # get INSTALLED intents number |
| 456 | if f.get("state") == "INSTALLED": |
| 457 | temp = temp + 1 |
| 458 | |
| 459 | main.log.info("Total Intents: {} INSTALLED: {}".format(totalIntents, temp)) |
| 460 | if totalIntents == temp: |
| 461 | intentVerify = main.TRUE |
| 462 | break |
| 463 | intentVerify = main.FALSE |
| 464 | k = k+1 |
| 465 | if not intentVerify: |
| 466 | # If some intents are not installed, grep the previous flows list, and finished this test case |
| 467 | main.log.warn( "Some intens did not install" ) |
| 468 | # We don't want to check flows if intents not installed, because onos will drop flows |
| 469 | if currFlows == 0: |
| 470 | # If currFlows equal 0, which means we failed to install intents at first, or we didn't get |
| 471 | # the correct number, so we need get flows here. |
| 472 | flowsState = json.loads( main.ONOSrest1.flows() ) |
| 473 | break |
| 474 | |
| 475 | main.log.info("Verify Flows states") |
| 476 | k = 1 |
| 477 | flowsVerify = main.TRUE |
| 478 | while k <= main.verifyAttempts: |
| 479 | # while loop for check flows by using REST api |
| 480 | time.sleep(3) |
| 481 | temp = 0 |
| 482 | flowsStateCount = [] |
| 483 | flowsState = json.loads( main.ONOSrest1.flows() ) |
| 484 | main.log.info("Total flows now: {}".format(len(flowsState))) |
| 485 | if ( flowsNum < len(flowsState) ): |
| 486 | flowsNum = len(flowsState) |
| 487 | print(flowsNum) |
| 488 | for f in flowsState: |
| 489 | # get PENDING_ADD flows |
| 490 | if f.get("state") == "PENDING_ADD": |
| 491 | temp = temp + 1 |
| 492 | |
| 493 | flowsStateCount.append(temp) |
| 494 | temp = 0 |
| 495 | |
| 496 | for f in flowsState: |
| 497 | # get PENDING_REMOVE flows |
| 498 | if f.get("state") == "PENDING_REMOVE": |
| 499 | temp = temp + 1 |
| 500 | |
| 501 | flowsStateCount.append(temp) |
| 502 | temp = 0 |
| 503 | |
| 504 | for f in flowsState: |
| 505 | # get REMOVED flows |
| 506 | if f.get("state") == "REMOVED": |
| 507 | temp = temp + 1 |
| 508 | |
| 509 | flowsStateCount.append(temp) |
| 510 | temp = 0 |
| 511 | |
| 512 | for f in flowsState: |
| 513 | # get FAILED flwos |
| 514 | if f.get("state") == "FAILED": |
| 515 | temp = temp + 1 |
| 516 | |
| 517 | flowsStateCount.append(temp) |
| 518 | temp = 0 |
| 519 | k = k + 1 |
| 520 | for c in flowsStateCount: |
| 521 | if int(c) > 0: |
| 522 | flowsVerify = main.FALSE |
| 523 | |
| 524 | main.log.info( "Check flows States:" ) |
| 525 | main.log.info( "PENDING_ADD: {}".format( flowsStateCount[0]) ) |
| 526 | main.log.info( "PENDING_REMOVE: {}".format( flowsStateCount[1]) ) |
| 527 | main.log.info( "REMOVED: {}".format( flowsStateCount[2]) ) |
| 528 | main.log.info( "FAILED: {}".format( flowsStateCount[3]) ) |
| 529 | |
| 530 | if flowsVerify == main.TRUE: |
| 531 | break |
| 532 | |
| 533 | del main.scale[0] |
| 534 | utilities.assert_equals( expect = main.TRUE, |
| 535 | actual = intentVerify, |
| 536 | onpass = "Successfully pushed and verified intents", |
| 537 | onfail = "Failed to push and verify intents" ) |
| 538 | |
| 539 | # we need the total intents before crash |
| 540 | totalIntents = len(intentsState) |
| 541 | totalFlows = flowsNum |
| 542 | |
| 543 | main.log.info( "Total Intents Installed before crash: {}".format( totalIntents ) ) |
| 544 | main.log.info( "Total Flows ADDED before crash: {}".format( totalFlows ) ) |
| 545 | |
| 546 | main.step('clean up Mininet') |
| 547 | main.Mininet1.stopNet() |
| 548 | |
| 549 | main.log.info("Writing results to DS file") |
| 550 | with open(main.dbFileName, "a") as dbFile: |
| 551 | # Scale number |
| 552 | temp = str(main.numCtrls) |
| 553 | temp += ",'" + "baremetal1" + "'" |
| 554 | # how many intents we installed before crash |
| 555 | temp += "," + str(totalIntents) |
| 556 | # how many flows we installed before crash |
| 557 | temp += "," + str(totalFlows) |
| 558 | # other columns in database, but we didn't use in this test |
| 559 | temp += "," + "0,0,0,0,0,0" |
| 560 | temp += "\n" |
| 561 | dbFile.write( temp ) |