kelvin-onlab | 1d381fe | 2015-07-14 16:24:56 -0700 | [diff] [blame] | 1 | |
| 2 | # Testing network scalability, this test suite scales up a network topology |
| 3 | # using mininet and verifies ONOS stability |
| 4 | |
GlennRC | 1c5df3c | 2015-08-27 16:12:09 -0700 | [diff] [blame] | 5 | class SCPFscaleTopo: |
kelvin-onlab | 1d381fe | 2015-07-14 16:24:56 -0700 | [diff] [blame] | 6 | |
| 7 | def __init__( self ): |
| 8 | self.default = '' |
| 9 | |
| 10 | def CASE1( self, main ): |
| 11 | import time |
| 12 | import os |
| 13 | import imp |
Jon Hall | f632d20 | 2015-07-30 15:45:11 -0700 | [diff] [blame] | 14 | import re |
kelvin-onlab | 1d381fe | 2015-07-14 16:24:56 -0700 | [diff] [blame] | 15 | |
| 16 | """ |
| 17 | - Construct tests variables |
| 18 | - GIT ( optional ) |
| 19 | - Checkout ONOS master branch |
| 20 | - Pull latest ONOS code |
| 21 | - Building ONOS ( optional ) |
| 22 | - Install ONOS package |
| 23 | - Build ONOS package |
| 24 | """ |
| 25 | |
| 26 | main.case( "Constructing test variables and building ONOS package" ) |
| 27 | main.step( "Constructing test variables" ) |
| 28 | stepResult = main.FALSE |
| 29 | |
kelvin-onlab | d9e23de | 2015-08-06 10:34:44 -0700 | [diff] [blame] | 30 | try: |
| 31 | main.testOnDirectory = os.path.dirname( os.getcwd ( ) ) |
| 32 | main.apps = main.params[ 'ENV' ][ 'cellApps' ] |
| 33 | gitBranch = main.params[ 'GIT' ][ 'branch' ] |
| 34 | main.dependencyPath = main.testOnDirectory + \ |
| 35 | main.params[ 'DEPENDENCY' ][ 'path' ] |
kelvin-onlab | d9e23de | 2015-08-06 10:34:44 -0700 | [diff] [blame] | 36 | main.multiovs = main.params[ 'DEPENDENCY' ][ 'multiovs' ] |
GlennRC | 632e289 | 2015-10-19 18:58:41 -0700 | [diff] [blame] | 37 | main.topoName = main.params[ 'TOPOLOGY' ][ 'topology' ] |
| 38 | main.numCtrls = int( main.params[ 'CTRL' ][ 'numCtrls' ] ) |
| 39 | main.topoScale = ( main.params[ 'TOPOLOGY' ][ 'scale' ] ).split( "," ) |
| 40 | main.topoScaleSize = len( main.topoScale ) |
kelvin-onlab | d9e23de | 2015-08-06 10:34:44 -0700 | [diff] [blame] | 41 | wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ] |
| 42 | wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ] |
| 43 | wrapperFile3 = main.params[ 'DEPENDENCY' ][ 'wrapper3' ] |
GlennRC | 632e289 | 2015-10-19 18:58:41 -0700 | [diff] [blame] | 44 | main.checkTopoAttempts = int( main.params['SLEEP']['topoAttempts']) |
kelvin-onlab | d9e23de | 2015-08-06 10:34:44 -0700 | [diff] [blame] | 45 | main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] ) |
| 46 | main.fwdSleep = int( main.params[ 'SLEEP' ][ 'fwd' ] ) |
GlennRC | 632e289 | 2015-10-19 18:58:41 -0700 | [diff] [blame] | 47 | main.balanceSleep = int( main.params[ 'SLEEP' ][ 'balance' ] ) |
| 48 | main.nodeDownSleep = int( main.params[ 'SLEEP' ][ 'nodeDown' ] ) |
| 49 | main.nodeUpSleep = int( main.params[ 'SLEEP' ][ 'nodeUp' ] ) |
| 50 | main.pingallTimeout = int( main.params[ 'TIMEOUT' ][ 'pingall' ] ) |
kelvin-onlab | d9e23de | 2015-08-06 10:34:44 -0700 | [diff] [blame] | 51 | gitPull = main.params[ 'GIT' ][ 'pull' ] |
GlennRC | 632e289 | 2015-10-19 18:58:41 -0700 | [diff] [blame] | 52 | main.homeDir = os.path.expanduser('~') |
kelvin-onlab | d9e23de | 2015-08-06 10:34:44 -0700 | [diff] [blame] | 53 | main.cellData = {} # for creating cell file |
| 54 | main.hostsData = {} |
| 55 | main.CLIs = [] |
| 56 | main.ONOSip = [] |
GlennRC | 632e289 | 2015-10-19 18:58:41 -0700 | [diff] [blame] | 57 | main.activeNodes = [] |
kelvin-onlab | d9e23de | 2015-08-06 10:34:44 -0700 | [diff] [blame] | 58 | main.ONOSip = main.ONOSbench.getOnosIps() |
kelvin-onlab | 1d381fe | 2015-07-14 16:24:56 -0700 | [diff] [blame] | 59 | |
GlennRC | 632e289 | 2015-10-19 18:58:41 -0700 | [diff] [blame] | 60 | except Exception: |
| 61 | main.log.exception( "Exception: constructing test variables" ) |
| 62 | main.cleanup() |
| 63 | main.exit() |
kelvin-onlab | 1d381fe | 2015-07-14 16:24:56 -0700 | [diff] [blame] | 64 | |
GlennRC | 632e289 | 2015-10-19 18:58:41 -0700 | [diff] [blame] | 65 | try: |
| 66 | for i in range(main.numCtrls): |
| 67 | main.CLIs.append( getattr( main, 'ONOScli%s' % (i+1) ) ) |
| 68 | |
| 69 | except Exception: |
| 70 | main.log.exception( "Exception: assinging ONOS cli handles to a list" ) |
| 71 | main.cleanup() |
| 72 | main.exit() |
| 73 | |
| 74 | try: |
kelvin-onlab | d9e23de | 2015-08-06 10:34:44 -0700 | [diff] [blame] | 75 | main.startUp = imp.load_source( wrapperFile1, |
| 76 | main.dependencyPath + |
| 77 | wrapperFile1 + |
| 78 | ".py" ) |
kelvin-onlab | 1d381fe | 2015-07-14 16:24:56 -0700 | [diff] [blame] | 79 | |
kelvin-onlab | d9e23de | 2015-08-06 10:34:44 -0700 | [diff] [blame] | 80 | main.scaleTopoFunction = imp.load_source( wrapperFile2, |
GlennRC | 632e289 | 2015-10-19 18:58:41 -0700 | [diff] [blame] | 81 | main.dependencyPath + |
| 82 | wrapperFile2 + |
| 83 | ".py" ) |
kelvin-onlab | d9e23de | 2015-08-06 10:34:44 -0700 | [diff] [blame] | 84 | |
| 85 | main.topo = imp.load_source( wrapperFile3, |
| 86 | main.dependencyPath + |
| 87 | wrapperFile3 + |
| 88 | ".py" ) |
GlennRC | 632e289 | 2015-10-19 18:58:41 -0700 | [diff] [blame] | 89 | except Exception: |
| 90 | main.log.exception( "Exception: importing wrapper files" ) |
kelvin-onlab | d9e23de | 2015-08-06 10:34:44 -0700 | [diff] [blame] | 91 | main.cleanup() |
| 92 | main.exit() |
kelvin-onlab | 1d381fe | 2015-07-14 16:24:56 -0700 | [diff] [blame] | 93 | |
GlennRC | 632e289 | 2015-10-19 18:58:41 -0700 | [diff] [blame] | 94 | main.ONOSbench.scp( main.Mininet1, |
| 95 | main.dependencyPath + |
| 96 | main.multiovs, |
| 97 | main.Mininet1.home, |
| 98 | direction="to" ) |
| 99 | |
| 100 | if main.CLIs: |
| 101 | stepResult = main.TRUE |
| 102 | else: |
| 103 | main.log.error( "Did not properly created list of " + |
| 104 | "ONOS CLI handle" ) |
| 105 | stepResult = main.FALSE |
| 106 | |
kelvin-onlab | 1d381fe | 2015-07-14 16:24:56 -0700 | [diff] [blame] | 107 | utilities.assert_equals( expect=main.TRUE, |
| 108 | actual=stepResult, |
| 109 | onpass="Successfully construct " + |
| 110 | "test variables ", |
| 111 | onfail="Failed to construct test variables" ) |
| 112 | |
| 113 | if gitPull == 'True': |
| 114 | main.step( "Building ONOS in " + gitBranch + " branch" ) |
| 115 | onosBuildResult = main.startUp.onosBuild( main, gitBranch ) |
| 116 | stepResult = onosBuildResult |
| 117 | utilities.assert_equals( expect=main.TRUE, |
| 118 | actual=stepResult, |
| 119 | onpass="Successfully compiled " + |
| 120 | "latest ONOS", |
| 121 | onfail="Failed to compile " + |
| 122 | "latest ONOS" ) |
| 123 | else: |
| 124 | main.log.warn( "Did not pull new code so skipping mvn " + |
| 125 | "clean install" ) |
| 126 | |
GlennRC | 632e289 | 2015-10-19 18:58:41 -0700 | [diff] [blame] | 127 | |
| 128 | def CASE2( self, main): |
kelvin-onlab | 1d381fe | 2015-07-14 16:24:56 -0700 | [diff] [blame] | 129 | """ |
| 130 | - Set up cell |
| 131 | - Create cell file |
| 132 | - Set cell file |
| 133 | - Verify cell file |
| 134 | - Kill ONOS process |
| 135 | - Uninstall ONOS cluster |
| 136 | - Verify ONOS start up |
| 137 | - Install ONOS cluster |
| 138 | - Connect to cli |
| 139 | """ |
| 140 | |
kelvin-onlab | 1d381fe | 2015-07-14 16:24:56 -0700 | [diff] [blame] | 141 | main.case( "Starting up " + str( main.numCtrls ) + |
| 142 | " node(s) ONOS cluster" ) |
GlennRC | 632e289 | 2015-10-19 18:58:41 -0700 | [diff] [blame] | 143 | main.caseExplanation = "Set up ONOS with " + str( main.numCtrls ) +\ |
| 144 | " node(s) ONOS cluster" |
| 145 | |
| 146 | |
kelvin-onlab | 1d381fe | 2015-07-14 16:24:56 -0700 | [diff] [blame] | 147 | |
| 148 | #kill off all onos processes |
| 149 | main.log.info( "Safety check, killing all ONOS processes" + |
| 150 | " before initiating enviornment setup" ) |
| 151 | |
GlennRC | 632e289 | 2015-10-19 18:58:41 -0700 | [diff] [blame] | 152 | for i in range( main.numCtrls ): |
kelvin-onlab | 1d381fe | 2015-07-14 16:24:56 -0700 | [diff] [blame] | 153 | main.ONOSbench.onosDie( main.ONOSip[ i ] ) |
| 154 | |
kelvin-onlab | 1d381fe | 2015-07-14 16:24:56 -0700 | [diff] [blame] | 155 | tempOnosIp = [] |
| 156 | for i in range( main.numCtrls ): |
| 157 | tempOnosIp.append( main.ONOSip[i] ) |
| 158 | |
| 159 | main.ONOSbench.createCellFile( main.ONOSbench.ip_address, |
| 160 | "temp", main.Mininet1.ip_address, |
GlennRC | 632e289 | 2015-10-19 18:58:41 -0700 | [diff] [blame] | 161 | main.apps, tempOnosIp ) |
kelvin-onlab | 1d381fe | 2015-07-14 16:24:56 -0700 | [diff] [blame] | 162 | |
| 163 | main.step( "Apply cell to environment" ) |
| 164 | cellResult = main.ONOSbench.setCell( "temp" ) |
| 165 | verifyResult = main.ONOSbench.verifyCell() |
| 166 | stepResult = cellResult and verifyResult |
| 167 | utilities.assert_equals( expect=main.TRUE, |
| 168 | actual=stepResult, |
| 169 | onpass="Successfully applied cell to " + \ |
| 170 | "environment", |
| 171 | onfail="Failed to apply cell to environment " ) |
| 172 | |
| 173 | main.step( "Creating ONOS package" ) |
| 174 | packageResult = main.ONOSbench.onosPackage() |
| 175 | stepResult = packageResult |
| 176 | utilities.assert_equals( expect=main.TRUE, |
| 177 | actual=stepResult, |
| 178 | onpass="Successfully created ONOS package", |
| 179 | onfail="Failed to create ONOS package" ) |
| 180 | |
GlennRC | 632e289 | 2015-10-19 18:58:41 -0700 | [diff] [blame] | 181 | time.sleep( main.startUpSleep ) |
| 182 | main.step( "Uninstalling ONOS package" ) |
| 183 | onosUninstallResult = main.TRUE |
| 184 | for ip in main.ONOSip: |
| 185 | onosUninstallResult = onosUninstallResult and \ |
| 186 | main.ONOSbench.onosUninstall( nodeIp=ip ) |
| 187 | stepResult = onosUninstallResult |
| 188 | utilities.assert_equals( expect=main.TRUE, |
| 189 | actual=stepResult, |
| 190 | onpass="Successfully uninstalled ONOS package", |
| 191 | onfail="Failed to uninstall ONOS package" ) |
kelvin-onlab | 1d381fe | 2015-07-14 16:24:56 -0700 | [diff] [blame] | 192 | |
GlennRC | 632e289 | 2015-10-19 18:58:41 -0700 | [diff] [blame] | 193 | time.sleep( main.startUpSleep ) |
| 194 | main.step( "Installing ONOS package" ) |
| 195 | onosInstallResult = main.TRUE |
| 196 | for i in range( main.numCtrls ): |
| 197 | onosInstallResult = onosInstallResult and \ |
| 198 | main.ONOSbench.onosInstall( node=main.ONOSip[ i ] ) |
| 199 | stepResult = onosInstallResult |
| 200 | utilities.assert_equals( expect=main.TRUE, |
| 201 | actual=stepResult, |
| 202 | onpass="Successfully installed ONOS package", |
| 203 | onfail="Failed to install ONOS package" ) |
kelvin-onlab | 1d381fe | 2015-07-14 16:24:56 -0700 | [diff] [blame] | 204 | |
GlennRC | 632e289 | 2015-10-19 18:58:41 -0700 | [diff] [blame] | 205 | time.sleep( main.startUpSleep ) |
| 206 | main.step( "Starting ONOS service" ) |
| 207 | stopResult = main.TRUE |
| 208 | startResult = main.TRUE |
| 209 | onosIsUp = main.TRUE |
| 210 | |
| 211 | for i in range( main.numCtrls ): |
| 212 | onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] ) |
| 213 | if onosIsUp == main.TRUE: |
| 214 | main.log.report( "ONOS instance is up and ready" ) |
| 215 | else: |
| 216 | main.log.report( "ONOS instance may not be up, stop and " + |
| 217 | "start ONOS again " ) |
| 218 | |
| 219 | for i in range( main.numCtrls ): |
| 220 | stopResult = stopResult and \ |
| 221 | main.ONOSbench.onosStop( main.ONOSip[ i ] ) |
| 222 | for i in range( main.numCtrls ): |
| 223 | startResult = startResult and \ |
| 224 | main.ONOSbench.onosStart( main.ONOSip[ i ] ) |
| 225 | stepResult = onosIsUp and stopResult and startResult |
| 226 | utilities.assert_equals( expect=main.TRUE, |
| 227 | actual=stepResult, |
| 228 | onpass="ONOS service is ready", |
| 229 | onfail="ONOS service did not start properly" ) |
| 230 | |
| 231 | main.step( "Start ONOS cli" ) |
| 232 | cliResult = main.TRUE |
| 233 | for i in range( main.numCtrls ): |
| 234 | cliResult = cliResult and \ |
| 235 | main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] ) |
| 236 | main.activeNodes.append( i ) |
| 237 | stepResult = cliResult |
| 238 | utilities.assert_equals( expect=main.TRUE, |
| 239 | actual=stepResult, |
| 240 | onpass="Successfully start ONOS cli", |
| 241 | onfail="Failed to start ONOS cli" ) |
| 242 | |
| 243 | |
| 244 | def CASE10( self, main ): |
| 245 | """ |
| 246 | Starting up torus topology |
| 247 | """ |
| 248 | main.case( "Starting up torus topology" ) |
| 249 | main.step( "Starting up torus topology" ) |
| 250 | |
| 251 | main.log.info( "Checking if mininet is already running" ) |
| 252 | if len( main.topoScale ) < main.topoScaleSize: |
| 253 | main.log.info( "Mininet is already running. Stopping mininet." ) |
| 254 | main.Mininet1.stopNet() |
| 255 | time.sleep(5) |
| 256 | else: |
| 257 | main.log.info( "Mininet was not running" ) |
| 258 | |
| 259 | try: |
| 260 | scale = main.topoScale.pop(0) |
| 261 | except Exception: |
| 262 | main.log.exception("Exception: popping from list of topology scales ") |
| 263 | main.cleanup() |
| 264 | main.exit() |
| 265 | |
| 266 | mnCmd = " mn --custom=" + main.homeDir + "/mininet/custom/multiovs.py " +\ |
| 267 | "--switch=ovsm --topo " + main.topoName + ","+ scale + "," + scale +\ |
| 268 | " --controller=remote,ip=" + main.ONOSip[ 0 ] +\ |
| 269 | " --controller=remote,ip=" + main.ONOSip[ 1 ] +\ |
| 270 | " --controller=remote,ip=" + main.ONOSip[ 2 ] + " --mac" |
| 271 | stepResult = main.Mininet1.startNet(mnCmd=mnCmd) |
| 272 | utilities.assert_equals( expect=main.TRUE, |
| 273 | actual=stepResult, |
| 274 | onpass=main.topoName + |
| 275 | " topology started successfully", |
| 276 | onfail=main.topoName + |
| 277 | " topology failed to start" ) |
| 278 | |
| 279 | |
| 280 | def CASE11( self, main ): |
| 281 | ''' |
| 282 | Pingall |
| 283 | ''' |
| 284 | main.case( "Pingall" ) |
| 285 | main.step( "Pingall" ) |
GlennRC | 708a960 | 2015-10-20 18:13:13 -0700 | [diff] [blame] | 286 | pingResult = main.Mininet1.pingall( timeout=main.pingallTimeout ) |
GlennRC | 632e289 | 2015-10-19 18:58:41 -0700 | [diff] [blame] | 287 | if not pingResult: |
| 288 | main.log.warn( "First pingall failed. Retrying..." ) |
| 289 | time.sleep(3) |
| 290 | pingResult = main.Mininet1.pingall( timeout=main.pingallTimeout ) |
| 291 | |
| 292 | utilities.assert_equals( expect=main.TRUE, |
| 293 | actual=pingResult, |
| 294 | onpass="Pingall successfull", |
| 295 | onfail="Pingall failed" ) |
| 296 | |
| 297 | |
| 298 | def CASE12( self, main ): |
kelvin-onlab | d9e23de | 2015-08-06 10:34:44 -0700 | [diff] [blame] | 299 | """ |
| 300 | Compare Topo |
| 301 | """ |
| 302 | import json |
| 303 | |
| 304 | main.case( "Compare ONOS Topology view to Mininet topology" ) |
| 305 | main.caseExplanation = "Compare topology elements between Mininet" +\ |
| 306 | " and ONOS" |
| 307 | |
| 308 | main.step( "Gathering topology information" ) |
kelvin-onlab | d9e23de | 2015-08-06 10:34:44 -0700 | [diff] [blame] | 309 | devicesResults = main.TRUE |
| 310 | linksResults = main.TRUE |
| 311 | hostsResults = main.TRUE |
GlennRC | 632e289 | 2015-10-19 18:58:41 -0700 | [diff] [blame] | 312 | |
kelvin-onlab | d9e23de | 2015-08-06 10:34:44 -0700 | [diff] [blame] | 313 | devices = main.topo.getAllDevices( main ) |
| 314 | hosts = main.topo.getAllHosts( main ) |
| 315 | ports = main.topo.getAllPorts( main ) |
| 316 | links = main.topo.getAllLinks( main ) |
| 317 | clusters = main.topo.getAllClusters( main ) |
| 318 | |
| 319 | mnSwitches = main.Mininet1.getSwitches() |
| 320 | mnLinks = main.Mininet1.getLinks() |
| 321 | mnHosts = main.Mininet1.getHosts() |
| 322 | |
GlennRC | 632e289 | 2015-10-19 18:58:41 -0700 | [diff] [blame] | 323 | main.step( "Comparing MN topology to ONOS topology" ) |
| 324 | |
| 325 | for controller in range(len(main.activeNodes)): |
| 326 | controllerStr = str( main.activeNodes[controller] + 1 ) |
kelvin-onlab | d9e23de | 2015-08-06 10:34:44 -0700 | [diff] [blame] | 327 | if devices[ controller ] and ports[ controller ] and\ |
| 328 | "Error" not in devices[ controller ] and\ |
| 329 | "Error" not in ports[ controller ]: |
| 330 | |
| 331 | currentDevicesResult = main.Mininet1.compareSwitches( |
| 332 | mnSwitches, |
| 333 | json.loads( devices[ controller ] ), |
| 334 | json.loads( ports[ controller ] ) ) |
| 335 | else: |
| 336 | currentDevicesResult = main.FALSE |
| 337 | utilities.assert_equals( expect=main.TRUE, |
| 338 | actual=currentDevicesResult, |
| 339 | onpass="ONOS" + controllerStr + |
| 340 | " Switches view is correct", |
| 341 | onfail="ONOS" + controllerStr + |
| 342 | " Switches view is incorrect" ) |
| 343 | |
| 344 | if links[ controller ] and "Error" not in links[ controller ]: |
| 345 | currentLinksResult = main.Mininet1.compareLinks( |
| 346 | mnSwitches, mnLinks, |
| 347 | json.loads( links[ controller ] ) ) |
| 348 | else: |
| 349 | currentLinksResult = main.FALSE |
| 350 | utilities.assert_equals( expect=main.TRUE, |
| 351 | actual=currentLinksResult, |
| 352 | onpass="ONOS" + controllerStr + |
| 353 | " links view is correct", |
| 354 | onfail="ONOS" + controllerStr + |
| 355 | " links view is incorrect" ) |
| 356 | |
| 357 | if hosts[ controller ] or "Error" not in hosts[ controller ]: |
| 358 | currentHostsResult = main.Mininet1.compareHosts( |
| 359 | mnHosts, |
| 360 | json.loads( hosts[ controller ] ) ) |
| 361 | else: |
| 362 | currentHostsResult = main.FALSE |
GlennRC | 632e289 | 2015-10-19 18:58:41 -0700 | [diff] [blame] | 363 | utilities.assert_equals( expect=main.TRUE, |
| 364 | actual=currentHostsResult, |
| 365 | onpass="ONOS" + controllerStr + |
| 366 | " hosts exist in Mininet", |
| 367 | onfail="ONOS" + controllerStr + |
| 368 | " hosts don't match Mininet" ) |
kelvin-onlab | d9e23de | 2015-08-06 10:34:44 -0700 | [diff] [blame] | 369 | |
GlennRC | 632e289 | 2015-10-19 18:58:41 -0700 | [diff] [blame] | 370 | def CASE100( self, main ): |
| 371 | ''' |
| 372 | Balance master |
| 373 | ''' |
| 374 | main.case("Balancing Masters") |
| 375 | main.step("Balancing Masters") |
| 376 | try: |
| 377 | controller = main.activeNodes[0] |
| 378 | stepResult = main.CLIs[controller].balanceMasters() |
| 379 | except Exception: |
| 380 | main.log.exception("Exception: balancing masters") |
| 381 | main.cleanup() |
| 382 | main.exit() |
| 383 | utilities.assert_equals( expect=main.TRUE, |
| 384 | actual=stepResult, |
| 385 | onpass="Balance masters was successfull", |
| 386 | onfail="Failed to balance masters") |
| 387 | |
| 388 | time.sleep(main.balanceSleep) |
| 389 | |
| 390 | |
| 391 | def CASE200( self, main ): |
| 392 | ''' |
GlennRC | ed2122e | 2015-10-21 14:38:46 -0700 | [diff] [blame] | 393 | Bring third node down |
GlennRC | 632e289 | 2015-10-19 18:58:41 -0700 | [diff] [blame] | 394 | ''' |
GlennRC | ed2122e | 2015-10-21 14:38:46 -0700 | [diff] [blame] | 395 | main.case( "Stopping an ONOS service" ) |
| 396 | main.step( "Bringing down node 3" ) |
GlennRC | 632e289 | 2015-10-19 18:58:41 -0700 | [diff] [blame] | 397 | |
GlennRC | ed2122e | 2015-10-21 14:38:46 -0700 | [diff] [blame] | 398 | # Always bring down the third node |
| 399 | main.deadNode = 2 |
GlennRC | 632e289 | 2015-10-19 18:58:41 -0700 | [diff] [blame] | 400 | |
GlennRC | ed2122e | 2015-10-21 14:38:46 -0700 | [diff] [blame] | 401 | # Printing purposes |
GlennRC | 632e289 | 2015-10-19 18:58:41 -0700 | [diff] [blame] | 402 | node = main.deadNode + 1 |
| 403 | |
| 404 | main.log.info( "deadnode: %s" % node ) |
| 405 | |
| 406 | main.log.info( "Stopping node %s" % node ) |
| 407 | startResult = main.ONOSbench.onosStop( main.ONOSip[ main.deadNode ] ) |
| 408 | |
| 409 | try: |
| 410 | main.activeNodes.pop( main.deadNode ) |
| 411 | except Exception: |
| 412 | main.log.exception( "Exception: popping from list of active nodes" ) |
| 413 | main.cleanup() |
| 414 | main.exit() |
| 415 | |
| 416 | utilities.assert_equals( expect=main.TRUE, |
| 417 | actual=stepResult, |
| 418 | onpass="Successfully brought down onos node %s" % node, |
| 419 | onfail="Failed to bring down onos node %s" % node ) |
| 420 | |
| 421 | time.sleep(main.nodeDownSleep) |
| 422 | |
| 423 | |
| 424 | def CASE300( self, main ): |
| 425 | ''' |
| 426 | Bring up onos node |
| 427 | ''' |
| 428 | main.case( "Bring the dead ONOS node back up" ) |
| 429 | main.step( "Bringing up an onos node" ) |
| 430 | |
| 431 | node = main.deadNode + 1 |
| 432 | |
| 433 | main.log.info( "Starting node %s" % node ) |
| 434 | startResult = main.ONOSbench.onosStart( main.ONOSip[ main.deadNode ] ) |
| 435 | |
| 436 | main.log.info( "Starting onos cli" ) |
| 437 | startCliResult = main.CLIs[ main.deadNode ].startOnosCli( main.ONOSip[ main.deadNode ] ) |
| 438 | |
| 439 | main.activeNodes.append( main.deadNode ) |
| 440 | |
| 441 | stepResult = startResult and startCliResult |
| 442 | |
| 443 | utilities.assert_equals( expect=main.TRUE, |
| 444 | actual=stepResult, |
| 445 | onpass="Successfully brought up onos node %s" % node, |
| 446 | onfail="Failed to bring up onos node %s" % node ) |
| 447 | |
| 448 | |
| 449 | time.sleep(main.nodeUpSleep) |
| 450 | |
| 451 | def CASE1000( self, main ): |
kelvin-onlab | 1d381fe | 2015-07-14 16:24:56 -0700 | [diff] [blame] | 452 | ''' |
| 453 | Report errors/warnings/exceptions |
| 454 | ''' |
| 455 | main.log.info("Error report: \n" ) |
| 456 | main.ONOSbench.logReport( main.ONOSip[ 0 ], |
| 457 | [ "INFO", |
| 458 | "FOLLOWER", |
| 459 | "WARN", |
| 460 | "flow", |
| 461 | "ERROR", |
| 462 | "Except" ], |
| 463 | "s" ) |