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