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