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