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