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