pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 1 | # Testing the functionality of SDN-IP with single ONOS instance |
| 2 | class USECASE_SdnipFunctionCluster: |
| 3 | |
| 4 | def __init__( self ): |
| 5 | self.default = '' |
| 6 | global branchName |
| 7 | |
| 8 | def CASE100( self, main ): |
| 9 | """ |
| 10 | Start mininet |
| 11 | """ |
| 12 | import imp |
| 13 | main.log.case( "Setup the Mininet testbed" ) |
| 14 | main.dependencyPath = main.testDir + \ |
| 15 | main.params[ 'DEPENDENCY' ][ 'path' ] |
| 16 | main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ] |
| 17 | |
| 18 | main.step( "Starting Mininet Topology" ) |
| 19 | topology = main.dependencyPath + main.topology |
| 20 | topoResult = main.Mininet.startNet( topoFile = topology ) |
| 21 | utilities.assert_equals( expect = main.TRUE, |
| 22 | actual = topoResult, |
| 23 | onpass = "Successfully loaded topology", |
| 24 | onfail = "Failed to load topology" ) |
| 25 | # Exit if topology did not load properly |
| 26 | if not topoResult: |
| 27 | main.cleanup() |
| 28 | main.exit() |
| 29 | main.step( "Connect switches to controllers" ) |
| 30 | |
| 31 | # connect all switches to controllers |
| 32 | swResult = main.TRUE |
| 33 | for i in range ( 1, int( main.params['config']['switchNum'] ) + 1 ): |
| 34 | sw = "sw%s" % ( i ) |
| 35 | swResult = swResult and main.Mininet.assignSwController( sw, |
| 36 | [ONOS1Ip, ONOS2Ip, ONOS3Ip] ) |
| 37 | |
| 38 | utilities.assert_equals( expect = main.TRUE, |
| 39 | actual = swResult, |
| 40 | onpass = "Successfully connect all switches to ONOS", |
| 41 | onfail = "Failed to connect all switches to ONOS" ) |
| 42 | if not swResult: |
| 43 | main.cleanup() |
| 44 | main.exit() |
| 45 | |
| 46 | |
| 47 | def CASE101( self, main ): |
| 48 | """ |
| 49 | Package ONOS and install it |
| 50 | Startup sequence: |
| 51 | cell <name> |
| 52 | onos-verify-cell |
| 53 | onos-package |
| 54 | onos-install -f |
| 55 | onos-wait-for-start |
| 56 | """ |
| 57 | import json |
| 58 | import time |
| 59 | import os |
| 60 | from operator import eq |
| 61 | |
| 62 | main.case( "Setting up ONOS environment" ) |
| 63 | |
| 64 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 65 | global ONOS1Ip |
| 66 | global ONOS2Ip |
| 67 | global ONOS3Ip |
| 68 | ONOS1Ip = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] ) |
| 69 | ONOS2Ip = os.getenv( main.params[ 'CTRL' ][ 'ip2' ] ) |
| 70 | ONOS3Ip = os.getenv( main.params[ 'CTRL' ][ 'ip3' ] ) |
| 71 | |
| 72 | global peer64514 |
| 73 | global peer64515 |
| 74 | global peer64516 |
| 75 | peer64514 = main.params['config']['peer64514'] |
| 76 | peer64515 = main.params['config']['peer64515'] |
| 77 | peer64516 = main.params['config']['peer64516'] |
| 78 | |
| 79 | main.step( "Applying cell variable to environment" ) |
| 80 | cellResult = main.ONOSbench.setCell( cellName ) |
| 81 | utilities.assert_equals( expect = main.TRUE, |
| 82 | actual = cellResult, |
| 83 | onpass = "Set cell succeeded", |
| 84 | onfail = "Set cell failed" ) |
| 85 | |
| 86 | verifyResult = main.ONOSbench.verifyCell() |
| 87 | utilities.assert_equals( expect = main.TRUE, |
| 88 | actual = verifyResult, |
| 89 | onpass = "Verify cell succeeded", |
| 90 | onfail = "Verify cell failed" ) |
| 91 | |
| 92 | branchName = main.ONOSbench.getBranchName() |
| 93 | main.log.report( "ONOS is on branch: " + branchName ) |
| 94 | |
| 95 | main.log.step( "Uninstalling ONOS" ) |
| 96 | uninstallResult = main.ONOSbench.onosUninstall( ONOS1Ip ) \ |
| 97 | and main.ONOSbench.onosUninstall( ONOS2Ip ) \ |
| 98 | and main.ONOSbench.onosUninstall( ONOS3Ip ) |
| 99 | utilities.assert_equals( expect = main.TRUE, |
| 100 | actual = uninstallResult, |
| 101 | onpass = "Uninstall ONOS from nodes succeeded", |
| 102 | onfail = "Uninstall ONOS form nodes failed" ) |
| 103 | |
| 104 | main.ONOSbench.getVersion( report = True ) |
| 105 | |
| 106 | main.step( "Creating ONOS package" ) |
| 107 | packageResult = main.ONOSbench.onosPackage( opTimeout = 500 ) |
| 108 | utilities.assert_equals( expect = main.TRUE, |
| 109 | actual = packageResult, |
| 110 | onpass = "Package ONOS succeeded", |
| 111 | onfail = "Package ONOS failed" ) |
| 112 | |
| 113 | main.step( "Installing ONOS package" ) |
| 114 | onos1InstallResult = main.ONOSbench.onosInstall( options = "-f", |
| 115 | node = ONOS1Ip ) |
| 116 | onos2InstallResult = main.ONOSbench.onosInstall( options = "-f", |
| 117 | node = ONOS2Ip ) |
| 118 | onos3InstallResult = main.ONOSbench.onosInstall( options = "-f", |
| 119 | node = ONOS3Ip ) |
| 120 | onosInstallResult = onos1InstallResult and onos2InstallResult \ |
| 121 | and onos3InstallResult |
| 122 | utilities.assert_equals( expect = main.TRUE, |
| 123 | actual = onosInstallResult, |
| 124 | onpass = "Install ONOS to nodes succeeded", |
| 125 | onfail = "Install ONOS to nodes failed" ) |
| 126 | |
| 127 | main.step( "Checking if ONOS is up yet" ) |
| 128 | onos1UpResult = main.ONOSbench.isup( ONOS1Ip, timeout = 420 ) |
| 129 | onos2UpResult = main.ONOSbench.isup( ONOS2Ip, timeout = 420 ) |
| 130 | onos3UpResult = main.ONOSbench.isup( ONOS3Ip, timeout = 420 ) |
| 131 | onosUpResult = onos1UpResult and onos2UpResult and onos3UpResult |
| 132 | utilities.assert_equals( expect = main.TRUE, |
| 133 | actual = onos1UpResult and onosUpResult, |
| 134 | onpass = "ONOS nodes are up", |
| 135 | onfail = "ONOS nodes are NOT up" ) |
| 136 | |
| 137 | main.step( "Checking if ONOS CLI is ready" ) |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 138 | cliResult1 = main.ONOScli1.startOnosCli( ONOS1Ip, |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 139 | commandlineTimeout = 100, onosStartTimeout = 600 ) |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 140 | cliResult2 = main.ONOScli2.startOnosCli( ONOS2Ip, |
| 141 | commandlineTimeout = 100, onosStartTimeout = 600 ) |
| 142 | cliResult = cliResult1 and cliResult2 |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 143 | utilities.assert_equals( expect = main.TRUE, |
| 144 | actual = cliResult, |
| 145 | onpass = "ONOS CLI (on node1) is ready", |
| 146 | onfail = "ONOS CLI (on node1) ready" ) |
| 147 | |
| 148 | caseResult = ( cellResult and verifyResult and |
| 149 | packageResult and |
| 150 | onosInstallResult and onosUpResult and cliResult ) |
| 151 | |
| 152 | utilities.assert_equals( expect = main.TRUE, actual = caseResult, |
| 153 | onpass = "ONOS startup successful", |
| 154 | onfail = "ONOS startup NOT successful" ) |
| 155 | |
| 156 | if caseResult == main.FALSE: |
| 157 | main.log.error( "ONOS startup failed!" ) |
| 158 | main.cleanup() |
| 159 | main.exit() |
| 160 | |
| 161 | |
| 162 | def CASE200( self, main ): |
| 163 | main.case( "Activate sdn-ip application" ) |
| 164 | main.log.info( "waiting link discovery......" ) |
| 165 | time.sleep( int ( main.params['timers']['TopoDiscovery'] ) ) |
| 166 | |
| 167 | main.log.info( "Get links in the network" ) |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 168 | summaryResult = main.ONOScli1.summary() |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 169 | linkNum = json.loads( summaryResult )[ "links" ] |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 170 | listResult = main.ONOScli1.links( jsonFormat = False ) |
| 171 | main.log.info( listResult ) |
| 172 | |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 173 | if linkNum < 100: |
| 174 | main.log.error( "Link number is wrong!" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 175 | main.cleanup() |
| 176 | main.exit() |
| 177 | |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 178 | main.step( "Activate sdn-ip application" ) |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 179 | activeSDNIPresult = main.ONOScli1.activateApp( "org.onosproject.sdnip" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 180 | utilities.assert_equals( expect = main.TRUE, |
| 181 | actual = activeSDNIPresult, |
| 182 | onpass = "Activate SDN-IP succeeded", |
| 183 | onfail = "Activate SDN-IP failed" ) |
| 184 | if not activeSDNIPresult: |
| 185 | main.cleanup() |
| 186 | main.exit() |
| 187 | |
| 188 | # TODO should be deleted in the future after the SDN-IP bug is fixed |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 189 | main.ONOScli1.deactivateApp( "org.onosproject.sdnip" ) |
| 190 | main.ONOScli1.activateApp( "org.onosproject.sdnip" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 191 | |
| 192 | |
| 193 | def CASE102( self, main ): |
| 194 | ''' |
| 195 | This test case is to load the methods from other Python files, and create |
| 196 | tunnels from mininet host to onos nodes. |
| 197 | ''' |
| 198 | import time |
| 199 | main.case( "Load methods from other Python file and create tunnels" ) |
| 200 | # load the methods from other file |
| 201 | wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ] |
| 202 | main.Functions = imp.load_source( wrapperFile1, |
| 203 | main.dependencyPath + |
| 204 | wrapperFile1 + |
| 205 | ".py" ) |
| 206 | # Create tunnels |
| 207 | main.Functions.setupTunnel( main, '1.1.1.2', 2000, ONOS1Ip, 2000 ) |
| 208 | main.Functions.setupTunnel( main, '1.1.1.4', 2000, ONOS2Ip, 2000 ) |
| 209 | main.Functions.setupTunnel( main, '1.1.1.6', 2000, ONOS3Ip, 2000 ) |
| 210 | |
| 211 | main.log.info( "Wait SDN-IP to finish installing connectivity intents \ |
| 212 | and the BGP paths in data plane are ready..." ) |
| 213 | time.sleep( int( main.params[ 'timers' ][ 'SdnIpSetup' ] ) ) |
| 214 | |
| 215 | main.log.info( "Wait Quagga to finish delivery all routes to each \ |
| 216 | other and to sdn-ip, plus finish installing all intents..." ) |
| 217 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 218 | # TODO |
| 219 | # time.sleep( int( main.params[ 'timers' ][ 'PathAvailable' ] ) ) |
| 220 | |
| 221 | ''' |
| 222 | # TODO: use for together with wrapperFile1 |
| 223 | wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ] |
| 224 | main.USECASE_SdnipI2MN_Cluster = imp.load_source( wrapperFile2, |
| 225 | main.dependencyPath + |
| 226 | wrapperFile2 + |
| 227 | ".py" ) |
| 228 | ''' |
| 229 | |
| 230 | |
| 231 | def CASE1( self, main ): |
| 232 | ''' |
| 233 | ping test from 3 bgp peers to BGP speaker |
| 234 | ''' |
| 235 | |
| 236 | main.case( "Ping tests between BGP peers and speakers" ) |
| 237 | main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"], |
| 238 | peers = ["peer64514", "peer64515", "peer64516"], |
| 239 | expectAllSuccess = True ) |
| 240 | main.Functions.pingSpeakerToPeer( main, speakers = ["speaker2"], |
| 241 | peers = [peer64514, peer64515, peer64516], |
| 242 | expectAllSuccess = True ) |
| 243 | |
| 244 | |
| 245 | def CASE2( self, main ): |
| 246 | ''' |
| 247 | point-to-point intents test for each BGP peer and BGP speaker pair |
| 248 | ''' |
| 249 | main.case( "Check point-to-point intents" ) |
| 250 | main.log.info( "There are %s BGP peers in total " |
| 251 | % main.params[ 'config' ][ 'peerNum' ] ) |
| 252 | main.step( "Check P2P intents number from ONOS CLI" ) |
| 253 | |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 254 | getIntentsResult = main.ONOScli1.intents( jsonFormat = True ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 255 | bgpIntentsActualNum = \ |
| 256 | main.QuaggaCliSpeaker1.extractActualBgpIntentNum( getIntentsResult ) |
| 257 | bgpIntentsExpectedNum = int( main.params[ 'config' ][ 'peerNum' ] ) * 6 * 2 |
| 258 | main.log.info( "bgpIntentsExpected num is:" ) |
| 259 | main.log.info( bgpIntentsExpectedNum ) |
| 260 | main.log.info( "bgpIntentsActual num is:" ) |
| 261 | main.log.info( bgpIntentsActualNum ) |
| 262 | utilities.assertEquals( \ |
| 263 | expect = True, |
| 264 | actual = eq( bgpIntentsExpectedNum, bgpIntentsActualNum ), |
| 265 | onpass = "PointToPointIntent Intent Num is correct!", |
| 266 | onfail = "PointToPointIntent Intent Num is wrong!" ) |
| 267 | |
| 268 | |
| 269 | def CASE3( self, main ): |
| 270 | ''' |
| 271 | routes and intents check to all BGP peers |
| 272 | ''' |
| 273 | main.case( "Check routes and M2S intents to all BGP peers" ) |
| 274 | |
| 275 | allRoutesExpected = [] |
| 276 | allRoutesExpected.append( "4.0.0.0/24" + "/" + "10.0.4.1" ) |
| 277 | allRoutesExpected.append( "5.0.0.0/24" + "/" + "10.0.5.1" ) |
| 278 | allRoutesExpected.append( "6.0.0.0/24" + "/" + "10.0.6.1" ) |
| 279 | |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 280 | getRoutesResult = main.ONOScli1.routes( jsonFormat = True ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 281 | allRoutesActual = \ |
| 282 | main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult ) |
| 283 | allRoutesStrExpected = str( sorted( allRoutesExpected ) ) |
| 284 | allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" ) |
| 285 | |
| 286 | main.step( "Check routes installed" ) |
| 287 | main.log.info( "Routes expected:" ) |
| 288 | main.log.info( allRoutesStrExpected ) |
| 289 | main.log.info( "Routes get from ONOS CLI:" ) |
| 290 | main.log.info( allRoutesStrActual ) |
| 291 | utilities.assertEquals( \ |
| 292 | expect = allRoutesStrExpected, actual = allRoutesStrActual, |
| 293 | onpass = "Routes are correct!", |
| 294 | onfail = "Routes are wrong!" ) |
| 295 | |
| 296 | main.step( "Check M2S intents installed" ) |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 297 | getIntentsResult = main.ONOScli1.intents( jsonFormat = True ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 298 | routeIntentsActualNum = \ |
| 299 | main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult ) |
| 300 | routeIntentsExpectedNum = 3 |
| 301 | |
| 302 | main.log.info( "MultiPointToSinglePoint Intent Num expected is:" ) |
| 303 | main.log.info( routeIntentsExpectedNum ) |
| 304 | main.log.info( "MultiPointToSinglePoint Intent NUM Actual is:" ) |
| 305 | main.log.info( routeIntentsActualNum ) |
| 306 | utilities.assertEquals( \ |
| 307 | expect = True, |
| 308 | actual = eq( routeIntentsExpectedNum, routeIntentsActualNum ), |
| 309 | onpass = "MultiPointToSinglePoint Intent Num is correct!", |
| 310 | onfail = "MultiPointToSinglePoint Intent Num is wrong!" ) |
| 311 | |
| 312 | main.step( "Check whether all flow status are ADDED" ) |
| 313 | utilities.assertEquals( \ |
| 314 | expect = main.TRUE, |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 315 | actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ), |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 316 | onpass = "Flow status is correct!", |
| 317 | onfail = "Flow status is wrong!" ) |
| 318 | |
| 319 | |
| 320 | def CASE4( self, main ): |
| 321 | ''' |
| 322 | Ping test in data plane for each route |
| 323 | ''' |
| 324 | main.case( "Ping test for each route, all hosts behind BGP peers" ) |
| 325 | main.Functions.pingHostToHost( main, |
| 326 | hosts = ["host64514", "host64515", "host64516"], |
| 327 | expectAllSuccess = True ) |
| 328 | |
| 329 | |
| 330 | def CASE5( self, main ): |
| 331 | ''' |
| 332 | Cut links to peers one by one, check routes/intents |
| 333 | ''' |
| 334 | import time |
| 335 | main.case( "Bring down links and check routes/intents" ) |
| 336 | main.step( "Bring down the link between sw32 and peer64514" ) |
| 337 | linkResult1 = main.Mininet.link( END1 = "sw32", END2 = "peer64514", |
| 338 | OPTION = "down" ) |
| 339 | utilities.assertEquals( expect = main.TRUE, |
| 340 | actual = linkResult1, |
| 341 | onpass = "Bring down link succeeded!", |
| 342 | onfail = "Bring down link failed!" ) |
| 343 | |
| 344 | if linkResult1 == main.TRUE: |
| 345 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 346 | main.Functions.checkRouteNum( main, 2 ) |
| 347 | main.Functions.checkM2SintentNum( main, 2 ) |
| 348 | else: |
| 349 | main.log.error( "Bring down link failed!" ) |
| 350 | main.cleanup() |
| 351 | main.exit() |
| 352 | |
| 353 | main.step( "Bring down the link between sw8 and peer64515" ) |
| 354 | linkResult2 = main.Mininet.link( END1 = "sw8", END2 = "peer64515", |
| 355 | OPTION = "down" ) |
| 356 | utilities.assertEquals( expect = main.TRUE, |
| 357 | actual = linkResult2, |
| 358 | onpass = "Bring down link succeeded!", |
| 359 | onfail = "Bring down link failed!" ) |
| 360 | if linkResult2 == main.TRUE: |
| 361 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 362 | main.Functions.checkRouteNum( main, 1 ) |
| 363 | main.Functions.checkM2SintentNum( main, 1 ) |
| 364 | else: |
| 365 | main.log.error( "Bring down link failed!" ) |
| 366 | main.cleanup() |
| 367 | main.exit() |
| 368 | |
| 369 | main.step( "Bring down the link between sw28 and peer64516" ) |
| 370 | linkResult3 = main.Mininet.link( END1 = "sw28", END2 = "peer64516", |
| 371 | OPTION = "down" ) |
| 372 | utilities.assertEquals( expect = main.TRUE, |
| 373 | actual = linkResult3, |
| 374 | onpass = "Bring down link succeeded!", |
| 375 | onfail = "Bring down link failed!" ) |
| 376 | if linkResult3 == main.TRUE: |
| 377 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 378 | main.Functions.checkRouteNum( main, 0 ) |
| 379 | main.Functions.checkM2SintentNum( main, 0 ) |
| 380 | else: |
| 381 | main.log.error( "Bring down link failed!" ) |
| 382 | main.cleanup() |
| 383 | main.exit() |
| 384 | |
| 385 | main.step( "Check whether all flow status are ADDED" ) |
| 386 | utilities.assertEquals( \ |
| 387 | expect = main.TRUE, |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 388 | actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ), |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 389 | onpass = "Flow status is correct!", |
| 390 | onfail = "Flow status is wrong!" ) |
| 391 | |
| 392 | # Ping test |
| 393 | main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"], |
| 394 | peers = ["peer64514", "peer64515", "peer64516"], |
| 395 | expectAllSuccess = False ) |
| 396 | main.Functions.pingHostToHost( main, |
| 397 | hosts = ["host64514", "host64515", "host64516"], |
| 398 | expectAllSuccess = False ) |
| 399 | |
| 400 | |
| 401 | def CASE6( self, main ): |
| 402 | ''' |
| 403 | Recover links to peers one by one, check routes/intents |
| 404 | ''' |
| 405 | import time |
| 406 | main.case( "Bring up links and check routes/intents" ) |
| 407 | main.step( "Bring up the link between sw32 and peer64514" ) |
| 408 | linkResult1 = main.Mininet.link( END1 = "sw32", END2 = "peer64514", |
| 409 | OPTION = "up" ) |
| 410 | utilities.assertEquals( expect = main.TRUE, |
| 411 | actual = linkResult1, |
| 412 | onpass = "Bring up link succeeded!", |
| 413 | onfail = "Bring up link failed!" ) |
| 414 | if linkResult1 == main.TRUE: |
| 415 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 416 | main.Functions.checkRouteNum( main, 1 ) |
| 417 | main.Functions.checkM2SintentNum( main, 1 ) |
| 418 | else: |
| 419 | main.log.error( "Bring up link failed!" ) |
| 420 | main.cleanup() |
| 421 | main.exit() |
| 422 | |
| 423 | main.step( "Bring up the link between sw8 and peer64515" ) |
| 424 | linkResult2 = main.Mininet.link( END1 = "sw8", END2 = "peer64515", |
| 425 | OPTION = "up" ) |
| 426 | utilities.assertEquals( expect = main.TRUE, |
| 427 | actual = linkResult2, |
| 428 | onpass = "Bring up link succeeded!", |
| 429 | onfail = "Bring up link failed!" ) |
| 430 | if linkResult2 == main.TRUE: |
| 431 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 432 | main.Functions.checkRouteNum( main, 2 ) |
| 433 | main.Functions.checkM2SintentNum( main, 2 ) |
| 434 | else: |
| 435 | main.log.error( "Bring up link failed!" ) |
| 436 | main.cleanup() |
| 437 | main.exit() |
| 438 | |
| 439 | main.step( "Bring up the link between sw28 and peer64516" ) |
| 440 | linkResult3 = main.Mininet.link( END1 = "sw28", END2 = "peer64516", |
| 441 | OPTION = "up" ) |
| 442 | utilities.assertEquals( expect = main.TRUE, |
| 443 | actual = linkResult3, |
| 444 | onpass = "Bring up link succeeded!", |
| 445 | onfail = "Bring up link failed!" ) |
| 446 | if linkResult3 == main.TRUE: |
| 447 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 448 | main.Functions.checkRouteNum( main, 3 ) |
| 449 | main.Functions.checkM2SintentNum( main, 3 ) |
| 450 | else: |
| 451 | main.log.error( "Bring up link failed!" ) |
| 452 | main.cleanup() |
| 453 | main.exit() |
| 454 | |
| 455 | main.step( "Check whether all flow status are ADDED" ) |
| 456 | utilities.assertEquals( \ |
| 457 | expect = main.TRUE, |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 458 | actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ), |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 459 | onpass = "Flow status is correct!", |
| 460 | onfail = "Flow status is wrong!" ) |
| 461 | |
| 462 | # Ping test |
| 463 | main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"], |
| 464 | peers = ["peer64514", "peer64515", "peer64516"], |
| 465 | expectAllSuccess = True ) |
| 466 | main.Functions.pingHostToHost( main, |
| 467 | hosts = ["host64514", "host64515", "host64516"], |
| 468 | expectAllSuccess = True ) |
| 469 | |
| 470 | |
| 471 | def CASE7( self, main ): |
| 472 | ''' |
| 473 | Shut down a edge switch, check P-2-P and M-2-S intents, ping test |
| 474 | ''' |
| 475 | import time |
| 476 | main.case( "Stop edge sw32,check P-2-P and M-2-S intents, ping test" ) |
| 477 | main.step( "Stop sw32" ) |
| 478 | result = main.Mininet.switch( SW = "sw32", OPTION = "stop" ) |
| 479 | utilities.assertEquals( expect = main.TRUE, actual = result, |
| 480 | onpass = "Stopping switch succeeded!", |
| 481 | onfail = "Stopping switch failed!" ) |
| 482 | |
| 483 | if result == main.TRUE: |
| 484 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 485 | main.Functions.checkRouteNum( main, 2 ) |
| 486 | main.Functions.checkM2SintentNum( main, 2 ) |
| 487 | main.Functions.checkP2PintentNum( main, 12 * 2 ) |
| 488 | else: |
| 489 | main.log.error( "Stopping switch failed!" ) |
| 490 | main.cleanup() |
| 491 | main.exit() |
| 492 | |
| 493 | main.step( "Check ping between hosts behind BGP peers" ) |
| 494 | result1 = main.Mininet.pingHost( src = "host64514", target = "host64515" ) |
| 495 | result2 = main.Mininet.pingHost( src = "host64515", target = "host64516" ) |
| 496 | result3 = main.Mininet.pingHost( src = "host64514", target = "host64516" ) |
| 497 | |
| 498 | pingResult1 = ( result1 == main.FALSE ) and ( result2 == main.TRUE ) \ |
| 499 | and ( result3 == main.FALSE ) |
| 500 | utilities.assert_equals( expect = True, actual = pingResult1, |
| 501 | onpass = "Ping test result is correct", |
| 502 | onfail = "Ping test result is wrong" ) |
| 503 | |
| 504 | if pingResult1 == False: |
| 505 | main.cleanup() |
| 506 | main.exit() |
| 507 | |
| 508 | main.step( "Check ping between BGP peers and speaker1" ) |
| 509 | result4 = main.Mininet.pingHost( src = "speaker1", target = "peer64514" ) |
| 510 | result5 = main.Mininet.pingHost( src = "speaker1", target = "peer64515" ) |
| 511 | result6 = main.Mininet.pingHost( src = "speaker1", target = "peer64516" ) |
| 512 | |
| 513 | pingResult2 = ( result4 == main.FALSE ) and ( result5 == main.TRUE ) \ |
| 514 | and ( result6 == main.TRUE ) |
| 515 | utilities.assert_equals( expect = True, actual = pingResult2, |
| 516 | onpass = "Speaker1 ping peers successful", |
| 517 | onfail = "Speaker1 ping peers NOT successful" ) |
| 518 | |
| 519 | if pingResult2 == False: |
| 520 | main.cleanup() |
| 521 | main.exit() |
| 522 | |
| 523 | main.step( "Check ping between BGP peers and speaker2" ) |
| 524 | # TODO |
| 525 | result7 = main.Mininet.pingHost( src = "speaker2", target = peer64514 ) |
| 526 | result8 = main.Mininet.pingHost( src = "speaker2", target = peer64515 ) |
| 527 | result9 = main.Mininet.pingHost( src = "speaker2", target = peer64516 ) |
| 528 | |
| 529 | pingResult3 = ( result7 == main.FALSE ) and ( result8 == main.TRUE ) \ |
| 530 | and ( result9 == main.TRUE ) |
| 531 | utilities.assert_equals( expect = True, actual = pingResult2, |
| 532 | onpass = "Speaker2 ping peers successful", |
| 533 | onfail = "Speaker2 ping peers NOT successful" ) |
| 534 | |
| 535 | if pingResult3 == False: |
| 536 | main.cleanup() |
| 537 | main.exit() |
| 538 | |
| 539 | main.step( "Check whether all flow status are ADDED" ) |
| 540 | utilities.assertEquals( \ |
| 541 | expect = main.TRUE, |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 542 | actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ), |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 543 | onpass = "Flow status is correct!", |
| 544 | onfail = "Flow status is wrong!" ) |
| 545 | |
| 546 | |
| 547 | def CASE8( self, main ): |
| 548 | ''' |
| 549 | Bring up the edge switch (sw32) which was shut down in CASE7, |
| 550 | check P-2-P and M-2-S intents, ping test |
| 551 | ''' |
| 552 | import time |
| 553 | main.case( "Start the edge sw32, check P-2-P and M-2-S intents, ping test" ) |
| 554 | main.step( "Start sw32" ) |
| 555 | result1 = main.Mininet.switch( SW = "sw32", OPTION = "start" ) |
| 556 | utilities.assertEquals( \ |
| 557 | expect = main.TRUE, |
| 558 | actual = result1, |
| 559 | onpass = "Starting switch succeeded!", |
| 560 | onfail = "Starting switch failed!" ) |
| 561 | |
| 562 | result2 = main.Mininet.assignSwController( "sw32", ONOS1Ip ) |
| 563 | utilities.assertEquals( \ |
| 564 | expect = main.TRUE, |
| 565 | actual = result2, |
| 566 | onpass = "Connect switch to ONOS succeeded!", |
| 567 | onfail = "Connect switch to ONOS failed!" ) |
| 568 | |
| 569 | if result1 and result2: |
| 570 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 571 | main.Functions.checkRouteNum( main, 3 ) |
| 572 | main.Functions.checkM2SintentNum( main, 3 ) |
| 573 | main.Functions.checkP2PintentNum( main, 18 * 2 ) |
| 574 | else: |
| 575 | main.log.error( "Starting switch failed!" ) |
| 576 | main.cleanup() |
| 577 | main.exit() |
| 578 | |
| 579 | main.step( "Check whether all flow status are ADDED" ) |
| 580 | utilities.assertEquals( \ |
| 581 | expect = main.TRUE, |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 582 | actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ), |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 583 | onpass = "Flow status is correct!", |
| 584 | onfail = "Flow status is wrong!" ) |
| 585 | |
| 586 | # Ping test |
| 587 | main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"], |
| 588 | peers = ["peer64514", "peer64515", "peer64516"], |
| 589 | expectAllSuccess = True ) |
| 590 | main.Functions.pingSpeakerToPeer( main, speakers = ["speaker2"], |
| 591 | peers = [peer64514, peer64515, peer64516], |
| 592 | expectAllSuccess = True ) |
| 593 | main.Functions.pingHostToHost( main, |
| 594 | hosts = ["host64514", "host64515", "host64516"], |
| 595 | expectAllSuccess = True ) |
| 596 | |
| 597 | |
| 598 | def CASE9( self, main ): |
| 599 | ''' |
| 600 | Bring down a switch in best path, check: |
| 601 | route number, P2P intent number, M2S intent number, ping test |
| 602 | ''' |
| 603 | main.case( "Stop sw11 located in best path, \ |
| 604 | check route number, P2P intent number, M2S intent number, ping test" ) |
| 605 | |
| 606 | main.log.info( "Check the flow number correctness before stopping sw11" ) |
| 607 | main.Functions.checkFlowNum( main, "sw11", 19 ) |
| 608 | main.Functions.checkFlowNum( main, "sw1", 3 ) |
| 609 | main.Functions.checkFlowNum( main, "sw7", 3 ) |
| 610 | main.log.info( main.Mininet.checkFlows( "sw11" ) ) |
| 611 | main.log.info( main.Mininet.checkFlows( "sw1" ) ) |
| 612 | main.log.info( main.Mininet.checkFlows( "sw7" ) ) |
| 613 | |
| 614 | main.step( "Stop sw11" ) |
| 615 | result = main.Mininet.switch( SW = "sw11", OPTION = "stop" ) |
| 616 | utilities.assertEquals( expect = main.TRUE, actual = result, |
| 617 | onpass = "Stopping switch succeeded!", |
| 618 | onfail = "Stopping switch failed!" ) |
| 619 | if result: |
| 620 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 621 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 622 | main.Functions.checkRouteNum( main, 3 ) |
| 623 | main.Functions.checkM2SintentNum( main, 3 ) |
| 624 | main.Functions.checkP2PintentNum( main, 18 * 2 ) |
| 625 | else: |
| 626 | main.log.error( "Stopping switch failed!" ) |
| 627 | main.cleanup() |
| 628 | main.exit() |
| 629 | |
| 630 | main.step( "Check whether all flow status are ADDED" ) |
| 631 | utilities.assertEquals( \ |
| 632 | expect = main.TRUE, |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 633 | actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ), |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 634 | onpass = "Flow status is correct!", |
| 635 | onfail = "Flow status is wrong!" ) |
| 636 | # Ping test |
| 637 | main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"], |
| 638 | peers = ["peer64514", "peer64515", "peer64516"], |
| 639 | expectAllSuccess = True ) |
| 640 | main.Functions.pingSpeakerToPeer( main, speakers = ["speaker2"], |
| 641 | peers = [peer64514, peer64515, peer64516], |
| 642 | expectAllSuccess = True ) |
| 643 | main.Functions.pingHostToHost( main, |
| 644 | hosts = ["host64514", "host64515", "host64516"], |
| 645 | expectAllSuccess = True ) |
| 646 | |
| 647 | |
| 648 | def CASE10( self, main ): |
| 649 | ''' |
| 650 | Bring up the switch which was stopped in CASE9, check: |
| 651 | route number, P2P intent number, M2S intent number, ping test |
| 652 | ''' |
| 653 | main.case( "Start sw11 which was stopped in CASE9, \ |
| 654 | check route number, P2P intent number, M2S intent number, ping test" ) |
| 655 | |
| 656 | main.log.info( "Check the flow status before starting sw11" ) |
| 657 | main.Functions.checkFlowNum( main, "sw1", 17 ) |
| 658 | main.Functions.checkFlowNum( main, "sw7", 5 ) |
| 659 | main.log.info( main.Mininet.checkFlows( "sw1" ) ) |
| 660 | main.log.info( main.Mininet.checkFlows( "sw7" ) ) |
| 661 | |
| 662 | main.step( "Start sw11" ) |
| 663 | result1 = main.Mininet.switch( SW = "sw11", OPTION = "start" ) |
| 664 | utilities.assertEquals( expect = main.TRUE, actual = result1, |
| 665 | onpass = "Starting switch succeeded!", |
| 666 | onfail = "Starting switch failed!" ) |
| 667 | result2 = main.Mininet.assignSwController( "sw11", ONOS1Ip ) |
| 668 | utilities.assertEquals( expect = main.TRUE, actual = result2, |
| 669 | onpass = "Connect switch to ONOS succeeded!", |
| 670 | onfail = "Connect switch to ONOS failed!" ) |
| 671 | if result1 and result2: |
| 672 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 673 | main.Functions.checkRouteNum( main, 3 ) |
| 674 | main.Functions.checkM2SintentNum( main, 3 ) |
| 675 | main.Functions.checkP2PintentNum( main, 18 * 2 ) |
| 676 | |
| 677 | main.log.debug( main.Mininet.checkFlows( "sw11" ) ) |
| 678 | main.log.debug( main.Mininet.checkFlows( "sw1" ) ) |
| 679 | main.log.debug( main.Mininet.checkFlows( "sw7" ) ) |
| 680 | else: |
| 681 | main.log.error( "Starting switch failed!" ) |
| 682 | main.cleanup() |
| 683 | main.exit() |
| 684 | |
| 685 | main.step( "Check whether all flow status are ADDED" ) |
| 686 | utilities.assertEquals( \ |
| 687 | expect = main.TRUE, |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 688 | actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ), |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 689 | onpass = "Flow status is correct!", |
| 690 | onfail = "Flow status is wrong!" ) |
| 691 | # Ping test |
| 692 | main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"], |
| 693 | peers = ["peer64514", "peer64515", "peer64516"], |
| 694 | expectAllSuccess = True ) |
| 695 | main.Functions.pingSpeakerToPeer( main, speakers = ["speaker2"], |
| 696 | peers = [peer64514, peer64515, peer64516], |
| 697 | expectAllSuccess = True ) |
| 698 | main.Functions.pingHostToHost( main, |
| 699 | hosts = ["host64514", "host64515", "host64516"], |
| 700 | expectAllSuccess = True ) |
| 701 | |
| 702 | |
| 703 | def CASE11(self, main): |
| 704 | import time |
| 705 | main.case( "Kill speaker1, check:\ |
| 706 | route number, P2P intent number, M2S intent number, ping test" ) |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 707 | main.log.info( "Check network status before killing speaker1" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 708 | main.Functions.checkRouteNum( main, 3 ) |
| 709 | main.Functions.checkM2SintentNum( main, 3 ) |
| 710 | main.Functions.checkP2PintentNum( main, 18 * 2 ) |
| 711 | main.step( "Check whether all flow status are ADDED" ) |
| 712 | utilities.assertEquals( \ |
| 713 | expect = main.TRUE, |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 714 | actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ), |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 715 | onpass = "Flow status is correct!", |
| 716 | onfail = "Flow status is wrong!" ) |
| 717 | |
| 718 | main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"], |
| 719 | peers = ["peer64514", "peer64515", "peer64516"], |
| 720 | expectAllSuccess = True ) |
| 721 | main.Functions.pingSpeakerToPeer( main, speakers = ["speaker2"], |
| 722 | peers = [peer64514, peer64515, peer64516], |
| 723 | expectAllSuccess = True ) |
| 724 | main.Functions.pingHostToHost( main, |
| 725 | hosts = ["host64514", "host64515", "host64516"], |
| 726 | expectAllSuccess = True ) |
| 727 | |
| 728 | main.step( "Kill speaker1" ) |
pingping-lin | 145cd0a | 2015-10-09 17:44:34 -0700 | [diff] [blame] | 729 | command1 = "ps -e | grep bgp -c" |
| 730 | result1 = main.Mininet.node( "root", command1 ) |
| 731 | |
| 732 | # The total BGP daemon number in this test environment is 5. |
| 733 | if "5" in result1: |
| 734 | main.log.debug( "Before kill speaker1, 5 BGP daemons - correct" ) |
| 735 | else: |
| 736 | main.log.warn( "Before kill speaker1, number of BGP daemons is wrong" ) |
| 737 | main.log.info( result1 ) |
| 738 | |
| 739 | command2 = "sudo kill -9 `ps -ef | grep quagga-sdn.conf | grep -v grep | awk '{print $2}'`" |
| 740 | result2 = main.Mininet.node( "root", command2 ) |
| 741 | |
| 742 | result3 = main.Mininet.node( "root", command1 ) |
| 743 | |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 744 | utilities.assert_equals( expect = True, |
pingping-lin | 145cd0a | 2015-10-09 17:44:34 -0700 | [diff] [blame] | 745 | actual = ( "4" in result3 ), |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 746 | onpass = "Kill speaker1 succeeded", |
| 747 | onfail = "Kill speaker1 failed" ) |
pingping-lin | 145cd0a | 2015-10-09 17:44:34 -0700 | [diff] [blame] | 748 | if ( "4" not in result3 ) : |
| 749 | main.log.info( result3 ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 750 | main.cleanup() |
| 751 | main.exit() |
| 752 | |
| 753 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 754 | main.Functions.checkRouteNum( main, 3 ) |
| 755 | main.Functions.checkM2SintentNum( main, 3 ) |
| 756 | main.Functions.checkP2PintentNum( main, 18 * 2 ) |
| 757 | |
| 758 | main.step( "Check whether all flow status are ADDED" ) |
| 759 | utilities.assertEquals( \ |
| 760 | expect = main.TRUE, |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 761 | actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ), |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 762 | onpass = "Flow status is correct!", |
| 763 | onfail = "Flow status is wrong!" ) |
| 764 | |
| 765 | ''' |
| 766 | main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"], |
| 767 | peers = ["peer64514", "peer64515", "peer64516"], |
| 768 | expectAllSuccess = False ) |
| 769 | ''' |
| 770 | main.Functions.pingSpeakerToPeer( main, speakers = ["speaker2"], |
| 771 | peers = [peer64514, peer64515, peer64516], |
| 772 | expectAllSuccess = True ) |
| 773 | main.Functions.pingHostToHost( main, |
| 774 | hosts = ["host64514", "host64515", "host64516"], |
| 775 | expectAllSuccess = True ) |
| 776 | |
| 777 | |
| 778 | def CASE12( self, main ): |
| 779 | import time |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 780 | import json |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 781 | main.case( "Bring down leader ONOS node, check: \ |
| 782 | route number, P2P intent number, M2S intent number, ping test" ) |
| 783 | main.step( "Find out ONOS leader node" ) |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 784 | result = main.ONOScli1.leaders() |
pingping-lin | 3f932a7 | 2015-10-09 16:44:50 -0700 | [diff] [blame] | 785 | jsonResult = json.loads( result ) |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 786 | leaderIP = "" |
| 787 | for entry in jsonResult: |
| 788 | if entry["topic"] == "org.onosproject.sdnip": |
| 789 | leaderIP = entry["leader"] |
| 790 | main.log.info( "leaderIP is: " ) |
| 791 | main.log.info( leaderIP ) |
| 792 | |
| 793 | main.step( "Uninstall ONOS/SDN-IP leader node" ) |
| 794 | if leaderIP == ONOS1Ip: |
| 795 | uninstallResult = main.ONOSbench.onosStop( ONOS1Ip ) |
| 796 | elif leaderIP == ONOS2Ip: |
| 797 | uninstallResult = main.ONOSbench.onosStop( ONOS2Ip ) |
| 798 | else: |
| 799 | uninstallResult = main.ONOSbench.onosStop( ONOS3Ip ) |
| 800 | |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 801 | utilities.assert_equals( expect = main.TRUE, |
| 802 | actual = uninstallResult, |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 803 | onpass = "Uninstall ONOS leader succeeded", |
| 804 | onfail = "Uninstall ONOS leader failed" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 805 | if uninstallResult != main.TRUE: |
| 806 | main.cleanup() |
| 807 | main.exit() |
| 808 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 809 | |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 810 | if leaderIP == ONOS1Ip: |
| 811 | main.Functions.checkRouteNum( main, 3, ONOScli = "ONOScli2" ) |
| 812 | main.Functions.checkM2SintentNum( main, 3, ONOScli = "ONOScli2" ) |
| 813 | main.Functions.checkP2PintentNum( main, 18 * 2, ONOScli = "ONOScli2" ) |
| 814 | |
| 815 | main.step( "Check whether all flow status are ADDED" ) |
| 816 | utilities.assertEquals( \ |
| 817 | expect = main.TRUE, |
| 818 | actual = main.ONOScli2.checkFlowsState( isPENDING_ADD = False ), |
| 819 | onpass = "Flow status is correct!", |
| 820 | onfail = "Flow status is wrong!" ) |
| 821 | else: |
| 822 | main.Functions.checkRouteNum( main, 3 ) |
| 823 | main.Functions.checkM2SintentNum( main, 3 ) |
| 824 | main.Functions.checkP2PintentNum( main, 18 * 2 ) |
| 825 | |
| 826 | main.step( "Check whether all flow status are ADDED" ) |
| 827 | utilities.assertEquals( \ |
| 828 | expect = main.TRUE, |
| 829 | actual = main.ONOScli1.checkFlowsState( isPENDING_ADD = False ), |
| 830 | onpass = "Flow status is correct!", |
| 831 | onfail = "Flow status is wrong!" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 832 | |
| 833 | main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"], |
| 834 | peers = ["peer64514", "peer64515", "peer64516"], |
| 835 | expectAllSuccess = True ) |
| 836 | main.Functions.pingSpeakerToPeer( main, speakers = ["speaker2"], |
| 837 | peers = [peer64514, peer64515, peer64516], |
| 838 | expectAllSuccess = True ) |
| 839 | main.Functions.pingHostToHost( main, |
| 840 | hosts = ["host64514", "host64515", "host64516"], |
| 841 | expectAllSuccess = True ) |