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