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