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