pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 1 | # Testing the functionality of SDN-IP with single ONOS instance |
pingping-lin | 5bb663b | 2015-09-24 11:47:50 -0700 | [diff] [blame] | 2 | class USECASE_SdnipFunction: |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 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 | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 15 | main.log.case( "Setup the Mininet testbed" ) |
pingping-lin | b702c60 | 2015-09-10 17:00:29 -0700 | [diff] [blame] | 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 ) |
pingping-lin | b702c60 | 2015-09-10 17:00:29 -0700 | [diff] [blame] | 23 | utilities.assert_equals( expect = main.TRUE, |
pingping-lin | 5bb663b | 2015-09-24 11:47:50 -0700 | [diff] [blame] | 24 | actual = topoResult, |
pingping-lin | b702c60 | 2015-09-10 17:00:29 -0700 | [diff] [blame] | 25 | onpass = "Successfully loaded topology", |
| 26 | onfail = "Failed to load topology" ) |
| 27 | # Exit if topology did not load properly |
| 28 | if not topoResult: |
| 29 | main.cleanup() |
| 30 | main.exit() |
pingping-lin | 5bb663b | 2015-09-24 11:47:50 -0700 | [diff] [blame] | 31 | main.step( "Connect switches to controller" ) |
| 32 | |
| 33 | global ONOS1Ip |
| 34 | ONOS1Ip = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] ) |
| 35 | # connect all switches to controller |
| 36 | swResult = main.TRUE |
| 37 | for i in range ( 1, int( main.params['config']['switchNum'] ) + 1 ): |
| 38 | sw = "sw%s" % ( i ) |
| 39 | swResult = swResult and main.Mininet.assignSwController( sw, ONOS1Ip ) |
| 40 | # swResult = swResult and main.Mininet.assignSwController( sw, ONOS1Ip, port = "6633" ) |
| 41 | utilities.assert_equals( expect = main.TRUE, |
| 42 | actual = swResult, |
| 43 | onpass = "Successfully connect all switches to ONOS", |
| 44 | onfail = "Failed to connect all switches to ONOS" ) |
| 45 | if not swResult: |
| 46 | main.cleanup() |
| 47 | main.exit() |
| 48 | |
| 49 | main.step( "Set up tunnel from Mininet node to onos node" ) |
| 50 | forwarding1 = '%s:2000:%s:2000' % ( '1.1.1.2', ONOS1Ip ) |
| 51 | command = 'ssh -nNT -o "PasswordAuthentication no" \ |
| 52 | -o "StrictHostKeyChecking no" -l sdn -L %s %s & ' % ( forwarding1, ONOS1Ip ) |
| 53 | |
| 54 | tunnelResult = main.TRUE |
| 55 | tunnelResult = main.Mininet.node( "root", command ) |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 56 | utilities.assert_equals( expect = True, |
| 57 | actual = ( "PasswordAuthentication" in tunnelResult ), |
| 58 | onpass = "Created tunnel succeeded", |
| 59 | onfail = "Create tunnel failed" ) |
| 60 | if ("PasswordAuthentication" not in tunnelResult) : |
pingping-lin | 5bb663b | 2015-09-24 11:47:50 -0700 | [diff] [blame] | 61 | main.cleanup() |
| 62 | main.exit() |
pingping-lin | 5bb663b | 2015-09-24 11:47:50 -0700 | [diff] [blame] | 63 | |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 64 | |
| 65 | # This case is to setup ONOS |
pingping-lin | b702c60 | 2015-09-10 17:00:29 -0700 | [diff] [blame] | 66 | def CASE101( self, main ): |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 67 | """ |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 68 | Compile ONOS and install it |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 69 | Startup sequence: |
| 70 | cell <name> |
| 71 | onos-verify-cell |
| 72 | git pull |
| 73 | mvn clean install |
| 74 | onos-package |
| 75 | onos-install -f |
| 76 | onos-wait-for-start |
| 77 | """ |
| 78 | import json |
| 79 | import time |
| 80 | from operator import eq |
| 81 | |
| 82 | main.case( "Setting up test environment" ) |
| 83 | |
| 84 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 85 | |
| 86 | main.step( "Applying cell variable to environment" ) |
| 87 | cellResult = main.ONOSbench.setCell( cellName ) |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 88 | utilities.assert_equals( expect = main.TRUE, |
| 89 | actual = cellResult, |
| 90 | onpass = "Set cell succeeded", |
| 91 | onfail = "Set cell failed" ) |
| 92 | |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 93 | verifyResult = main.ONOSbench.verifyCell() |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 94 | utilities.assert_equals( expect = main.TRUE, |
| 95 | actual = verifyResult, |
| 96 | onpass = "Verify cell succeeded", |
| 97 | onfail = "Verify cell failed" ) |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 98 | |
| 99 | branchName = main.ONOSbench.getBranchName() |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 100 | main.log.report( "ONOS is on branch: " + branchName ) |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 101 | |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 102 | main.log.step( "Uninstalling ONOS" ) |
| 103 | uninstallResult = main.ONOSbench.onosUninstall( ONOS1Ip ) |
| 104 | utilities.assert_equals( expect = main.TRUE, |
| 105 | actual = uninstallResult, |
| 106 | onpass = "Uninstall ONOS succeeded", |
| 107 | onfail = "Uninstall ONOS failed" ) |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 108 | |
| 109 | main.step( "Git pull" ) |
| 110 | gitPullResult = main.ONOSbench.gitPull() |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 111 | main.log.info( "gitPullResult" ) |
| 112 | main.log.info( gitPullResult ) |
| 113 | gitPullResult2 = ( gitPullResult == main.TRUE ) or ( gitPullResult == 3 ) |
| 114 | utilities.assert_equals( expect = True, |
| 115 | actual = gitPullResult2, |
| 116 | onpass = "Git pull ONOS succeeded", |
| 117 | onfail = "Git pull ONOS failed" ) |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 118 | |
| 119 | main.step( "Using mvn clean install" ) |
| 120 | if gitPullResult == main.TRUE: |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 121 | mciResult = main.ONOSbench.cleanInstall( mciTimeout = 1000 ) |
| 122 | utilities.assert_equals( expect = main.TRUE, |
| 123 | actual = mciResult, |
| 124 | onpass = "Maven clean install ONOS succeeded", |
| 125 | onfail = "Maven clean install ONOS failed" ) |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 126 | else: |
| 127 | main.log.warn( "Did not pull new code so skipping mvn " + |
| 128 | "clean install" ) |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 129 | mciResult = main.TRUE |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 130 | |
| 131 | main.ONOSbench.getVersion( report = True ) |
| 132 | |
| 133 | main.step( "Creating ONOS package" ) |
| 134 | packageResult = main.ONOSbench.onosPackage( opTimeout = 500 ) |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 135 | utilities.assert_equals( expect = main.TRUE, |
| 136 | actual = packageResult, |
| 137 | onpass = "Package ONOS succeeded", |
| 138 | onfail = "Package ONOS failed" ) |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 139 | |
| 140 | main.step( "Installing ONOS package" ) |
| 141 | onos1InstallResult = main.ONOSbench.onosInstall( options = "-f", |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 142 | node = ONOS1Ip ) |
| 143 | utilities.assert_equals( expect = main.TRUE, |
| 144 | actual = onos1InstallResult, |
| 145 | onpass = "Install ONOS succeeded", |
| 146 | onfail = "Install ONOS failed" ) |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 147 | |
| 148 | main.step( "Checking if ONOS is up yet" ) |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 149 | onos1UpResult = main.ONOSbench.isup( ONOS1Ip, timeout = 420 ) |
| 150 | utilities.assert_equals( expect = main.TRUE, |
| 151 | actual = onos1UpResult, |
| 152 | onpass = "ONOS is up", |
| 153 | onfail = "ONOS is NOT up" ) |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 154 | |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 155 | main.step( "Checking if ONOS CLI is ready" ) |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 156 | cliResult = main.ONOScli.startOnosCli( ONOS1Ip, |
| 157 | commandlineTimeout = 100, onosStartTimeout = 600 ) |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 158 | utilities.assert_equals( expect = main.TRUE, |
| 159 | actual = cliResult, |
| 160 | onpass = "ONOS CLI is ready", |
| 161 | onfail = "ONOS CLI is NOT ready" ) |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 162 | |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 163 | caseResult = ( cellResult and verifyResult and |
| 164 | gitPullResult and mciResult and packageResult and |
| 165 | onos1InstallResult and onos1UpResult and cliResult ) |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 166 | |
pingping-lin | b702c60 | 2015-09-10 17:00:29 -0700 | [diff] [blame] | 167 | utilities.assert_equals( expect = main.TRUE, actual = caseResult, |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 168 | onpass = "ONOS startup successful", |
| 169 | onfail = "ONOS startup NOT successful" ) |
| 170 | |
pingping-lin | b702c60 | 2015-09-10 17:00:29 -0700 | [diff] [blame] | 171 | if caseResult == main.FALSE: |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 172 | main.cleanup() |
| 173 | main.exit() |
| 174 | |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 175 | main.log.info( "Get links in the network" ) |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 176 | listResult = main.ONOScli.links( jsonFormat = False ) |
| 177 | main.log.info( listResult ) |
pingping-lin | b702c60 | 2015-09-10 17:00:29 -0700 | [diff] [blame] | 178 | |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 179 | main.step( "Activate sdn-ip application" ) |
| 180 | activeSDNIPresult = main.ONOScli.activateApp( "org.onosproject.sdnip" ) |
| 181 | utilities.assert_equals( expect = main.TRUE, |
| 182 | actual = activeSDNIPresult, |
| 183 | onpass = "Activate SDN-IP succeeded", |
| 184 | onfail = "Activate SDN-IP failed" ) |
| 185 | |
| 186 | main.log.info( "Wait SDN-IP to finish installing connectivity intents \ |
pingping-lin | b702c60 | 2015-09-10 17:00:29 -0700 | [diff] [blame] | 187 | and the BGP paths in data plane are ready..." ) |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 188 | time.sleep( int( main.params[ 'timers' ][ 'SdnIpSetup' ] ) ) |
pingping-lin | b702c60 | 2015-09-10 17:00:29 -0700 | [diff] [blame] | 189 | main.log.info( "Wait Quagga to finish delivery all routes to each \ |
| 190 | other and to sdn-ip, plus finish installing all intents..." ) |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 191 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 192 | time.sleep( int( main.params[ 'timers' ][ 'PathAvailable' ] ) ) |
| 193 | |
| 194 | |
pingping-lin | 4f80c49 | 2015-09-15 14:34:42 -0700 | [diff] [blame] | 195 | def CASE102( self, main ): |
| 196 | ''' |
| 197 | This test case is to load the methods from other Python files. |
| 198 | ''' |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 199 | main.case( "Loading methods from other Python file" ) |
pingping-lin | 4f80c49 | 2015-09-15 14:34:42 -0700 | [diff] [blame] | 200 | # load the methods from other file |
| 201 | wrapperFile = main.params[ 'DEPENDENCY' ][ 'wrapper1' ] |
| 202 | main.Functions = imp.load_source( wrapperFile, |
| 203 | main.dependencyPath + |
| 204 | wrapperFile + |
| 205 | ".py" ) |
| 206 | |
| 207 | |
pingping-lin | 0ce6062 | 2015-09-10 14:37:33 -0700 | [diff] [blame] | 208 | def CASE1( self, main ): |
| 209 | ''' |
| 210 | ping test from 3 bgp peers to BGP speaker |
| 211 | ''' |
pingping-lin | 950b50d | 2015-09-14 12:00:08 -0700 | [diff] [blame] | 212 | |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 213 | main.case( "Ping tests between BGP peers and speakers" ) |
pingping-lin | 829428d | 2015-09-22 20:50:00 -0700 | [diff] [blame] | 214 | main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"], |
| 215 | peers = ["peer64514", "peer64515", "peer64516"], |
| 216 | expectAllSuccess = True ) |
pingping-lin | 0ce6062 | 2015-09-10 14:37:33 -0700 | [diff] [blame] | 217 | |
pingping-lin | 950b50d | 2015-09-14 12:00:08 -0700 | [diff] [blame] | 218 | |
pingping-lin | 0ce6062 | 2015-09-10 14:37:33 -0700 | [diff] [blame] | 219 | def CASE2( self, main ): |
| 220 | ''' |
| 221 | point-to-point intents test for each BGP peer and BGP speaker pair |
| 222 | ''' |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 223 | main.case( "Check point-to-point intents" ) |
pingping-lin | 0ce6062 | 2015-09-10 14:37:33 -0700 | [diff] [blame] | 224 | main.log.info( "There are %s BGP peers in total " |
| 225 | % main.params[ 'config' ][ 'peerNum' ] ) |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 226 | main.step( "Check P2P intents number from ONOS CLI" ) |
pingping-lin | 0ce6062 | 2015-09-10 14:37:33 -0700 | [diff] [blame] | 227 | |
| 228 | getIntentsResult = main.ONOScli.intents( jsonFormat = True ) |
| 229 | bgpIntentsActualNum = \ |
| 230 | main.QuaggaCliSpeaker1.extractActualBgpIntentNum( getIntentsResult ) |
| 231 | bgpIntentsExpectedNum = int( main.params[ 'config' ][ 'peerNum' ] ) * 6 |
| 232 | main.log.info( "bgpIntentsExpected num is:" ) |
| 233 | main.log.info( bgpIntentsExpectedNum ) |
| 234 | main.log.info( "bgpIntentsActual num is:" ) |
| 235 | main.log.info( bgpIntentsActualNum ) |
| 236 | utilities.assertEquals( \ |
| 237 | expect = True, |
| 238 | actual = eq( bgpIntentsExpectedNum, bgpIntentsActualNum ), |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 239 | onpass = "PointToPointIntent Intent Num is correct!", |
| 240 | onfail = "PointToPointIntent Intent Num is wrong!" ) |
pingping-lin | 0ce6062 | 2015-09-10 14:37:33 -0700 | [diff] [blame] | 241 | |
| 242 | |
| 243 | def CASE3( self, main ): |
| 244 | ''' |
| 245 | routes and intents check to all BGP peers |
| 246 | ''' |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 247 | main.case( "Check routes and M2S intents to all BGP peers" ) |
pingping-lin | 0ce6062 | 2015-09-10 14:37:33 -0700 | [diff] [blame] | 248 | |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 249 | allRoutesExpected = [] |
| 250 | allRoutesExpected.append( "4.0.0.0/24" + "/" + "10.0.4.1" ) |
| 251 | allRoutesExpected.append( "5.0.0.0/24" + "/" + "10.0.5.1" ) |
| 252 | allRoutesExpected.append( "6.0.0.0/24" + "/" + "10.0.6.1" ) |
| 253 | |
| 254 | getRoutesResult = main.ONOScli.routes( jsonFormat = True ) |
| 255 | allRoutesActual = \ |
| 256 | main.QuaggaCliSpeaker1.extractActualRoutesMaster( getRoutesResult ) |
| 257 | allRoutesStrExpected = str( sorted( allRoutesExpected ) ) |
| 258 | allRoutesStrActual = str( allRoutesActual ).replace( 'u', "" ) |
| 259 | |
| 260 | main.step( "Check routes installed" ) |
| 261 | main.log.info( "Routes expected:" ) |
| 262 | main.log.info( allRoutesStrExpected ) |
| 263 | main.log.info( "Routes get from ONOS CLI:" ) |
| 264 | main.log.info( allRoutesStrActual ) |
| 265 | utilities.assertEquals( \ |
| 266 | expect = allRoutesStrExpected, actual = allRoutesStrActual, |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 267 | onpass = "Routes are correct!", |
| 268 | onfail = "Routes are wrong!" ) |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 269 | |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 270 | main.step( "Check M2S intents installed" ) |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 271 | getIntentsResult = main.ONOScli.intents( jsonFormat = True ) |
| 272 | routeIntentsActualNum = \ |
| 273 | main.QuaggaCliSpeaker1.extractActualRouteIntentNum( getIntentsResult ) |
| 274 | routeIntentsExpectedNum = 3 |
| 275 | |
| 276 | main.log.info( "MultiPointToSinglePoint Intent Num expected is:" ) |
| 277 | main.log.info( routeIntentsExpectedNum ) |
| 278 | main.log.info( "MultiPointToSinglePoint Intent NUM Actual is:" ) |
| 279 | main.log.info( routeIntentsActualNum ) |
| 280 | utilities.assertEquals( \ |
| 281 | expect = True, |
| 282 | actual = eq( routeIntentsExpectedNum, routeIntentsActualNum ), |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 283 | onpass = "MultiPointToSinglePoint Intent Num is correct!", |
| 284 | onfail = "MultiPointToSinglePoint Intent Num is wrong!" ) |
pingping-lin | 28e7b21 | 2015-09-10 10:14:58 -0700 | [diff] [blame] | 285 | |
pingping-lin | bab7f8a | 2015-09-21 17:33:36 -0700 | [diff] [blame] | 286 | main.step( "Check whether all flow status are ADDED" ) |
| 287 | utilities.assertEquals( \ |
| 288 | expect = main.TRUE, |
| 289 | actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ), |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 290 | onpass = "Flow status is correct!", |
| 291 | onfail = "Flow status is wrong!" ) |
pingping-lin | bab7f8a | 2015-09-21 17:33:36 -0700 | [diff] [blame] | 292 | |
pingping-lin | 950b50d | 2015-09-14 12:00:08 -0700 | [diff] [blame] | 293 | |
| 294 | def CASE4( self, main ): |
| 295 | ''' |
| 296 | Ping test in data plane for each route |
| 297 | ''' |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 298 | main.case( "Ping test for each route, all hosts behind BGP peers" ) |
pingping-lin | 829428d | 2015-09-22 20:50:00 -0700 | [diff] [blame] | 299 | main.Functions.pingHostToHost( main, |
| 300 | hosts = ["host64514", "host64515", "host64516"], |
| 301 | expectAllSuccess = True ) |
pingping-lin | 4f80c49 | 2015-09-15 14:34:42 -0700 | [diff] [blame] | 302 | |
| 303 | |
| 304 | def CASE5( self, main ): |
| 305 | ''' |
| 306 | Cut links to peers one by one, check routes/intents |
| 307 | ''' |
| 308 | import time |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 309 | main.case( "Bring down links and check routes/intents" ) |
pingping-lin | 4f80c49 | 2015-09-15 14:34:42 -0700 | [diff] [blame] | 310 | main.step( "Bring down the link between sw32 and peer64514" ) |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 311 | linkResult1 = main.Mininet.link( END1 = "sw32", END2 = "peer64514", |
| 312 | OPTION = "down" ) |
| 313 | utilities.assertEquals( expect = main.TRUE, |
| 314 | actual = linkResult1, |
| 315 | onpass = "Bring down link succeeded!", |
| 316 | onfail = "Bring down link failed!" ) |
| 317 | |
| 318 | if linkResult1 == main.TRUE: |
pingping-lin | 4f80c49 | 2015-09-15 14:34:42 -0700 | [diff] [blame] | 319 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 320 | main.Functions.checkRouteNum( main, 2 ) |
| 321 | main.Functions.checkM2SintentNum( main, 2 ) |
| 322 | else: |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 323 | main.log.info( "Bring down link failed!" ) |
| 324 | main.cleanup() |
| 325 | main.exit() |
pingping-lin | 4f80c49 | 2015-09-15 14:34:42 -0700 | [diff] [blame] | 326 | |
| 327 | main.step( "Bring down the link between sw8 and peer64515" ) |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 328 | linkResult2 = main.Mininet.link( END1 = "sw8", END2 = "peer64515", |
| 329 | OPTION = "down" ) |
| 330 | utilities.assertEquals( expect = main.TRUE, |
| 331 | actual = linkResult2, |
| 332 | onpass = "Bring down link succeeded!", |
| 333 | onfail = "Bring down link failed!" ) |
| 334 | if linkResult2 == main.TRUE: |
pingping-lin | 4f80c49 | 2015-09-15 14:34:42 -0700 | [diff] [blame] | 335 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 336 | main.Functions.checkRouteNum( main, 1 ) |
| 337 | main.Functions.checkM2SintentNum( main, 1 ) |
| 338 | else: |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 339 | main.log.info( "Bring down link failed!" ) |
| 340 | main.cleanup() |
| 341 | main.exit() |
pingping-lin | 4f80c49 | 2015-09-15 14:34:42 -0700 | [diff] [blame] | 342 | |
| 343 | main.step( "Bring down the link between sw28 and peer64516" ) |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 344 | linkResult3 = main.Mininet.link( END1 = "sw28", END2 = "peer64516", |
| 345 | OPTION = "down" ) |
| 346 | utilities.assertEquals( expect = main.TRUE, |
| 347 | actual = linkResult3, |
| 348 | onpass = "Bring down link succeeded!", |
| 349 | onfail = "Bring down link failed!" ) |
| 350 | if linkResult3 == main.TRUE: |
pingping-lin | 4f80c49 | 2015-09-15 14:34:42 -0700 | [diff] [blame] | 351 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 352 | main.Functions.checkRouteNum( main, 0 ) |
| 353 | main.Functions.checkM2SintentNum( main, 0 ) |
| 354 | else: |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 355 | main.log.info( "Bring down link failed!" ) |
| 356 | main.cleanup() |
| 357 | main.exit() |
pingping-lin | 4f80c49 | 2015-09-15 14:34:42 -0700 | [diff] [blame] | 358 | |
pingping-lin | bab7f8a | 2015-09-21 17:33:36 -0700 | [diff] [blame] | 359 | main.step( "Check whether all flow status are ADDED" ) |
| 360 | utilities.assertEquals( \ |
| 361 | expect = main.TRUE, |
| 362 | actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ), |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 363 | onpass = "Flow status is correct!", |
| 364 | onfail = "Flow status is wrong!" ) |
pingping-lin | bab7f8a | 2015-09-21 17:33:36 -0700 | [diff] [blame] | 365 | |
pingping-lin | 829428d | 2015-09-22 20:50:00 -0700 | [diff] [blame] | 366 | # Ping test |
| 367 | main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"], |
| 368 | peers = ["peer64514", "peer64515", "peer64516"], |
| 369 | expectAllSuccess = False ) |
| 370 | main.Functions.pingHostToHost( main, |
| 371 | hosts = ["host64514", "host64515", "host64516"], |
| 372 | expectAllSuccess = False ) |
pingping-lin | 4f80c49 | 2015-09-15 14:34:42 -0700 | [diff] [blame] | 373 | |
pingping-lin | 829428d | 2015-09-22 20:50:00 -0700 | [diff] [blame] | 374 | |
| 375 | def CASE6( self, main ): |
pingping-lin | 4f80c49 | 2015-09-15 14:34:42 -0700 | [diff] [blame] | 376 | ''' |
| 377 | Recover links to peers one by one, check routes/intents |
| 378 | ''' |
| 379 | import time |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 380 | main.case( "Bring up links and check routes/intents" ) |
pingping-lin | 4f80c49 | 2015-09-15 14:34:42 -0700 | [diff] [blame] | 381 | main.step( "Bring up the link between sw32 and peer64514" ) |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 382 | linkResult1 = main.Mininet.link( END1 = "sw32", END2 = "peer64514", |
| 383 | OPTION = "up" ) |
| 384 | utilities.assertEquals( expect = main.TRUE, |
| 385 | actual = linkResult1, |
| 386 | onpass = "Bring up link succeeded!", |
| 387 | onfail = "Bring up link failed!" ) |
| 388 | if linkResult1 == main.TRUE: |
pingping-lin | 4f80c49 | 2015-09-15 14:34:42 -0700 | [diff] [blame] | 389 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 390 | main.Functions.checkRouteNum( main, 1 ) |
| 391 | main.Functions.checkM2SintentNum( main, 1 ) |
| 392 | else: |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 393 | main.log.info( "Bring up link failed!" ) |
| 394 | main.cleanup() |
| 395 | main.exit() |
pingping-lin | 4f80c49 | 2015-09-15 14:34:42 -0700 | [diff] [blame] | 396 | |
| 397 | main.step( "Bring up the link between sw8 and peer64515" ) |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 398 | linkResult2 = main.Mininet.link( END1 = "sw8", END2 = "peer64515", |
| 399 | OPTION = "up" ) |
| 400 | utilities.assertEquals( expect = main.TRUE, |
| 401 | actual = linkResult2, |
| 402 | onpass = "Bring up link succeeded!", |
| 403 | onfail = "Bring up link failed!" ) |
| 404 | if linkResult2 == main.TRUE: |
pingping-lin | 4f80c49 | 2015-09-15 14:34:42 -0700 | [diff] [blame] | 405 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 406 | main.Functions.checkRouteNum( main, 2 ) |
| 407 | main.Functions.checkM2SintentNum( main, 2 ) |
| 408 | else: |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 409 | main.log.info( "Bring up link failed!" ) |
| 410 | main.cleanup() |
| 411 | main.exit() |
pingping-lin | 4f80c49 | 2015-09-15 14:34:42 -0700 | [diff] [blame] | 412 | |
| 413 | main.step( "Bring up the link between sw28 and peer64516" ) |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 414 | linkResult3 = main.Mininet.link( END1 = "sw28", END2 = "peer64516", |
| 415 | OPTION = "up" ) |
| 416 | utilities.assertEquals( expect = main.TRUE, |
| 417 | actual = linkResult3, |
| 418 | onpass = "Bring up link succeeded!", |
| 419 | onfail = "Bring up link failed!" ) |
| 420 | if linkResult3 == main.TRUE: |
pingping-lin | 4f80c49 | 2015-09-15 14:34:42 -0700 | [diff] [blame] | 421 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 422 | main.Functions.checkRouteNum( main, 3 ) |
| 423 | main.Functions.checkM2SintentNum( main, 3 ) |
| 424 | else: |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 425 | main.log.info( "Bring up link failed!" ) |
| 426 | main.cleanup() |
| 427 | main.exit() |
pingping-lin | bab7f8a | 2015-09-21 17:33:36 -0700 | [diff] [blame] | 428 | |
| 429 | main.step( "Check whether all flow status are ADDED" ) |
| 430 | utilities.assertEquals( \ |
| 431 | expect = main.TRUE, |
| 432 | actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ), |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 433 | onpass = "Flow status is correct!", |
| 434 | onfail = "Flow status is wrong!" ) |
pingping-lin | 829428d | 2015-09-22 20:50:00 -0700 | [diff] [blame] | 435 | |
| 436 | # Ping test |
| 437 | main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"], |
| 438 | peers = ["peer64514", "peer64515", "peer64516"], |
| 439 | expectAllSuccess = True ) |
| 440 | main.Functions.pingHostToHost( main, |
| 441 | hosts = ["host64514", "host64515", "host64516"], |
| 442 | expectAllSuccess = True ) |
pingping-lin | 8244a3b | 2015-09-16 13:36:56 -0700 | [diff] [blame] | 443 | |
| 444 | |
pingping-lin | 829428d | 2015-09-22 20:50:00 -0700 | [diff] [blame] | 445 | def CASE7( self, main ): |
pingping-lin | 8244a3b | 2015-09-16 13:36:56 -0700 | [diff] [blame] | 446 | ''' |
pingping-lin | 829428d | 2015-09-22 20:50:00 -0700 | [diff] [blame] | 447 | Shut down a edge switch, check P-2-P and M-2-S intents, ping test |
pingping-lin | 8244a3b | 2015-09-16 13:36:56 -0700 | [diff] [blame] | 448 | ''' |
| 449 | import time |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 450 | main.case( "Stop edge sw32,check P-2-P and M-2-S intents, ping test" ) |
pingping-lin | 8244a3b | 2015-09-16 13:36:56 -0700 | [diff] [blame] | 451 | main.step( "Stop sw32" ) |
| 452 | result = main.Mininet.switch( SW = "sw32", OPTION = "stop" ) |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 453 | utilities.assertEquals( \ |
| 454 | expect = main.TRUE, |
| 455 | actual = result, |
| 456 | onpass = "Stopping switch succeeded!", |
| 457 | onfail = "Stopping switch failed!" ) |
| 458 | |
pingping-lin | 8244a3b | 2015-09-16 13:36:56 -0700 | [diff] [blame] | 459 | if result == main.TRUE: |
| 460 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 461 | main.Functions.checkRouteNum( main, 2 ) |
| 462 | main.Functions.checkM2SintentNum( main, 2 ) |
| 463 | main.Functions.checkP2PintentNum( main, 12 ) |
| 464 | else: |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 465 | main.log.info( "Stopping switch failed!" ) |
| 466 | main.cleanup() |
| 467 | main.exit() |
pingping-lin | 8244a3b | 2015-09-16 13:36:56 -0700 | [diff] [blame] | 468 | |
pingping-lin | 829428d | 2015-09-22 20:50:00 -0700 | [diff] [blame] | 469 | main.step( "Check ping between hosts behind BGP peers" ) |
| 470 | result1 = main.Mininet.pingHost( src = "host64514", target = "host64515" ) |
| 471 | result2 = main.Mininet.pingHost( src = "host64515", target = "host64516" ) |
| 472 | result3 = main.Mininet.pingHost( src = "host64514", target = "host64516" ) |
| 473 | |
| 474 | pingResult1 = ( result1 == main.FALSE ) and ( result2 == main.TRUE ) \ |
| 475 | and ( result3 == main.FALSE ) |
| 476 | utilities.assert_equals( expect = True, actual = pingResult1, |
| 477 | onpass = "Ping test result is correct", |
| 478 | onfail = "Ping test result is wrong" ) |
| 479 | |
| 480 | if pingResult1 == False: |
| 481 | main.cleanup() |
| 482 | main.exit() |
| 483 | |
| 484 | main.step( "Check ping between BGP peers and speakers" ) |
| 485 | result4 = main.Mininet.pingHost( src = "speaker1", target = "peer64514" ) |
| 486 | result5 = main.Mininet.pingHost( src = "speaker1", target = "peer64515" ) |
| 487 | result6 = main.Mininet.pingHost( src = "speaker1", target = "peer64516" ) |
| 488 | |
| 489 | pingResult2 = ( result4 == main.FALSE ) and ( result5 == main.TRUE ) \ |
| 490 | and ( result6 == main.TRUE ) |
| 491 | utilities.assert_equals( expect = True, actual = pingResult2, |
| 492 | onpass = "Speaker1 ping peers successful", |
| 493 | onfail = "Speaker1 ping peers NOT successful" ) |
| 494 | |
| 495 | if pingResult2 == False: |
| 496 | main.cleanup() |
| 497 | main.exit() |
| 498 | |
pingping-lin | bab7f8a | 2015-09-21 17:33:36 -0700 | [diff] [blame] | 499 | main.step( "Check whether all flow status are ADDED" ) |
| 500 | utilities.assertEquals( \ |
| 501 | expect = main.TRUE, |
| 502 | actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ), |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 503 | onpass = "Flow status is correct!", |
| 504 | onfail = "Flow status is wrong!" ) |
pingping-lin | 8244a3b | 2015-09-16 13:36:56 -0700 | [diff] [blame] | 505 | |
pingping-lin | d791d34 | 2015-09-17 18:34:31 -0700 | [diff] [blame] | 506 | |
pingping-lin | 8244a3b | 2015-09-16 13:36:56 -0700 | [diff] [blame] | 507 | def CASE8( self, main ): |
pingping-lin | d791d34 | 2015-09-17 18:34:31 -0700 | [diff] [blame] | 508 | ''' |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 509 | Bring up the edge switch (sw32) which was shut down in CASE7, |
pingping-lin | d791d34 | 2015-09-17 18:34:31 -0700 | [diff] [blame] | 510 | check P-2-P and M-2-S intents, ping test |
| 511 | ''' |
| 512 | import time |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 513 | main.case( "Start the edge sw32, check P-2-P and M-2-S intents, ping test" ) |
pingping-lin | d791d34 | 2015-09-17 18:34:31 -0700 | [diff] [blame] | 514 | main.step( "Start sw32" ) |
| 515 | result1 = main.Mininet.switch( SW = "sw32", OPTION = "start" ) |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 516 | utilities.assertEquals( \ |
| 517 | expect = main.TRUE, |
| 518 | actual = result1, |
| 519 | onpass = "Starting switch succeeded!", |
| 520 | onfail = "Starting switch failed!" ) |
| 521 | |
pingping-lin | d791d34 | 2015-09-17 18:34:31 -0700 | [diff] [blame] | 522 | result2 = main.Mininet.assignSwController( "sw32", ONOS1Ip ) |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 523 | utilities.assertEquals( \ |
| 524 | expect = main.TRUE, |
| 525 | actual = result2, |
| 526 | onpass = "Connect switch to ONOS succeeded!", |
| 527 | onfail = "Connect switch to ONOS failed!" ) |
pingping-lin | d791d34 | 2015-09-17 18:34:31 -0700 | [diff] [blame] | 528 | |
| 529 | if result1 and result2: |
| 530 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 531 | main.Functions.checkRouteNum( main, 3 ) |
| 532 | main.Functions.checkM2SintentNum( main, 3 ) |
| 533 | main.Functions.checkP2PintentNum( main, 18 ) |
| 534 | else: |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 535 | main.log.info( "Starting switch failed!" ) |
pingping-lin | d791d34 | 2015-09-17 18:34:31 -0700 | [diff] [blame] | 536 | main.cleanup() |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 537 | main.exit() |
pingping-lin | 4f80c49 | 2015-09-15 14:34:42 -0700 | [diff] [blame] | 538 | |
pingping-lin | bab7f8a | 2015-09-21 17:33:36 -0700 | [diff] [blame] | 539 | main.step( "Check whether all flow status are ADDED" ) |
| 540 | utilities.assertEquals( \ |
| 541 | expect = main.TRUE, |
| 542 | actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ), |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 543 | onpass = "Flow status is correct!", |
| 544 | onfail = "Flow status is wrong!" ) |
pingping-lin | bab7f8a | 2015-09-21 17:33:36 -0700 | [diff] [blame] | 545 | |
pingping-lin | 829428d | 2015-09-22 20:50:00 -0700 | [diff] [blame] | 546 | # Ping test |
| 547 | main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"], |
| 548 | peers = ["peer64514", "peer64515", "peer64516"], |
| 549 | expectAllSuccess = True ) |
| 550 | main.Functions.pingHostToHost( main, |
| 551 | hosts = ["host64514", "host64515", "host64516"], |
| 552 | expectAllSuccess = True ) |
pingping-lin | bab7f8a | 2015-09-21 17:33:36 -0700 | [diff] [blame] | 553 | |
pingping-lin | 829428d | 2015-09-22 20:50:00 -0700 | [diff] [blame] | 554 | |
| 555 | def CASE9( self, main ): |
pingping-lin | bab7f8a | 2015-09-21 17:33:36 -0700 | [diff] [blame] | 556 | ''' |
| 557 | Bring down a switch in best path, check: |
| 558 | route number, P2P intent number, M2S intent number, ping test |
| 559 | ''' |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 560 | main.case( "Stop sw11 located in best path, \ |
pingping-lin | bab7f8a | 2015-09-21 17:33:36 -0700 | [diff] [blame] | 561 | check route number, P2P intent number, M2S intent number, ping test" ) |
| 562 | |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 563 | main.step( "Check the flow number correctness before stopping sw11" ) |
pingping-lin | bab7f8a | 2015-09-21 17:33:36 -0700 | [diff] [blame] | 564 | main.Functions.checkFlowNum( main, "sw11", 13 ) |
| 565 | main.Functions.checkFlowNum( main, "sw1", 3 ) |
| 566 | main.Functions.checkFlowNum( main, "sw7", 3 ) |
| 567 | main.log.info( main.Mininet.checkFlows( "sw11" ) ) |
| 568 | main.log.info( main.Mininet.checkFlows( "sw1" ) ) |
| 569 | main.log.info( main.Mininet.checkFlows( "sw7" ) ) |
| 570 | |
| 571 | main.step( "Stop sw11" ) |
| 572 | result = main.Mininet.switch( SW = "sw11", OPTION = "stop" ) |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 573 | utilities.assertEquals( \ |
| 574 | expect = main.TRUE, |
| 575 | actual = result, |
| 576 | onpass = "Stopping switch succeeded!", |
| 577 | onfail = "Stopping switch failed!" ) |
pingping-lin | bab7f8a | 2015-09-21 17:33:36 -0700 | [diff] [blame] | 578 | if result: |
| 579 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 580 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
pingping-lin | bab7f8a | 2015-09-21 17:33:36 -0700 | [diff] [blame] | 581 | main.Functions.checkRouteNum( main, 3 ) |
| 582 | main.Functions.checkM2SintentNum( main, 3 ) |
| 583 | main.Functions.checkP2PintentNum( main, 18 ) |
pingping-lin | bab7f8a | 2015-09-21 17:33:36 -0700 | [diff] [blame] | 584 | else: |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 585 | main.log.info( "Stopping switch failed!" ) |
pingping-lin | bab7f8a | 2015-09-21 17:33:36 -0700 | [diff] [blame] | 586 | main.cleanup() |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 587 | main.exit() |
pingping-lin | bab7f8a | 2015-09-21 17:33:36 -0700 | [diff] [blame] | 588 | |
| 589 | main.step( "Check whether all flow status are ADDED" ) |
| 590 | utilities.assertEquals( \ |
| 591 | expect = main.TRUE, |
| 592 | actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ), |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 593 | onpass = "Flow status is correct!", |
| 594 | onfail = "Flow status is wrong!" ) |
pingping-lin | 829428d | 2015-09-22 20:50:00 -0700 | [diff] [blame] | 595 | # Ping test |
| 596 | main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"], |
| 597 | peers = ["peer64514", "peer64515", "peer64516"], |
| 598 | expectAllSuccess = True ) |
| 599 | main.Functions.pingHostToHost( main, |
| 600 | hosts = ["host64514", "host64515", "host64516"], |
| 601 | expectAllSuccess = True ) |
pingping-lin | bab7f8a | 2015-09-21 17:33:36 -0700 | [diff] [blame] | 602 | |
| 603 | |
| 604 | def CASE10( self, main ): |
| 605 | ''' |
| 606 | Bring up the switch which was stopped in CASE9, check: |
| 607 | route number, P2P intent number, M2S intent number, ping test |
| 608 | ''' |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 609 | main.case( "Start sw11 which was stopped in CASE9, \ |
pingping-lin | bab7f8a | 2015-09-21 17:33:36 -0700 | [diff] [blame] | 610 | check route number, P2P intent number, M2S intent number, ping test" ) |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 611 | |
| 612 | main.step( "Check the flow status before starting sw11" ) |
| 613 | main.Functions.checkFlowNum( main, "sw1", 11 ) |
| 614 | main.Functions.checkFlowNum( main, "sw7", 5 ) |
| 615 | main.log.info( main.Mininet.checkFlows( "sw1" ) ) |
| 616 | main.log.info( main.Mininet.checkFlows( "sw7" ) ) |
| 617 | |
pingping-lin | bab7f8a | 2015-09-21 17:33:36 -0700 | [diff] [blame] | 618 | main.step( "Start sw11" ) |
pingping-lin | 0351dee | 2015-09-28 13:26:35 -0700 | [diff] [blame] | 619 | result1 = main.Mininet.switch( SW = "sw11", OPTION = "start" ) |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 620 | utilities.assertEquals( \ |
| 621 | expect = main.TRUE, |
| 622 | actual = result1, |
| 623 | onpass = "Starting switch succeeded!", |
| 624 | onfail = "Starting switch failed!" ) |
pingping-lin | 0351dee | 2015-09-28 13:26:35 -0700 | [diff] [blame] | 625 | result2 = main.Mininet.assignSwController( "sw11", ONOS1Ip ) |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 626 | utilities.assertEquals( \ |
| 627 | expect = main.TRUE, |
| 628 | actual = result2, |
| 629 | onpass = "Connect switch to ONOS succeeded!", |
| 630 | onfail = "Connect switch to ONOS failed!" ) |
pingping-lin | 0351dee | 2015-09-28 13:26:35 -0700 | [diff] [blame] | 631 | if result1 and result2: |
pingping-lin | bab7f8a | 2015-09-21 17:33:36 -0700 | [diff] [blame] | 632 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 633 | main.Functions.checkRouteNum( main, 3 ) |
| 634 | main.Functions.checkM2SintentNum( main, 3 ) |
| 635 | main.Functions.checkP2PintentNum( main, 18 ) |
| 636 | |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 637 | # log for debug |
pingping-lin | bab7f8a | 2015-09-21 17:33:36 -0700 | [diff] [blame] | 638 | main.log.info( main.Mininet.checkFlows( "sw11" ) ) |
| 639 | main.log.info( main.Mininet.checkFlows( "sw1" ) ) |
| 640 | main.log.info( main.Mininet.checkFlows( "sw7" ) ) |
| 641 | else: |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 642 | main.log.info( "Starting switch failed!" ) |
pingping-lin | bab7f8a | 2015-09-21 17:33:36 -0700 | [diff] [blame] | 643 | main.cleanup() |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 644 | main.exit() |
pingping-lin | bab7f8a | 2015-09-21 17:33:36 -0700 | [diff] [blame] | 645 | |
| 646 | main.step( "Check whether all flow status are ADDED" ) |
| 647 | utilities.assertEquals( \ |
| 648 | expect = main.TRUE, |
| 649 | actual = main.ONOScli.checkFlowsState( isPENDING_ADD = False ), |
pingping-lin | b3ebd3f | 2015-09-28 22:17:05 -0700 | [diff] [blame] | 650 | onpass = "Flow status is correct!", |
| 651 | onfail = "Flow status is wrong!" ) |
pingping-lin | 829428d | 2015-09-22 20:50:00 -0700 | [diff] [blame] | 652 | # Ping test |
| 653 | main.Functions.pingSpeakerToPeer( main, speakers = ["speaker1"], |
| 654 | peers = ["peer64514", "peer64515", "peer64516"], |
| 655 | expectAllSuccess = True ) |
| 656 | main.Functions.pingHostToHost( main, |
| 657 | hosts = ["host64514", "host64515", "host64516"], |
| 658 | expectAllSuccess = True ) |