pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 1 | # Testing the functionality of SDN-IP with single ONOS instance |
| 2 | class USECASE_SdnipI2: |
| 3 | |
| 4 | def __init__( self ): |
| 5 | self.default = '' |
| 6 | global branchName |
| 7 | |
pingping-lin | b702c60 | 2015-09-10 17:00:29 -0700 | [diff] [blame] | 8 | # This case is to setup Mininet testbed |
| 9 | def CASE100( self, main ): |
| 10 | """ |
| 11 | Start mininet |
| 12 | """ |
| 13 | import os |
pingping-lin | 4f80c49 | 2015-09-15 14:34:42 -0700 | [diff] [blame] | 14 | import imp |
pingping-lin | b702c60 | 2015-09-10 17:00:29 -0700 | [diff] [blame] | 15 | main.log.case( "Start Mininet topology" ) |
| 16 | main.dependencyPath = main.testDir + \ |
| 17 | main.params[ 'DEPENDENCY' ][ 'path' ] |
| 18 | main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ] |
| 19 | |
| 20 | main.step( "Starting Mininet Topology" ) |
| 21 | topology = main.dependencyPath + main.topology |
| 22 | topoResult = main.Mininet.startNet( topoFile = topology ) |
| 23 | stepResult = topoResult |
| 24 | utilities.assert_equals( expect = main.TRUE, |
| 25 | actual = stepResult, |
| 26 | onpass = "Successfully loaded topology", |
| 27 | onfail = "Failed to load topology" ) |
| 28 | # Exit if topology did not load properly |
| 29 | if not topoResult: |
| 30 | main.cleanup() |
| 31 | main.exit() |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 32 | |
| 33 | # This case is to setup ONOS |
pingping-lin | b702c60 | 2015-09-10 17:00:29 -0700 | [diff] [blame] | 34 | def CASE101( self, main ): |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 35 | """ |
| 36 | CASE100 is to compile ONOS and install it |
| 37 | Startup sequence: |
| 38 | cell <name> |
| 39 | onos-verify-cell |
| 40 | git pull |
| 41 | mvn clean install |
| 42 | onos-package |
| 43 | onos-install -f |
| 44 | onos-wait-for-start |
| 45 | """ |
| 46 | import json |
| 47 | import time |
| 48 | from operator import eq |
| 49 | |
| 50 | main.case( "Setting up test environment" ) |
| 51 | |
| 52 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
pingping-lin | d791d34 | 2015-09-17 18:34:31 -0700 | [diff] [blame] | 53 | global ONOS1Ip |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 54 | ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 55 | |
| 56 | main.step( "Applying cell variable to environment" ) |
| 57 | cellResult = main.ONOSbench.setCell( cellName ) |
| 58 | verifyResult = main.ONOSbench.verifyCell() |
| 59 | |
| 60 | branchName = main.ONOSbench.getBranchName() |
| 61 | main.log.info( "ONOS is on branch: " + branchName ) |
| 62 | |
| 63 | main.log.report( "Uninstalling ONOS" ) |
| 64 | main.ONOSbench.onosUninstall( ONOS1Ip ) |
| 65 | |
| 66 | # cleanInstallResult = main.TRUE |
| 67 | # gitPullResult = main.TRUE |
| 68 | |
| 69 | main.step( "Git pull" ) |
| 70 | gitPullResult = main.ONOSbench.gitPull() |
| 71 | |
| 72 | main.step( "Using mvn clean install" ) |
| 73 | if gitPullResult == main.TRUE: |
| 74 | cleanInstallResult = main.ONOSbench.cleanInstall( mciTimeout = 1000 ) |
| 75 | else: |
| 76 | main.log.warn( "Did not pull new code so skipping mvn " + |
| 77 | "clean install" ) |
| 78 | cleanInstallResult = main.TRUE |
| 79 | |
| 80 | main.ONOSbench.getVersion( report = True ) |
| 81 | |
| 82 | main.step( "Creating ONOS package" ) |
| 83 | packageResult = main.ONOSbench.onosPackage( opTimeout = 500 ) |
| 84 | |
| 85 | main.step( "Installing ONOS package" ) |
| 86 | onos1InstallResult = main.ONOSbench.onosInstall( options = "-f", |
| 87 | node = ONOS1Ip ) |
| 88 | |
| 89 | main.step( "Checking if ONOS is up yet" ) |
| 90 | for i in range( 2 ): |
| 91 | onos1Isup = main.ONOSbench.isup( ONOS1Ip, timeout = 420 ) |
| 92 | if onos1Isup: |
| 93 | break |
| 94 | if not onos1Isup: |
| 95 | main.log.report( "ONOS1 didn't start!" ) |
| 96 | |
| 97 | cliResult = main.ONOScli.startOnosCli( ONOS1Ip, |
| 98 | commandlineTimeout = 100, onosStartTimeout = 600 ) |
| 99 | |
pingping-lin | b702c60 | 2015-09-10 17:00:29 -0700 | [diff] [blame] | 100 | caseResult = ( cleanInstallResult and packageResult and |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 101 | cellResult and verifyResult and |
| 102 | onos1InstallResult and |
| 103 | onos1Isup and cliResult ) |
| 104 | |
pingping-lin | b702c60 | 2015-09-10 17:00:29 -0700 | [diff] [blame] | 105 | utilities.assert_equals( expect = main.TRUE, actual = caseResult, |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 106 | onpass = "ONOS startup successful", |
| 107 | onfail = "ONOS startup NOT successful" ) |
| 108 | |
pingping-lin | b702c60 | 2015-09-10 17:00:29 -0700 | [diff] [blame] | 109 | if caseResult == main.FALSE: |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 110 | main.cleanup() |
| 111 | main.exit() |
| 112 | |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 113 | main.step( "Get links in the network" ) |
| 114 | listResult = main.ONOScli.links( jsonFormat = False ) |
| 115 | main.log.info( listResult ) |
| 116 | main.log.info( "Activate sdn-ip application" ) |
| 117 | main.ONOScli.activateApp( "org.onosproject.sdnip" ) |
pingping-lin | b702c60 | 2015-09-10 17:00:29 -0700 | [diff] [blame] | 118 | |
| 119 | main.log.info( "Wait sdn-ip to finish installing connectivity intents, \ |
| 120 | and the BGP paths in data plane are ready..." ) |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 121 | time.sleep( int( main.params[ 'timers' ][ 'SdnIpSetup' ] ) ) |
pingping-lin | b702c60 | 2015-09-10 17:00:29 -0700 | [diff] [blame] | 122 | main.log.info( "Wait Quagga to finish delivery all routes to each \ |
| 123 | other and to sdn-ip, plus finish installing all intents..." ) |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 124 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 125 | time.sleep( int( main.params[ 'timers' ][ 'PathAvailable' ] ) ) |
| 126 | |
| 127 | |
pingping-lin | 4f80c49 | 2015-09-15 14:34:42 -0700 | [diff] [blame] | 128 | def CASE102( self, main ): |
| 129 | ''' |
| 130 | This test case is to load the methods from other Python files. |
| 131 | ''' |
| 132 | main.case( "Loading the methods from other Python file" ) |
| 133 | # load the methods from other file |
| 134 | wrapperFile = main.params[ 'DEPENDENCY' ][ 'wrapper1' ] |
| 135 | main.Functions = imp.load_source( wrapperFile, |
| 136 | main.dependencyPath + |
| 137 | wrapperFile + |
| 138 | ".py" ) |
| 139 | |
| 140 | |
pingping-lin | 0ce6062 | 2015-09-10 14:37:33 -0700 | [diff] [blame] | 141 | def CASE1( self, main ): |
| 142 | ''' |
| 143 | ping test from 3 bgp peers to BGP speaker |
| 144 | ''' |
pingping-lin | 950b50d | 2015-09-14 12:00:08 -0700 | [diff] [blame] | 145 | |
| 146 | m2SIntentsNumberActual = main.ONOScli.m2SIntentInstalledNumber() |
| 147 | main.log.info( "MultiPointToSinglePoint intent number actual is:" ) |
| 148 | main.log.info( m2SIntentsNumberActual ) |
| 149 | |
pingping-lin | 0ce6062 | 2015-09-10 14:37:33 -0700 | [diff] [blame] | 150 | main.case( "This case is to check ping between BGP peers and speakers" ) |
pingping-lin | b702c60 | 2015-09-10 17:00:29 -0700 | [diff] [blame] | 151 | result1 = main.Mininet.pingHost( src = "speaker1", target = "peer64514" ) |
| 152 | result2 = main.Mininet.pingHost( src = "speaker1", target = "peer64515" ) |
| 153 | result3 = main.Mininet.pingHost( src = "speaker1", target = "peer64516" ) |
| 154 | |
pingping-lin | 950b50d | 2015-09-14 12:00:08 -0700 | [diff] [blame] | 155 | |
pingping-lin | b702c60 | 2015-09-10 17:00:29 -0700 | [diff] [blame] | 156 | caseResult = result1 and result2 and result3 |
| 157 | utilities.assert_equals( expect = main.TRUE, actual = caseResult, |
| 158 | onpass = "Speaker1 ping peers successful", |
| 159 | onfail = "Speaker1 ping peers NOT successful" ) |
| 160 | |
| 161 | if caseResult == main.FALSE: |
| 162 | main.cleanup() |
| 163 | main.exit() |
pingping-lin | 0ce6062 | 2015-09-10 14:37:33 -0700 | [diff] [blame] | 164 | |
pingping-lin | 950b50d | 2015-09-14 12:00:08 -0700 | [diff] [blame] | 165 | |
pingping-lin | 0ce6062 | 2015-09-10 14:37:33 -0700 | [diff] [blame] | 166 | def CASE2( self, main ): |
| 167 | ''' |
| 168 | point-to-point intents test for each BGP peer and BGP speaker pair |
| 169 | ''' |
| 170 | main.case( "This case is to check point-to-point intents" ) |
| 171 | main.log.info( "There are %s BGP peers in total " |
| 172 | % main.params[ 'config' ][ 'peerNum' ] ) |
| 173 | main.step( "Get point-to-point intents from ONOS CLI" ) |
| 174 | |
| 175 | getIntentsResult = main.ONOScli.intents( jsonFormat = True ) |
| 176 | bgpIntentsActualNum = \ |
| 177 | main.QuaggaCliSpeaker1.extractActualBgpIntentNum( getIntentsResult ) |
| 178 | bgpIntentsExpectedNum = int( main.params[ 'config' ][ 'peerNum' ] ) * 6 |
| 179 | main.log.info( "bgpIntentsExpected num is:" ) |
| 180 | main.log.info( bgpIntentsExpectedNum ) |
| 181 | main.log.info( "bgpIntentsActual num is:" ) |
| 182 | main.log.info( bgpIntentsActualNum ) |
| 183 | utilities.assertEquals( \ |
| 184 | expect = True, |
| 185 | actual = eq( bgpIntentsExpectedNum, bgpIntentsActualNum ), |
| 186 | onpass = "***PointToPointIntent Intent Num in SDN-IP are correct!***", |
| 187 | onfail = "***PointToPointIntent Intent Num in SDN-IP are wrong!***" ) |
| 188 | |
| 189 | |
| 190 | def CASE3( self, main ): |
| 191 | ''' |
| 192 | routes and intents check to all BGP peers |
| 193 | ''' |
| 194 | main.case( "This case is to check routes and intents to all BGP peers" ) |
| 195 | |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 196 | allRoutesExpected = [] |
| 197 | allRoutesExpected.append( "4.0.0.0/24" + "/" + "10.0.4.1" ) |
| 198 | allRoutesExpected.append( "5.0.0.0/24" + "/" + "10.0.5.1" ) |
| 199 | allRoutesExpected.append( "6.0.0.0/24" + "/" + "10.0.6.1" ) |
| 200 | |
| 201 | getRoutesResult = main.ONOScli.routes( jsonFormat = True ) |
| 202 | allRoutesActual = \ |
| 203 | main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult ) |
| 204 | allRoutesStrExpected = str( sorted( allRoutesExpected ) ) |
| 205 | allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" ) |
| 206 | |
| 207 | main.step( "Check routes installed" ) |
| 208 | main.log.info( "Routes expected:" ) |
| 209 | main.log.info( allRoutesStrExpected ) |
| 210 | main.log.info( "Routes get from ONOS CLI:" ) |
| 211 | main.log.info( allRoutesStrActual ) |
| 212 | utilities.assertEquals( \ |
| 213 | expect = allRoutesStrExpected, actual = allRoutesStrActual, |
| 214 | onpass = "***Routes in SDN-IP are correct!***", |
| 215 | onfail = "***Routes in SDN-IP are wrong!***" ) |
| 216 | |
| 217 | main.step( "Check MultiPointToSinglePointIntent intents installed" ) |
| 218 | getIntentsResult = main.ONOScli.intents( jsonFormat = True ) |
| 219 | routeIntentsActualNum = \ |
| 220 | main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult ) |
| 221 | routeIntentsExpectedNum = 3 |
| 222 | |
| 223 | main.log.info( "MultiPointToSinglePoint Intent Num expected is:" ) |
| 224 | main.log.info( routeIntentsExpectedNum ) |
| 225 | main.log.info( "MultiPointToSinglePoint Intent NUM Actual is:" ) |
| 226 | main.log.info( routeIntentsActualNum ) |
| 227 | utilities.assertEquals( \ |
| 228 | expect = True, |
| 229 | actual = eq( routeIntentsExpectedNum, routeIntentsActualNum ), |
| 230 | onpass = "***MultiPointToSinglePoint Intent Num in SDN-IP is \ |
| 231 | correct!***", |
| 232 | onfail = "***MultiPointToSinglePoint Intent Num in SDN-IP is \ |
| 233 | wrong!***" ) |
| 234 | |
pingping-lin | 950b50d | 2015-09-14 12:00:08 -0700 | [diff] [blame] | 235 | |
| 236 | def CASE4( self, main ): |
| 237 | ''' |
| 238 | Ping test in data plane for each route |
| 239 | ''' |
| 240 | main.case( "This case is to check ping for each route" ) |
| 241 | result1 = main.Mininet.pingHost( src = "host64514", target = "host64515" ) |
| 242 | result2 = main.Mininet.pingHost( src = "host64515", target = "host64516" ) |
| 243 | result3 = main.Mininet.pingHost( src = "host64514", target = "host64516" ) |
| 244 | |
| 245 | caseResult = result1 and result2 and result3 |
| 246 | utilities.assert_equals( expect = main.TRUE, actual = caseResult, |
| 247 | onpass = "Ping test for each route successful", |
| 248 | onfail = "Ping test for each route NOT successful" ) |
| 249 | |
| 250 | if caseResult == main.FALSE: |
| 251 | main.cleanup() |
| 252 | main.exit() |
pingping-lin | 4f80c49 | 2015-09-15 14:34:42 -0700 | [diff] [blame] | 253 | |
| 254 | |
| 255 | def CASE5( self, main ): |
| 256 | ''' |
| 257 | Cut links to peers one by one, check routes/intents |
| 258 | ''' |
| 259 | import time |
| 260 | main.case( "This case is to bring down links and check routes/intents" ) |
| 261 | main.step( "Bring down the link between sw32 and peer64514" ) |
| 262 | result = main.Mininet.link( END1 = "sw32", END2 = "peer64514", |
| 263 | OPTION = "down" ) |
| 264 | if result == main.TRUE: |
| 265 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 266 | main.Functions.checkRouteNum( main, 2 ) |
| 267 | main.Functions.checkM2SintentNum( main, 2 ) |
| 268 | else: |
| 269 | main.log.info( "Bring down link failed!!!" ) |
| 270 | main.exit(); |
| 271 | |
| 272 | main.step( "Bring down the link between sw8 and peer64515" ) |
| 273 | result = main.Mininet.link( END1 = "sw8", END2 = "peer64515", |
| 274 | OPTION = "down" ) |
| 275 | if result == main.TRUE: |
| 276 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 277 | main.Functions.checkRouteNum( main, 1 ) |
| 278 | main.Functions.checkM2SintentNum( main, 1 ) |
| 279 | else: |
| 280 | main.log.info( "Bring down link failed!!!" ) |
| 281 | main.exit(); |
| 282 | |
| 283 | main.step( "Bring down the link between sw28 and peer64516" ) |
| 284 | result = main.Mininet.link( END1 = "sw28", END2 = "peer64516", |
| 285 | OPTION = "down" ) |
| 286 | if result == main.TRUE: |
| 287 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 288 | main.Functions.checkRouteNum( main, 0 ) |
| 289 | main.Functions.checkM2SintentNum( main, 0 ) |
| 290 | else: |
| 291 | main.log.info( "Bring down link failed!!!" ) |
| 292 | main.exit(); |
| 293 | |
| 294 | |
| 295 | def CASE6(self, main): |
| 296 | ''' |
| 297 | Recover links to peers one by one, check routes/intents |
| 298 | ''' |
| 299 | import time |
| 300 | main.case( "This case is to bring up links and check routes/intents" ) |
| 301 | main.step( "Bring up the link between sw32 and peer64514" ) |
| 302 | result = main.Mininet.link( END1 = "sw32", END2 = "peer64514", |
| 303 | OPTION = "up" ) |
| 304 | if result == main.TRUE: |
| 305 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 306 | main.Functions.checkRouteNum( main, 1 ) |
| 307 | main.Functions.checkM2SintentNum( main, 1 ) |
| 308 | else: |
| 309 | main.log.info( "Bring up link failed!!!" ) |
| 310 | main.exit(); |
| 311 | |
| 312 | main.step( "Bring up the link between sw8 and peer64515" ) |
| 313 | result = main.Mininet.link( END1 = "sw8", END2 = "peer64515", |
| 314 | OPTION = "up" ) |
| 315 | if result == main.TRUE: |
| 316 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 317 | main.Functions.checkRouteNum( main, 2 ) |
| 318 | main.Functions.checkM2SintentNum( main, 2 ) |
| 319 | else: |
| 320 | main.log.info( "Bring up link failed!!!" ) |
| 321 | main.exit(); |
| 322 | |
| 323 | main.step( "Bring up the link between sw28 and peer64516" ) |
| 324 | result = main.Mininet.link( END1 = "sw28", END2 = "peer64516", |
| 325 | OPTION = "up" ) |
| 326 | if result == main.TRUE: |
| 327 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 328 | main.Functions.checkRouteNum( main, 3 ) |
| 329 | main.Functions.checkM2SintentNum( main, 3 ) |
| 330 | else: |
| 331 | main.log.info( "Bring up link failed!!!" ) |
| 332 | main.exit(); |
pingping-lin | 8244a3b | 2015-09-16 13:36:56 -0700 | [diff] [blame] | 333 | ''' |
| 334 | Note: at the end of this test case, we should carry out ping test. |
| 335 | So we run CASE4 again after CASE6 |
| 336 | ''' |
| 337 | |
| 338 | |
| 339 | def CASE7(self, main): |
| 340 | ''' |
| 341 | shut down a edge switch, check P-2-P and M-2-S intents, ping test |
| 342 | ''' |
| 343 | import time |
| 344 | main.case( "This case is to stop 1 edge switch,\ |
| 345 | check P-2-P and M-2-S intents, ping test") |
| 346 | main.step( "Stop sw32" ) |
| 347 | result = main.Mininet.switch( SW = "sw32", OPTION = "stop" ) |
| 348 | if result == main.TRUE: |
| 349 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 350 | main.Functions.checkRouteNum( main, 2 ) |
| 351 | main.Functions.checkM2SintentNum( main, 2 ) |
| 352 | main.Functions.checkP2PintentNum( main, 12 ) |
| 353 | else: |
| 354 | main.log.info( "Stop switch failed!!!" ) |
| 355 | main.exit(); |
| 356 | |
| 357 | ''' |
| 358 | main.step( "Stop sw8" ) |
| 359 | result = main.Mininet.switch( SW = "sw8", OPTION = "stop" ) |
| 360 | if result == main.TRUE: |
| 361 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 362 | main.Functions.checkRouteNum( main, 1 ) |
| 363 | |
| 364 | # Note: there should be 0 M2S intent, not 1. |
| 365 | main.Functions.checkM2SintentNum( main, 0 ) |
| 366 | main.Functions.checkP2PintentNum( main, 6 ) |
| 367 | else: |
| 368 | main.log.info( "Stop switch failed!!!" ) |
| 369 | main.exit(); |
| 370 | |
| 371 | main.step( "Stop sw28" ) |
| 372 | result = main.Mininet.switch( SW = "sw28", OPTION = "stop" ) |
| 373 | if result == main.TRUE: |
| 374 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 375 | main.Functions.checkRouteNum( main, 0 ) |
| 376 | main.Functions.checkM2SintentNum( main, 0 ) |
| 377 | main.Functions.checkP2PintentNum( main, 0 ) |
| 378 | else: |
| 379 | main.log.info( "Stop switch failed!!!" ) |
| 380 | main.exit(); |
| 381 | ''' |
| 382 | ''' |
| 383 | ping test between BGP speaker and BGP peers, ping test between hosts |
| 384 | behind BGP peers === |
| 385 | ''' |
| 386 | |
pingping-lin | d791d34 | 2015-09-17 18:34:31 -0700 | [diff] [blame] | 387 | |
pingping-lin | 8244a3b | 2015-09-16 13:36:56 -0700 | [diff] [blame] | 388 | def CASE8( self, main ): |
pingping-lin | d791d34 | 2015-09-17 18:34:31 -0700 | [diff] [blame] | 389 | ''' |
| 390 | Bring up the edge switch which was shut down in CASE7, |
| 391 | check P-2-P and M-2-S intents, ping test |
| 392 | ''' |
| 393 | import time |
| 394 | main.case( "This case is to start the switch which was shut down in CASE7,\ |
pingping-lin | 8244a3b | 2015-09-16 13:36:56 -0700 | [diff] [blame] | 395 | check P-2-P and M-2-S intents, ping test" ) |
pingping-lin | d791d34 | 2015-09-17 18:34:31 -0700 | [diff] [blame] | 396 | main.step( "Start sw32" ) |
| 397 | result1 = main.Mininet.switch( SW = "sw32", OPTION = "start" ) |
| 398 | result2 = main.Mininet.assignSwController( "sw32", ONOS1Ip ) |
| 399 | |
| 400 | if result1 and result2: |
| 401 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 402 | main.Functions.checkRouteNum( main, 3 ) |
| 403 | main.Functions.checkM2SintentNum( main, 3 ) |
| 404 | main.Functions.checkP2PintentNum( main, 18 ) |
| 405 | else: |
| 406 | main.log.info( "Start switch failed!!!" ) |
| 407 | main.cleanup() |
| 408 | main.exit(); |
pingping-lin | 4f80c49 | 2015-09-15 14:34:42 -0700 | [diff] [blame] | 409 | |
pingping-lin | 9563aec | 2015-09-16 17:20:07 -0700 | [diff] [blame] | 410 | |
| 411 | def CASE20( self, main ): |
| 412 | ''' |
| 413 | ping test from 3 bgp peers to BGP speaker |
| 414 | ''' |
| 415 | main.case( "This case is to check ping between BGP peers and speakers" ) |
| 416 | result1 = main.Mininet.pingHost( src = "speaker1", target = "peer64514" ) |
| 417 | result2 = main.Mininet.pingHost( src = "speaker1", target = "peer64515" ) |
| 418 | result3 = main.Mininet.pingHost( src = "speaker1", target = "peer64516" ) |
| 419 | |
| 420 | |
| 421 | caseResult = result1 or result2 or result3 |
| 422 | utilities.assert_equals( expect = main.FALSE, actual = caseResult, |
| 423 | onpass = "Speaker1 failed to ping all peers - Correct", |
| 424 | onfail = "Speaker1 did not fail to ping all peers- NOT Correct" ) |
| 425 | |
| 426 | if caseResult == main.TRUE: |
| 427 | main.cleanup() |
| 428 | main.exit() |
| 429 | |
| 430 | |
| 431 | def CASE21( self, main ): |
| 432 | ''' |
| 433 | Ping test in data plane for each route |
| 434 | ''' |
| 435 | main.case( "This case is to check ping for each route" ) |
| 436 | result1 = main.Mininet.pingHost( src = "host64514", target = "host64515" ) |
| 437 | result2 = main.Mininet.pingHost( src = "host64515", target = "host64516" ) |
| 438 | result3 = main.Mininet.pingHost( src = "host64514", target = "host64516" ) |
| 439 | |
| 440 | caseResult = result1 or result2 or result3 |
| 441 | utilities.assert_equals( expect = main.FALSE, actual = caseResult, |
| 442 | onpass = "Ping test for all routes failed- Correct", |
| 443 | onfail = "Ping test for all routes NOT failed- NOT Correct" ) |
| 444 | |
| 445 | if caseResult == main.TRUE: |
| 446 | main.cleanup() |
| 447 | main.exit() |
| 448 | |