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