Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1 | import sys |
| 2 | import os |
| 3 | import re |
| 4 | import time |
| 5 | import json |
| 6 | import itertools |
| 7 | |
| 8 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 9 | class CHOtest: |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 10 | |
| 11 | def __init__( self ): |
| 12 | self.default = '' |
| 13 | |
| 14 | def CASE1( self, main ): |
| 15 | """ |
| 16 | Startup sequence: |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 17 | apply cell <name> |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 18 | git pull |
| 19 | mvn clean install |
| 20 | onos-package |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 21 | onos-verify-cell |
| 22 | onos-uninstall |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 23 | onos-install |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 24 | onos-start-cli |
| 25 | """ |
| 26 | import time |
| 27 | |
| 28 | global intentState |
| 29 | main.threadID = 0 |
| 30 | main.pingTimeout = 300 |
| 31 | main.numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ] |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 32 | git_pull = main.params[ 'GIT' ][ 'autoPull' ] |
| 33 | git_branch = main.params[ 'GIT' ][ 'branch' ] |
Hari Krishna | 1006577 | 2015-07-10 15:55:53 -0700 | [diff] [blame] | 34 | karafTimeout = main.params['CTRL']['karafCliTimeout'] |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 35 | main.checkIntentsDelay = int( main.params['timers']['CheckIntentDelay'] ) |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 36 | main.failSwitch = bool( main.params['TEST']['fail_switch'] ) |
| 37 | main.emailOnStop = bool( main.params['TEST']['email'] ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 38 | main.newTopo = "" |
| 39 | main.CLIs = [] |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 40 | |
| 41 | for i in range( 1, int(main.numCtrls) + 1 ): |
| 42 | main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 43 | |
| 44 | main.case( "Set up test environment" ) |
| 45 | main.log.report( "Set up test environment" ) |
| 46 | main.log.report( "_______________________" ) |
| 47 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 48 | main.step( "Apply Cell environment for ONOS" ) |
| 49 | if ( main.onoscell ): |
| 50 | cellName = main.onoscell |
| 51 | cell_result = main.ONOSbench.setCell( cellName ) |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 52 | utilities.assert_equals( expect=main.TRUE, actual=cell_result, |
| 53 | onpass="Test step PASS", |
| 54 | onfail="Test step FAIL" ) |
| 55 | else: |
| 56 | main.log.error( "Please provide onoscell option at TestON CLI to run CHO tests" ) |
| 57 | main.log.error( "Example: ~/TestON/bin/cli.py run OnosCHO onoscell <cellName>" ) |
| 58 | main.clean() |
| 59 | main.exit() |
| 60 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 61 | main.step( "Git checkout and pull " + git_branch ) |
| 62 | if git_pull == 'on': |
| 63 | checkout_result = main.ONOSbench.gitCheckout( git_branch ) |
| 64 | pull_result = main.ONOSbench.gitPull() |
| 65 | cp_result = ( checkout_result and pull_result ) |
| 66 | else: |
| 67 | checkout_result = main.TRUE |
| 68 | pull_result = main.TRUE |
| 69 | main.log.info( "Skipped git checkout and pull" ) |
| 70 | cp_result = ( checkout_result and pull_result ) |
| 71 | utilities.assert_equals( expect=main.TRUE, actual=cp_result, |
| 72 | onpass="Test step PASS", |
| 73 | onfail="Test step FAIL" ) |
| 74 | |
| 75 | main.step( "mvn clean & install" ) |
| 76 | if git_pull == 'on': |
| 77 | mvn_result = main.ONOSbench.cleanInstall() |
| 78 | utilities.assert_equals( expect=main.TRUE, actual=mvn_result, |
| 79 | onpass="Test step PASS", |
| 80 | onfail="Test step FAIL" ) |
| 81 | else: |
| 82 | mvn_result = main.TRUE |
| 83 | main.log.info("Skipped mvn clean install as git pull is disabled in params file") |
| 84 | |
| 85 | main.ONOSbench.getVersion( report=True ) |
| 86 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 87 | main.step( "Create ONOS package" ) |
| 88 | packageResult = main.ONOSbench.onosPackage() |
| 89 | utilities.assert_equals( expect=main.TRUE, actual=packageResult, |
| 90 | onpass="Test step PASS", |
| 91 | onfail="Test step FAIL" ) |
| 92 | |
| 93 | main.step( "Uninstall ONOS package on all Nodes" ) |
| 94 | uninstallResult = main.TRUE |
| 95 | for i in range( int( main.numCtrls ) ): |
| 96 | main.log.info( "Uninstalling package on ONOS Node IP: " + main.onosIPs[i] ) |
| 97 | u_result = main.ONOSbench.onosUninstall( main.onosIPs[i] ) |
| 98 | utilities.assert_equals( expect=main.TRUE, actual=u_result, |
| 99 | onpass="Test step PASS", |
| 100 | onfail="Test step FAIL" ) |
| 101 | uninstallResult = ( uninstallResult and u_result ) |
| 102 | |
| 103 | main.step( "Install ONOS package on all Nodes" ) |
| 104 | installResult = main.TRUE |
| 105 | for i in range( int( main.numCtrls ) ): |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 106 | main.log.info( "Installing package on ONOS Node IP: " + main.onosIPs[i] ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 107 | i_result = main.ONOSbench.onosInstall( node=main.onosIPs[i] ) |
| 108 | utilities.assert_equals( expect=main.TRUE, actual=i_result, |
| 109 | onpass="Test step PASS", |
| 110 | onfail="Test step FAIL" ) |
| 111 | installResult = ( installResult and i_result ) |
| 112 | |
| 113 | main.step( "Verify ONOS nodes UP status" ) |
| 114 | statusResult = main.TRUE |
| 115 | for i in range( int( main.numCtrls ) ): |
| 116 | main.log.info( "ONOS Node " + main.onosIPs[i] + " status:" ) |
| 117 | onos_status = main.ONOSbench.onosStatus( node=main.onosIPs[i] ) |
| 118 | utilities.assert_equals( expect=main.TRUE, actual=onos_status, |
| 119 | onpass="Test step PASS", |
| 120 | onfail="Test step FAIL" ) |
| 121 | statusResult = ( statusResult and onos_status ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 122 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 123 | main.step( "Start ONOS CLI on all nodes" ) |
| 124 | cliResult = main.TRUE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 125 | main.log.step(" Start ONOS cli using thread ") |
| 126 | startCliResult = main.TRUE |
| 127 | pool = [] |
| 128 | time1 = time.time() |
| 129 | for i in range( int( main.numCtrls) ): |
| 130 | t = main.Thread( target=main.CLIs[i].startOnosCli, |
| 131 | threadID=main.threadID, |
| 132 | name="startOnosCli", |
| 133 | args=[ main.onosIPs[i], karafTimeout ] ) |
| 134 | pool.append(t) |
| 135 | t.start() |
| 136 | main.threadID = main.threadID + 1 |
| 137 | for t in pool: |
| 138 | t.join() |
| 139 | startCliResult = startCliResult and t.result |
| 140 | time2 = time.time() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 141 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 142 | if not startCliResult: |
| 143 | main.log.info("ONOS CLI did not start up properly") |
| 144 | main.cleanup() |
| 145 | main.exit() |
| 146 | else: |
| 147 | main.log.info("Successful CLI startup") |
| 148 | startCliResult = main.TRUE |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 149 | |
| 150 | main.step( "Set IPv6 cfg parameters for Neighbor Discovery" ) |
| 151 | cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.proxyarp.ProxyArp", "ipv6NeighborDiscovery", "true" ) |
| 152 | cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "ipv6NeighborDiscovery", "true" ) |
| 153 | cfgResult = cfgResult1 and cfgResult2 |
| 154 | utilities.assert_equals( expect=main.TRUE, actual=cfgResult, |
| 155 | onpass="ipv6NeighborDiscovery cfg is set to true", |
| 156 | onfail="Failed to cfg set ipv6NeighborDiscovery" ) |
| 157 | |
| 158 | case1Result = installResult and uninstallResult and statusResult and startCliResult and cfgResult |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 159 | main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1)) |
| 160 | utilities.assert_equals( expect=main.TRUE, actual=case1Result, |
| 161 | onpass="Set up test environment PASS", |
| 162 | onfail="Set up test environment FAIL" ) |
| 163 | |
| 164 | def CASE20( self, main ): |
| 165 | """ |
| 166 | This test script Loads a new Topology (Att) on CHO setup and balances all switches |
| 167 | """ |
| 168 | import re |
| 169 | import time |
| 170 | import copy |
| 171 | |
| 172 | main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] ) |
| 173 | main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] ) |
| 174 | main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] ) |
| 175 | main.pingTimeout = 300 |
| 176 | main.log.report( |
| 177 | "Load Att topology and Balance all Mininet switches across controllers" ) |
| 178 | main.log.report( |
| 179 | "________________________________________________________________________" ) |
| 180 | main.case( |
| 181 | "Assign and Balance all Mininet switches across controllers" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 182 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 183 | main.step( "Stop any previous Mininet network topology" ) |
| 184 | cliResult = main.TRUE |
| 185 | if main.newTopo == main.params['TOPO3']['topo']: |
| 186 | stopStatus = main.Mininet1.stopNet( fileName = "topoSpine" ) |
| 187 | |
| 188 | main.step( "Start Mininet with Att topology" ) |
| 189 | main.newTopo = main.params['TOPO1']['topo'] |
GlennRC | c6cd2a6 | 2015-08-10 16:08:22 -0700 | [diff] [blame] | 190 | mininetDir = main.Mininet1.home + "/custom/" |
| 191 | topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo |
| 192 | main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to") |
| 193 | topoPath = mininetDir + main.newTopo |
| 194 | startStatus = main.Mininet1.startNet(topoFile = topoPath) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 195 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 196 | main.step( "Assign switches to controllers" ) |
| 197 | for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 ) |
| 198 | main.Mininet1.assignSwController( |
| 199 | sw="s" + str( i ), |
Hari Krishna | 1006577 | 2015-07-10 15:55:53 -0700 | [diff] [blame] | 200 | ip=main.onosIPs ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 201 | |
| 202 | switch_mastership = main.TRUE |
| 203 | for i in range( 1, ( main.numMNswitches + 1 ) ): |
| 204 | response = main.Mininet1.getSwController( "s" + str( i ) ) |
| 205 | print( "Response is " + str( response ) ) |
| 206 | if re.search( "tcp:" + main.onosIPs[0], response ): |
| 207 | switch_mastership = switch_mastership and main.TRUE |
| 208 | else: |
| 209 | switch_mastership = main.FALSE |
| 210 | |
| 211 | if switch_mastership == main.TRUE: |
| 212 | main.log.report( "Controller assignment successfull" ) |
| 213 | else: |
| 214 | main.log.report( "Controller assignment failed" ) |
| 215 | |
| 216 | time.sleep(30) # waiting here to make sure topology converges across all nodes |
| 217 | |
| 218 | main.step( "Balance devices across controllers" ) |
| 219 | balanceResult = main.ONOScli1.balanceMasters() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 220 | # giving some breathing time for ONOS to complete re-balance |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 221 | time.sleep( 5 ) |
| 222 | |
| 223 | topology_output = main.ONOScli1.topology() |
| 224 | topology_result = main.ONOSbench.getTopology( topology_output ) |
| 225 | case2Result = ( switch_mastership and startStatus ) |
| 226 | utilities.assert_equals( |
| 227 | expect=main.TRUE, |
| 228 | actual=case2Result, |
| 229 | onpass="Starting new Att topology test PASS", |
| 230 | onfail="Starting new Att topology test FAIL" ) |
| 231 | |
| 232 | def CASE21( self, main ): |
| 233 | """ |
| 234 | This test script Loads a new Topology (Chordal) on CHO setup and balances all switches |
| 235 | """ |
| 236 | import re |
| 237 | import time |
| 238 | import copy |
| 239 | |
| 240 | main.newTopo = main.params['TOPO2']['topo'] |
| 241 | main.numMNswitches = int ( main.params[ 'TOPO2' ][ 'numSwitches' ] ) |
| 242 | main.numMNlinks = int ( main.params[ 'TOPO2' ][ 'numLinks' ] ) |
| 243 | main.numMNhosts = int ( main.params[ 'TOPO2' ][ 'numHosts' ] ) |
| 244 | main.pingTimeout = 300 |
| 245 | main.log.report( |
| 246 | "Load Chordal topology and Balance all Mininet switches across controllers" ) |
| 247 | main.log.report( |
| 248 | "________________________________________________________________________" ) |
| 249 | main.case( |
| 250 | "Assign and Balance all Mininet switches across controllers" ) |
| 251 | |
| 252 | main.step( "Stop any previous Mininet network topology" ) |
| 253 | stopStatus = main.Mininet1.stopNet(fileName = "topoAtt" ) |
| 254 | |
GlennRC | c6cd2a6 | 2015-08-10 16:08:22 -0700 | [diff] [blame] | 255 | main.step("Start Mininet with Chordal topology") |
| 256 | mininetDir = main.Mininet1.home + "/custom/" |
| 257 | topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo |
| 258 | main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to") |
| 259 | topoPath = mininetDir + main.newTopo |
| 260 | startStatus = main.Mininet1.startNet(topoFile = topoPath) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 261 | |
| 262 | main.step( "Assign switches to controllers" ) |
| 263 | |
| 264 | for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 ) |
| 265 | main.Mininet1.assignSwController( |
| 266 | sw="s" + str( i ), |
Hari Krishna | 1006577 | 2015-07-10 15:55:53 -0700 | [diff] [blame] | 267 | ip=main.onosIPs ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 268 | |
| 269 | switch_mastership = main.TRUE |
| 270 | for i in range( 1, ( main.numMNswitches + 1 ) ): |
| 271 | response = main.Mininet1.getSwController( "s" + str( i ) ) |
| 272 | print( "Response is " + str( response ) ) |
| 273 | if re.search( "tcp:" + main.onosIPs[0], response ): |
| 274 | switch_mastership = switch_mastership and main.TRUE |
| 275 | else: |
| 276 | switch_mastership = main.FALSE |
| 277 | |
| 278 | if switch_mastership == main.TRUE: |
| 279 | main.log.report( "Controller assignment successfull" ) |
| 280 | else: |
| 281 | main.log.report( "Controller assignment failed" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 282 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 283 | main.step( "Balance devices across controllers" ) |
| 284 | balanceResult = main.ONOScli1.balanceMasters() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 285 | # giving some breathing time for ONOS to complete re-balance |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 286 | time.sleep( 5 ) |
| 287 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 288 | caseResult = switch_mastership |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 289 | time.sleep(30) |
| 290 | utilities.assert_equals( |
| 291 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 292 | actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 293 | onpass="Starting new Chordal topology test PASS", |
| 294 | onfail="Starting new Chordal topology test FAIL" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 295 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 296 | def CASE22( self, main ): |
| 297 | """ |
| 298 | This test script Loads a new Topology (Spine) on CHO setup and balances all switches |
| 299 | """ |
| 300 | import re |
| 301 | import time |
| 302 | import copy |
| 303 | |
| 304 | main.newTopo = main.params['TOPO3']['topo'] |
| 305 | main.numMNswitches = int ( main.params[ 'TOPO3' ][ 'numSwitches' ] ) |
| 306 | main.numMNlinks = int ( main.params[ 'TOPO3' ][ 'numLinks' ] ) |
| 307 | main.numMNhosts = int ( main.params[ 'TOPO3' ][ 'numHosts' ] ) |
| 308 | main.pingTimeout = 600 |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 309 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 310 | main.log.report( |
| 311 | "Load Spine and Leaf topology and Balance all Mininet switches across controllers" ) |
| 312 | main.log.report( |
| 313 | "________________________________________________________________________" ) |
| 314 | main.case( |
| 315 | "Assign and Balance all Mininet switches across controllers" ) |
| 316 | main.step( "Stop any previous Mininet network topology" ) |
| 317 | stopStatus = main.Mininet1.stopNet(fileName = "topoChordal" ) |
GlennRC | c6cd2a6 | 2015-08-10 16:08:22 -0700 | [diff] [blame] | 318 | |
| 319 | main.step("Start Mininet with Spine topology") |
| 320 | mininetDir = main.Mininet1.home + "/custom/" |
| 321 | topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo |
| 322 | main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to") |
| 323 | topoPath = mininetDir + main.newTopo |
| 324 | startStatus = main.Mininet1.startNet(topoFile = topoPath) |
| 325 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 326 | time.sleep(60) |
| 327 | main.step( "Assign switches to controllers" ) |
| 328 | |
| 329 | for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 ) |
| 330 | main.Mininet1.assignSwController( |
| 331 | sw="s" + str( i ), |
Hari Krishna | 1006577 | 2015-07-10 15:55:53 -0700 | [diff] [blame] | 332 | ip=main.onosIPs ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 333 | |
| 334 | switch_mastership = main.TRUE |
| 335 | for i in range( 1, ( main.numMNswitches + 1 ) ): |
| 336 | response = main.Mininet1.getSwController( "s" + str( i ) ) |
| 337 | print( "Response is " + str( response ) ) |
| 338 | if re.search( "tcp:" + main.onosIPs[0], response ): |
| 339 | switch_mastership = switch_mastership and main.TRUE |
| 340 | else: |
| 341 | switch_mastership = main.FALSE |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 342 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 343 | if switch_mastership == main.TRUE: |
| 344 | main.log.report( "Controller assignment successfull" ) |
| 345 | else: |
| 346 | main.log.report( "Controller assignment failed" ) |
| 347 | time.sleep( 5 ) |
| 348 | |
| 349 | main.step( "Balance devices across controllers" ) |
| 350 | for i in range( int( main.numCtrls ) ): |
| 351 | balanceResult = main.ONOScli1.balanceMasters() |
| 352 | # giving some breathing time for ONOS to complete re-balance |
| 353 | time.sleep( 3 ) |
| 354 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 355 | caseResult = switch_mastership |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 356 | time.sleep(60) |
| 357 | utilities.assert_equals( |
| 358 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 359 | actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 360 | onpass="Starting new Spine topology test PASS", |
| 361 | onfail="Starting new Spine topology test FAIL" ) |
| 362 | |
| 363 | def CASE3( self, main ): |
| 364 | """ |
| 365 | This Test case will be extended to collect and store more data related |
| 366 | ONOS state. |
| 367 | """ |
| 368 | import re |
| 369 | import copy |
| 370 | main.deviceDPIDs = [] |
| 371 | main.hostMACs = [] |
| 372 | main.deviceLinks = [] |
| 373 | main.deviceActiveLinksCount = [] |
| 374 | main.devicePortsEnabledCount = [] |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 375 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 376 | main.log.report( |
| 377 | "Collect and Store topology details from ONOS before running any Tests" ) |
| 378 | main.log.report( |
| 379 | "____________________________________________________________________" ) |
| 380 | main.case( "Collect and Store Topology Details from ONOS" ) |
| 381 | main.step( "Collect and store current number of switches and links" ) |
| 382 | topology_output = main.ONOScli1.topology() |
| 383 | topology_result = main.ONOSbench.getTopology( topology_output ) |
| 384 | numOnosDevices = topology_result[ 'devices' ] |
| 385 | numOnosLinks = topology_result[ 'links' ] |
| 386 | topoResult = main.TRUE |
| 387 | |
| 388 | if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks == int(numOnosLinks) ) ): |
| 389 | main.step( "Store Device DPIDs" ) |
| 390 | for i in range( 1, (main.numMNswitches+1) ): |
| 391 | main.deviceDPIDs.append( "of:00000000000000" + format( i, '02x' ) ) |
| 392 | print "Device DPIDs in Store: \n", str( main.deviceDPIDs ) |
| 393 | |
| 394 | main.step( "Store Host MACs" ) |
| 395 | for i in range( 1, ( main.numMNhosts + 1 ) ): |
| 396 | main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" ) |
| 397 | print "Host MACs in Store: \n", str( main.hostMACs ) |
| 398 | main.MACsDict = {} |
| 399 | print "Creating dictionary of DPID and HostMacs" |
| 400 | for i in range(len(main.hostMACs)): |
| 401 | main.MACsDict[main.deviceDPIDs[i]] = main.hostMACs[i].split('/')[0] |
| 402 | print main.MACsDict |
| 403 | main.step( "Collect and store all Devices Links" ) |
| 404 | linksResult = main.ONOScli1.links( jsonFormat=False ) |
| 405 | ansi_escape = re.compile( r'\x1b[^m]*m' ) |
| 406 | linksResult = ansi_escape.sub( '', linksResult ) |
| 407 | linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" ) |
| 408 | linksResult = linksResult.splitlines() |
| 409 | main.deviceLinks = copy.copy( linksResult ) |
| 410 | print "Device Links Stored: \n", str( main.deviceLinks ) |
| 411 | # this will be asserted to check with the params provided count of |
| 412 | # links |
| 413 | print "Length of Links Store", len( main.deviceLinks ) |
| 414 | |
| 415 | main.step( "Collect and store each Device ports enabled Count" ) |
| 416 | time1 = time.time() |
| 417 | for i in xrange(1,(main.numMNswitches + 1), int( main.numCtrls ) ): |
| 418 | pool = [] |
| 419 | for cli in main.CLIs: |
| 420 | if i >= main.numMNswitches + 1: |
| 421 | break |
| 422 | dpid = "of:00000000000000" + format( i,'02x' ) |
| 423 | t = main.Thread(target = cli.getDevicePortsEnabledCount,threadID = main.threadID, name = "getDevicePortsEnabledCount",args = [dpid]) |
| 424 | t.start() |
| 425 | pool.append(t) |
| 426 | i = i + 1 |
| 427 | main.threadID = main.threadID + 1 |
| 428 | for thread in pool: |
| 429 | thread.join() |
| 430 | portResult = thread.result |
| 431 | main.devicePortsEnabledCount.append( portResult ) |
| 432 | print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount ) |
| 433 | time2 = time.time() |
| 434 | main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1)) |
| 435 | |
| 436 | main.step( "Collect and store each Device active links Count" ) |
| 437 | time1 = time.time() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 438 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 439 | for i in xrange( 1,( main.numMNswitches + 1 ), int( main.numCtrls) ): |
| 440 | pool = [] |
| 441 | for cli in main.CLIs: |
| 442 | if i >= main.numMNswitches + 1: |
| 443 | break |
| 444 | dpid = "of:00000000000000" + format( i,'02x' ) |
| 445 | t = main.Thread( target = cli.getDeviceLinksActiveCount, |
| 446 | threadID = main.threadID, |
| 447 | name = "getDevicePortsEnabledCount", |
| 448 | args = [dpid]) |
| 449 | t.start() |
| 450 | pool.append(t) |
| 451 | i = i + 1 |
| 452 | main.threadID = main.threadID + 1 |
| 453 | for thread in pool: |
| 454 | thread.join() |
| 455 | linkCountResult = thread.result |
| 456 | main.deviceActiveLinksCount.append( linkCountResult ) |
| 457 | print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount ) |
| 458 | time2 = time.time() |
| 459 | main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1)) |
| 460 | |
| 461 | else: |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 462 | main.log.info("Devices (expected): %s, Links (expected): %s" % |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 463 | ( str( main.numMNswitches ), str( main.numMNlinks ) ) ) |
| 464 | main.log.info("Devices (actual): %s, Links (actual): %s" % |
| 465 | ( numOnosDevices , numOnosLinks ) ) |
| 466 | main.log.info("Topology does not match, exiting CHO test...") |
| 467 | topoResult = main.FALSE |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 468 | # It's better exit here from running the test |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 469 | main.cleanup() |
| 470 | main.exit() |
| 471 | |
| 472 | # just returning TRUE for now as this one just collects data |
| 473 | case3Result = topoResult |
| 474 | utilities.assert_equals( expect=main.TRUE, actual=case3Result, |
| 475 | onpass="Saving ONOS topology data test PASS", |
| 476 | onfail="Saving ONOS topology data test FAIL" ) |
| 477 | |
| 478 | def CASE40( self, main ): |
| 479 | """ |
| 480 | Verify Reactive forwarding (Att Topology) |
| 481 | """ |
| 482 | import re |
| 483 | import copy |
| 484 | import time |
| 485 | main.log.report( "Verify Reactive forwarding (Att Topology)" ) |
| 486 | main.log.report( "______________________________________________" ) |
| 487 | main.case( "Enable Reactive forwarding and Verify ping all" ) |
| 488 | main.step( "Enable Reactive forwarding" ) |
| 489 | installResult = main.TRUE |
| 490 | # Activate fwd app |
| 491 | appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" ) |
| 492 | appCheck = main.TRUE |
| 493 | pool = [] |
| 494 | for cli in main.CLIs: |
| 495 | t = main.Thread( target=cli.appToIDCheck, |
| 496 | name="appToIDCheck-" + str( i ), |
| 497 | args=[] ) |
| 498 | pool.append( t ) |
| 499 | t.start() |
| 500 | for t in pool: |
| 501 | t.join() |
| 502 | appCheck = appCheck and t.result |
| 503 | utilities.assert_equals( expect=main.TRUE, actual=appCheck, |
| 504 | onpass="App Ids seem to be correct", |
| 505 | onfail="Something is wrong with app Ids" ) |
| 506 | if appCheck != main.TRUE: |
| 507 | main.log.warn( main.CLIs[0].apps() ) |
| 508 | main.log.warn( main.CLIs[0].appIDs() ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 509 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 510 | time.sleep( 10 ) |
| 511 | |
| 512 | main.step( "Verify Pingall" ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 513 | pingResult = main.FALSE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 514 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 515 | pingResult = main.Mininet1.pingall( timeout=main.pingTimeout ) |
| 516 | if not pingResult: |
GlennRC | f07c44a | 2015-09-18 13:33:46 -0700 | [diff] [blame] | 517 | main.log.warn("First pingall failed. Trying again...") |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 518 | pingResult = main.Mininet1.pingall( timeout=main.pingTimeout) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 519 | time2 = time.time() |
| 520 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 521 | main.log.report( |
| 522 | "Time taken for Ping All: " + |
| 523 | str( timeDiff ) + |
| 524 | " seconds" ) |
| 525 | |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 526 | if pingResult == main.TRUE: |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 527 | main.log.report( "IPv4 Pingall Test in Reactive mode successful" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 528 | else: |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 529 | main.log.report( "IPv4 Pingall Test in Reactive mode failed" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 530 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 531 | caseResult = appCheck and pingResult |
| 532 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 533 | onpass="Reactive Mode IPv4 Pingall test PASS", |
| 534 | onfail="Reactive Mode IPv4 Pingall test FAIL" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 535 | |
| 536 | def CASE41( self, main ): |
| 537 | """ |
| 538 | Verify Reactive forwarding (Chordal Topology) |
| 539 | """ |
| 540 | import re |
| 541 | import copy |
| 542 | import time |
| 543 | main.log.report( "Verify Reactive forwarding (Chordal Topology)" ) |
| 544 | main.log.report( "______________________________________________" ) |
| 545 | main.case( "Enable Reactive forwarding and Verify ping all" ) |
| 546 | main.step( "Enable Reactive forwarding" ) |
| 547 | installResult = main.TRUE |
| 548 | # Activate fwd app |
| 549 | appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" ) |
| 550 | |
| 551 | appCheck = main.TRUE |
| 552 | pool = [] |
| 553 | for cli in main.CLIs: |
| 554 | t = main.Thread( target=cli.appToIDCheck, |
| 555 | name="appToIDCheck-" + str( i ), |
| 556 | args=[] ) |
| 557 | pool.append( t ) |
| 558 | t.start() |
| 559 | for t in pool: |
| 560 | t.join() |
| 561 | appCheck = appCheck and t.result |
| 562 | utilities.assert_equals( expect=main.TRUE, actual=appCheck, |
| 563 | onpass="App Ids seem to be correct", |
| 564 | onfail="Something is wrong with app Ids" ) |
| 565 | if appCheck != main.TRUE: |
| 566 | main.log.warn( main.CLIs[0].apps() ) |
| 567 | main.log.warn( main.CLIs[0].appIDs() ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 568 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 569 | time.sleep( 10 ) |
| 570 | |
| 571 | main.step( "Verify Pingall" ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 572 | pingResult = main.FALSE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 573 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 574 | pingResult = main.Mininet1.pingall( timeout=main.pingTimeout ) |
| 575 | if not pingResult: |
GlennRC | f07c44a | 2015-09-18 13:33:46 -0700 | [diff] [blame] | 576 | main.log.warn("First pingall failed. Trying again...") |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 577 | pingResult = main.Mininet1.pingall( timeout=main.pingTimeout ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 578 | time2 = time.time() |
| 579 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 580 | main.log.report( |
| 581 | "Time taken for Ping All: " + |
| 582 | str( timeDiff ) + |
| 583 | " seconds" ) |
| 584 | |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 585 | if pingResult == main.TRUE: |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 586 | main.log.report( "IPv4 Pingall Test in Reactive mode successful" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 587 | else: |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 588 | main.log.report( "IPv4 Pingall Test in Reactive mode failed" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 589 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 590 | caseResult = appCheck and pingResult |
| 591 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 592 | onpass="Reactive Mode IPv4 Pingall test PASS", |
| 593 | onfail="Reactive Mode IPv4 Pingall test FAIL" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 594 | |
| 595 | def CASE42( self, main ): |
| 596 | """ |
| 597 | Verify Reactive forwarding (Spine Topology) |
| 598 | """ |
| 599 | import re |
| 600 | import copy |
| 601 | import time |
| 602 | main.log.report( "Verify Reactive forwarding (Spine Topology)" ) |
| 603 | main.log.report( "______________________________________________" ) |
| 604 | main.case( "Enable Reactive forwarding and Verify ping all" ) |
| 605 | main.step( "Enable Reactive forwarding" ) |
| 606 | installResult = main.TRUE |
| 607 | # Activate fwd app |
| 608 | appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" ) |
| 609 | |
| 610 | appCheck = main.TRUE |
| 611 | pool = [] |
| 612 | for cli in main.CLIs: |
| 613 | t = main.Thread( target=cli.appToIDCheck, |
| 614 | name="appToIDCheck-" + str( i ), |
| 615 | args=[] ) |
| 616 | pool.append( t ) |
| 617 | t.start() |
| 618 | for t in pool: |
| 619 | t.join() |
| 620 | appCheck = appCheck and t.result |
| 621 | utilities.assert_equals( expect=main.TRUE, actual=appCheck, |
| 622 | onpass="App Ids seem to be correct", |
| 623 | onfail="Something is wrong with app Ids" ) |
| 624 | if appCheck != main.TRUE: |
| 625 | main.log.warn( main.CLIs[0].apps() ) |
| 626 | main.log.warn( main.CLIs[0].appIDs() ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 627 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 628 | time.sleep( 10 ) |
| 629 | |
| 630 | main.step( "Verify Pingall" ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 631 | pingResult = main.FALSE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 632 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 633 | pingResult = main.Mininet1.pingall( timeout=main.pingTimeout ) |
| 634 | if not pingResult: |
GlennRC | f07c44a | 2015-09-18 13:33:46 -0700 | [diff] [blame] | 635 | main.log.warn("First pingall failed. Trying again...") |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 636 | pingResult = main.Mininet1.pingall( timeout=main.pingTimeout ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 637 | time2 = time.time() |
| 638 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 639 | main.log.report( |
| 640 | "Time taken for Ping All: " + |
| 641 | str( timeDiff ) + |
| 642 | " seconds" ) |
| 643 | |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 644 | if pingResult == main.TRUE: |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 645 | main.log.report( "IPv4 Pingall Test in Reactive mode successful" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 646 | else: |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 647 | main.log.report( "IPv4 Pingall Test in Reactive mode failed" ) |
| 648 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 649 | caseResult = appCheck and pingResult |
| 650 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 651 | onpass="Reactive Mode IPv4 Pingall test PASS", |
| 652 | onfail="Reactive Mode IPv4 Pingall test FAIL" ) |
| 653 | |
| 654 | def CASE140( self, main ): |
| 655 | """ |
| 656 | Verify IPv6 Reactive forwarding (Att Topology) |
| 657 | """ |
| 658 | import re |
| 659 | import copy |
| 660 | import time |
| 661 | main.log.report( "Verify IPv6 Reactive forwarding (Att Topology)" ) |
| 662 | main.log.report( "______________________________________________" ) |
| 663 | main.case( "Enable IPv6 Reactive forwarding and Verify ping all" ) |
| 664 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 665 | |
| 666 | main.step( "Set IPv6 cfg parameters for Reactive forwarding" ) |
| 667 | cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" ) |
| 668 | cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" ) |
| 669 | cfgResult = cfgResult1 and cfgResult2 |
| 670 | utilities.assert_equals( expect=main.TRUE, actual=cfgResult, |
| 671 | onpass="Reactive mode ipv6Fowarding cfg is set to true", |
| 672 | onfail="Failed to cfg set Reactive mode ipv6Fowarding" ) |
| 673 | |
| 674 | main.step( "Verify IPv6 Pingall" ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 675 | pingResult = main.FALSE |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 676 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 677 | pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout) |
| 678 | if not pingResult: |
GlennRC | f07c44a | 2015-09-18 13:33:46 -0700 | [diff] [blame] | 679 | main.log.warn("First pingall failed. Trying again..") |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 680 | pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 681 | time2 = time.time() |
| 682 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 683 | main.log.report( |
| 684 | "Time taken for IPv6 Ping All: " + |
| 685 | str( timeDiff ) + |
| 686 | " seconds" ) |
| 687 | |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 688 | if pingResult == main.TRUE: |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 689 | main.log.report( "IPv6 Pingall Test in Reactive mode successful" ) |
| 690 | else: |
| 691 | main.log.report( "IPv6 Pingall Test in Reactive mode failed" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 692 | |
| 693 | main.step( "Disable Reactive forwarding" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 694 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 695 | main.log.info( "Uninstall reactive forwarding app" ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 696 | appCheck = main.TRUE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 697 | appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" ) |
| 698 | pool = [] |
| 699 | for cli in main.CLIs: |
| 700 | t = main.Thread( target=cli.appToIDCheck, |
| 701 | name="appToIDCheck-" + str( i ), |
| 702 | args=[] ) |
| 703 | pool.append( t ) |
| 704 | t.start() |
| 705 | |
| 706 | for t in pool: |
| 707 | t.join() |
| 708 | appCheck = appCheck and t.result |
| 709 | utilities.assert_equals( expect=main.TRUE, actual=appCheck, |
| 710 | onpass="App Ids seem to be correct", |
| 711 | onfail="Something is wrong with app Ids" ) |
| 712 | if appCheck != main.TRUE: |
| 713 | main.log.warn( main.CLIs[0].apps() ) |
| 714 | main.log.warn( main.CLIs[0].appIDs() ) |
| 715 | |
| 716 | # Waiting for reative flows to be cleared. |
| 717 | time.sleep( 30 ) |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 718 | caseResult = appCheck and cfgResult and pingResult |
| 719 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 720 | onpass="Reactive Mode IPv6 Pingall test PASS", |
| 721 | onfail="Reactive Mode IPv6 Pingall test FAIL" ) |
| 722 | |
| 723 | def CASE141( self, main ): |
| 724 | """ |
| 725 | Verify IPv6 Reactive forwarding (Chordal Topology) |
| 726 | """ |
| 727 | import re |
| 728 | import copy |
| 729 | import time |
| 730 | main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" ) |
| 731 | main.log.report( "______________________________________________" ) |
| 732 | main.case( "Enable IPv6 Reactive forwarding and Verify ping all" ) |
| 733 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 734 | |
| 735 | main.step( "Set IPv6 cfg parameters for Reactive forwarding" ) |
| 736 | cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" ) |
| 737 | cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" ) |
| 738 | cfgResult = cfgResult1 and cfgResult2 |
| 739 | utilities.assert_equals( expect=main.TRUE, actual=cfgResult, |
| 740 | onpass="Reactive mode ipv6Fowarding cfg is set to true", |
| 741 | onfail="Failed to cfg set Reactive mode ipv6Fowarding" ) |
| 742 | |
| 743 | main.step( "Verify IPv6 Pingall" ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 744 | pingResult = main.FALSE |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 745 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 746 | pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout) |
| 747 | if not pingResult: |
GlennRC | f07c44a | 2015-09-18 13:33:46 -0700 | [diff] [blame] | 748 | main.log.warn("First pingall failed. Trying again..") |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 749 | pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 750 | time2 = time.time() |
| 751 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 752 | main.log.report( |
| 753 | "Time taken for IPv6 Ping All: " + |
| 754 | str( timeDiff ) + |
| 755 | " seconds" ) |
| 756 | |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 757 | if pingResult == main.TRUE: |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 758 | main.log.report( "IPv6 Pingall Test in Reactive mode successful" ) |
| 759 | else: |
| 760 | main.log.report( "IPv6 Pingall Test in Reactive mode failed" ) |
| 761 | |
| 762 | main.step( "Disable Reactive forwarding" ) |
| 763 | |
| 764 | main.log.info( "Uninstall reactive forwarding app" ) |
| 765 | appCheck = main.TRUE |
| 766 | appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" ) |
| 767 | pool = [] |
| 768 | for cli in main.CLIs: |
| 769 | t = main.Thread( target=cli.appToIDCheck, |
| 770 | name="appToIDCheck-" + str( i ), |
| 771 | args=[] ) |
| 772 | pool.append( t ) |
| 773 | t.start() |
| 774 | |
| 775 | for t in pool: |
| 776 | t.join() |
| 777 | appCheck = appCheck and t.result |
| 778 | utilities.assert_equals( expect=main.TRUE, actual=appCheck, |
| 779 | onpass="App Ids seem to be correct", |
| 780 | onfail="Something is wrong with app Ids" ) |
| 781 | if appCheck != main.TRUE: |
| 782 | main.log.warn( main.CLIs[0].apps() ) |
| 783 | main.log.warn( main.CLIs[0].appIDs() ) |
| 784 | |
| 785 | # Waiting for reative flows to be cleared. |
| 786 | time.sleep( 30 ) |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 787 | caseResult = appCheck and cfgResult and pingResult |
| 788 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 789 | onpass="Reactive Mode IPv6 Pingall test PASS", |
| 790 | onfail="Reactive Mode IPv6 Pingall test FAIL" ) |
| 791 | |
| 792 | def CASE142( self, main ): |
| 793 | """ |
| 794 | Verify IPv6 Reactive forwarding (Spine Topology) |
| 795 | """ |
| 796 | import re |
| 797 | import copy |
| 798 | import time |
| 799 | main.log.report( "Verify IPv6 Reactive forwarding (Spine Topology)" ) |
| 800 | main.log.report( "______________________________________________" ) |
| 801 | main.case( "Enable IPv6 Reactive forwarding and Verify ping all" ) |
| 802 | # Spine topology do not have hosts h1-h10 |
| 803 | hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ] |
| 804 | main.step( "Set IPv6 cfg parameters for Reactive forwarding" ) |
| 805 | cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" ) |
| 806 | cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" ) |
| 807 | cfgResult = cfgResult1 and cfgResult2 |
| 808 | utilities.assert_equals( expect=main.TRUE, actual=cfgResult, |
| 809 | onpass="Reactive mode ipv6Fowarding cfg is set to true", |
| 810 | onfail="Failed to cfg set Reactive mode ipv6Fowarding" ) |
| 811 | |
| 812 | main.step( "Verify IPv6 Pingall" ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 813 | pingResult = main.FALSE |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 814 | time1 = time.time() |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 815 | ping_result = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout) |
| 816 | if not ping_result: |
| 817 | main.log.warn("First pingall failed. Trying again...") |
| 818 | ping_result = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 819 | time2 = time.time() |
| 820 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 821 | main.log.report( |
| 822 | "Time taken for IPv6 Ping All: " + |
| 823 | str( timeDiff ) + |
| 824 | " seconds" ) |
| 825 | |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 826 | if pingResult == main.TRUE: |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 827 | main.log.report( "IPv6 Pingall Test in Reactive mode successful" ) |
| 828 | else: |
| 829 | main.log.report( "IPv6 Pingall Test in Reactive mode failed" ) |
| 830 | |
| 831 | main.step( "Disable Reactive forwarding" ) |
| 832 | |
| 833 | main.log.info( "Uninstall reactive forwarding app" ) |
| 834 | appCheck = main.TRUE |
| 835 | appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" ) |
| 836 | pool = [] |
| 837 | for cli in main.CLIs: |
| 838 | t = main.Thread( target=cli.appToIDCheck, |
| 839 | name="appToIDCheck-" + str( i ), |
| 840 | args=[] ) |
| 841 | pool.append( t ) |
| 842 | t.start() |
| 843 | |
| 844 | for t in pool: |
| 845 | t.join() |
| 846 | appCheck = appCheck and t.result |
| 847 | utilities.assert_equals( expect=main.TRUE, actual=appCheck, |
| 848 | onpass="App Ids seem to be correct", |
| 849 | onfail="Something is wrong with app Ids" ) |
| 850 | if appCheck != main.TRUE: |
| 851 | main.log.warn( main.CLIs[0].apps() ) |
| 852 | main.log.warn( main.CLIs[0].appIDs() ) |
| 853 | |
| 854 | # Waiting for reative flows to be cleared. |
| 855 | time.sleep( 30 ) |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 856 | caseResult = appCheck and cfgResult and pingResult |
| 857 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 858 | onpass="Reactive Mode IPv6 Pingall test PASS", |
| 859 | onfail="Reactive Mode IPv6 Pingall test FAIL" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 860 | |
| 861 | def CASE5( self, main ): |
| 862 | """ |
| 863 | Compare current ONOS topology with reference data |
| 864 | """ |
| 865 | import re |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 866 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 867 | devicesDPIDTemp = [] |
| 868 | hostMACsTemp = [] |
| 869 | deviceLinksTemp = [] |
| 870 | deviceActiveLinksCountTemp = [] |
| 871 | devicePortsEnabledCountTemp = [] |
| 872 | |
| 873 | main.log.report( |
| 874 | "Compare ONOS topology with reference data in Stores" ) |
| 875 | main.log.report( "__________________________________________________" ) |
| 876 | main.case( "Compare ONOS topology with reference data" ) |
| 877 | |
| 878 | main.step( "Compare current Device ports enabled with reference" ) |
| 879 | time1 = time.time() |
| 880 | for i in xrange( 1,(main.numMNswitches + 1), int( main.numCtrls ) ): |
| 881 | pool = [] |
| 882 | for cli in main.CLIs: |
| 883 | if i >= main.numMNswitches + 1: |
| 884 | break |
| 885 | dpid = "of:00000000000000" + format( i,'02x' ) |
| 886 | t = main.Thread(target = cli.getDevicePortsEnabledCount, |
| 887 | threadID = main.threadID, |
| 888 | name = "getDevicePortsEnabledCount", |
| 889 | args = [dpid]) |
| 890 | t.start() |
| 891 | pool.append(t) |
| 892 | i = i + 1 |
| 893 | main.threadID = main.threadID + 1 |
| 894 | for thread in pool: |
| 895 | thread.join() |
| 896 | portResult = thread.result |
| 897 | #portTemp = re.split( r'\t+', portResult ) |
| 898 | #portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" ) |
| 899 | devicePortsEnabledCountTemp.append( portResult ) |
| 900 | |
| 901 | time2 = time.time() |
| 902 | main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1)) |
| 903 | main.log.info ( |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 904 | "Device Enabled ports EXPECTED: %s" % |
| 905 | str( main.devicePortsEnabledCount ) ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 906 | main.log.info ( |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 907 | "Device Enabled ports ACTUAL: %s" % |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 908 | str( devicePortsEnabledCountTemp ) ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 909 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 910 | if ( cmp( main.devicePortsEnabledCount, |
| 911 | devicePortsEnabledCountTemp ) == 0 ): |
| 912 | stepResult1 = main.TRUE |
| 913 | else: |
| 914 | stepResult1 = main.FALSE |
| 915 | |
| 916 | main.step( "Compare Device active links with reference" ) |
| 917 | time1 = time.time() |
| 918 | for i in xrange( 1, ( main.numMNswitches + 1) , int( main.numCtrls ) ): |
| 919 | pool = [] |
| 920 | for cli in main.CLIs: |
| 921 | if i >= main.numMNswitches + 1: |
| 922 | break |
| 923 | dpid = "of:00000000000000" + format( i,'02x' ) |
| 924 | t = main.Thread(target = cli.getDeviceLinksActiveCount, |
| 925 | threadID = main.threadID, |
| 926 | name = "getDeviceLinksActiveCount", |
| 927 | args = [dpid]) |
| 928 | t.start() |
| 929 | pool.append(t) |
| 930 | i = i + 1 |
| 931 | main.threadID = main.threadID + 1 |
| 932 | for thread in pool: |
| 933 | thread.join() |
| 934 | linkCountResult = thread.result |
| 935 | #linkCountTemp = re.split( r'\t+', linkCountResult ) |
| 936 | #linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" ) |
| 937 | deviceActiveLinksCountTemp.append( linkCountResult ) |
| 938 | |
| 939 | time2 = time.time() |
| 940 | main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1)) |
| 941 | main.log.info ( |
| 942 | "Device Active links EXPECTED: %s" % |
| 943 | str( main.deviceActiveLinksCount ) ) |
| 944 | main.log.info ( |
| 945 | "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) ) |
| 946 | if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ): |
| 947 | stepResult2 = main.TRUE |
| 948 | else: |
| 949 | stepResult2 = main.FALSE |
| 950 | |
| 951 | """ |
| 952 | place holder for comparing devices, hosts, paths and intents if required. |
| 953 | Links and ports data would be incorrect with out devices anyways. |
| 954 | """ |
| 955 | case5Result = ( stepResult1 and stepResult2 ) |
| 956 | utilities.assert_equals( expect=main.TRUE, actual=case5Result, |
| 957 | onpass="Compare Topology test PASS", |
| 958 | onfail="Compare Topology test FAIL" ) |
| 959 | |
| 960 | def CASE60( self ): |
| 961 | """ |
| 962 | Install 300 host intents and verify ping all (Att Topology) |
| 963 | """ |
| 964 | main.log.report( "Add 300 host intents and verify pingall (Att Topology)" ) |
| 965 | main.log.report( "_______________________________________" ) |
| 966 | import itertools |
| 967 | import time |
| 968 | main.case( "Install 300 host intents" ) |
| 969 | main.step( "Add host Intents" ) |
| 970 | intentResult = main.TRUE |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 971 | hostCombos = list( itertools.combinations( main.hostMACs, 2 ) ) |
| 972 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 973 | intentIdList = [] |
| 974 | time1 = time.time() |
| 975 | for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ): |
| 976 | pool = [] |
| 977 | for cli in main.CLIs: |
| 978 | if i >= len( hostCombos ): |
| 979 | break |
| 980 | t = main.Thread( target=cli.addHostIntent, |
| 981 | threadID=main.threadID, |
| 982 | name="addHostIntent", |
| 983 | args=[hostCombos[i][0],hostCombos[i][1]]) |
| 984 | pool.append(t) |
| 985 | t.start() |
| 986 | i = i + 1 |
| 987 | main.threadID = main.threadID + 1 |
| 988 | for thread in pool: |
| 989 | thread.join() |
| 990 | intentIdList.append(thread.result) |
| 991 | time2 = time.time() |
| 992 | main.log.info("Time for adding host intents: %2f seconds" %(time2-time1)) |
| 993 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 994 | # Saving intent ids to check intents in later cases |
| 995 | main.intentIds = list(intentIdList) |
| 996 | |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 997 | main.step("Verify intents are installed") |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 998 | |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 999 | # Giving onos 3 chances to install intents |
| 1000 | for i in range(3): |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 1001 | if i != 0: |
| 1002 | main.log.warn( "Verification failed. Retrying..." ) |
| 1003 | main.log.info("Waiting for onos to install intents...") |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1004 | time.sleep( main.checkIntentsDelay ) |
| 1005 | |
| 1006 | intentState = main.TRUE |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 1007 | for e in range(int(main.numCtrls)): |
| 1008 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 1009 | intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\ |
| 1010 | intentState |
| 1011 | if not intentState: |
| 1012 | main.log.warn( "Not all intents installed" ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1013 | if intentState: |
| 1014 | break |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 1015 | else: |
| 1016 | #Dumping intent summary |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1017 | main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) ) |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 1018 | |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1019 | |
| 1020 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 1021 | onpass="INTENTS INSTALLED", |
| 1022 | onfail="SOME INTENTS NOT INSTALLED" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1023 | |
| 1024 | main.step( "Verify Ping across all hosts" ) |
| 1025 | pingResult = main.FALSE |
| 1026 | time1 = time.time() |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1027 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout) |
| 1028 | if not pingResult: |
| 1029 | main.log.warn("First pingall failed. Retrying...") |
| 1030 | time1 = time.time() |
| 1031 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1032 | time2 = time.time() |
| 1033 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1034 | main.log.report( |
| 1035 | "Time taken for Ping All: " + |
| 1036 | str( timeDiff ) + |
| 1037 | " seconds" ) |
| 1038 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 1039 | onpass="PING ALL PASS", |
| 1040 | onfail="PING ALL FAIL" ) |
| 1041 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 1042 | caseResult = ( intentState and pingResult ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1043 | utilities.assert_equals( |
| 1044 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 1045 | actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1046 | onpass="Install 300 Host Intents and Ping All test PASS", |
| 1047 | onfail="Install 300 Host Intents and Ping All test FAIL" ) |
| 1048 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1049 | if not intentState: |
| 1050 | main.log.debug( "Intents failed to install completely" ) |
| 1051 | if not pingResult: |
| 1052 | main.log.debug( "Pingall failed" ) |
| 1053 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 1054 | if not caseResult and main.failSwitch: |
| 1055 | main.log.report("Stopping test") |
| 1056 | main.stop( email=main.emailOnStop ) |
| 1057 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1058 | def CASE61( self ): |
| 1059 | """ |
| 1060 | Install 600 host intents and verify ping all for Chordal Topology |
| 1061 | """ |
| 1062 | main.log.report( "Add 600 host intents and verify pingall (Chordal Topo)" ) |
| 1063 | main.log.report( "_______________________________________" ) |
| 1064 | import itertools |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1065 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1066 | main.case( "Install 600 host intents" ) |
| 1067 | main.step( "Add host Intents" ) |
| 1068 | intentResult = main.TRUE |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1069 | hostCombos = list( itertools.combinations( main.hostMACs, 2 ) ) |
| 1070 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1071 | intentIdList = [] |
| 1072 | time1 = time.time() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1073 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1074 | for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ): |
| 1075 | pool = [] |
| 1076 | for cli in main.CLIs: |
| 1077 | if i >= len( hostCombos ): |
| 1078 | break |
| 1079 | t = main.Thread( target=cli.addHostIntent, |
| 1080 | threadID=main.threadID, |
| 1081 | name="addHostIntent", |
| 1082 | args=[hostCombos[i][0],hostCombos[i][1]]) |
| 1083 | pool.append(t) |
| 1084 | t.start() |
| 1085 | i = i + 1 |
| 1086 | main.threadID = main.threadID + 1 |
| 1087 | for thread in pool: |
| 1088 | thread.join() |
| 1089 | intentIdList.append(thread.result) |
| 1090 | time2 = time.time() |
| 1091 | main.log.info("Time for adding host intents: %2f seconds" %(time2-time1)) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1092 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1093 | # Saving intent ids to check intents in later cases |
| 1094 | main.intentIds = list(intentIdList) |
| 1095 | |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1096 | main.step("Verify intents are installed") |
| 1097 | |
| 1098 | # Giving onos 3 chances to install intents |
| 1099 | for i in range(3): |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 1100 | if i != 0: |
| 1101 | main.log.warn( "Verification failed. Retrying..." ) |
| 1102 | main.log.info("Waiting for onos to install intents...") |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1103 | time.sleep( main.checkIntentsDelay ) |
| 1104 | |
| 1105 | intentState = main.TRUE |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 1106 | for e in range(int(main.numCtrls)): |
| 1107 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 1108 | intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\ |
| 1109 | intentState |
| 1110 | if not intentState: |
| 1111 | main.log.warn( "Not all intents installed" ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1112 | if intentState: |
| 1113 | break |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 1114 | else: |
| 1115 | #Dumping intent summary |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1116 | main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1117 | |
| 1118 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 1119 | onpass="INTENTS INSTALLED", |
| 1120 | onfail="SOME INTENTS NOT INSTALLED" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1121 | |
| 1122 | main.step( "Verify Ping across all hosts" ) |
| 1123 | pingResult = main.FALSE |
| 1124 | time1 = time.time() |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1125 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout) |
| 1126 | if not pingResult: |
| 1127 | main.log.warn("First pingall failed. Retrying...") |
| 1128 | time1 = time.time() |
| 1129 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1130 | time2 = time.time() |
| 1131 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1132 | main.log.report( |
| 1133 | "Time taken for Ping All: " + |
| 1134 | str( timeDiff ) + |
| 1135 | " seconds" ) |
| 1136 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 1137 | onpass="PING ALL PASS", |
| 1138 | onfail="PING ALL FAIL" ) |
| 1139 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 1140 | caseResult = ( intentState and pingResult ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1141 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1142 | utilities.assert_equals( |
| 1143 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 1144 | actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1145 | onpass="Install 300 Host Intents and Ping All test PASS", |
| 1146 | onfail="Install 300 Host Intents and Ping All test FAIL" ) |
| 1147 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1148 | if not intentState: |
| 1149 | main.log.debug( "Intents failed to install completely" ) |
| 1150 | if not pingResult: |
| 1151 | main.log.debug( "Pingall failed" ) |
| 1152 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 1153 | if not caseResult and main.failSwitch: |
| 1154 | main.log.report("Stopping test") |
| 1155 | main.stop( email=main.emailOnStop ) |
| 1156 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1157 | def CASE62( self ): |
| 1158 | """ |
| 1159 | Install 2278 host intents and verify ping all for Spine Topology |
| 1160 | """ |
| 1161 | main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" ) |
| 1162 | main.log.report( "_______________________________________" ) |
| 1163 | import itertools |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1164 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1165 | main.case( "Install 2278 host intents" ) |
| 1166 | main.step( "Add host Intents" ) |
| 1167 | intentResult = main.TRUE |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1168 | hostCombos = list( itertools.combinations( main.hostMACs, 2 ) ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1169 | main.pingTimeout = 300 |
| 1170 | intentIdList = [] |
| 1171 | time1 = time.time() |
| 1172 | for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ): |
| 1173 | pool = [] |
| 1174 | for cli in main.CLIs: |
| 1175 | if i >= len( hostCombos ): |
| 1176 | break |
| 1177 | t = main.Thread( target=cli.addHostIntent, |
| 1178 | threadID=main.threadID, |
| 1179 | name="addHostIntent", |
| 1180 | args=[hostCombos[i][0],hostCombos[i][1]]) |
| 1181 | pool.append(t) |
| 1182 | t.start() |
| 1183 | i = i + 1 |
| 1184 | main.threadID = main.threadID + 1 |
| 1185 | for thread in pool: |
| 1186 | thread.join() |
| 1187 | intentIdList.append(thread.result) |
| 1188 | time2 = time.time() |
| 1189 | main.log.info("Time for adding host intents: %2f seconds" %(time2-time1)) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1190 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1191 | # Saving intent ids to check intents in later cases |
| 1192 | main.intentIds = list(intentIdList) |
| 1193 | |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1194 | main.step("Verify intents are installed") |
| 1195 | |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 1196 | # Giving onos 3 chances to install intents |
| 1197 | for i in range(3): |
| 1198 | if i != 0: |
| 1199 | main.log.warn( "Verification failed. Retrying..." ) |
| 1200 | main.log.info("Waiting for onos to install intents...") |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1201 | time.sleep( main.checkIntentsDelay ) |
| 1202 | |
| 1203 | intentState = main.TRUE |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 1204 | for e in range(int(main.numCtrls)): |
| 1205 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 1206 | intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\ |
| 1207 | intentState |
| 1208 | if not intentState: |
| 1209 | main.log.warn( "Not all intents installed" ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1210 | if intentState: |
| 1211 | break |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 1212 | else: |
| 1213 | #Dumping intent summary |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1214 | main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1215 | |
| 1216 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 1217 | onpass="INTENTS INSTALLED", |
| 1218 | onfail="SOME INTENTS NOT INSTALLED" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1219 | |
| 1220 | main.step( "Verify Ping across all hosts" ) |
| 1221 | pingResult = main.FALSE |
| 1222 | time1 = time.time() |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1223 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout) |
| 1224 | if not pingResult: |
| 1225 | main.log.warn("First pingall failed. Retrying...") |
| 1226 | time1 = time.time() |
| 1227 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1228 | time2 = time.time() |
| 1229 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1230 | main.log.report( |
| 1231 | "Time taken for Ping All: " + |
| 1232 | str( timeDiff ) + |
| 1233 | " seconds" ) |
| 1234 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 1235 | onpass="PING ALL PASS", |
| 1236 | onfail="PING ALL FAIL" ) |
| 1237 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 1238 | caseResult = ( intentState and pingResult ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1239 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1240 | utilities.assert_equals( |
| 1241 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 1242 | actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1243 | onpass="Install 2278 Host Intents and Ping All test PASS", |
| 1244 | onfail="Install 2278 Host Intents and Ping All test FAIL" ) |
| 1245 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1246 | if not intentState: |
| 1247 | main.log.debug( "Intents failed to install completely" ) |
| 1248 | if not pingResult: |
| 1249 | main.log.debug( "Pingall failed" ) |
| 1250 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 1251 | if not caseResult and main.failSwitch: |
| 1252 | main.log.report("Stopping test") |
| 1253 | main.stop( email=main.emailOnStop ) |
| 1254 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 1255 | def CASE160( self ): |
| 1256 | """ |
| 1257 | Verify IPv6 ping across 300 host intents (Att Topology) |
| 1258 | """ |
| 1259 | main.log.report( "Verify IPv6 ping across 300 host intents (Att Topology)" ) |
| 1260 | main.log.report( "_________________________________________________" ) |
| 1261 | import itertools |
| 1262 | import time |
| 1263 | main.case( "IPv6 ping all 300 host intents" ) |
| 1264 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 1265 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 1266 | pingResult = main.FALSE |
| 1267 | time1 = time.time() |
| 1268 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 1269 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1270 | main.log.warn("First pingall failed. Retrying...") |
| 1271 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 1272 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 1273 | time2 = time.time() |
| 1274 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1275 | main.log.report( |
| 1276 | "Time taken for IPv6 Ping All: " + |
| 1277 | str( timeDiff ) + |
| 1278 | " seconds" ) |
| 1279 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 1280 | onpass="PING ALL PASS", |
| 1281 | onfail="PING ALL FAIL" ) |
| 1282 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 1283 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 1284 | utilities.assert_equals( |
| 1285 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 1286 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 1287 | onpass="IPv6 Ping across 300 host intents test PASS", |
| 1288 | onfail="IPv6 Ping across 300 host intents test FAIL" ) |
| 1289 | |
| 1290 | def CASE161( self ): |
| 1291 | """ |
| 1292 | Verify IPv6 ping across 600 host intents (Chordal Topology) |
| 1293 | """ |
| 1294 | main.log.report( "Verify IPv6 ping across 600 host intents (Chordal Topology)" ) |
| 1295 | main.log.report( "_________________________________________________" ) |
| 1296 | import itertools |
| 1297 | import time |
| 1298 | main.case( "IPv6 ping all 600 host intents" ) |
| 1299 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 1300 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 1301 | pingResult = main.FALSE |
| 1302 | time1 = time.time() |
| 1303 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 1304 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1305 | main.log.warn("First pingall failed. Retrying...") |
| 1306 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 1307 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1308 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 1309 | time2 = time.time() |
| 1310 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1311 | main.log.report( |
| 1312 | "Time taken for IPv6 Ping All: " + |
| 1313 | str( timeDiff ) + |
| 1314 | " seconds" ) |
| 1315 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 1316 | onpass="PING ALL PASS", |
| 1317 | onfail="PING ALL FAIL" ) |
| 1318 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 1319 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 1320 | utilities.assert_equals( |
| 1321 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 1322 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 1323 | onpass="IPv6 Ping across 600 host intents test PASS", |
| 1324 | onfail="IPv6 Ping across 600 host intents test FAIL" ) |
| 1325 | |
| 1326 | def CASE162( self ): |
| 1327 | """ |
| 1328 | Verify IPv6 ping across 2278 host intents (Spine Topology) |
| 1329 | """ |
| 1330 | main.log.report( "Verify IPv6 ping across 2278 host intents (Spine Topology)" ) |
| 1331 | main.log.report( "_________________________________________________" ) |
| 1332 | import itertools |
| 1333 | import time |
| 1334 | main.case( "IPv6 ping all 600 host intents" ) |
| 1335 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 1336 | hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ] |
| 1337 | pingResult = main.FALSE |
| 1338 | time1 = time.time() |
| 1339 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 1340 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1341 | main.log.warn("First pingall failed. Retrying...") |
| 1342 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 1343 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1344 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 1345 | time2 = time.time() |
| 1346 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1347 | main.log.report( |
| 1348 | "Time taken for IPv6 Ping All: " + |
| 1349 | str( timeDiff ) + |
| 1350 | " seconds" ) |
| 1351 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 1352 | onpass="PING ALL PASS", |
| 1353 | onfail="PING ALL FAIL" ) |
| 1354 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 1355 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 1356 | utilities.assert_equals( |
| 1357 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 1358 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 1359 | onpass="IPv6 Ping across 600 host intents test PASS", |
| 1360 | onfail="IPv6 Ping across 600 host intents test FAIL" ) |
| 1361 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1362 | def CASE70( self, main ): |
| 1363 | """ |
| 1364 | Randomly bring some core links down and verify ping all ( Host Intents-Att Topo) |
| 1365 | """ |
| 1366 | import random |
| 1367 | main.randomLink1 = [] |
| 1368 | main.randomLink2 = [] |
| 1369 | main.randomLink3 = [] |
| 1370 | link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ] |
| 1371 | link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' ) |
| 1372 | link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ] |
| 1373 | link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' ) |
| 1374 | link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ] |
| 1375 | link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' ) |
| 1376 | switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ] |
| 1377 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 1378 | |
| 1379 | main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" ) |
| 1380 | main.log.report( "___________________________________________________________________________" ) |
| 1381 | main.case( "Host intents - Randomly bring some core links down and verify ping all" ) |
| 1382 | main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" ) |
| 1383 | if ( int( switchLinksToToggle ) == |
| 1384 | 0 or int( switchLinksToToggle ) > 5 ): |
| 1385 | main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" ) |
| 1386 | #main.cleanup() |
| 1387 | #main.exit() |
| 1388 | else: |
| 1389 | main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" ) |
| 1390 | |
| 1391 | main.step( "Cut links on Core devices using user provided range" ) |
| 1392 | main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) ) |
| 1393 | main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) ) |
| 1394 | main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) ) |
| 1395 | for i in range( int( switchLinksToToggle ) ): |
| 1396 | main.Mininet1.link( |
| 1397 | END1=link1End1, |
| 1398 | END2=main.randomLink1[ i ], |
| 1399 | OPTION="down" ) |
| 1400 | time.sleep( link_sleep ) |
| 1401 | main.Mininet1.link( |
| 1402 | END1=link2End1, |
| 1403 | END2=main.randomLink2[ i ], |
| 1404 | OPTION="down" ) |
| 1405 | time.sleep( link_sleep ) |
| 1406 | main.Mininet1.link( |
| 1407 | END1=link3End1, |
| 1408 | END2=main.randomLink3[ i ], |
| 1409 | OPTION="down" ) |
| 1410 | time.sleep( link_sleep ) |
| 1411 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1412 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1413 | linkDown = main.ONOSbench.checkStatus( |
| 1414 | topology_output, main.numMNswitches, str( |
| 1415 | int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) ) |
| 1416 | utilities.assert_equals( |
| 1417 | expect=main.TRUE, |
| 1418 | actual=linkDown, |
| 1419 | onpass="Link Down discovered properly", |
| 1420 | onfail="Link down was not discovered in " + |
| 1421 | str( link_sleep ) + |
| 1422 | " seconds" ) |
| 1423 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1424 | main.step("Verify intents are installed") |
| 1425 | # Checking a maximum of 3 |
| 1426 | for i in range(3): |
| 1427 | if i != 0: |
| 1428 | main.log.warn( "Verification failed. Retrying..." ) |
| 1429 | main.log.info("Giving onos some time...") |
| 1430 | time.sleep( main.checkIntentsDelay ) |
| 1431 | |
| 1432 | intentState = main.TRUE |
| 1433 | for e in range(int(main.numCtrls)): |
| 1434 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 1435 | intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\ |
| 1436 | intentState |
| 1437 | if not intentState: |
| 1438 | main.log.warn( "Not all intents installed" ) |
| 1439 | if intentState: |
| 1440 | break |
| 1441 | else: |
| 1442 | #Dumping intent summary |
| 1443 | main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) ) |
| 1444 | |
| 1445 | |
| 1446 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 1447 | onpass="INTENTS INSTALLED", |
| 1448 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 1449 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1450 | main.step( "Verify Ping across all hosts" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1451 | pingResult = main.FALSE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1452 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1453 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
| 1454 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1455 | main.log.warn("First pingall failed. Retrying...") |
| 1456 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1457 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1458 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1459 | time2 = time.time() |
| 1460 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1461 | main.log.report( |
| 1462 | "Time taken for Ping All: " + |
| 1463 | str( timeDiff ) + |
| 1464 | " seconds" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1465 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1466 | onpass="PING ALL PASS", |
| 1467 | onfail="PING ALL FAIL" ) |
| 1468 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 1469 | caseResult = linkDown and pingResult and intentState |
| 1470 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1471 | onpass="Random Link cut Test PASS", |
| 1472 | onfail="Random Link cut Test FAIL" ) |
| 1473 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1474 | # Printing what exactly failed |
| 1475 | if not linkDown: |
| 1476 | main.log.debug( "Link down was not discovered correctly" ) |
| 1477 | if not pingResult: |
| 1478 | main.log.debug( "Pingall failed" ) |
| 1479 | if not intentState: |
| 1480 | main.log.debug( "Intents are not all installed" ) |
| 1481 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 1482 | if not caseResult and main.failSwitch: |
| 1483 | main.log.report("Stopping test") |
| 1484 | main.stop( email=main.emailOnStop ) |
| 1485 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1486 | def CASE80( self, main ): |
| 1487 | """ |
| 1488 | Bring the core links up that are down and verify ping all ( Host Intents-Att Topo ) |
| 1489 | """ |
| 1490 | import random |
| 1491 | link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ] |
| 1492 | link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ] |
| 1493 | link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ] |
| 1494 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 1495 | switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ] |
| 1496 | |
| 1497 | main.log.report( |
| 1498 | "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" ) |
| 1499 | main.log.report( |
| 1500 | "__________________________________________________________________" ) |
| 1501 | main.case( |
| 1502 | "Host intents - Bring the core links up that are down and verify ping all" ) |
| 1503 | main.step( "Bring randomly cut links on Core devices up" ) |
| 1504 | for i in range( int( switchLinksToToggle ) ): |
| 1505 | main.Mininet1.link( |
| 1506 | END1=link1End1, |
| 1507 | END2=main.randomLink1[ i ], |
| 1508 | OPTION="up" ) |
| 1509 | time.sleep( link_sleep ) |
| 1510 | main.Mininet1.link( |
| 1511 | END1=link2End1, |
| 1512 | END2=main.randomLink2[ i ], |
| 1513 | OPTION="up" ) |
| 1514 | time.sleep( link_sleep ) |
| 1515 | main.Mininet1.link( |
| 1516 | END1=link3End1, |
| 1517 | END2=main.randomLink3[ i ], |
| 1518 | OPTION="up" ) |
| 1519 | time.sleep( link_sleep ) |
| 1520 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1521 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1522 | linkUp = main.ONOSbench.checkStatus( |
| 1523 | topology_output, |
| 1524 | main.numMNswitches, |
| 1525 | str( main.numMNlinks ) ) |
| 1526 | utilities.assert_equals( |
| 1527 | expect=main.TRUE, |
| 1528 | actual=linkUp, |
| 1529 | onpass="Link up discovered properly", |
| 1530 | onfail="Link up was not discovered in " + |
| 1531 | str( link_sleep ) + |
| 1532 | " seconds" ) |
| 1533 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1534 | main.step("Verify intents are installed") |
| 1535 | # Checking a maximum of 3 |
| 1536 | for i in range(3): |
| 1537 | if i != 0: |
| 1538 | main.log.warn( "Verification failed. Retrying..." ) |
| 1539 | main.log.info("Giving onos some time...") |
| 1540 | time.sleep( main.checkIntentsDelay ) |
| 1541 | |
| 1542 | intentState = main.TRUE |
| 1543 | for e in range(int(main.numCtrls)): |
| 1544 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 1545 | intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\ |
| 1546 | intentState |
| 1547 | if not intentState: |
| 1548 | main.log.warn( "Not all intents installed" ) |
| 1549 | if intentState: |
| 1550 | break |
| 1551 | else: |
| 1552 | #Dumping intent summary |
| 1553 | main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) ) |
| 1554 | |
| 1555 | |
| 1556 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 1557 | onpass="INTENTS INSTALLED", |
| 1558 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 1559 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1560 | main.step( "Verify Ping across all hosts" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1561 | pingResult = main.FALSE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1562 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1563 | pingResult = main.Mininet1.pingall( timeout=main.pingTimeout ) |
| 1564 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1565 | main.log.warn("First pingall failed. Retrying...") |
| 1566 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1567 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1568 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1569 | time2 = time.time() |
| 1570 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1571 | main.log.report( |
| 1572 | "Time taken for Ping All: " + |
| 1573 | str( timeDiff ) + |
| 1574 | " seconds" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1575 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1576 | onpass="PING ALL PASS", |
| 1577 | onfail="PING ALL FAIL" ) |
| 1578 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 1579 | caseResult = linkUp and pingResult |
| 1580 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1581 | onpass="Link Up Test PASS", |
| 1582 | onfail="Link Up Test FAIL" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1583 | # Printing what exactly failed |
| 1584 | if not linkUp: |
| 1585 | main.log.debug( "Link down was not discovered correctly" ) |
| 1586 | if not pingResult: |
| 1587 | main.log.debug( "Pingall failed" ) |
| 1588 | if not intentState: |
| 1589 | main.log.debug( "Intents are not all installed" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1590 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 1591 | if not caseResult and main.failSwitch: |
| 1592 | main.log.report("Stopping test") |
| 1593 | main.stop( email=main.emailOnStop ) |
| 1594 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1595 | def CASE71( self, main ): |
| 1596 | """ |
| 1597 | Randomly bring some core links down and verify ping all ( Point Intents-Att Topo) |
| 1598 | """ |
| 1599 | import random |
| 1600 | main.randomLink1 = [] |
| 1601 | main.randomLink2 = [] |
| 1602 | main.randomLink3 = [] |
| 1603 | link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ] |
| 1604 | link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' ) |
| 1605 | link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ] |
| 1606 | link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' ) |
| 1607 | link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ] |
| 1608 | link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' ) |
| 1609 | switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ] |
| 1610 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 1611 | |
| 1612 | main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" ) |
| 1613 | main.log.report( "___________________________________________________________________________" ) |
| 1614 | main.case( "Point intents - Randomly bring some core links down and verify ping all" ) |
| 1615 | main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" ) |
| 1616 | if ( int( switchLinksToToggle ) == |
| 1617 | 0 or int( switchLinksToToggle ) > 5 ): |
| 1618 | main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" ) |
| 1619 | #main.cleanup() |
| 1620 | #main.exit() |
| 1621 | else: |
| 1622 | main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" ) |
| 1623 | |
| 1624 | main.step( "Cut links on Core devices using user provided range" ) |
| 1625 | main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) ) |
| 1626 | main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) ) |
| 1627 | main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) ) |
| 1628 | for i in range( int( switchLinksToToggle ) ): |
| 1629 | main.Mininet1.link( |
| 1630 | END1=link1End1, |
| 1631 | END2=main.randomLink1[ i ], |
| 1632 | OPTION="down" ) |
| 1633 | time.sleep( link_sleep ) |
| 1634 | main.Mininet1.link( |
| 1635 | END1=link2End1, |
| 1636 | END2=main.randomLink2[ i ], |
| 1637 | OPTION="down" ) |
| 1638 | time.sleep( link_sleep ) |
| 1639 | main.Mininet1.link( |
| 1640 | END1=link3End1, |
| 1641 | END2=main.randomLink3[ i ], |
| 1642 | OPTION="down" ) |
| 1643 | time.sleep( link_sleep ) |
| 1644 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1645 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1646 | linkDown = main.ONOSbench.checkStatus( |
| 1647 | topology_output, main.numMNswitches, str( |
| 1648 | int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) ) |
| 1649 | utilities.assert_equals( |
| 1650 | expect=main.TRUE, |
| 1651 | actual=linkDown, |
| 1652 | onpass="Link Down discovered properly", |
| 1653 | onfail="Link down was not discovered in " + |
| 1654 | str( link_sleep ) + |
| 1655 | " seconds" ) |
| 1656 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1657 | main.step("Verify intents are installed") |
| 1658 | # Checking a maximum of 3 |
| 1659 | for i in range(3): |
| 1660 | if i != 0: |
| 1661 | main.log.warn( "Verification failed. Retrying..." ) |
| 1662 | main.log.info("Giving onos some time...") |
| 1663 | time.sleep( main.checkIntentsDelay ) |
| 1664 | |
| 1665 | intentState = main.TRUE |
| 1666 | for e in range(int(main.numCtrls)): |
| 1667 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 1668 | intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\ |
| 1669 | intentState |
| 1670 | if not intentState: |
| 1671 | main.log.warn( "Not all intents installed" ) |
| 1672 | if intentState: |
| 1673 | break |
| 1674 | else: |
| 1675 | #Dumping intent summary |
| 1676 | main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) ) |
| 1677 | |
| 1678 | |
| 1679 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 1680 | onpass="INTENTS INSTALLED", |
| 1681 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 1682 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1683 | main.step( "Verify Ping across all hosts" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1684 | pingResult = main.FALSE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1685 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1686 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
| 1687 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1688 | main.log.warn("First pingall failed. Retrying...") |
| 1689 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1690 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1691 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1692 | time2 = time.time() |
| 1693 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1694 | main.log.report( |
| 1695 | "Time taken for Ping All: " + |
| 1696 | str( timeDiff ) + |
| 1697 | " seconds" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1698 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1699 | onpass="PING ALL PASS", |
| 1700 | onfail="PING ALL FAIL" ) |
| 1701 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 1702 | caseResult = linkDown and pingResult and intentState |
| 1703 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1704 | onpass="Random Link cut Test PASS", |
| 1705 | onfail="Random Link cut Test FAIL" ) |
| 1706 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1707 | # Printing what exactly failed |
| 1708 | if not linkDown: |
| 1709 | main.log.debug( "Link down was not discovered correctly" ) |
| 1710 | if not pingResult: |
| 1711 | main.log.debug( "Pingall failed" ) |
| 1712 | if not intentState: |
| 1713 | main.log.debug( "Intents are not all installed" ) |
| 1714 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 1715 | if not caseResult and main.failSwitch: |
| 1716 | main.log.report("Stopping test") |
| 1717 | main.stop( email=main.emailOnStop ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1718 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1719 | def CASE81( self, main ): |
| 1720 | """ |
| 1721 | Bring the core links up that are down and verify ping all ( Point Intents-Att Topo ) |
| 1722 | """ |
| 1723 | import random |
| 1724 | link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ] |
| 1725 | link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ] |
| 1726 | link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ] |
| 1727 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 1728 | switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ] |
| 1729 | |
| 1730 | main.log.report( |
| 1731 | "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" ) |
| 1732 | main.log.report( |
| 1733 | "__________________________________________________________________" ) |
| 1734 | main.case( |
| 1735 | "Point intents - Bring the core links up that are down and verify ping all" ) |
| 1736 | main.step( "Bring randomly cut links on Core devices up" ) |
| 1737 | for i in range( int( switchLinksToToggle ) ): |
| 1738 | main.Mininet1.link( |
| 1739 | END1=link1End1, |
| 1740 | END2=main.randomLink1[ i ], |
| 1741 | OPTION="up" ) |
| 1742 | time.sleep( link_sleep ) |
| 1743 | main.Mininet1.link( |
| 1744 | END1=link2End1, |
| 1745 | END2=main.randomLink2[ i ], |
| 1746 | OPTION="up" ) |
| 1747 | time.sleep( link_sleep ) |
| 1748 | main.Mininet1.link( |
| 1749 | END1=link3End1, |
| 1750 | END2=main.randomLink3[ i ], |
| 1751 | OPTION="up" ) |
| 1752 | time.sleep( link_sleep ) |
| 1753 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1754 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1755 | linkUp = main.ONOSbench.checkStatus( |
| 1756 | topology_output, |
| 1757 | main.numMNswitches, |
| 1758 | str( main.numMNlinks ) ) |
| 1759 | utilities.assert_equals( |
| 1760 | expect=main.TRUE, |
| 1761 | actual=linkUp, |
| 1762 | onpass="Link up discovered properly", |
| 1763 | onfail="Link up was not discovered in " + |
| 1764 | str( link_sleep ) + |
| 1765 | " seconds" ) |
| 1766 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1767 | main.step("Verify intents are installed") |
| 1768 | # Checking a maximum of 3 |
| 1769 | for i in range(3): |
| 1770 | if i != 0: |
| 1771 | main.log.warn( "Verification failed. Retrying..." ) |
| 1772 | main.log.info("Giving onos some time...") |
| 1773 | time.sleep( main.checkIntentsDelay ) |
| 1774 | |
| 1775 | intentState = main.TRUE |
| 1776 | for e in range(int(main.numCtrls)): |
| 1777 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 1778 | intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\ |
| 1779 | intentState |
| 1780 | if not intentState: |
| 1781 | main.log.warn( "Not all intents installed" ) |
| 1782 | if intentState: |
| 1783 | break |
| 1784 | else: |
| 1785 | #Dumping intent summary |
| 1786 | main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) ) |
| 1787 | |
| 1788 | |
| 1789 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 1790 | onpass="INTENTS INSTALLED", |
| 1791 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 1792 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1793 | main.step( "Verify Ping across all hosts" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1794 | pingResult = main.FALSE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1795 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1796 | pingResult = main.Mininet1.pingall( timeout=main.pingTimeout ) |
| 1797 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1798 | main.log.warn("First pingall failed. Retrying...") |
| 1799 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1800 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1801 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1802 | time2 = time.time() |
| 1803 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1804 | main.log.report( |
| 1805 | "Time taken for Ping All: " + |
| 1806 | str( timeDiff ) + |
| 1807 | " seconds" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1808 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1809 | onpass="PING ALL PASS", |
| 1810 | onfail="PING ALL FAIL" ) |
| 1811 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 1812 | caseResult = linkUp and pingResult |
| 1813 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1814 | onpass="Link Up Test PASS", |
| 1815 | onfail="Link Up Test FAIL" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1816 | # Printing what exactly failed |
| 1817 | if not linkUp: |
| 1818 | main.log.debug( "Link down was not discovered correctly" ) |
| 1819 | if not pingResult: |
| 1820 | main.log.debug( "Pingall failed" ) |
| 1821 | if not intentState: |
| 1822 | main.log.debug( "Intents are not all installed" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1823 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 1824 | if not caseResult and main.failSwitch: |
| 1825 | main.log.report("Stopping test") |
| 1826 | main.stop( email=main.emailOnStop ) |
| 1827 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1828 | def CASE72( self, main ): |
| 1829 | """ |
| 1830 | Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo) |
| 1831 | """ |
| 1832 | import random |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1833 | import itertools |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1834 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1835 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1836 | main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" ) |
| 1837 | main.log.report( "___________________________________________________________________________" ) |
| 1838 | main.case( "Host intents - Randomly bring some core links down and verify ping all" ) |
| 1839 | switches = [] |
| 1840 | switchesComb = [] |
| 1841 | for i in range( main.numMNswitches ): |
| 1842 | switches.append('s%d'%(i+1)) |
| 1843 | switchesLinksComb = list(itertools.combinations(switches,2)) |
| 1844 | main.randomLinks = random.sample(switchesLinksComb, 5 ) |
| 1845 | print main.randomLinks |
| 1846 | main.step( "Cut links on random devices" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1847 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1848 | for switch in main.randomLinks: |
| 1849 | main.Mininet1.link( |
| 1850 | END1=switch[0], |
| 1851 | END2=switch[1], |
| 1852 | OPTION="down") |
| 1853 | time.sleep( link_sleep ) |
| 1854 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1855 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1856 | linkDown = main.ONOSbench.checkStatus( |
| 1857 | topology_output, main.numMNswitches, str( |
| 1858 | int( main.numMNlinks ) - 5 * 2 ) ) |
| 1859 | utilities.assert_equals( |
| 1860 | expect=main.TRUE, |
| 1861 | actual=linkDown, |
| 1862 | onpass="Link Down discovered properly", |
| 1863 | onfail="Link down was not discovered in " + |
| 1864 | str( link_sleep ) + |
| 1865 | " seconds" ) |
| 1866 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1867 | main.step("Verify intents are installed") |
| 1868 | # Checking a maximum of 3 |
| 1869 | for i in range(3): |
| 1870 | if i != 0: |
| 1871 | main.log.warn( "Verification failed. Retrying..." ) |
| 1872 | main.log.info("Giving onos some time...") |
| 1873 | time.sleep( main.checkIntentsDelay ) |
| 1874 | |
| 1875 | intentState = main.TRUE |
| 1876 | for e in range(int(main.numCtrls)): |
| 1877 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 1878 | intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\ |
| 1879 | intentState |
| 1880 | if not intentState: |
| 1881 | main.log.warn( "Not all intents installed" ) |
| 1882 | if intentState: |
| 1883 | break |
| 1884 | else: |
| 1885 | #Dumping intent summary |
| 1886 | main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) ) |
| 1887 | |
| 1888 | |
| 1889 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 1890 | onpass="INTENTS INSTALLED", |
| 1891 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 1892 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1893 | main.step( "Verify Ping across all hosts" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1894 | pingResult = main.FALSE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1895 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1896 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
| 1897 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1898 | main.log.warn("First pingall failed. Retrying...") |
| 1899 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1900 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1901 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1902 | time2 = time.time() |
| 1903 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1904 | main.log.report( |
| 1905 | "Time taken for Ping All: " + |
| 1906 | str( timeDiff ) + |
| 1907 | " seconds" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1908 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1909 | onpass="PING ALL PASS", |
| 1910 | onfail="PING ALL FAIL" ) |
| 1911 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 1912 | caseResult = linkDown and pingResult and intentState |
| 1913 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1914 | onpass="Random Link cut Test PASS", |
| 1915 | onfail="Random Link cut Test FAIL" ) |
| 1916 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1917 | # Printing what exactly failed |
| 1918 | if not linkDown: |
| 1919 | main.log.debug( "Link down was not discovered correctly" ) |
| 1920 | if not pingResult: |
| 1921 | main.log.debug( "Pingall failed" ) |
| 1922 | if not intentState: |
| 1923 | main.log.debug( "Intents are not all installed" ) |
| 1924 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 1925 | if not caseResult and main.failSwitch: |
| 1926 | main.log.report("Stopping test") |
| 1927 | main.stop( email=main.emailOnStop ) |
| 1928 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1929 | def CASE82( self, main ): |
| 1930 | """ |
| 1931 | Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo ) |
| 1932 | """ |
| 1933 | import random |
| 1934 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1935 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1936 | main.log.report( |
| 1937 | "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" ) |
| 1938 | main.log.report( |
| 1939 | "__________________________________________________________________" ) |
| 1940 | main.case( |
| 1941 | "Host intents - Bring the core links up that are down and verify ping all" ) |
| 1942 | main.step( "Bring randomly cut links on devices up" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1943 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1944 | for switch in main.randomLinks: |
| 1945 | main.Mininet1.link( |
| 1946 | END1=switch[0], |
| 1947 | END2=switch[1], |
| 1948 | OPTION="up") |
| 1949 | time.sleep( link_sleep ) |
| 1950 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1951 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1952 | linkUp = main.ONOSbench.checkStatus( |
| 1953 | topology_output, |
| 1954 | main.numMNswitches, |
| 1955 | str( main.numMNlinks ) ) |
| 1956 | utilities.assert_equals( |
| 1957 | expect=main.TRUE, |
| 1958 | actual=linkUp, |
| 1959 | onpass="Link up discovered properly", |
| 1960 | onfail="Link up was not discovered in " + |
| 1961 | str( link_sleep ) + |
| 1962 | " seconds" ) |
| 1963 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1964 | main.step("Verify intents are installed") |
| 1965 | # Checking a maximum of 3 |
| 1966 | for i in range(3): |
| 1967 | if i != 0: |
| 1968 | main.log.warn( "Verification failed. Retrying..." ) |
| 1969 | main.log.info("Giving onos some time...") |
| 1970 | time.sleep( main.checkIntentsDelay ) |
| 1971 | |
| 1972 | intentState = main.TRUE |
| 1973 | for e in range(int(main.numCtrls)): |
| 1974 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 1975 | intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\ |
| 1976 | intentState |
| 1977 | if not intentState: |
| 1978 | main.log.warn( "Not all intents installed" ) |
| 1979 | if intentState: |
| 1980 | break |
| 1981 | else: |
| 1982 | #Dumping intent summary |
| 1983 | main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) ) |
| 1984 | |
| 1985 | |
| 1986 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 1987 | onpass="INTENTS INSTALLED", |
| 1988 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 1989 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1990 | main.step( "Verify Ping across all hosts" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1991 | pingResult = main.FALSE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1992 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1993 | pingResult = main.Mininet1.pingall( timeout=main.pingTimeout ) |
| 1994 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1995 | main.log.warn("First pingall failed. Retrying...") |
| 1996 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1997 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1998 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1999 | time2 = time.time() |
| 2000 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2001 | main.log.report( |
| 2002 | "Time taken for Ping All: " + |
| 2003 | str( timeDiff ) + |
| 2004 | " seconds" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2005 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2006 | onpass="PING ALL PASS", |
| 2007 | onfail="PING ALL FAIL" ) |
| 2008 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2009 | caseResult = linkUp and pingResult |
| 2010 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2011 | onpass="Link Up Test PASS", |
| 2012 | onfail="Link Up Test FAIL" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2013 | # Printing what exactly failed |
| 2014 | if not linkUp: |
| 2015 | main.log.debug( "Link down was not discovered correctly" ) |
| 2016 | if not pingResult: |
| 2017 | main.log.debug( "Pingall failed" ) |
| 2018 | if not intentState: |
| 2019 | main.log.debug( "Intents are not all installed" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2020 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2021 | if not caseResult and main.failSwitch: |
| 2022 | main.log.report("Stopping test") |
| 2023 | main.stop( email=main.emailOnStop ) |
| 2024 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2025 | def CASE73( self, main ): |
| 2026 | """ |
| 2027 | Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo) |
| 2028 | """ |
| 2029 | import random |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2030 | import itertools |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2031 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2032 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2033 | main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" ) |
| 2034 | main.log.report( "___________________________________________________________________________" ) |
| 2035 | main.case( "Point intents - Randomly bring some core links down and verify ping all" ) |
| 2036 | switches = [] |
| 2037 | switchesComb = [] |
| 2038 | for i in range( main.numMNswitches ): |
| 2039 | switches.append('s%d'%(i+1)) |
| 2040 | switchesLinksComb = list(itertools.combinations(switches,2)) |
| 2041 | main.randomLinks = random.sample(switchesLinksComb, 5 ) |
| 2042 | print main.randomLinks |
| 2043 | main.step( "Cut links on random devices" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2044 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2045 | for switch in main.randomLinks: |
| 2046 | main.Mininet1.link( |
| 2047 | END1=switch[0], |
| 2048 | END2=switch[1], |
| 2049 | OPTION="down") |
| 2050 | time.sleep( link_sleep ) |
| 2051 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 2052 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2053 | linkDown = main.ONOSbench.checkStatus( |
| 2054 | topology_output, main.numMNswitches, str( |
| 2055 | int( main.numMNlinks ) - 5 * 2 ) ) |
| 2056 | utilities.assert_equals( |
| 2057 | expect=main.TRUE, |
| 2058 | actual=linkDown, |
| 2059 | onpass="Link Down discovered properly", |
| 2060 | onfail="Link down was not discovered in " + |
| 2061 | str( link_sleep ) + |
| 2062 | " seconds" ) |
| 2063 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2064 | main.step("Verify intents are installed") |
| 2065 | # Checking a maximum of 3 |
| 2066 | for i in range(3): |
| 2067 | if i != 0: |
| 2068 | main.log.warn( "Verification failed. Retrying..." ) |
| 2069 | main.log.info("Giving onos some time...") |
| 2070 | time.sleep( main.checkIntentsDelay ) |
| 2071 | |
| 2072 | intentState = main.TRUE |
| 2073 | for e in range(int(main.numCtrls)): |
| 2074 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 2075 | intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\ |
| 2076 | intentState |
| 2077 | if not intentState: |
| 2078 | main.log.warn( "Not all intents installed" ) |
| 2079 | if intentState: |
| 2080 | break |
| 2081 | else: |
| 2082 | #Dumping intent summary |
| 2083 | main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) ) |
| 2084 | |
| 2085 | |
| 2086 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 2087 | onpass="INTENTS INSTALLED", |
| 2088 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 2089 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2090 | main.step( "Verify Ping across all hosts" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2091 | pingResult = main.FALSE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2092 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2093 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
| 2094 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2095 | main.log.warn("First pingall failed. Retrying...") |
| 2096 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2097 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2098 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2099 | time2 = time.time() |
| 2100 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2101 | main.log.report( |
| 2102 | "Time taken for Ping All: " + |
| 2103 | str( timeDiff ) + |
| 2104 | " seconds" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2105 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2106 | onpass="PING ALL PASS", |
| 2107 | onfail="PING ALL FAIL" ) |
| 2108 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2109 | caseResult = linkDown and pingResult and intentState |
| 2110 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2111 | onpass="Random Link cut Test PASS", |
| 2112 | onfail="Random Link cut Test FAIL" ) |
| 2113 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2114 | # Printing what exactly failed |
| 2115 | if not linkDown: |
| 2116 | main.log.debug( "Link down was not discovered correctly" ) |
| 2117 | if not pingResult: |
| 2118 | main.log.debug( "Pingall failed" ) |
| 2119 | if not intentState: |
| 2120 | main.log.debug( "Intents are not all installed" ) |
| 2121 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2122 | if not caseResult and main.failSwitch: |
| 2123 | main.log.report("Stopping test") |
| 2124 | main.stop( email=main.emailOnStop ) |
| 2125 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2126 | def CASE83( self, main ): |
| 2127 | """ |
| 2128 | Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo ) |
| 2129 | """ |
| 2130 | import random |
| 2131 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2132 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2133 | main.log.report( |
| 2134 | "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" ) |
| 2135 | main.log.report( |
| 2136 | "__________________________________________________________________" ) |
| 2137 | main.case( |
| 2138 | "Point intents - Bring the core links up that are down and verify ping all" ) |
| 2139 | main.step( "Bring randomly cut links on devices up" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2140 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2141 | for switch in main.randomLinks: |
| 2142 | main.Mininet1.link( |
| 2143 | END1=switch[0], |
| 2144 | END2=switch[1], |
| 2145 | OPTION="up") |
| 2146 | time.sleep( link_sleep ) |
| 2147 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 2148 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2149 | linkUp = main.ONOSbench.checkStatus( |
| 2150 | topology_output, |
| 2151 | main.numMNswitches, |
| 2152 | str( main.numMNlinks ) ) |
| 2153 | utilities.assert_equals( |
| 2154 | expect=main.TRUE, |
| 2155 | actual=linkUp, |
| 2156 | onpass="Link up discovered properly", |
| 2157 | onfail="Link up was not discovered in " + |
| 2158 | str( link_sleep ) + |
| 2159 | " seconds" ) |
| 2160 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2161 | main.step("Verify intents are installed") |
| 2162 | # Checking a maximum of 3 |
| 2163 | for i in range(3): |
| 2164 | if i != 0: |
| 2165 | main.log.warn( "Verification failed. Retrying..." ) |
| 2166 | main.log.info("Giving onos some time...") |
| 2167 | time.sleep( main.checkIntentsDelay ) |
| 2168 | |
| 2169 | intentState = main.TRUE |
| 2170 | for e in range(int(main.numCtrls)): |
| 2171 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 2172 | intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\ |
| 2173 | intentState |
| 2174 | if not intentState: |
| 2175 | main.log.warn( "Not all intents installed" ) |
| 2176 | if intentState: |
| 2177 | break |
| 2178 | else: |
| 2179 | #Dumping intent summary |
| 2180 | main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) ) |
| 2181 | |
| 2182 | |
| 2183 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 2184 | onpass="INTENTS INSTALLED", |
| 2185 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 2186 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2187 | main.step( "Verify Ping across all hosts" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2188 | pingResult = main.FALSE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2189 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2190 | pingResult = main.Mininet1.pingall( timeout=main.pingTimeout ) |
| 2191 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2192 | main.log.warn("First pingall failed. Retrying...") |
| 2193 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2194 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2195 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2196 | time2 = time.time() |
| 2197 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2198 | main.log.report( |
| 2199 | "Time taken for Ping All: " + |
| 2200 | str( timeDiff ) + |
| 2201 | " seconds" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2202 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2203 | onpass="PING ALL PASS", |
| 2204 | onfail="PING ALL FAIL" ) |
| 2205 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2206 | caseResult = linkUp and pingResult |
| 2207 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2208 | onpass="Link Up Test PASS", |
| 2209 | onfail="Link Up Test FAIL" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2210 | # Printing what exactly failed |
| 2211 | if not linkUp: |
| 2212 | main.log.debug( "Link down was not discovered correctly" ) |
| 2213 | if not pingResult: |
| 2214 | main.log.debug( "Pingall failed" ) |
| 2215 | if not intentState: |
| 2216 | main.log.debug( "Intents are not all installed" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2217 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2218 | if not caseResult and main.failSwitch: |
| 2219 | main.log.report("Stopping test") |
| 2220 | main.stop( email=main.emailOnStop ) |
| 2221 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2222 | def CASE74( self, main ): |
| 2223 | """ |
| 2224 | Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo) |
| 2225 | """ |
| 2226 | import random |
| 2227 | main.randomLink1 = [] |
| 2228 | main.randomLink2 = [] |
| 2229 | main.randomLink3 = [] |
| 2230 | main.randomLink4 = [] |
| 2231 | link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ] |
| 2232 | link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' ) |
| 2233 | link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' ) |
| 2234 | link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ] |
| 2235 | link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' ) |
| 2236 | link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' ) |
| 2237 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 2238 | main.pingTimeout = 400 |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2239 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2240 | main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" ) |
| 2241 | main.log.report( "___________________________________________________________________________" ) |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 2242 | main.log.case( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2243 | linkIndex = range(4) |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 2244 | linkIndexS9 = random.sample(linkIndex,1)[0] |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2245 | linkIndex.remove(linkIndexS9) |
| 2246 | linkIndexS10 = random.sample(linkIndex,1)[0] |
| 2247 | main.randomLink1 = link1End2top[linkIndexS9] |
| 2248 | main.randomLink2 = link2End2top[linkIndexS10] |
| 2249 | main.randomLink3 = random.sample(link1End2bot,1)[0] |
| 2250 | main.randomLink4 = random.sample(link2End2bot,1)[0] |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 2251 | |
| 2252 | # Work around for link state propagation delay. Added some sleep time. |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2253 | # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" ) |
| 2254 | # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" ) |
| 2255 | main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" ) |
| 2256 | time.sleep( link_sleep ) |
| 2257 | main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" ) |
| 2258 | time.sleep( link_sleep ) |
| 2259 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 2260 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2261 | linkDown = main.ONOSbench.checkStatus( |
| 2262 | topology_output, main.numMNswitches, str( |
Hari Krishna | 390d470 | 2015-08-21 14:37:46 -0700 | [diff] [blame] | 2263 | int( main.numMNlinks ) - 4 )) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2264 | utilities.assert_equals( |
| 2265 | expect=main.TRUE, |
| 2266 | actual=linkDown, |
| 2267 | onpass="Link Down discovered properly", |
| 2268 | onfail="Link down was not discovered in " + |
| 2269 | str( link_sleep ) + |
| 2270 | " seconds" ) |
| 2271 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2272 | main.step("Verify intents are installed") |
| 2273 | # Checking a maximum of 3 |
| 2274 | for i in range(3): |
| 2275 | if i != 0: |
| 2276 | main.log.warn( "Verification failed. Retrying..." ) |
| 2277 | main.log.info("Giving onos some time...") |
| 2278 | time.sleep( main.checkIntentsDelay ) |
| 2279 | |
| 2280 | intentState = main.TRUE |
| 2281 | for e in range(int(main.numCtrls)): |
| 2282 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 2283 | intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\ |
| 2284 | intentState |
| 2285 | if not intentState: |
| 2286 | main.log.warn( "Not all intents installed" ) |
| 2287 | if intentState: |
| 2288 | break |
| 2289 | else: |
| 2290 | #Dumping intent summary |
| 2291 | main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) ) |
| 2292 | |
| 2293 | |
| 2294 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 2295 | onpass="INTENTS INSTALLED", |
| 2296 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 2297 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2298 | main.step( "Verify Ping across all hosts" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2299 | pingResult = main.FALSE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2300 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2301 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
| 2302 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2303 | main.log.warn("First pingall failed. Retrying...") |
| 2304 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2305 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2306 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2307 | time2 = time.time() |
| 2308 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2309 | main.log.report( |
| 2310 | "Time taken for Ping All: " + |
| 2311 | str( timeDiff ) + |
| 2312 | " seconds" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2313 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2314 | onpass="PING ALL PASS", |
| 2315 | onfail="PING ALL FAIL" ) |
| 2316 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2317 | caseResult = linkDown and pingResult and intentState |
| 2318 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2319 | onpass="Random Link cut Test PASS", |
| 2320 | onfail="Random Link cut Test FAIL" ) |
| 2321 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2322 | # Printing what exactly failed |
| 2323 | if not linkDown: |
| 2324 | main.log.debug( "Link down was not discovered correctly" ) |
| 2325 | if not pingResult: |
| 2326 | main.log.debug( "Pingall failed" ) |
| 2327 | if not intentState: |
| 2328 | main.log.debug( "Intents are not all installed" ) |
| 2329 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2330 | if not caseResult and main.failSwitch: |
| 2331 | main.log.report("Stopping test") |
| 2332 | main.stop( email=main.emailOnStop ) |
| 2333 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2334 | def CASE84( self, main ): |
| 2335 | """ |
| 2336 | Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo ) |
| 2337 | """ |
| 2338 | import random |
| 2339 | link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ] |
| 2340 | link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ] |
| 2341 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 2342 | main.log.report( |
| 2343 | "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" ) |
| 2344 | main.log.report( |
| 2345 | "__________________________________________________________________" ) |
| 2346 | main.case( |
| 2347 | "Host intents - Bring the core links up that are down and verify ping all" ) |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 2348 | |
| 2349 | # Work around for link state propagation delay. Added some sleep time. |
| 2350 | # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" ) |
| 2351 | # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2352 | main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" ) |
| 2353 | time.sleep( link_sleep ) |
| 2354 | main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" ) |
| 2355 | time.sleep( link_sleep ) |
| 2356 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 2357 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2358 | linkUp = main.ONOSbench.checkStatus( |
| 2359 | topology_output, |
| 2360 | main.numMNswitches, |
| 2361 | str( main.numMNlinks ) ) |
| 2362 | utilities.assert_equals( |
| 2363 | expect=main.TRUE, |
| 2364 | actual=linkUp, |
| 2365 | onpass="Link up discovered properly", |
| 2366 | onfail="Link up was not discovered in " + |
| 2367 | str( link_sleep ) + |
| 2368 | " seconds" ) |
| 2369 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2370 | main.step("Verify intents are installed") |
| 2371 | # Checking a maximum of 3 |
| 2372 | for i in range(3): |
| 2373 | if i != 0: |
| 2374 | main.log.warn( "Verification failed. Retrying..." ) |
| 2375 | main.log.info("Giving onos some time...") |
| 2376 | time.sleep( main.checkIntentsDelay ) |
| 2377 | |
| 2378 | intentState = main.TRUE |
| 2379 | for e in range(int(main.numCtrls)): |
| 2380 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 2381 | intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\ |
| 2382 | intentState |
| 2383 | if not intentState: |
| 2384 | main.log.warn( "Not all intents installed" ) |
| 2385 | if intentState: |
| 2386 | break |
| 2387 | else: |
| 2388 | #Dumping intent summary |
| 2389 | main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) ) |
| 2390 | |
| 2391 | |
| 2392 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 2393 | onpass="INTENTS INSTALLED", |
| 2394 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 2395 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2396 | main.step( "Verify Ping across all hosts" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2397 | pingResult = main.FALSE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2398 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2399 | pingResult = main.Mininet1.pingall( timeout=main.pingTimeout ) |
| 2400 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2401 | main.log.warn("First pingall failed. Retrying...") |
| 2402 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2403 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2404 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2405 | time2 = time.time() |
| 2406 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2407 | main.log.report( |
| 2408 | "Time taken for Ping All: " + |
| 2409 | str( timeDiff ) + |
| 2410 | " seconds" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2411 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2412 | onpass="PING ALL PASS", |
| 2413 | onfail="PING ALL FAIL" ) |
| 2414 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2415 | caseResult = linkUp and pingResult |
| 2416 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2417 | onpass="Link Up Test PASS", |
| 2418 | onfail="Link Up Test FAIL" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2419 | # Printing what exactly failed |
| 2420 | if not linkUp: |
| 2421 | main.log.debug( "Link down was not discovered correctly" ) |
| 2422 | if not pingResult: |
| 2423 | main.log.debug( "Pingall failed" ) |
| 2424 | if not intentState: |
| 2425 | main.log.debug( "Intents are not all installed" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2426 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2427 | if not caseResult and main.failSwitch: |
| 2428 | main.log.report("Stopping test") |
| 2429 | main.stop( email=main.emailOnStop ) |
| 2430 | |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 2431 | def CASE75( self, main ): |
| 2432 | """ |
| 2433 | Randomly bring some core links down and verify ping all ( Point Intents-Spine Topo) |
| 2434 | """ |
| 2435 | import random |
| 2436 | main.randomLink1 = [] |
| 2437 | main.randomLink2 = [] |
| 2438 | main.randomLink3 = [] |
| 2439 | main.randomLink4 = [] |
| 2440 | link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ] |
| 2441 | link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' ) |
| 2442 | link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' ) |
| 2443 | link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ] |
| 2444 | link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' ) |
| 2445 | link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' ) |
| 2446 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 2447 | main.pingTimeout = 400 |
| 2448 | |
| 2449 | main.log.report( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" ) |
| 2450 | main.log.report( "___________________________________________________________________________" ) |
| 2451 | main.case( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" ) |
| 2452 | linkIndex = range(4) |
| 2453 | linkIndexS9 = random.sample(linkIndex,1)[0] |
| 2454 | linkIndex.remove(linkIndexS9) |
| 2455 | linkIndexS10 = random.sample(linkIndex,1)[0] |
| 2456 | main.randomLink1 = link1End2top[linkIndexS9] |
| 2457 | main.randomLink2 = link2End2top[linkIndexS10] |
| 2458 | main.randomLink3 = random.sample(link1End2bot,1)[0] |
| 2459 | main.randomLink4 = random.sample(link2End2bot,1)[0] |
| 2460 | |
| 2461 | # Work around for link state propagation delay. Added some sleep time. |
| 2462 | # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" ) |
| 2463 | # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" ) |
| 2464 | main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" ) |
| 2465 | time.sleep( link_sleep ) |
| 2466 | main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" ) |
| 2467 | time.sleep( link_sleep ) |
| 2468 | |
| 2469 | topology_output = main.ONOScli1.topology() |
| 2470 | linkDown = main.ONOSbench.checkStatus( |
| 2471 | topology_output, main.numMNswitches, str( |
Hari Krishna | 390d470 | 2015-08-21 14:37:46 -0700 | [diff] [blame] | 2472 | int( main.numMNlinks ) - 4 )) |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 2473 | utilities.assert_equals( |
| 2474 | expect=main.TRUE, |
| 2475 | actual=linkDown, |
| 2476 | onpass="Link Down discovered properly", |
| 2477 | onfail="Link down was not discovered in " + |
| 2478 | str( link_sleep ) + |
| 2479 | " seconds" ) |
| 2480 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2481 | main.step("Verify intents are installed") |
| 2482 | # Checking a maximum of 3 |
| 2483 | for i in range(3): |
| 2484 | if i != 0: |
| 2485 | main.log.warn( "Verification failed. Retrying..." ) |
| 2486 | main.log.info("Giving onos some time...") |
| 2487 | time.sleep( main.checkIntentsDelay ) |
| 2488 | |
| 2489 | intentState = main.TRUE |
| 2490 | for e in range(int(main.numCtrls)): |
| 2491 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 2492 | intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\ |
| 2493 | intentState |
| 2494 | if not intentState: |
| 2495 | main.log.warn( "Not all intents installed" ) |
| 2496 | if intentState: |
| 2497 | break |
| 2498 | else: |
| 2499 | #Dumping intent summary |
| 2500 | main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) ) |
| 2501 | |
| 2502 | |
| 2503 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 2504 | onpass="INTENTS INSTALLED", |
| 2505 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 2506 | |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 2507 | main.step( "Verify Ping across all hosts" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2508 | pingResult = main.FALSE |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 2509 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2510 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
| 2511 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2512 | main.log.warn("First pingall failed. Retrying...") |
| 2513 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2514 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2515 | |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 2516 | time2 = time.time() |
| 2517 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2518 | main.log.report( |
| 2519 | "Time taken for Ping All: " + |
| 2520 | str( timeDiff ) + |
| 2521 | " seconds" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2522 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 2523 | onpass="PING ALL PASS", |
| 2524 | onfail="PING ALL FAIL" ) |
| 2525 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2526 | caseResult = linkDown and pingResult and intentState |
| 2527 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 2528 | onpass="Random Link cut Test PASS", |
| 2529 | onfail="Random Link cut Test FAIL" ) |
| 2530 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2531 | # Printing what exactly failed |
| 2532 | if not linkDown: |
| 2533 | main.log.debug( "Link down was not discovered correctly" ) |
| 2534 | if not pingResult: |
| 2535 | main.log.debug( "Pingall failed" ) |
| 2536 | if not intentState: |
| 2537 | main.log.debug( "Intents are not all installed" ) |
| 2538 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2539 | if not caseResult and main.failSwitch: |
| 2540 | main.log.report("Stopping test") |
| 2541 | main.stop( email=main.emailOnStop ) |
| 2542 | |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 2543 | def CASE85( self, main ): |
| 2544 | """ |
| 2545 | Bring the core links up that are down and verify ping all ( Point Intents-Spine Topo ) |
| 2546 | """ |
| 2547 | import random |
| 2548 | link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ] |
| 2549 | link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ] |
| 2550 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 2551 | main.log.report( |
| 2552 | "Bring the core links up that are down and verify ping all (Point Intents-Spine Topo" ) |
| 2553 | main.log.report( |
| 2554 | "__________________________________________________________________" ) |
| 2555 | main.case( |
| 2556 | "Point intents - Bring the core links up that are down and verify ping all" ) |
| 2557 | |
| 2558 | # Work around for link state propagation delay. Added some sleep time. |
| 2559 | # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" ) |
| 2560 | # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" ) |
| 2561 | main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" ) |
| 2562 | time.sleep( link_sleep ) |
| 2563 | main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" ) |
| 2564 | time.sleep( link_sleep ) |
| 2565 | |
| 2566 | topology_output = main.ONOScli1.topology() |
| 2567 | linkUp = main.ONOSbench.checkStatus( |
| 2568 | topology_output, |
| 2569 | main.numMNswitches, |
| 2570 | str( main.numMNlinks ) ) |
| 2571 | utilities.assert_equals( |
| 2572 | expect=main.TRUE, |
| 2573 | actual=linkUp, |
| 2574 | onpass="Link up discovered properly", |
| 2575 | onfail="Link up was not discovered in " + |
| 2576 | str( link_sleep ) + |
| 2577 | " seconds" ) |
| 2578 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2579 | main.step("Verify intents are installed") |
| 2580 | # Checking a maximum of 3 |
| 2581 | for i in range(3): |
| 2582 | if i != 0: |
| 2583 | main.log.warn( "Verification failed. Retrying..." ) |
| 2584 | main.log.info("Giving onos some time...") |
| 2585 | time.sleep( main.checkIntentsDelay ) |
| 2586 | |
| 2587 | intentState = main.TRUE |
| 2588 | for e in range(int(main.numCtrls)): |
| 2589 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 2590 | intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\ |
| 2591 | intentState |
| 2592 | if not intentState: |
| 2593 | main.log.warn( "Not all intents installed" ) |
| 2594 | if intentState: |
| 2595 | break |
| 2596 | else: |
| 2597 | #Dumping intent summary |
| 2598 | main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) ) |
| 2599 | |
| 2600 | |
| 2601 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 2602 | onpass="INTENTS INSTALLED", |
| 2603 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 2604 | |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 2605 | main.step( "Verify Ping across all hosts" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2606 | pingResult = main.FALSE |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 2607 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2608 | pingResult = main.Mininet1.pingall( timeout=main.pingTimeout ) |
| 2609 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2610 | main.log.warn("First pingall failed. Retrying...") |
| 2611 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2612 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2613 | |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 2614 | time2 = time.time() |
| 2615 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2616 | main.log.report( |
| 2617 | "Time taken for Ping All: " + |
| 2618 | str( timeDiff ) + |
| 2619 | " seconds" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2620 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 2621 | onpass="PING ALL PASS", |
| 2622 | onfail="PING ALL FAIL" ) |
| 2623 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2624 | caseResult = linkUp and pingResult |
| 2625 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 2626 | onpass="Link Up Test PASS", |
| 2627 | onfail="Link Up Test FAIL" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2628 | # Printing what exactly failed |
| 2629 | if not linkUp: |
| 2630 | main.log.debug( "Link down was not discovered correctly" ) |
| 2631 | if not pingResult: |
| 2632 | main.log.debug( "Pingall failed" ) |
| 2633 | if not intentState: |
| 2634 | main.log.debug( "Intents are not all installed" ) |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 2635 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2636 | if not caseResult and main.failSwitch: |
| 2637 | main.log.report("Stopping test") |
| 2638 | main.stop( email=main.emailOnStop ) |
| 2639 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2640 | def CASE170( self ): |
| 2641 | """ |
| 2642 | IPv6 ping all with some core links down( Host Intents-Att Topo) |
| 2643 | """ |
| 2644 | main.log.report( "IPv6 ping all with some core links down( Host Intents-Att Topo )" ) |
| 2645 | main.log.report( "_________________________________________________" ) |
| 2646 | import itertools |
| 2647 | import time |
| 2648 | main.case( "IPv6 ping all with some core links down( Host Intents-Att Topo )" ) |
| 2649 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2650 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2651 | pingResult = main.FALSE |
| 2652 | time1 = time.time() |
| 2653 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2654 | if not pingResult: |
| 2655 | main.log.warn("Failed to ping Ipv6 hosts. Retrying...") |
| 2656 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2657 | time2 = time.time() |
| 2658 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2659 | main.log.report( |
| 2660 | "Time taken for IPv6 Ping All: " + |
| 2661 | str( timeDiff ) + |
| 2662 | " seconds" ) |
| 2663 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2664 | onpass="PING ALL PASS", |
| 2665 | onfail="PING ALL FAIL" ) |
| 2666 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2667 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2668 | utilities.assert_equals( |
| 2669 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2670 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2671 | onpass="IPv6 Ping across 300 host intents test PASS", |
| 2672 | onfail="IPv6 Ping across 300 host intents test FAIL" ) |
| 2673 | |
| 2674 | def CASE180( self ): |
| 2675 | """ |
| 2676 | IPv6 ping all with after core links back up( Host Intents-Att Topo) |
| 2677 | """ |
| 2678 | main.log.report( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" ) |
| 2679 | main.log.report( "_________________________________________________" ) |
| 2680 | import itertools |
| 2681 | import time |
| 2682 | main.case( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" ) |
| 2683 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2684 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2685 | pingResult = main.FALSE |
| 2686 | time1 = time.time() |
| 2687 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2688 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2689 | main.log.warn("First ping failed. Retrying...") |
| 2690 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2691 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2692 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2693 | time2 = time.time() |
| 2694 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2695 | main.log.report( |
| 2696 | "Time taken for IPv6 Ping All: " + |
| 2697 | str( timeDiff ) + |
| 2698 | " seconds" ) |
| 2699 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2700 | onpass="PING ALL PASS", |
| 2701 | onfail="PING ALL FAIL" ) |
| 2702 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2703 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2704 | utilities.assert_equals( |
| 2705 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2706 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2707 | onpass="IPv6 Ping across 300 host intents test PASS", |
| 2708 | onfail="IPv6 Ping across 300 host intents test FAIL" ) |
| 2709 | |
| 2710 | def CASE171( self ): |
| 2711 | """ |
| 2712 | IPv6 ping all with some core links down( Point Intents-Att Topo) |
| 2713 | """ |
| 2714 | main.log.report( "IPv6 ping all with some core links down( Point Intents-Att Topo )" ) |
| 2715 | main.log.report( "_________________________________________________" ) |
| 2716 | import itertools |
| 2717 | import time |
| 2718 | main.case( "IPv6 ping all with some core links down( Point Intents-Att Topo )" ) |
| 2719 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2720 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2721 | pingResult = main.FALSE |
| 2722 | time1 = time.time() |
| 2723 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2724 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2725 | main.log.warn("First ping failed. Retrying...") |
| 2726 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2727 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2728 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2729 | time2 = time.time() |
| 2730 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2731 | main.log.report( |
| 2732 | "Time taken for IPv6 Ping All: " + |
| 2733 | str( timeDiff ) + |
| 2734 | " seconds" ) |
| 2735 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2736 | onpass="PING ALL PASS", |
| 2737 | onfail="PING ALL FAIL" ) |
| 2738 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2739 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2740 | utilities.assert_equals( |
| 2741 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2742 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2743 | onpass="IPv6 Ping across 600 point intents test PASS", |
| 2744 | onfail="IPv6 Ping across 600 point intents test FAIL" ) |
| 2745 | |
| 2746 | def CASE181( self ): |
| 2747 | """ |
| 2748 | IPv6 ping all with after core links back up( Point Intents-Att Topo) |
| 2749 | """ |
| 2750 | main.log.report( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" ) |
| 2751 | main.log.report( "_________________________________________________" ) |
| 2752 | import itertools |
| 2753 | import time |
| 2754 | main.case( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" ) |
| 2755 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2756 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2757 | pingResult = main.FALSE |
| 2758 | time1 = time.time() |
| 2759 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2760 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2761 | main.log.warn("First ping failed. Retrying...") |
| 2762 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2763 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2764 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2765 | time2 = time.time() |
| 2766 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2767 | main.log.report( |
| 2768 | "Time taken for IPv6 Ping All: " + |
| 2769 | str( timeDiff ) + |
| 2770 | " seconds" ) |
| 2771 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2772 | onpass="PING ALL PASS", |
| 2773 | onfail="PING ALL FAIL" ) |
| 2774 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2775 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2776 | utilities.assert_equals( |
| 2777 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2778 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2779 | onpass="IPv6 Ping across 600 Point intents test PASS", |
| 2780 | onfail="IPv6 Ping across 600 Point intents test FAIL" ) |
| 2781 | |
| 2782 | def CASE172( self ): |
| 2783 | """ |
| 2784 | IPv6 ping all with some core links down( Host Intents-Chordal Topo) |
| 2785 | """ |
| 2786 | main.log.report( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" ) |
| 2787 | main.log.report( "_________________________________________________" ) |
| 2788 | import itertools |
| 2789 | import time |
| 2790 | main.case( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" ) |
| 2791 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2792 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2793 | pingResult = main.FALSE |
| 2794 | time1 = time.time() |
| 2795 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2796 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2797 | main.log.warn("First ping failed. Retrying...") |
| 2798 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2799 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2800 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2801 | time2 = time.time() |
| 2802 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2803 | main.log.report( |
| 2804 | "Time taken for IPv6 Ping All: " + |
| 2805 | str( timeDiff ) + |
| 2806 | " seconds" ) |
| 2807 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2808 | onpass="PING ALL PASS", |
| 2809 | onfail="PING ALL FAIL" ) |
| 2810 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2811 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2812 | utilities.assert_equals( |
| 2813 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2814 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2815 | onpass="IPv6 Ping across 300 host intents test PASS", |
| 2816 | onfail="IPv6 Ping across 300 host intents test FAIL" ) |
| 2817 | |
| 2818 | def CASE182( self ): |
| 2819 | """ |
| 2820 | IPv6 ping all with after core links back up( Host Intents-Chordal Topo) |
| 2821 | """ |
| 2822 | main.log.report( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" ) |
| 2823 | main.log.report( "_________________________________________________" ) |
| 2824 | import itertools |
| 2825 | import time |
| 2826 | main.case( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" ) |
| 2827 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2828 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2829 | pingResult = main.FALSE |
| 2830 | time1 = time.time() |
| 2831 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2832 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2833 | main.log.warn("First ping failed. Retrying...") |
| 2834 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2835 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2836 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2837 | time2 = time.time() |
| 2838 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2839 | main.log.report( |
| 2840 | "Time taken for IPv6 Ping All: " + |
| 2841 | str( timeDiff ) + |
| 2842 | " seconds" ) |
| 2843 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2844 | onpass="PING ALL PASS", |
| 2845 | onfail="PING ALL FAIL" ) |
| 2846 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2847 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2848 | utilities.assert_equals( |
| 2849 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2850 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2851 | onpass="IPv6 Ping across 300 host intents test PASS", |
| 2852 | onfail="IPv6 Ping across 300 host intents test FAIL" ) |
| 2853 | |
| 2854 | def CASE173( self ): |
| 2855 | """ |
| 2856 | IPv6 ping all with some core links down( Point Intents-Chordal Topo) |
| 2857 | """ |
| 2858 | main.log.report( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" ) |
| 2859 | main.log.report( "_________________________________________________" ) |
| 2860 | import itertools |
| 2861 | import time |
| 2862 | main.case( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" ) |
| 2863 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2864 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2865 | pingResult = main.FALSE |
| 2866 | time1 = time.time() |
| 2867 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2868 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2869 | main.log.warn("First ping failed. Retrying...") |
| 2870 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2871 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2872 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2873 | time2 = time.time() |
| 2874 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2875 | main.log.report( |
| 2876 | "Time taken for IPv6 Ping All: " + |
| 2877 | str( timeDiff ) + |
| 2878 | " seconds" ) |
| 2879 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2880 | onpass="PING ALL PASS", |
| 2881 | onfail="PING ALL FAIL" ) |
| 2882 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2883 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2884 | utilities.assert_equals( |
| 2885 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2886 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2887 | onpass="IPv6 Ping across 600 point intents test PASS", |
| 2888 | onfail="IPv6 Ping across 600 point intents test FAIL" ) |
| 2889 | |
| 2890 | def CASE183( self ): |
| 2891 | """ |
| 2892 | IPv6 ping all with after core links back up( Point Intents-Chordal Topo) |
| 2893 | """ |
| 2894 | main.log.report( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" ) |
| 2895 | main.log.report( "_________________________________________________" ) |
| 2896 | import itertools |
| 2897 | import time |
| 2898 | main.case( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" ) |
| 2899 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2900 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2901 | pingResult = main.FALSE |
| 2902 | time1 = time.time() |
| 2903 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2904 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2905 | main.log.warn("First ping failed. Retrying...") |
| 2906 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2907 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2908 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2909 | time2 = time.time() |
| 2910 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2911 | main.log.report( |
| 2912 | "Time taken for IPv6 Ping All: " + |
| 2913 | str( timeDiff ) + |
| 2914 | " seconds" ) |
| 2915 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2916 | onpass="PING ALL PASS", |
| 2917 | onfail="PING ALL FAIL" ) |
| 2918 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2919 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2920 | utilities.assert_equals( |
| 2921 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2922 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2923 | onpass="IPv6 Ping across 600 Point intents test PASS", |
| 2924 | onfail="IPv6 Ping across 600 Point intents test FAIL" ) |
| 2925 | |
| 2926 | def CASE174( self ): |
| 2927 | """ |
| 2928 | IPv6 ping all with some core links down( Host Intents-Spine Topo) |
| 2929 | """ |
| 2930 | main.log.report( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" ) |
| 2931 | main.log.report( "_________________________________________________" ) |
| 2932 | import itertools |
| 2933 | import time |
| 2934 | main.case( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" ) |
| 2935 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2936 | hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ] |
| 2937 | pingResult = main.FALSE |
| 2938 | time1 = time.time() |
| 2939 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2940 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2941 | main.log.warn("First ping failed. Retrying...") |
| 2942 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2943 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2944 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2945 | time2 = time.time() |
| 2946 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2947 | main.log.report( |
| 2948 | "Time taken for IPv6 Ping All: " + |
| 2949 | str( timeDiff ) + |
| 2950 | " seconds" ) |
| 2951 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2952 | onpass="PING ALL PASS", |
| 2953 | onfail="PING ALL FAIL" ) |
| 2954 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2955 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2956 | utilities.assert_equals( |
| 2957 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2958 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2959 | onpass="IPv6 Ping across 2278 host intents test PASS", |
| 2960 | onfail="IPv6 Ping across 2278 host intents test FAIL" ) |
| 2961 | |
| 2962 | def CASE184( self ): |
| 2963 | """ |
| 2964 | IPv6 ping all with after core links back up( Host Intents-Spine Topo) |
| 2965 | """ |
| 2966 | main.log.report( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" ) |
| 2967 | main.log.report( "_________________________________________________" ) |
| 2968 | import itertools |
| 2969 | import time |
| 2970 | main.case( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" ) |
| 2971 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2972 | hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ] |
| 2973 | pingResult = main.FALSE |
| 2974 | time1 = time.time() |
| 2975 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2976 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2977 | main.log.warn("First ping failed. Retrying...") |
| 2978 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2979 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2980 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2981 | time2 = time.time() |
| 2982 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2983 | main.log.report( |
| 2984 | "Time taken for IPv6 Ping All: " + |
| 2985 | str( timeDiff ) + |
| 2986 | " seconds" ) |
| 2987 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2988 | onpass="PING ALL PASS", |
| 2989 | onfail="PING ALL FAIL" ) |
| 2990 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2991 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2992 | utilities.assert_equals( |
| 2993 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 2994 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2995 | onpass="IPv6 Ping across 2278 host intents test PASS", |
| 2996 | onfail="IPv6 Ping across 2278 host intents test FAIL" ) |
| 2997 | |
| 2998 | def CASE175( self ): |
| 2999 | """ |
| 3000 | IPv6 ping all with some core links down( Point Intents-Spine Topo) |
| 3001 | """ |
| 3002 | main.log.report( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" ) |
| 3003 | main.log.report( "_________________________________________________" ) |
| 3004 | import itertools |
| 3005 | import time |
| 3006 | main.case( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" ) |
| 3007 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 3008 | hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ] |
| 3009 | pingResult = main.FALSE |
| 3010 | time1 = time.time() |
| 3011 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 3012 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3013 | main.log.warn("First ping failed. Retrying...") |
| 3014 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 3015 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3016 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3017 | time2 = time.time() |
| 3018 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 3019 | main.log.report( |
| 3020 | "Time taken for IPv6 Ping All: " + |
| 3021 | str( timeDiff ) + |
| 3022 | " seconds" ) |
| 3023 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 3024 | onpass="PING ALL PASS", |
| 3025 | onfail="PING ALL FAIL" ) |
| 3026 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 3027 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3028 | utilities.assert_equals( |
| 3029 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 3030 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3031 | onpass="IPv6 Ping across 4556 point intents test PASS", |
| 3032 | onfail="IPv6 Ping across 4556 point intents test FAIL" ) |
| 3033 | |
| 3034 | def CASE185( self ): |
| 3035 | """ |
| 3036 | IPv6 ping all with after core links back up( Point Intents-Spine Topo) |
| 3037 | """ |
| 3038 | main.log.report( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" ) |
| 3039 | main.log.report( "_________________________________________________" ) |
| 3040 | import itertools |
| 3041 | import time |
| 3042 | main.case( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" ) |
| 3043 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 3044 | hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ] |
| 3045 | pingResult = main.FALSE |
| 3046 | time1 = time.time() |
| 3047 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 3048 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3049 | main.log.warn("First ping failed. Retrying...") |
| 3050 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 3051 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3052 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3053 | time2 = time.time() |
| 3054 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 3055 | main.log.report( |
| 3056 | "Time taken for IPv6 Ping All: " + |
| 3057 | str( timeDiff ) + |
| 3058 | " seconds" ) |
| 3059 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 3060 | onpass="PING ALL PASS", |
| 3061 | onfail="PING ALL FAIL" ) |
| 3062 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 3063 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3064 | utilities.assert_equals( |
| 3065 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 3066 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3067 | onpass="IPv6 Ping across 4556 Point intents test PASS", |
| 3068 | onfail="IPv6 Ping across 4556 Point intents test FAIL" ) |
| 3069 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3070 | def CASE90( self ): |
| 3071 | """ |
| 3072 | Install 600 point intents and verify ping all (Att Topology) |
| 3073 | """ |
| 3074 | main.log.report( "Add 600 point intents and verify pingall (Att Topology)" ) |
| 3075 | main.log.report( "_______________________________________" ) |
| 3076 | import itertools |
| 3077 | import time |
| 3078 | main.case( "Install 600 point intents" ) |
| 3079 | main.step( "Add point Intents" ) |
| 3080 | intentResult = main.TRUE |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3081 | deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) ) |
| 3082 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3083 | intentIdList = [] |
| 3084 | time1 = time.time() |
| 3085 | for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ): |
| 3086 | pool = [] |
| 3087 | for cli in main.CLIs: |
| 3088 | if i >= len( deviceCombos ): |
| 3089 | break |
| 3090 | t = main.Thread( target=cli.addPointIntent, |
| 3091 | threadID=main.threadID, |
| 3092 | name="addPointIntent", |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3093 | args=[deviceCombos[i][0],deviceCombos[i][1],1,1,'',main.MACsDict.get(deviceCombos[i][0]),main.MACsDict.get(deviceCombos[i][1])]) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3094 | pool.append(t) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3095 | t.start() |
| 3096 | i = i + 1 |
| 3097 | main.threadID = main.threadID + 1 |
| 3098 | for thread in pool: |
| 3099 | thread.join() |
| 3100 | intentIdList.append(thread.result) |
| 3101 | time2 = time.time() |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 3102 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3103 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 3104 | # Saving intent ids to check intents in later case |
| 3105 | main.intentIds = list(intentIdList) |
| 3106 | |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3107 | main.step("Verify intents are installed") |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3108 | |
| 3109 | # Giving onos 3 chances to install intents |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3110 | for i in range(3): |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3111 | if i != 0: |
| 3112 | main.log.warn( "Verification failed. Retrying..." ) |
| 3113 | main.log.info("Waiting for onos to install intents...") |
| 3114 | time.sleep( main.checkIntentsDelay ) |
| 3115 | |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3116 | intentState = main.TRUE |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3117 | for e in range(int(main.numCtrls)): |
| 3118 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 3119 | intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\ |
| 3120 | intentState |
| 3121 | if not intentState: |
| 3122 | main.log.warn( "Not all intents installed" ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3123 | if intentState: |
| 3124 | break |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3125 | else: |
| 3126 | #Dumping intent summary |
| 3127 | main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3128 | |
| 3129 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 3130 | onpass="INTENTS INSTALLED", |
| 3131 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 3132 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3133 | main.step( "Verify Ping across all hosts" ) |
| 3134 | pingResult = main.FALSE |
| 3135 | time1 = time.time() |
| 3136 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 3137 | time2 = time.time() |
| 3138 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 3139 | main.log.report( |
| 3140 | "Time taken for Ping All: " + |
| 3141 | str( timeDiff ) + |
| 3142 | " seconds" ) |
| 3143 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 3144 | onpass="PING tALL PASS", |
| 3145 | onfail="PING ALL FAIL" ) |
| 3146 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 3147 | caseResult = ( intentState and pingResult ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3148 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3149 | utilities.assert_equals( |
| 3150 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 3151 | actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3152 | onpass="Install 600 point Intents and Ping All test PASS", |
| 3153 | onfail="Install 600 point Intents and Ping All test FAIL" ) |
| 3154 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 3155 | if not intentState: |
| 3156 | main.log.debug( "Intents failed to install completely" ) |
| 3157 | if not pingResult: |
| 3158 | main.log.debug( "Pingall failed" ) |
| 3159 | |
| 3160 | if not caseResult and main.failSwitch: |
| 3161 | main.log.report("Stopping test") |
| 3162 | main.stop( email=main.emailOnStop ) |
| 3163 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3164 | def CASE91( self ): |
| 3165 | """ |
| 3166 | Install 600 point intents and verify ping all (Chordal Topology) |
| 3167 | """ |
| 3168 | main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" ) |
| 3169 | main.log.report( "_______________________________________" ) |
| 3170 | import itertools |
| 3171 | import time |
| 3172 | main.case( "Install 600 point intents" ) |
| 3173 | main.step( "Add point Intents" ) |
| 3174 | intentResult = main.TRUE |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3175 | deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) ) |
| 3176 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3177 | intentIdList = [] |
| 3178 | time1 = time.time() |
| 3179 | for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ): |
| 3180 | pool = [] |
| 3181 | for cli in main.CLIs: |
| 3182 | if i >= len( deviceCombos ): |
| 3183 | break |
| 3184 | t = main.Thread( target=cli.addPointIntent, |
| 3185 | threadID=main.threadID, |
| 3186 | name="addPointIntent", |
Hari Krishna | 55b171b | 2015-09-02 09:46:03 -0700 | [diff] [blame] | 3187 | args=[deviceCombos[i][0],deviceCombos[i][1],1,1,'',main.MACsDict.get(deviceCombos[i][0]),main.MACsDict.get(deviceCombos[i][1])]) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3188 | pool.append(t) |
| 3189 | #time.sleep(1) |
| 3190 | t.start() |
| 3191 | i = i + 1 |
| 3192 | main.threadID = main.threadID + 1 |
| 3193 | for thread in pool: |
| 3194 | thread.join() |
| 3195 | intentIdList.append(thread.result) |
| 3196 | time2 = time.time() |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 3197 | main.log.info( "Time for adding point intents: %2f seconds" %(time2-time1) ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3198 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 3199 | # Saving intent ids to check intents in later case |
| 3200 | main.intentIds = list(intentIdList) |
| 3201 | |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3202 | main.step("Verify intents are installed") |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3203 | |
| 3204 | # Giving onos 3 chances to install intents |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3205 | for i in range(3): |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3206 | if i != 0: |
| 3207 | main.log.warn( "Verification failed. Retrying..." ) |
| 3208 | main.log.info("Waiting for onos to install intents...") |
| 3209 | time.sleep( main.checkIntentsDelay ) |
| 3210 | |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3211 | intentState = main.TRUE |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3212 | for e in range(int(main.numCtrls)): |
| 3213 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 3214 | intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\ |
| 3215 | intentState |
| 3216 | if not intentState: |
| 3217 | main.log.warn( "Not all intents installed" ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3218 | if intentState: |
| 3219 | break |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3220 | else: |
| 3221 | #Dumping intent summary |
| 3222 | main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3223 | |
| 3224 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 3225 | onpass="INTENTS INSTALLED", |
| 3226 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 3227 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3228 | main.step( "Verify Ping across all hosts" ) |
| 3229 | pingResult = main.FALSE |
| 3230 | time1 = time.time() |
| 3231 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 3232 | time2 = time.time() |
| 3233 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 3234 | main.log.report( |
| 3235 | "Time taken for Ping All: " + |
| 3236 | str( timeDiff ) + |
| 3237 | " seconds" ) |
| 3238 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 3239 | onpass="PING ALL PASS", |
| 3240 | onfail="PING ALL FAIL" ) |
| 3241 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 3242 | caseResult = ( intentState and pingResult ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3243 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3244 | utilities.assert_equals( |
| 3245 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 3246 | actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3247 | onpass="Install 600 point Intents and Ping All test PASS", |
| 3248 | onfail="Install 600 point Intents and Ping All test FAIL" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3249 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 3250 | if not intentState: |
| 3251 | main.log.debug( "Intents failed to install completely" ) |
| 3252 | if not pingResult: |
| 3253 | main.log.debug( "Pingall failed" ) |
| 3254 | |
| 3255 | if not caseResult and main.failSwitch: |
| 3256 | main.log.report("Stopping test") |
| 3257 | main.stop( email=main.emailOnStop ) |
| 3258 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3259 | def CASE92( self ): |
| 3260 | """ |
| 3261 | Install 4556 point intents and verify ping all (Spine Topology) |
| 3262 | """ |
| 3263 | main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" ) |
| 3264 | main.log.report( "_______________________________________" ) |
| 3265 | import itertools |
| 3266 | import time |
| 3267 | main.case( "Install 4556 point intents" ) |
| 3268 | main.step( "Add point Intents" ) |
| 3269 | intentResult = main.TRUE |
| 3270 | main.pingTimeout = 600 |
| 3271 | for i in range(len(main.hostMACs)): |
| 3272 | main.MACsDict[main.deviceDPIDs[i+10]] = main.hostMACs[i].split('/')[0] |
| 3273 | print main.MACsDict |
| 3274 | deviceCombos = list( itertools.permutations( main.deviceDPIDs[10:], 2 ) ) |
| 3275 | intentIdList = [] |
| 3276 | time1 = time.time() |
| 3277 | for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ): |
| 3278 | pool = [] |
| 3279 | for cli in main.CLIs: |
| 3280 | if i >= len( deviceCombos ): |
| 3281 | break |
| 3282 | t = main.Thread( target=cli.addPointIntent, |
| 3283 | threadID=main.threadID, |
| 3284 | name="addPointIntent", |
Hari Krishna | 55b171b | 2015-09-02 09:46:03 -0700 | [diff] [blame] | 3285 | args=[deviceCombos[i][0],deviceCombos[i][1],1,1,'',main.MACsDict.get(deviceCombos[i][0]),main.MACsDict.get(deviceCombos[i][1])]) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3286 | pool.append(t) |
| 3287 | #time.sleep(1) |
| 3288 | t.start() |
| 3289 | i = i + 1 |
| 3290 | main.threadID = main.threadID + 1 |
| 3291 | for thread in pool: |
| 3292 | thread.join() |
| 3293 | intentIdList.append(thread.result) |
| 3294 | time2 = time.time() |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 3295 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3296 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 3297 | # Saving intent ids to check intents in later case |
| 3298 | main.intentIds = list(intentIdList) |
| 3299 | |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3300 | main.step("Verify intents are installed") |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3301 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 3302 | # Giving onos 5 chances to install intents |
| 3303 | for i in range(5): |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3304 | if i != 0: |
| 3305 | main.log.warn( "Verification failed. Retrying..." ) |
| 3306 | main.log.info("Waiting for onos to install intents...") |
| 3307 | time.sleep( main.checkIntentsDelay ) |
| 3308 | |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3309 | intentState = main.TRUE |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3310 | for e in range(int(main.numCtrls)): |
| 3311 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 3312 | intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\ |
| 3313 | intentState |
| 3314 | if not intentState: |
| 3315 | main.log.warn( "Not all intents installed" ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3316 | if intentState: |
| 3317 | break |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3318 | else: |
| 3319 | #Dumping intent summary |
| 3320 | main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3321 | |
| 3322 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 3323 | onpass="INTENTS INSTALLED", |
| 3324 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 3325 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3326 | main.step( "Verify Ping across all hosts" ) |
| 3327 | pingResult = main.FALSE |
| 3328 | time1 = time.time() |
| 3329 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 3330 | time2 = time.time() |
| 3331 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 3332 | main.log.report( |
| 3333 | "Time taken for Ping All: " + |
| 3334 | str( timeDiff ) + |
| 3335 | " seconds" ) |
| 3336 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 3337 | onpass="PING ALL PASS", |
| 3338 | onfail="PING ALL FAIL" ) |
| 3339 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 3340 | caseResult = ( intentState and pingResult ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3341 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3342 | utilities.assert_equals( |
| 3343 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 3344 | actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3345 | onpass="Install 4556 point Intents and Ping All test PASS", |
| 3346 | onfail="Install 4556 point Intents and Ping All test FAIL" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3347 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 3348 | if not intentState: |
| 3349 | main.log.debug( "Intents failed to install completely" ) |
| 3350 | if not pingResult: |
| 3351 | main.log.debug( "Pingall failed" ) |
| 3352 | |
| 3353 | if not caseResult and main.failSwitch: |
| 3354 | main.log.report("Stopping test") |
| 3355 | main.stop( email=main.emailOnStop ) |
| 3356 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3357 | def CASE93( self ): |
| 3358 | """ |
| 3359 | Install multi-single point intents and verify Ping all works |
| 3360 | for att topology |
| 3361 | """ |
| 3362 | import copy |
| 3363 | import time |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3364 | from collections import Counter |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3365 | main.log.report( "Install multi-single point intents and verify Ping all" ) |
| 3366 | main.log.report( "___________________________________________" ) |
| 3367 | main.case( "Install multi-single point intents and Ping all" ) |
| 3368 | deviceDPIDsCopy = copy.copy(main.deviceDPIDs) |
| 3369 | portIngressList = ['1']*(len(deviceDPIDsCopy) - 1) |
| 3370 | intentIdList = [] |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3371 | main.log.info( "MACsDict" + str(main.MACsDict) ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3372 | time1 = time.time() |
| 3373 | for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)): |
| 3374 | pool = [] |
| 3375 | for cli in main.CLIs: |
| 3376 | egressDevice = deviceDPIDsCopy[i] |
| 3377 | ingressDeviceList = copy.copy(deviceDPIDsCopy) |
| 3378 | ingressDeviceList.remove(egressDevice) |
| 3379 | if i >= len( deviceDPIDsCopy ): |
| 3380 | break |
| 3381 | t = main.Thread( target=cli.addMultipointToSinglepointIntent, |
| 3382 | threadID=main.threadID, |
| 3383 | name="addMultipointToSinglepointIntent", |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3384 | args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)]) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3385 | pool.append(t) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3386 | t.start() |
| 3387 | i = i + 1 |
| 3388 | main.threadID = main.threadID + 1 |
| 3389 | for thread in pool: |
| 3390 | thread.join() |
| 3391 | intentIdList.append(thread.result) |
| 3392 | time2 = time.time() |
| 3393 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3394 | |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3395 | main.step("Verify intents are installed") |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3396 | |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3397 | # Giving onos 3 chances to install intents |
| 3398 | for i in range(3): |
| 3399 | if i != 0: |
| 3400 | main.log.warn( "Verification failed. Retrying..." ) |
| 3401 | main.log.info("Waiting for onos to install intents...") |
| 3402 | time.sleep( main.checkIntentsDelay ) |
| 3403 | |
| 3404 | intentState = main.TRUE |
| 3405 | for e in range(int(main.numCtrls)): |
| 3406 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 3407 | intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\ |
| 3408 | intentState |
| 3409 | if not intentState: |
| 3410 | main.log.warn( "Not all intents installed" ) |
| 3411 | if intentState: |
| 3412 | break |
| 3413 | else: |
| 3414 | #Dumping intent summary |
| 3415 | main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) ) |
| 3416 | |
| 3417 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 3418 | onpass="INTENTS INSTALLED", |
| 3419 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 3420 | |
| 3421 | main.log.info( "Checking flows state" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3422 | checkFlowsState = main.ONOScli1.checkFlowsState() |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3423 | # Giving onos time to return the state of the flows |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3424 | time.sleep(50) |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3425 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3426 | main.step( "Verify Ping across all hosts" ) |
| 3427 | pingResult = main.FALSE |
| 3428 | time1 = time.time() |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3429 | pingResult = main.Mininet1.pingall( timeout=main.pingTimeout ) |
| 3430 | if not pingResult: |
| 3431 | time1 = time.time() |
| 3432 | main.log.warn("First pingall failed. Retrying") |
| 3433 | pingResult = main.Mininet1.pingall( timeout=main.pingTimeout ) |
| 3434 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3435 | time2 = time.time() |
| 3436 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 3437 | main.log.report( |
| 3438 | "Time taken for Ping All: " + |
| 3439 | str( timeDiff ) + |
| 3440 | " seconds" ) |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3441 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 3442 | caseResult = ( checkFlowsState and pingResult and intentState ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3443 | utilities.assert_equals( |
| 3444 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 3445 | actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3446 | onpass="Install 25 multi to single point Intents and Ping All test PASS", |
| 3447 | onfail="Install 25 multi to single point Intents and Ping All test FAIL" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3448 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3449 | def CASE94( self ): |
| 3450 | """ |
| 3451 | Install multi-single point intents and verify Ping all works |
| 3452 | for Chordal topology |
| 3453 | """ |
| 3454 | import copy |
| 3455 | import time |
| 3456 | main.log.report( "Install multi-single point intents and verify Ping all" ) |
| 3457 | main.log.report( "___________________________________________" ) |
| 3458 | main.case( "Install multi-single point intents and Ping all" ) |
| 3459 | deviceDPIDsCopy = copy.copy(main.deviceDPIDs) |
| 3460 | portIngressList = ['1']*(len(deviceDPIDsCopy) - 1) |
| 3461 | intentIdList = [] |
| 3462 | print "MACsDict", main.MACsDict |
| 3463 | time1 = time.time() |
| 3464 | for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)): |
| 3465 | pool = [] |
| 3466 | for cli in main.CLIs: |
| 3467 | egressDevice = deviceDPIDsCopy[i] |
| 3468 | ingressDeviceList = copy.copy(deviceDPIDsCopy) |
| 3469 | ingressDeviceList.remove(egressDevice) |
| 3470 | if i >= len( deviceDPIDsCopy ): |
| 3471 | break |
| 3472 | t = main.Thread( target=cli.addMultipointToSinglepointIntent, |
| 3473 | threadID=main.threadID, |
| 3474 | name="addMultipointToSinglepointIntent", |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3475 | args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)]) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3476 | pool.append(t) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3477 | t.start() |
| 3478 | i = i + 1 |
| 3479 | main.threadID = main.threadID + 1 |
| 3480 | for thread in pool: |
| 3481 | thread.join() |
| 3482 | intentIdList.append(thread.result) |
| 3483 | time2 = time.time() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3484 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3485 | |
| 3486 | main.step("Verify intents are installed") |
| 3487 | |
| 3488 | # Giving onos 3 chances to install intents |
| 3489 | for i in range(3): |
| 3490 | if i != 0: |
| 3491 | main.log.warn( "Verification failed. Retrying..." ) |
| 3492 | main.log.info("Waiting for onos to install intents...") |
| 3493 | time.sleep( main.checkIntentsDelay ) |
| 3494 | |
| 3495 | intentState = main.TRUE |
| 3496 | for e in range(int(main.numCtrls)): |
| 3497 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 3498 | intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\ |
| 3499 | intentState |
| 3500 | if not intentState: |
| 3501 | main.log.warn( "Not all intents installed" ) |
| 3502 | if intentState: |
| 3503 | break |
| 3504 | else: |
| 3505 | #Dumping intent summary |
| 3506 | main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) ) |
| 3507 | |
| 3508 | |
| 3509 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 3510 | onpass="INTENTS INSTALLED", |
| 3511 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 3512 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3513 | main.step( "Verify Ping across all hosts" ) |
| 3514 | pingResult = main.FALSE |
| 3515 | time1 = time.time() |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3516 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout) |
| 3517 | if not pingResult: |
| 3518 | main.log.info( "First pingall failed. Retrying..." ) |
| 3519 | time1 = time.time() |
| 3520 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3521 | time2 = time.time() |
| 3522 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 3523 | main.log.report( |
| 3524 | "Time taken for Ping All: " + |
| 3525 | str( timeDiff ) + |
| 3526 | " seconds" ) |
| 3527 | |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3528 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 3529 | caseResult = ( pingResult and intentState ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3530 | utilities.assert_equals( |
| 3531 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 3532 | actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3533 | onpass="Install 25 multi to single point Intents and Ping All test PASS", |
| 3534 | onfail="Install 25 multi to single point Intents and Ping All test FAIL" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3535 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3536 | #def CASE95 multi-single point intent for Spine |
| 3537 | |
| 3538 | def CASE96( self ): |
| 3539 | """ |
| 3540 | Install single-multi point intents and verify Ping all works |
| 3541 | for att topology |
| 3542 | """ |
| 3543 | import copy |
| 3544 | main.log.report( "Install single-multi point intents and verify Ping all" ) |
| 3545 | main.log.report( "___________________________________________" ) |
| 3546 | main.case( "Install single-multi point intents and Ping all" ) |
| 3547 | deviceDPIDsCopy = copy.copy(main.deviceDPIDs) |
| 3548 | portEgressList = ['1']*(len(deviceDPIDsCopy) - 1) |
| 3549 | intentIdList = [] |
| 3550 | print "MACsDict", main.MACsDict |
| 3551 | time1 = time.time() |
| 3552 | for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)): |
| 3553 | pool = [] |
| 3554 | for cli in main.CLIs: |
| 3555 | ingressDevice = deviceDPIDsCopy[i] |
| 3556 | egressDeviceList = copy.copy(deviceDPIDsCopy) |
| 3557 | egressDeviceList.remove(ingressDevice) |
| 3558 | if i >= len( deviceDPIDsCopy ): |
| 3559 | break |
| 3560 | t = main.Thread( target=cli.addSinglepointToMultipointIntent, |
| 3561 | threadID=main.threadID, |
| 3562 | name="addSinglepointToMultipointIntent", |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3563 | args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice)]) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3564 | pool.append(t) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3565 | t.start() |
| 3566 | i = i + 1 |
| 3567 | main.threadID = main.threadID + 1 |
| 3568 | for thread in pool: |
| 3569 | thread.join() |
| 3570 | intentIdList.append(thread.result) |
| 3571 | time2 = time.time() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3572 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3573 | |
| 3574 | main.step("Verify intents are installed") |
| 3575 | |
| 3576 | # Giving onos 3 chances to install intents |
| 3577 | for i in range(3): |
| 3578 | if i != 0: |
| 3579 | main.log.warn( "Verification failed. Retrying..." ) |
| 3580 | main.log.info("Waiting for onos to install intents...") |
| 3581 | time.sleep( main.checkIntentsDelay ) |
| 3582 | |
| 3583 | intentState = main.TRUE |
| 3584 | for e in range(int(main.numCtrls)): |
| 3585 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 3586 | intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\ |
| 3587 | intentState |
| 3588 | if not intentState: |
| 3589 | main.log.warn( "Not all intents installed" ) |
| 3590 | if intentState: |
| 3591 | break |
| 3592 | else: |
| 3593 | #Dumping intent summary |
| 3594 | main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) ) |
| 3595 | |
| 3596 | |
| 3597 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 3598 | onpass="INTENTS INSTALLED", |
| 3599 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 3600 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3601 | main.step( "Verify Ping across all hosts" ) |
| 3602 | pingResult = main.FALSE |
| 3603 | time1 = time.time() |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3604 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout) |
| 3605 | if not pingResult: |
| 3606 | main.log.info( "First pingall failed. Retrying..." ) |
| 3607 | time1 = time.time() |
| 3608 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3609 | time2 = time.time() |
| 3610 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 3611 | main.log.report( |
| 3612 | "Time taken for Ping All: " + |
| 3613 | str( timeDiff ) + |
| 3614 | " seconds" ) |
| 3615 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 3616 | caseResult = ( pingResult and intentState ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3617 | utilities.assert_equals( |
| 3618 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 3619 | actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3620 | onpass="Install 25 single to multi point Intents and Ping All test PASS", |
| 3621 | onfail="Install 25 single to multi point Intents and Ping All test FAIL" ) |
| 3622 | |
| 3623 | def CASE97( self ): |
| 3624 | """ |
| 3625 | Install single-multi point intents and verify Ping all works |
| 3626 | for Chordal topology |
| 3627 | """ |
| 3628 | import copy |
| 3629 | main.log.report( "Install single-multi point intents and verify Ping all" ) |
| 3630 | main.log.report( "___________________________________________" ) |
| 3631 | main.case( "Install single-multi point intents and Ping all" ) |
| 3632 | deviceDPIDsCopy = copy.copy(main.deviceDPIDs) |
| 3633 | portEgressList = ['1']*(len(deviceDPIDsCopy) - 1) |
| 3634 | intentIdList = [] |
| 3635 | print "MACsDict", main.MACsDict |
| 3636 | time1 = time.time() |
| 3637 | for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)): |
| 3638 | pool = [] |
| 3639 | for cli in main.CLIs: |
| 3640 | ingressDevice = deviceDPIDsCopy[i] |
| 3641 | egressDeviceList = copy.copy(deviceDPIDsCopy) |
| 3642 | egressDeviceList.remove(ingressDevice) |
| 3643 | if i >= len( deviceDPIDsCopy ): |
| 3644 | break |
| 3645 | t = main.Thread( target=cli.addSinglepointToMultipointIntent, |
| 3646 | threadID=main.threadID, |
| 3647 | name="addSinglepointToMultipointIntent", |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3648 | args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice),'']) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3649 | pool.append(t) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3650 | t.start() |
| 3651 | i = i + 1 |
| 3652 | main.threadID = main.threadID + 1 |
| 3653 | for thread in pool: |
| 3654 | thread.join() |
| 3655 | intentIdList.append(thread.result) |
| 3656 | time2 = time.time() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3657 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3658 | |
| 3659 | main.step("Verify intents are installed") |
| 3660 | |
| 3661 | # Giving onos 3 chances to install intents |
| 3662 | for i in range(3): |
| 3663 | if i != 0: |
| 3664 | main.log.warn( "Verification failed. Retrying..." ) |
| 3665 | main.log.info("Waiting for onos to install intents...") |
| 3666 | time.sleep( main.checkIntentsDelay ) |
| 3667 | |
| 3668 | intentState = main.TRUE |
| 3669 | for e in range(int(main.numCtrls)): |
| 3670 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 3671 | intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\ |
| 3672 | intentState |
| 3673 | if not intentState: |
| 3674 | main.log.warn( "Not all intents installed" ) |
| 3675 | if intentState: |
| 3676 | break |
| 3677 | else: |
| 3678 | #Dumping intent summary |
| 3679 | main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) ) |
| 3680 | |
| 3681 | |
| 3682 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 3683 | onpass="INTENTS INSTALLED", |
| 3684 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 3685 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3686 | main.step( "Verify Ping across all hosts" ) |
| 3687 | pingResult = main.FALSE |
| 3688 | time1 = time.time() |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3689 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout) |
| 3690 | if not pingResult: |
| 3691 | main.log.info( "First pingall failed. Retrying..." ) |
| 3692 | time1 = time.time() |
| 3693 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3694 | time2 = time.time() |
| 3695 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 3696 | main.log.report( |
| 3697 | "Time taken for Ping All: " + |
| 3698 | str( timeDiff ) + |
| 3699 | " seconds" ) |
| 3700 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 3701 | caseResult = ( pingResult and intentState ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3702 | utilities.assert_equals( |
| 3703 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 3704 | actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3705 | onpass="Install 25 single to multi point Intents and Ping All test PASS", |
| 3706 | onfail="Install 25 single to multi point Intents and Ping All test FAIL" ) |
| 3707 | |
| 3708 | def CASE98( self ): |
| 3709 | """ |
| 3710 | Install single-multi point intents and verify Ping all works |
| 3711 | for Spine topology |
| 3712 | """ |
| 3713 | import copy |
| 3714 | main.log.report( "Install single-multi point intents and verify Ping all" ) |
| 3715 | main.log.report( "___________________________________________" ) |
| 3716 | main.case( "Install single-multi point intents and Ping all" ) |
| 3717 | deviceDPIDsCopy = copy.copy( main.deviceDPIDs ) |
| 3718 | deviceDPIDsCopy = deviceDPIDsCopy[ 10: ] |
| 3719 | portEgressList = [ '1' ]*(len(deviceDPIDsCopy) - 1) |
| 3720 | intentIdList = [] |
| 3721 | MACsDictCopy = {} |
| 3722 | for i in range( len( deviceDPIDsCopy ) ): |
| 3723 | MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ] |
| 3724 | |
| 3725 | print "deviceDPIDsCopy", deviceDPIDsCopy |
| 3726 | print "" |
| 3727 | print "MACsDictCopy", MACsDictCopy |
| 3728 | time1 = time.time() |
| 3729 | for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)): |
| 3730 | pool = [] |
| 3731 | for cli in main.CLIs: |
| 3732 | if i >= len( deviceDPIDsCopy ): |
| 3733 | break |
| 3734 | ingressDevice = deviceDPIDsCopy[i] |
| 3735 | egressDeviceList = copy.copy(deviceDPIDsCopy) |
| 3736 | egressDeviceList.remove(ingressDevice) |
| 3737 | t = main.Thread( target=cli.addSinglepointToMultipointIntent, |
| 3738 | threadID=main.threadID, |
| 3739 | name="addSinglepointToMultipointIntent", |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3740 | args =[ingressDevice,egressDeviceList,'1',portEgressList,'',MACsDictCopy.get(ingressDevice),'']) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3741 | pool.append(t) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3742 | t.start() |
| 3743 | i = i + 1 |
| 3744 | main.threadID = main.threadID + 1 |
| 3745 | for thread in pool: |
| 3746 | thread.join() |
| 3747 | intentIdList.append(thread.result) |
| 3748 | time2 = time.time() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3749 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3750 | |
| 3751 | main.step("Verify intents are installed") |
| 3752 | |
| 3753 | # Giving onos 3 chances to install intents |
| 3754 | for i in range(3): |
| 3755 | if i != 0: |
| 3756 | main.log.warn( "Verification failed. Retrying..." ) |
| 3757 | main.log.info("Waiting for onos to install intents...") |
| 3758 | time.sleep( main.checkIntentsDelay ) |
| 3759 | |
| 3760 | intentState = main.TRUE |
| 3761 | for e in range(int(main.numCtrls)): |
| 3762 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 3763 | intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\ |
| 3764 | intentState |
| 3765 | if not intentState: |
| 3766 | main.log.warn( "Not all intents installed" ) |
| 3767 | if intentState: |
| 3768 | break |
| 3769 | else: |
| 3770 | #Dumping intent summary |
| 3771 | main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) ) |
| 3772 | |
| 3773 | |
| 3774 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 3775 | onpass="INTENTS INSTALLED", |
| 3776 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 3777 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3778 | main.step( "Verify Ping across all hosts" ) |
| 3779 | pingResult = main.FALSE |
| 3780 | time1 = time.time() |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3781 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout) |
| 3782 | if not pingResult: |
| 3783 | main.log.info( "First pingall failed. Retrying..." ) |
| 3784 | time1 = time.time() |
| 3785 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3786 | time2 = time.time() |
| 3787 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 3788 | main.log.report( |
| 3789 | "Time taken for Ping All: " + |
| 3790 | str( timeDiff ) + |
| 3791 | " seconds" ) |
| 3792 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 3793 | caseResult = ( pingResult and intentState ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3794 | utilities.assert_equals( |
| 3795 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 3796 | actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3797 | onpass="Install 25 single to multi point Intents and Ping All test PASS", |
| 3798 | onfail="Install 25 single to multi point Intents and Ping All test FAIL" ) |
| 3799 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3800 | def CASE190( self ): |
| 3801 | """ |
| 3802 | Verify IPv6 ping across 600 Point intents (Att Topology) |
| 3803 | """ |
| 3804 | main.log.report( "Verify IPv6 ping across 600 Point intents (Att Topology)" ) |
| 3805 | main.log.report( "_________________________________________________" ) |
| 3806 | import itertools |
| 3807 | import time |
| 3808 | main.case( "IPv6 ping all 600 Point intents" ) |
| 3809 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 3810 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 3811 | pingResult = main.FALSE |
| 3812 | time1 = time.time() |
| 3813 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 3814 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3815 | main.log.warn("First pingall failed. Retrying...") |
| 3816 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 3817 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
| 3818 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3819 | time2 = time.time() |
| 3820 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 3821 | main.log.report( |
| 3822 | "Time taken for IPv6 Ping All: " + |
| 3823 | str( timeDiff ) + |
| 3824 | " seconds" ) |
| 3825 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 3826 | onpass="PING ALL PASS", |
| 3827 | onfail="PING ALL FAIL" ) |
| 3828 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 3829 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3830 | utilities.assert_equals( |
| 3831 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 3832 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3833 | onpass="IPv6 Ping across 600 Point intents test PASS", |
| 3834 | onfail="IPv6 Ping across 600 Point intents test FAIL" ) |
| 3835 | |
| 3836 | def CASE191( self ): |
| 3837 | """ |
| 3838 | Verify IPv6 ping across 600 Point intents (Chordal Topology) |
| 3839 | """ |
| 3840 | main.log.report( "Verify IPv6 ping across 600 Point intents (Chordal Topology)" ) |
| 3841 | main.log.report( "_________________________________________________" ) |
| 3842 | import itertools |
| 3843 | import time |
| 3844 | main.case( "IPv6 ping all 600 Point intents" ) |
| 3845 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 3846 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 3847 | pingResult = main.FALSE |
| 3848 | time1 = time.time() |
| 3849 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 3850 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3851 | main.log.warn("First pingall failed. Retrying...") |
| 3852 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 3853 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3854 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3855 | time2 = time.time() |
| 3856 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 3857 | main.log.report( |
| 3858 | "Time taken for IPv6 Ping All: " + |
| 3859 | str( timeDiff ) + |
| 3860 | " seconds" ) |
| 3861 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 3862 | onpass="PING ALL PASS", |
| 3863 | onfail="PING ALL FAIL" ) |
| 3864 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 3865 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3866 | utilities.assert_equals( |
| 3867 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 3868 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3869 | onpass="IPv6 Ping across 600 Point intents test PASS", |
| 3870 | onfail="IPv6 Ping across 600 Point intents test FAIL" ) |
| 3871 | |
| 3872 | def CASE192( self ): |
| 3873 | """ |
| 3874 | Verify IPv6 ping across 4556 Point intents (Spine Topology) |
| 3875 | """ |
| 3876 | main.log.report( "Verify IPv6 ping across 4556 Point intents (Spine Topology)" ) |
| 3877 | main.log.report( "_________________________________________________" ) |
| 3878 | import itertools |
| 3879 | import time |
Hari Krishna | 310efca | 2015-09-03 09:43:16 -0700 | [diff] [blame] | 3880 | main.case( "IPv6 ping all 4556 Point intents" ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3881 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 3882 | hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ] |
| 3883 | pingResult = main.FALSE |
| 3884 | time1 = time.time() |
| 3885 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3886 | if not pingResult: |
| 3887 | main.log.warn("First pingall failed. Retrying...") |
| 3888 | time1 = time.time() |
| 3889 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
| 3890 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3891 | time2 = time.time() |
| 3892 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 3893 | main.log.report( |
| 3894 | "Time taken for IPv6 Ping All: " + |
| 3895 | str( timeDiff ) + |
| 3896 | " seconds" ) |
| 3897 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 3898 | onpass="PING ALL PASS", |
| 3899 | onfail="PING ALL FAIL" ) |
| 3900 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 3901 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3902 | utilities.assert_equals( |
| 3903 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 3904 | actual=caseResult, |
Hari Krishna | 310efca | 2015-09-03 09:43:16 -0700 | [diff] [blame] | 3905 | onpass="IPv6 Ping across 4556 Point intents test PASS", |
| 3906 | onfail="IPv6 Ping across 4556 Point intents test FAIL" ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3907 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3908 | def CASE10( self ): |
| 3909 | import time |
GlennRC | c6cd2a6 | 2015-08-10 16:08:22 -0700 | [diff] [blame] | 3910 | import re |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3911 | """ |
| 3912 | Remove all Intents |
| 3913 | """ |
| 3914 | main.log.report( "Remove all intents that were installed previously" ) |
| 3915 | main.log.report( "______________________________________________" ) |
| 3916 | main.log.info( "Remove all intents" ) |
| 3917 | main.case( "Removing intents" ) |
Hari Krishna | ad0c520 | 2015-09-01 14:26:49 -0700 | [diff] [blame] | 3918 | purgeDelay = int( main.params[ "timers" ][ "IntentPurgeDelay" ] ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3919 | main.step( "Obtain the intent id's first" ) |
| 3920 | intentsList = main.ONOScli1.getAllIntentIds() |
| 3921 | ansi_escape = re.compile( r'\x1b[^m]*m' ) |
| 3922 | intentsList = ansi_escape.sub( '', intentsList ) |
| 3923 | intentsList = intentsList.replace( |
| 3924 | " onos:intents | grep id=", |
| 3925 | "" ).replace( |
| 3926 | "id=", |
| 3927 | "" ).replace( |
| 3928 | "\r\r", |
| 3929 | "" ) |
| 3930 | intentsList = intentsList.splitlines() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3931 | intentIdList = [] |
| 3932 | step1Result = main.TRUE |
| 3933 | moreIntents = main.TRUE |
| 3934 | removeIntentCount = 0 |
| 3935 | intentsCount = len(intentsList) |
| 3936 | main.log.info ( "Current number of intents: " + str(intentsCount) ) |
| 3937 | if ( len( intentsList ) > 1 ): |
| 3938 | results = main.TRUE |
| 3939 | main.log.info("Removing intent...") |
| 3940 | while moreIntents: |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 3941 | # This is a work around only: cycle through intents removal for up to 5 times. |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3942 | if removeIntentCount == 5: |
| 3943 | break |
| 3944 | removeIntentCount = removeIntentCount + 1 |
| 3945 | intentsList1 = main.ONOScli1.getAllIntentIds() |
| 3946 | if len( intentsList1 ) == 0: |
| 3947 | break |
| 3948 | ansi_escape = re.compile( r'\x1b[^m]*m' ) |
| 3949 | intentsList1 = ansi_escape.sub( '', intentsList1 ) |
| 3950 | intentsList1 = intentsList1.replace( |
| 3951 | " onos:intents | grep id=", |
| 3952 | "" ).replace( |
| 3953 | " state=", |
| 3954 | "" ).replace( |
| 3955 | "\r\r", |
| 3956 | "" ) |
| 3957 | intentsList1 = intentsList1.splitlines() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3958 | main.log.info ( "Round %d intents to remove: " %(removeIntentCount) ) |
| 3959 | print intentsList1 |
| 3960 | intentIdList1 = [] |
| 3961 | if ( len( intentsList1 ) > 0 ): |
| 3962 | moreIntents = main.TRUE |
| 3963 | for i in range( len( intentsList1 ) ): |
| 3964 | intentsTemp1 = intentsList1[ i ].split( ',' ) |
| 3965 | intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] ) |
| 3966 | main.log.info ( "Leftover Intent IDs: " + str(intentIdList1) ) |
| 3967 | main.log.info ( "Length of Leftover Intents list: " + str(len(intentIdList1)) ) |
| 3968 | time1 = time.time() |
| 3969 | for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ): |
| 3970 | pool = [] |
| 3971 | for cli in main.CLIs: |
| 3972 | if i >= len( intentIdList1 ): |
| 3973 | break |
| 3974 | t = main.Thread( target=cli.removeIntent, |
| 3975 | threadID=main.threadID, |
| 3976 | name="removeIntent", |
| 3977 | args=[intentIdList1[i],'org.onosproject.cli',False,False]) |
| 3978 | pool.append(t) |
| 3979 | t.start() |
| 3980 | i = i + 1 |
| 3981 | main.threadID = main.threadID + 1 |
| 3982 | for thread in pool: |
| 3983 | thread.join() |
| 3984 | intentIdList.append(thread.result) |
| 3985 | #time.sleep(2) |
| 3986 | time2 = time.time() |
| 3987 | main.log.info("Time for removing host intents: %2f seconds" %(time2-time1)) |
Hari Krishna | ad0c520 | 2015-09-01 14:26:49 -0700 | [diff] [blame] | 3988 | time.sleep( purgeDelay ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3989 | main.log.info("Purging WITHDRAWN Intents") |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 3990 | purgeResult = main.ONOScli1.purgeWithdrawnIntents() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3991 | else: |
| 3992 | time.sleep(10) |
| 3993 | if len( main.ONOScli1.intents()): |
| 3994 | continue |
| 3995 | break |
Hari Krishna | ad0c520 | 2015-09-01 14:26:49 -0700 | [diff] [blame] | 3996 | time.sleep( purgeDelay ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3997 | else: |
| 3998 | print "Removed %d intents" %(intentsCount) |
| 3999 | step1Result = main.TRUE |
| 4000 | else: |
| 4001 | print "No Intent IDs found in Intents list: ", intentsList |
| 4002 | step1Result = main.FALSE |
| 4003 | |
| 4004 | print main.ONOScli1.intents() |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 4005 | caseResult = step1Result |
| 4006 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 4007 | onpass="Intent removal test successful", |
| 4008 | onfail="Intent removal test failed" ) |
| 4009 | |
| 4010 | def CASE12( self, main ): |
| 4011 | """ |
| 4012 | Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it |
| 4013 | """ |
| 4014 | import re |
| 4015 | import copy |
| 4016 | import time |
| 4017 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 4018 | threadID = 0 |
| 4019 | |
| 4020 | main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" ) |
| 4021 | main.log.report( "_____________________________________________________" ) |
| 4022 | main.case( "Enable Intent based Reactive forwarding and Verify ping all" ) |
| 4023 | main.step( "Enable intent based Reactive forwarding" ) |
| 4024 | installResult = main.FALSE |
| 4025 | feature = "onos-app-ifwd" |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 4026 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 4027 | pool = [] |
| 4028 | time1 = time.time() |
| 4029 | for cli,feature in main.CLIs: |
| 4030 | t = main.Thread(target=cli,threadID=threadID, |
| 4031 | name="featureInstall",args=[feature]) |
| 4032 | pool.append(t) |
| 4033 | t.start() |
| 4034 | threadID = threadID + 1 |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 4035 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 4036 | results = [] |
| 4037 | for thread in pool: |
| 4038 | thread.join() |
| 4039 | results.append(thread.result) |
| 4040 | time2 = time.time() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 4041 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 4042 | if( all(result == main.TRUE for result in results) == False): |
| 4043 | main.log.info("Did not install onos-app-ifwd feature properly") |
| 4044 | #main.cleanup() |
| 4045 | #main.exit() |
| 4046 | else: |
| 4047 | main.log.info("Successful feature:install onos-app-ifwd") |
| 4048 | installResult = main.TRUE |
| 4049 | main.log.info("Time for feature:install onos-app-ifwd: %2f seconds" %(time2-time1)) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 4050 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 4051 | main.step( "Verify Pingall" ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 4052 | pingResult = main.FALSE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 4053 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 4054 | pingResult = main.Mininet1.pingall(timeout=600) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 4055 | time2 = time.time() |
| 4056 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 4057 | main.log.report( |
| 4058 | "Time taken for Ping All: " + |
| 4059 | str( timeDiff ) + |
| 4060 | " seconds" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 4061 | |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 4062 | if pingResult == main.TRUE: |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 4063 | main.log.report( "Pingall Test in Reactive mode successful" ) |
| 4064 | else: |
| 4065 | main.log.report( "Pingall Test in Reactive mode failed" ) |
| 4066 | |
| 4067 | main.step( "Disable Intent based Reactive forwarding" ) |
| 4068 | uninstallResult = main.FALSE |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 4069 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 4070 | pool = [] |
| 4071 | time1 = time.time() |
| 4072 | for cli,feature in main.CLIs: |
| 4073 | t = main.Thread(target=cli,threadID=threadID, |
| 4074 | name="featureUninstall",args=[feature]) |
| 4075 | pool.append(t) |
| 4076 | t.start() |
| 4077 | threadID = threadID + 1 |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 4078 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 4079 | results = [] |
| 4080 | for thread in pool: |
| 4081 | thread.join() |
| 4082 | results.append(thread.result) |
| 4083 | time2 = time.time() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 4084 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 4085 | if( all(result == main.TRUE for result in results) == False): |
| 4086 | main.log.info("Did not uninstall onos-app-ifwd feature properly") |
| 4087 | uninstallResult = main.FALSE |
| 4088 | #main.cleanup() |
| 4089 | #main.exit() |
| 4090 | else: |
| 4091 | main.log.info("Successful feature:uninstall onos-app-ifwd") |
| 4092 | uninstallResult = main.TRUE |
| 4093 | main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1)) |
| 4094 | |
| 4095 | # Waiting for reative flows to be cleared. |
| 4096 | time.sleep( 10 ) |
| 4097 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame^] | 4098 | caseResult = installResult and pingResult and uninstallResult |
| 4099 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 4100 | onpass="Intent based Reactive forwarding Pingall test PASS", |
| 4101 | onfail="Intent based Reactive forwarding Pingall test FAIL" ) |