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