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