Jeremy Ronquillo | b27ce4c | 2017-07-17 12:41:28 -0700 | [diff] [blame^] | 1 | """ |
| 2 | Copyright 2015 Open Networking Foundation (ONF) |
| 3 | |
| 4 | Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>, |
| 5 | the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>, |
| 6 | or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg> |
| 7 | |
| 8 | TestON is free software: you can redistribute it and/or modify |
| 9 | it under the terms of the GNU General Public License as published by |
| 10 | the Free Software Foundation, either version 2 of the License, or |
| 11 | (at your option) any later version. |
| 12 | |
| 13 | TestON is distributed in the hope that it will be useful, |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | GNU General Public License for more details. |
| 17 | |
| 18 | You should have received a copy of the GNU General Public License |
| 19 | along with TestON. If not, see <http://www.gnu.org/licenses/>. |
| 20 | """ |
| 21 | |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 22 | # Testing the functionality of SDN-IP with single ONOS instance |
| 23 | class USECASE_SdnipFunctionCluster: |
| 24 | |
| 25 | def __init__( self ): |
| 26 | self.default = '' |
| 27 | global branchName |
| 28 | |
| 29 | def CASE100( self, main ): |
| 30 | """ |
| 31 | Start mininet |
| 32 | """ |
| 33 | import imp |
Jon Hall | 362aa92 | 2016-03-31 09:39:26 -0700 | [diff] [blame] | 34 | main.case( "Setup the Mininet testbed" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 35 | main.dependencyPath = main.testDir + \ |
| 36 | main.params[ 'DEPENDENCY' ][ 'path' ] |
| 37 | main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ] |
| 38 | |
| 39 | main.step( "Starting Mininet Topology" ) |
| 40 | topology = main.dependencyPath + main.topology |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 41 | topoResult = main.Mininet.startNet( topoFile=topology ) |
| 42 | utilities.assert_equals( expect=main.TRUE, |
| 43 | actual=topoResult, |
| 44 | onpass="Successfully loaded topology", |
| 45 | onfail="Failed to load topology" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 46 | # Exit if topology did not load properly |
| 47 | if not topoResult: |
| 48 | main.cleanup() |
| 49 | main.exit() |
| 50 | main.step( "Connect switches to controllers" ) |
| 51 | |
| 52 | # connect all switches to controllers |
| 53 | swResult = main.TRUE |
| 54 | for i in range ( 1, int( main.params['config']['switchNum'] ) + 1 ): |
| 55 | sw = "sw%s" % ( i ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 56 | swResult = swResult and main.Mininet.assignSwController( sw, main.ONOSip ) |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 57 | utilities.assert_equals( expect=main.TRUE, |
| 58 | actual=swResult, |
| 59 | onpass="Successfully connect all switches to ONOS", |
| 60 | onfail="Failed to connect all switches to ONOS" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 61 | if not swResult: |
| 62 | main.cleanup() |
| 63 | main.exit() |
| 64 | |
| 65 | |
| 66 | def CASE101( self, main ): |
| 67 | """ |
| 68 | Package ONOS and install it |
| 69 | Startup sequence: |
| 70 | cell <name> |
| 71 | onos-verify-cell |
| 72 | onos-package |
| 73 | onos-install -f |
| 74 | onos-wait-for-start |
| 75 | """ |
| 76 | import json |
| 77 | import time |
| 78 | import os |
| 79 | from operator import eq |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 80 | global p64514 |
| 81 | global p64515 |
| 82 | global p64516 |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 83 | p64514 = main.params[ 'config' ][ 'p64514' ] |
| 84 | p64515 = main.params[ 'config' ][ 'p64515' ] |
| 85 | p64516 = main.params[ 'config' ][ 'p64516' ] |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 86 | |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 87 | try: |
| 88 | from tests.USECASE.dependencies.sdnipBaseFunction import SdnBase |
| 89 | except ImportError: |
| 90 | main.log.error( "sdnBase not found. exiting the test" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 91 | main.exit() |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 92 | try: |
| 93 | main.sdnBase |
| 94 | except ( NameError, AttributeError ): |
| 95 | main.sdnBase = SdnBase() |
| 96 | |
| 97 | main.sdnBase.initSetup() |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 98 | |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 99 | def CASE200( self, main ): |
| 100 | main.case( "Activate sdn-ip application" ) |
| 101 | main.log.info( "waiting link discovery......" ) |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 102 | time.sleep( int( main.params['timers']['TopoDiscovery'] ) ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 103 | |
Jon Hall | 362aa92 | 2016-03-31 09:39:26 -0700 | [diff] [blame] | 104 | main.step( "Get links in the network" ) |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 105 | summaryResult = main.ONOScli1.summary() |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 106 | linkNum = json.loads( summaryResult )[ "links" ] |
Jon Hall | 362aa92 | 2016-03-31 09:39:26 -0700 | [diff] [blame] | 107 | main.log.info( "Expected 100 links, actual number is: {}".format( linkNum ) ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 108 | if linkNum < 100: |
Jon Hall | 362aa92 | 2016-03-31 09:39:26 -0700 | [diff] [blame] | 109 | main.log.error( "Link number is wrong! Retrying..." ) |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 110 | time.sleep( int( main.params['timers']['TopoDiscovery'] ) ) |
Jon Hall | 362aa92 | 2016-03-31 09:39:26 -0700 | [diff] [blame] | 111 | summaryResult = main.ONOScli1.summary() |
| 112 | linkNum = json.loads( summaryResult )[ "links" ] |
| 113 | main.log.info( "Expected 100 links, actual number is: {}".format( linkNum ) ) |
| 114 | utilities.assert_equals( expect=100, |
| 115 | actual=linkNum, |
| 116 | onpass="ONOS correctly discovered all links", |
| 117 | onfail="ONOS Failed to discover all links" ) |
| 118 | if linkNum < 100: |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 119 | main.cleanup() |
| 120 | main.exit() |
| 121 | |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 122 | main.step( "Activate sdn-ip application" ) |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 123 | activeSDNIPresult = main.ONOScli1.activateApp( "org.onosproject.sdnip" ) |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 124 | utilities.assert_equals( expect=main.TRUE, |
| 125 | actual=activeSDNIPresult, |
| 126 | onpass="Activate SDN-IP succeeded", |
| 127 | onfail="Activate SDN-IP failed" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 128 | if not activeSDNIPresult: |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 129 | main.log.info( "Activate SDN-IP failed!" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 130 | main.cleanup() |
| 131 | main.exit() |
| 132 | |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 133 | def CASE102( self, main ): |
| 134 | ''' |
| 135 | This test case is to load the methods from other Python files, and create |
| 136 | tunnels from mininet host to onos nodes. |
| 137 | ''' |
| 138 | import time |
| 139 | main.case( "Load methods from other Python file and create tunnels" ) |
| 140 | # load the methods from other file |
| 141 | wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ] |
| 142 | main.Functions = imp.load_source( wrapperFile1, |
| 143 | main.dependencyPath + |
| 144 | wrapperFile1 + |
| 145 | ".py" ) |
| 146 | # Create tunnels |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 147 | for i in range ( len( main.ONOSip ) ): |
| 148 | main.Functions.setupTunnel( main, '1.1.1.' + str( ( i + 1 ) * 2 ), 2000, main.ONOSip[ i ], 2000 ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 149 | |
| 150 | main.log.info( "Wait SDN-IP to finish installing connectivity intents \ |
| 151 | and the BGP paths in data plane are ready..." ) |
| 152 | time.sleep( int( main.params[ 'timers' ][ 'SdnIpSetup' ] ) ) |
| 153 | |
| 154 | main.log.info( "Wait Quagga to finish delivery all routes to each \ |
| 155 | other and to sdn-ip, plus finish installing all intents..." ) |
| 156 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 157 | |
| 158 | def CASE1( self, main ): |
| 159 | ''' |
| 160 | ping test from 3 bgp peers to BGP speaker |
| 161 | ''' |
| 162 | |
Jon Hall | 362aa92 | 2016-03-31 09:39:26 -0700 | [diff] [blame] | 163 | main.case( "Ping between BGP peers and speakers" ) |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 164 | main.Functions.pingSpeakerToPeer( main, speakers=[ "spk1" ], |
| 165 | peers=[ "p64514", "p64515", "p64516" ], |
| 166 | expectAllSuccess=True ) |
| 167 | |
| 168 | main.Functions.pingSpeakerToPeer( main, speakers=["spk2"], |
| 169 | peers=[ p64514, p64515, p64516 ], |
| 170 | expectAllSuccess=True ) |
| 171 | |
| 172 | main.Functions.pingSpeakerToPeer( main, speakers=[ "spk3" ], |
| 173 | peers=[ "p64519", "p64520" ], |
| 174 | expectAllSuccess=True ) |
| 175 | |
| 176 | main.Functions.pingSpeakerToPeer( main, speakers=[ "spk4" ], |
| 177 | peers=[ "p64517", "p64518" ], |
| 178 | expectAllSuccess=True ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 179 | |
| 180 | def CASE2( self, main ): |
| 181 | ''' |
| 182 | point-to-point intents test for each BGP peer and BGP speaker pair |
| 183 | ''' |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 184 | main.sdnBase.pToPIntentTest( 12 ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 185 | |
| 186 | def CASE3( self, main ): |
| 187 | ''' |
| 188 | routes and intents check to all BGP peers |
| 189 | ''' |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 190 | import time |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 191 | main.case( "Check routes and M2S intents to all BGP peers" ) |
| 192 | |
Jon Hall | 362aa92 | 2016-03-31 09:39:26 -0700 | [diff] [blame] | 193 | main.step( "Check routes installed" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 194 | allRoutesExpected = [] |
| 195 | allRoutesExpected.append( "4.0.0.0/24" + "/" + "10.0.4.1" ) |
| 196 | allRoutesExpected.append( "5.0.0.0/24" + "/" + "10.0.5.1" ) |
| 197 | allRoutesExpected.append( "6.0.0.0/24" + "/" + "10.0.6.1" ) |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 198 | allRoutesExpected.append( "7.0.0.0/24" + "/" + "10.0.7.1" ) |
| 199 | allRoutesExpected.append( "8.0.0.0/24" + "/" + "10.0.8.1" ) |
| 200 | allRoutesExpected.append( "9.0.0.0/24" + "/" + "10.0.9.1" ) |
| 201 | allRoutesExpected.append( "20.0.0.0/24" + "/" + "10.0.20.1" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 202 | |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 203 | main.sdnBase.routeAndIntentCheck( allRoutesExpected, 7 ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 204 | |
| 205 | |
| 206 | def CASE4( self, main ): |
| 207 | ''' |
| 208 | Ping test in data plane for each route |
| 209 | ''' |
| 210 | main.case( "Ping test for each route, all hosts behind BGP peers" ) |
| 211 | main.Functions.pingHostToHost( main, |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 212 | hosts=["h64514", "h64515", "h64516"], |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 213 | expectAllSuccess=True ) |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 214 | main.Functions.pingHostToHost(main, |
| 215 | hosts=["h64517", "h64518"], |
| 216 | expectAllSuccess=True) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 217 | main.Functions.pingHostToHost( main, |
| 218 | hosts=[ "h64519", "h64520" ], |
| 219 | expectAllSuccess=True ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 220 | |
| 221 | def CASE5( self, main ): |
| 222 | ''' |
| 223 | Cut links to peers one by one, check routes/intents |
| 224 | ''' |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 225 | main.sdnBase.linkUpDownCheck( "p64514", "p64515", "p64516", |
| 226 | 6, 6, 5, 5, 4, 4, |
| 227 | "spk1", [ "h64514", "h64515", "h64516" ], |
| 228 | "down" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 229 | |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 230 | def CASE6( self, main ): |
| 231 | ''' |
| 232 | Recover links to peers one by one, check routes/intents |
| 233 | ''' |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 234 | main.sdnBase.linkUpDownCheck( "p64514", "p64515", "p64516", |
| 235 | 5, 5, 6, 6, 7, 7, |
| 236 | "spk1", [ "h64514", "h64515", "h64516" ], |
| 237 | "up" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 238 | |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 239 | def CASE7( self, main ): |
| 240 | ''' |
| 241 | Shut down a edge switch, check P-2-P and M-2-S intents, ping test |
| 242 | ''' |
| 243 | import time |
| 244 | main.case( "Stop edge sw32,check P-2-P and M-2-S intents, ping test" ) |
| 245 | main.step( "Stop sw32" ) |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 246 | result = main.Mininet.switch( SW="sw32", OPTION="stop" ) |
Jon Hall | 362aa92 | 2016-03-31 09:39:26 -0700 | [diff] [blame] | 247 | utilities.assert_equals( expect=main.TRUE, actual=result, |
| 248 | onpass="Stopping switch succeeded!", |
| 249 | onfail="Stopping switch failed!" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 250 | |
| 251 | if result == main.TRUE: |
| 252 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 253 | main.Functions.checkRouteNum( main, 6 ) |
| 254 | main.Functions.checkM2SintentNum( main, 6 ) |
| 255 | main.Functions.checkP2PintentNum( main, 48 ) #14 * 2 |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 256 | else: |
| 257 | main.log.error( "Stopping switch failed!" ) |
| 258 | main.cleanup() |
| 259 | main.exit() |
| 260 | |
| 261 | main.step( "Check ping between hosts behind BGP peers" ) |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 262 | result1 = main.Mininet.pingHost( src="h64514", target="h64515" ) |
| 263 | result2 = main.Mininet.pingHost( src="h64515", target="h64516" ) |
| 264 | result3 = main.Mininet.pingHost( src="h64514", target="h64516" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 265 | |
| 266 | pingResult1 = ( result1 == main.FALSE ) and ( result2 == main.TRUE ) \ |
| 267 | and ( result3 == main.FALSE ) |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 268 | utilities.assert_equals( expect=True, actual=pingResult1, |
| 269 | onpass="Ping test result is correct", |
| 270 | onfail="Ping test result is wrong" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 271 | |
| 272 | if pingResult1 == False: |
| 273 | main.cleanup() |
| 274 | main.exit() |
| 275 | |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 276 | main.step( "Check ping between BGP peers and spk1" ) |
| 277 | result4 = main.Mininet.pingHost( src="spk1", target="p64514" ) |
| 278 | result5 = main.Mininet.pingHost( src="spk1", target="p64515" ) |
| 279 | result6 = main.Mininet.pingHost( src="spk1", target="p64516" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 280 | |
| 281 | pingResult2 = ( result4 == main.FALSE ) and ( result5 == main.TRUE ) \ |
| 282 | and ( result6 == main.TRUE ) |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 283 | utilities.assert_equals( expect=True, actual=pingResult2, |
| 284 | onpass="Speaker1 ping peers successful", |
| 285 | onfail="Speaker1 ping peers NOT successful" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 286 | |
| 287 | if pingResult2 == False: |
| 288 | main.cleanup() |
| 289 | main.exit() |
| 290 | |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 291 | main.step( "Check ping between BGP peers and spk2" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 292 | # TODO |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 293 | result7 = main.Mininet.pingHost( src="spk2", target=p64514 ) |
| 294 | result8 = main.Mininet.pingHost( src="spk2", target=p64515 ) |
| 295 | result9 = main.Mininet.pingHost( src="spk2", target=p64516 ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 296 | |
| 297 | pingResult3 = ( result7 == main.FALSE ) and ( result8 == main.TRUE ) \ |
| 298 | and ( result9 == main.TRUE ) |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 299 | utilities.assert_equals( expect=True, actual=pingResult2, |
| 300 | onpass="Speaker2 ping peers successful", |
| 301 | onfail="Speaker2 ping peers NOT successful" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 302 | |
| 303 | if pingResult3 == False: |
| 304 | main.cleanup() |
| 305 | main.exit() |
| 306 | |
| 307 | main.step( "Check whether all flow status are ADDED" ) |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 308 | flowCheck = utilities.retry( main.ONOScli1.checkFlowsState, |
| 309 | main.FALSE, |
| 310 | kwargs={'isPENDING':False}, |
| 311 | attempts=10 ) |
Jon Hall | 362aa92 | 2016-03-31 09:39:26 -0700 | [diff] [blame] | 312 | utilities.assert_equals( expect=main.TRUE, |
| 313 | actual=flowCheck, |
| 314 | onpass="Flow status is correct!", |
| 315 | onfail="Flow status is wrong!" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 316 | |
| 317 | def CASE8( self, main ): |
| 318 | ''' |
| 319 | Bring up the edge switch (sw32) which was shut down in CASE7, |
| 320 | check P-2-P and M-2-S intents, ping test |
| 321 | ''' |
| 322 | import time |
| 323 | main.case( "Start the edge sw32, check P-2-P and M-2-S intents, ping test" ) |
| 324 | main.step( "Start sw32" ) |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 325 | result1 = main.Mininet.switch( SW="sw32", OPTION="start" ) |
Jon Hall | 362aa92 | 2016-03-31 09:39:26 -0700 | [diff] [blame] | 326 | utilities.assert_equals( expect=main.TRUE, |
| 327 | actual=result1, |
| 328 | onpass="Starting switch succeeded!", |
| 329 | onfail="Starting switch failed!" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 330 | |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 331 | result2 = main.Mininet.assignSwController( "sw32", main.ONOSip[ 0 ] ) |
Jon Hall | 362aa92 | 2016-03-31 09:39:26 -0700 | [diff] [blame] | 332 | utilities.assert_equals( expect=main.TRUE, |
| 333 | actual=result2, |
| 334 | onpass="Connect switch to ONOS succeeded!", |
| 335 | onfail="Connect switch to ONOS failed!" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 336 | |
| 337 | if result1 and result2: |
| 338 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 339 | main.Functions.checkRouteNum( main, 7 ) |
| 340 | main.Functions.checkM2SintentNum( main, 7 ) |
| 341 | main.Functions.checkP2PintentNum( main, 30 * 2 ) # 18*2 |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 342 | else: |
| 343 | main.log.error( "Starting switch failed!" ) |
| 344 | main.cleanup() |
| 345 | main.exit() |
| 346 | |
| 347 | main.step( "Check whether all flow status are ADDED" ) |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 348 | flowCheck = utilities.retry( main.ONOScli1.checkFlowsState, |
| 349 | main.FALSE, |
| 350 | kwargs={'isPENDING':False}, |
| 351 | attempts=10 ) |
Jon Hall | 362aa92 | 2016-03-31 09:39:26 -0700 | [diff] [blame] | 352 | utilities.assert_equals( expect=main.TRUE, |
| 353 | actual=flowCheck, |
| 354 | onpass="Flow status is correct!", |
| 355 | onfail="Flow status is wrong!" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 356 | |
| 357 | # Ping test |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 358 | main.Functions.pingSpeakerToPeer( main, speakers=[ "spk1" ], |
| 359 | peers=["p64514", "p64515", "p64516"], |
| 360 | expectAllSuccess=True ) |
| 361 | |
| 362 | main.Functions.pingSpeakerToPeer( main, speakers=[ "spk2" ], |
| 363 | peers=[ p64514, p64515, p64516 ], |
| 364 | expectAllSuccess=True ) |
| 365 | |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 366 | main.Functions.pingHostToHost( main, |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 367 | hosts=[ "h64514", "h64515", "h64516" ], |
| 368 | expectAllSuccess=True ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 369 | |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 370 | def CASE9( self, main ): |
| 371 | ''' |
| 372 | Bring down a switch in best path, check: |
| 373 | route number, P2P intent number, M2S intent number, ping test |
| 374 | ''' |
| 375 | main.case( "Stop sw11 located in best path, \ |
| 376 | check route number, P2P intent number, M2S intent number, ping test" ) |
| 377 | |
| 378 | main.log.info( "Check the flow number correctness before stopping sw11" ) |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 379 | main.Functions.checkFlowNum( main, "sw11", 49 ) |
| 380 | main.Functions.checkFlowNum( main, "sw1", 7 ) |
| 381 | main.Functions.checkFlowNum( main, "sw7", 34 ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 382 | main.log.info( main.Mininet.checkFlows( "sw11" ) ) |
| 383 | main.log.info( main.Mininet.checkFlows( "sw1" ) ) |
| 384 | main.log.info( main.Mininet.checkFlows( "sw7" ) ) |
| 385 | |
| 386 | main.step( "Stop sw11" ) |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 387 | result = main.Mininet.switch( SW="sw11", OPTION="stop" ) |
Jon Hall | 362aa92 | 2016-03-31 09:39:26 -0700 | [diff] [blame] | 388 | utilities.assert_equals( expect=main.TRUE, actual=result, |
| 389 | onpass="Stopping switch succeeded!", |
| 390 | onfail="Stopping switch failed!" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 391 | if result: |
| 392 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
| 393 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 394 | main.Functions.checkRouteNum( main, 7 ) |
| 395 | main.Functions.checkM2SintentNum( main, 7 ) |
| 396 | main.Functions.checkP2PintentNum( main, 30 * 2 ) #18 * 2 |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 397 | else: |
| 398 | main.log.error( "Stopping switch failed!" ) |
| 399 | main.cleanup() |
| 400 | main.exit() |
| 401 | |
| 402 | main.step( "Check whether all flow status are ADDED" ) |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 403 | flowCheck = utilities.retry( main.ONOScli1.checkFlowsState, |
| 404 | main.FALSE, |
| 405 | kwargs={'isPENDING':False}, |
| 406 | attempts=10 ) |
Jon Hall | 362aa92 | 2016-03-31 09:39:26 -0700 | [diff] [blame] | 407 | utilities.assert_equals( expect=main.TRUE, |
| 408 | actual=flowCheck, |
| 409 | onpass="Flow status is correct!", |
| 410 | onfail="Flow status is wrong!" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 411 | # Ping test |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 412 | main.Functions.pingSpeakerToPeer( main, speakers=["spk1"], |
| 413 | peers=["p64514", "p64515", "p64516"], |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 414 | expectAllSuccess=True ) |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 415 | main.Functions.pingSpeakerToPeer( main, speakers=["spk2"], |
| 416 | peers=[p64514, p64515, p64516], |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 417 | expectAllSuccess=True ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 418 | main.Functions.pingHostToHost( main, |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 419 | hosts=["h64514", "h64515", "h64516"], |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 420 | expectAllSuccess=True ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 421 | |
| 422 | |
| 423 | def CASE10( self, main ): |
| 424 | ''' |
| 425 | Bring up the switch which was stopped in CASE9, check: |
| 426 | route number, P2P intent number, M2S intent number, ping test |
| 427 | ''' |
| 428 | main.case( "Start sw11 which was stopped in CASE9, \ |
| 429 | check route number, P2P intent number, M2S intent number, ping test" ) |
| 430 | |
| 431 | main.log.info( "Check the flow status before starting sw11" ) |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 432 | main.Functions.checkFlowNum( main, "sw1", 36 ) |
| 433 | main.Functions.checkFlowNum( main, "sw7", 30 ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 434 | main.log.info( main.Mininet.checkFlows( "sw1" ) ) |
| 435 | main.log.info( main.Mininet.checkFlows( "sw7" ) ) |
| 436 | |
| 437 | main.step( "Start sw11" ) |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 438 | result1 = main.Mininet.switch( SW="sw11", OPTION="start" ) |
Jon Hall | 362aa92 | 2016-03-31 09:39:26 -0700 | [diff] [blame] | 439 | utilities.assert_equals( expect=main.TRUE, actual=result1, |
| 440 | onpass="Starting switch succeeded!", |
| 441 | onfail="Starting switch failed!" ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 442 | result2 = main.Mininet.assignSwController( "sw11", main.ONOSip[ 0 ] ) |
Jon Hall | 362aa92 | 2016-03-31 09:39:26 -0700 | [diff] [blame] | 443 | utilities.assert_equals( expect=main.TRUE, actual=result2, |
| 444 | onpass="Connect switch to ONOS succeeded!", |
| 445 | onfail="Connect switch to ONOS failed!" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 446 | if result1 and result2: |
| 447 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 448 | main.Functions.checkRouteNum( main, 7 ) |
| 449 | main.Functions.checkM2SintentNum( main, 7 ) |
| 450 | main.Functions.checkP2PintentNum( main, 30 * 2 ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 451 | |
| 452 | main.log.debug( main.Mininet.checkFlows( "sw11" ) ) |
| 453 | main.log.debug( main.Mininet.checkFlows( "sw1" ) ) |
| 454 | main.log.debug( main.Mininet.checkFlows( "sw7" ) ) |
| 455 | else: |
| 456 | main.log.error( "Starting switch failed!" ) |
| 457 | main.cleanup() |
| 458 | main.exit() |
| 459 | |
| 460 | main.step( "Check whether all flow status are ADDED" ) |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 461 | flowCheck = utilities.retry( main.ONOScli1.checkFlowsState, |
| 462 | main.FALSE, |
| 463 | kwargs={'isPENDING':False}, |
| 464 | attempts=10 ) |
Jon Hall | 362aa92 | 2016-03-31 09:39:26 -0700 | [diff] [blame] | 465 | utilities.assert_equals( expect=main.TRUE, |
| 466 | actual=flowCheck, |
| 467 | onpass="Flow status is correct!", |
| 468 | onfail="Flow status is wrong!" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 469 | # Ping test |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 470 | main.Functions.pingSpeakerToPeer( main, speakers=["spk1"], |
| 471 | peers=["p64514", "p64515", "p64516"], |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 472 | expectAllSuccess=True ) |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 473 | main.Functions.pingSpeakerToPeer( main, speakers=["spk2"], |
| 474 | peers=[p64514, p64515, p64516], |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 475 | expectAllSuccess=True ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 476 | main.Functions.pingHostToHost( main, |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 477 | hosts=["h64514", "h64515", "h64516"], |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 478 | expectAllSuccess=True ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 479 | |
| 480 | |
| 481 | def CASE11(self, main): |
| 482 | import time |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 483 | main.case( "Kill spk1, check:\ |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 484 | route number, P2P intent number, M2S intent number, ping test" ) |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 485 | main.log.info( "Check network status before killing spk1" ) |
| 486 | main.Functions.checkRouteNum( main, 7 ) |
| 487 | main.Functions.checkM2SintentNum( main, 7 ) |
| 488 | main.Functions.checkP2PintentNum( main, 30 * 2 ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 489 | main.step( "Check whether all flow status are ADDED" ) |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 490 | flowCheck = utilities.retry( main.ONOScli1.checkFlowsState, |
| 491 | main.FALSE, |
| 492 | kwargs={'isPENDING':False}, |
| 493 | attempts=10 ) |
Jon Hall | 362aa92 | 2016-03-31 09:39:26 -0700 | [diff] [blame] | 494 | utilities.assert_equals( expect=main.TRUE, |
| 495 | actual=flowCheck, |
| 496 | onpass="Flow status is correct!", |
| 497 | onfail="Flow status is wrong!" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 498 | |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 499 | main.Functions.pingSpeakerToPeer( main, speakers=["spk1"], |
| 500 | peers=["p64514", "p64515", "p64516"], |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 501 | expectAllSuccess=True ) |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 502 | main.Functions.pingSpeakerToPeer( main, speakers=["spk2"], |
| 503 | peers=[p64514, p64515, p64516], |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 504 | expectAllSuccess=True ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 505 | main.Functions.pingHostToHost( main, |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 506 | hosts=["h64514", "h64515", "h64516"], |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 507 | expectAllSuccess=True ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 508 | |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 509 | main.step( "Kill spk1" ) |
pingping-lin | 145cd0a | 2015-10-09 17:44:34 -0700 | [diff] [blame] | 510 | command1 = "ps -e | grep bgp -c" |
| 511 | result1 = main.Mininet.node( "root", command1 ) |
| 512 | |
| 513 | # The total BGP daemon number in this test environment is 5. |
| 514 | if "5" in result1: |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 515 | main.log.debug( "Before kill spk1, 5 BGP daemons - correct" ) |
pingping-lin | 145cd0a | 2015-10-09 17:44:34 -0700 | [diff] [blame] | 516 | else: |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 517 | main.log.warn( "Before kill spk1, number of BGP daemons is wrong" ) |
pingping-lin | 145cd0a | 2015-10-09 17:44:34 -0700 | [diff] [blame] | 518 | main.log.info( result1 ) |
| 519 | |
| 520 | command2 = "sudo kill -9 `ps -ef | grep quagga-sdn.conf | grep -v grep | awk '{print $2}'`" |
| 521 | result2 = main.Mininet.node( "root", command2 ) |
| 522 | |
| 523 | result3 = main.Mininet.node( "root", command1 ) |
| 524 | |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 525 | utilities.assert_equals( expect=True, |
| 526 | actual=( "4" in result3 ), |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 527 | onpass="Kill spk1 succeeded", |
| 528 | onfail="Kill spk1 failed" ) |
pingping-lin | 145cd0a | 2015-10-09 17:44:34 -0700 | [diff] [blame] | 529 | if ( "4" not in result3 ) : |
| 530 | main.log.info( result3 ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 531 | main.cleanup() |
| 532 | main.exit() |
| 533 | |
| 534 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 535 | main.Functions.checkRouteNum( main, 7 ) |
| 536 | main.Functions.checkM2SintentNum( main, 7 ) |
| 537 | main.Functions.checkP2PintentNum( main, 30 * 2 ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 538 | |
| 539 | main.step( "Check whether all flow status are ADDED" ) |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 540 | flowCheck = utilities.retry( main.ONOScli1.checkFlowsState, |
| 541 | main.FALSE, |
| 542 | kwargs={'isPENDING':False}, |
| 543 | attempts=10 ) |
Jon Hall | 362aa92 | 2016-03-31 09:39:26 -0700 | [diff] [blame] | 544 | utilities.assert_equals( expect=main.TRUE, |
| 545 | actual=flowCheck, |
| 546 | onpass="Flow status is correct!", |
| 547 | onfail="Flow status is wrong!" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 548 | |
| 549 | ''' |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 550 | main.Functions.pingSpeakerToPeer( main, speakers=["spk1"], |
| 551 | peers=["p64514", "p64515", "p64516"], |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 552 | expectAllSuccess=False ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 553 | ''' |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 554 | main.Functions.pingSpeakerToPeer( main, speakers=["spk2"], |
| 555 | peers=[p64514, p64515, p64516], |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 556 | expectAllSuccess=True ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 557 | main.Functions.pingHostToHost( main, |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 558 | hosts=["h64514", "h64515", "h64516"], |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 559 | expectAllSuccess=True ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 560 | |
| 561 | |
| 562 | def CASE12( self, main ): |
| 563 | import time |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 564 | import json |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 565 | main.case( "Bring down leader ONOS node, check: \ |
| 566 | route number, P2P intent number, M2S intent number, ping test" ) |
| 567 | main.step( "Find out ONOS leader node" ) |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 568 | result = main.ONOScli1.leaders() |
pingping-lin | 3f932a7 | 2015-10-09 16:44:50 -0700 | [diff] [blame] | 569 | jsonResult = json.loads( result ) |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 570 | leaderIP = "" |
| 571 | for entry in jsonResult: |
| 572 | if entry["topic"] == "org.onosproject.sdnip": |
| 573 | leaderIP = entry["leader"] |
| 574 | main.log.info( "leaderIP is: " ) |
| 575 | main.log.info( leaderIP ) |
| 576 | |
| 577 | main.step( "Uninstall ONOS/SDN-IP leader node" ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 578 | for ip in main.ONOSip: |
| 579 | if leaderIP == ip: |
| 580 | uninstallResult = main.ONOSbench.onosStop( ip ) |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 581 | |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 582 | utilities.assert_equals( expect=main.TRUE, |
| 583 | actual=uninstallResult, |
| 584 | onpass="Uninstall ONOS leader succeeded", |
| 585 | onfail="Uninstall ONOS leader failed" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 586 | if uninstallResult != main.TRUE: |
| 587 | main.cleanup() |
| 588 | main.exit() |
| 589 | time.sleep( int( main.params[ 'timers' ][ 'RouteDelivery' ] ) ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 590 | |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 591 | if leaderIP == main.ONOSip[ 0 ]: |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 592 | main.Functions.checkRouteNum( main, 7, ONOScli="ONOScli2" ) |
| 593 | main.Functions.checkM2SintentNum( main, 7, ONOScli="ONOScli2" ) |
| 594 | main.Functions.checkP2PintentNum( main, 30 * 2, ONOScli="ONOScli2" ) |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 595 | |
| 596 | main.step( "Check whether all flow status are ADDED" ) |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 597 | flowCheck = utilities.retry( main.ONOScli1.checkFlowsState, |
| 598 | main.FALSE, |
| 599 | kwargs={'isPENDING':False}, |
| 600 | attempts=10 ) |
Jon Hall | 362aa92 | 2016-03-31 09:39:26 -0700 | [diff] [blame] | 601 | utilities.assert_equals( expect=main.TRUE, |
| 602 | actual=flowCheck, |
| 603 | onpass="Flow status is correct!", |
| 604 | onfail="Flow status is wrong!" ) |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 605 | else: |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 606 | main.Functions.checkRouteNum( main, 7 ) |
| 607 | main.Functions.checkM2SintentNum( main, 7 ) |
| 608 | main.Functions.checkP2PintentNum( main, 30 * 2 ) |
pingping-lin | a14c7c8 | 2015-10-09 15:44:36 -0700 | [diff] [blame] | 609 | |
| 610 | main.step( "Check whether all flow status are ADDED" ) |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 611 | flowCheck = utilities.retry( main.ONOScli1.checkFlowsState, |
| 612 | main.FALSE, |
| 613 | kwargs={'isPENDING':False}, |
| 614 | attempts=10 ) |
Jon Hall | 362aa92 | 2016-03-31 09:39:26 -0700 | [diff] [blame] | 615 | utilities.assert_equals( expect=main.TRUE, |
| 616 | actual=flowCheck, |
| 617 | onpass="Flow status is correct!", |
| 618 | onfail="Flow status is wrong!" ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 619 | |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 620 | main.Functions.pingSpeakerToPeer( main, speakers=["spk1"], |
| 621 | peers=["p64514", "p64515", "p64516"], |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 622 | expectAllSuccess=True ) |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 623 | main.Functions.pingSpeakerToPeer( main, speakers=["spk2"], |
| 624 | peers=[p64514, p64515, p64516], |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 625 | expectAllSuccess=True ) |
pingping-lin | ea32cf8 | 2015-10-08 22:37:37 -0700 | [diff] [blame] | 626 | main.Functions.pingHostToHost( main, |
alison | 62006dd | 2016-12-15 16:21:28 -0800 | [diff] [blame] | 627 | hosts=["h64514", "h64515", "h64516"], |
Jon Hall | 6e9897d | 2016-02-29 14:41:32 -0800 | [diff] [blame] | 628 | expectAllSuccess=True ) |