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