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