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" ) |
| 1266 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 1267 | pingResult = main.FALSE |
| 1268 | time1 = time.time() |
| 1269 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 1270 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1271 | main.log.warn("First pingall failed. Retrying...") |
| 1272 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 1273 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 1274 | time2 = time.time() |
| 1275 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1276 | main.log.report( |
| 1277 | "Time taken for IPv6 Ping All: " + |
| 1278 | str( timeDiff ) + |
| 1279 | " seconds" ) |
| 1280 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 1281 | onpass="PING ALL PASS", |
| 1282 | onfail="PING ALL FAIL" ) |
| 1283 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 1284 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 1285 | utilities.assert_equals( |
| 1286 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 1287 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 1288 | onpass="IPv6 Ping across 300 host intents test PASS", |
| 1289 | onfail="IPv6 Ping across 300 host intents test FAIL" ) |
| 1290 | |
| 1291 | def CASE161( self ): |
| 1292 | """ |
| 1293 | Verify IPv6 ping across 600 host intents (Chordal Topology) |
| 1294 | """ |
| 1295 | main.log.report( "Verify IPv6 ping across 600 host intents (Chordal Topology)" ) |
| 1296 | main.log.report( "_________________________________________________" ) |
| 1297 | import itertools |
| 1298 | import time |
| 1299 | main.case( "IPv6 ping all 600 host intents" ) |
| 1300 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 1301 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 1302 | pingResult = main.FALSE |
| 1303 | time1 = time.time() |
| 1304 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 1305 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1306 | main.log.warn("First pingall failed. Retrying...") |
| 1307 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 1308 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1309 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 1310 | time2 = time.time() |
| 1311 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1312 | main.log.report( |
| 1313 | "Time taken for IPv6 Ping All: " + |
| 1314 | str( timeDiff ) + |
| 1315 | " seconds" ) |
| 1316 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 1317 | onpass="PING ALL PASS", |
| 1318 | onfail="PING ALL FAIL" ) |
| 1319 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 1320 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 1321 | utilities.assert_equals( |
| 1322 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 1323 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 1324 | onpass="IPv6 Ping across 600 host intents test PASS", |
| 1325 | onfail="IPv6 Ping across 600 host intents test FAIL" ) |
| 1326 | |
| 1327 | def CASE162( self ): |
| 1328 | """ |
| 1329 | Verify IPv6 ping across 2278 host intents (Spine Topology) |
| 1330 | """ |
| 1331 | main.log.report( "Verify IPv6 ping across 2278 host intents (Spine Topology)" ) |
| 1332 | main.log.report( "_________________________________________________" ) |
| 1333 | import itertools |
| 1334 | import time |
| 1335 | main.case( "IPv6 ping all 600 host intents" ) |
| 1336 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 1337 | hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ] |
| 1338 | pingResult = main.FALSE |
| 1339 | time1 = time.time() |
| 1340 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 1341 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1342 | main.log.warn("First pingall failed. Retrying...") |
| 1343 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 1344 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1345 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 1346 | time2 = time.time() |
| 1347 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1348 | main.log.report( |
| 1349 | "Time taken for IPv6 Ping All: " + |
| 1350 | str( timeDiff ) + |
| 1351 | " seconds" ) |
| 1352 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 1353 | onpass="PING ALL PASS", |
| 1354 | onfail="PING ALL FAIL" ) |
| 1355 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 1356 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 1357 | utilities.assert_equals( |
| 1358 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 1359 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 1360 | onpass="IPv6 Ping across 600 host intents test PASS", |
| 1361 | onfail="IPv6 Ping across 600 host intents test FAIL" ) |
| 1362 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1363 | def CASE70( self, main ): |
| 1364 | """ |
| 1365 | Randomly bring some core links down and verify ping all ( Host Intents-Att Topo) |
| 1366 | """ |
| 1367 | import random |
| 1368 | main.randomLink1 = [] |
| 1369 | main.randomLink2 = [] |
| 1370 | main.randomLink3 = [] |
| 1371 | link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ] |
| 1372 | link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' ) |
| 1373 | link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ] |
| 1374 | link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' ) |
| 1375 | link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ] |
| 1376 | link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' ) |
| 1377 | switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ] |
| 1378 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 1379 | |
| 1380 | main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" ) |
| 1381 | main.log.report( "___________________________________________________________________________" ) |
| 1382 | main.case( "Host intents - Randomly bring some core links down and verify ping all" ) |
| 1383 | main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" ) |
| 1384 | if ( int( switchLinksToToggle ) == |
| 1385 | 0 or int( switchLinksToToggle ) > 5 ): |
| 1386 | main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" ) |
| 1387 | #main.cleanup() |
| 1388 | #main.exit() |
| 1389 | else: |
| 1390 | main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" ) |
| 1391 | |
| 1392 | main.step( "Cut links on Core devices using user provided range" ) |
| 1393 | main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) ) |
| 1394 | main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) ) |
| 1395 | main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) ) |
| 1396 | for i in range( int( switchLinksToToggle ) ): |
| 1397 | main.Mininet1.link( |
| 1398 | END1=link1End1, |
| 1399 | END2=main.randomLink1[ i ], |
| 1400 | OPTION="down" ) |
| 1401 | time.sleep( link_sleep ) |
| 1402 | main.Mininet1.link( |
| 1403 | END1=link2End1, |
| 1404 | END2=main.randomLink2[ i ], |
| 1405 | OPTION="down" ) |
| 1406 | time.sleep( link_sleep ) |
| 1407 | main.Mininet1.link( |
| 1408 | END1=link3End1, |
| 1409 | END2=main.randomLink3[ i ], |
| 1410 | OPTION="down" ) |
| 1411 | time.sleep( link_sleep ) |
| 1412 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1413 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1414 | linkDown = main.ONOSbench.checkStatus( |
| 1415 | topology_output, main.numMNswitches, str( |
| 1416 | int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) ) |
| 1417 | utilities.assert_equals( |
| 1418 | expect=main.TRUE, |
| 1419 | actual=linkDown, |
| 1420 | onpass="Link Down discovered properly", |
| 1421 | onfail="Link down was not discovered in " + |
| 1422 | str( link_sleep ) + |
| 1423 | " seconds" ) |
| 1424 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1425 | main.step("Verify intents are installed") |
GlennRC | 1dde171 | 2015-10-02 11:03:08 -0700 | [diff] [blame^] | 1426 | # Giving onos multiple chances to install intents |
| 1427 | for i in range( main.intentCheck ): |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1428 | if i != 0: |
| 1429 | main.log.warn( "Verification failed. Retrying..." ) |
| 1430 | main.log.info("Giving onos some time...") |
| 1431 | time.sleep( main.checkIntentsDelay ) |
| 1432 | |
| 1433 | intentState = main.TRUE |
| 1434 | for e in range(int(main.numCtrls)): |
| 1435 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 1436 | intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\ |
| 1437 | intentState |
| 1438 | if not intentState: |
| 1439 | main.log.warn( "Not all intents installed" ) |
| 1440 | if intentState: |
| 1441 | break |
| 1442 | else: |
| 1443 | #Dumping intent summary |
| 1444 | main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) ) |
| 1445 | |
| 1446 | |
| 1447 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 1448 | onpass="INTENTS INSTALLED", |
| 1449 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 1450 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1451 | main.step( "Verify Ping across all hosts" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1452 | pingResult = main.FALSE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1453 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1454 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
| 1455 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1456 | main.log.warn("First pingall failed. Retrying...") |
| 1457 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1458 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1459 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1460 | time2 = time.time() |
| 1461 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1462 | main.log.report( |
| 1463 | "Time taken for Ping All: " + |
| 1464 | str( timeDiff ) + |
| 1465 | " seconds" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1466 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1467 | onpass="PING ALL PASS", |
| 1468 | onfail="PING ALL FAIL" ) |
| 1469 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 1470 | caseResult = linkDown and pingResult and intentState |
| 1471 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1472 | onpass="Random Link cut Test PASS", |
| 1473 | onfail="Random Link cut Test FAIL" ) |
| 1474 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1475 | # Printing what exactly failed |
| 1476 | if not linkDown: |
| 1477 | main.log.debug( "Link down was not discovered correctly" ) |
| 1478 | if not pingResult: |
| 1479 | main.log.debug( "Pingall failed" ) |
| 1480 | if not intentState: |
| 1481 | main.log.debug( "Intents are not all installed" ) |
| 1482 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 1483 | if not caseResult and main.failSwitch: |
| 1484 | main.log.report("Stopping test") |
| 1485 | main.stop( email=main.emailOnStop ) |
| 1486 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1487 | def CASE80( self, main ): |
| 1488 | """ |
| 1489 | Bring the core links up that are down and verify ping all ( Host Intents-Att Topo ) |
| 1490 | """ |
| 1491 | import random |
| 1492 | link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ] |
| 1493 | link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ] |
| 1494 | link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ] |
| 1495 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 1496 | switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ] |
| 1497 | |
| 1498 | main.log.report( |
| 1499 | "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" ) |
| 1500 | main.log.report( |
| 1501 | "__________________________________________________________________" ) |
| 1502 | main.case( |
| 1503 | "Host intents - Bring the core links up that are down and verify ping all" ) |
| 1504 | main.step( "Bring randomly cut links on Core devices up" ) |
| 1505 | for i in range( int( switchLinksToToggle ) ): |
| 1506 | main.Mininet1.link( |
| 1507 | END1=link1End1, |
| 1508 | END2=main.randomLink1[ i ], |
| 1509 | OPTION="up" ) |
| 1510 | time.sleep( link_sleep ) |
| 1511 | main.Mininet1.link( |
| 1512 | END1=link2End1, |
| 1513 | END2=main.randomLink2[ i ], |
| 1514 | OPTION="up" ) |
| 1515 | time.sleep( link_sleep ) |
| 1516 | main.Mininet1.link( |
| 1517 | END1=link3End1, |
| 1518 | END2=main.randomLink3[ i ], |
| 1519 | OPTION="up" ) |
| 1520 | time.sleep( link_sleep ) |
| 1521 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1522 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1523 | linkUp = main.ONOSbench.checkStatus( |
| 1524 | topology_output, |
| 1525 | main.numMNswitches, |
| 1526 | str( main.numMNlinks ) ) |
| 1527 | utilities.assert_equals( |
| 1528 | expect=main.TRUE, |
| 1529 | actual=linkUp, |
| 1530 | onpass="Link up discovered properly", |
| 1531 | onfail="Link up was not discovered in " + |
| 1532 | str( link_sleep ) + |
| 1533 | " seconds" ) |
| 1534 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1535 | main.step("Verify intents are installed") |
GlennRC | 1dde171 | 2015-10-02 11:03:08 -0700 | [diff] [blame^] | 1536 | # Giving onos multiple chances to install intents |
| 1537 | for i in range( main.intentCheck ): |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1538 | if i != 0: |
| 1539 | main.log.warn( "Verification failed. Retrying..." ) |
| 1540 | main.log.info("Giving onos some time...") |
| 1541 | time.sleep( main.checkIntentsDelay ) |
| 1542 | |
| 1543 | intentState = main.TRUE |
| 1544 | for e in range(int(main.numCtrls)): |
| 1545 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 1546 | intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\ |
| 1547 | intentState |
| 1548 | if not intentState: |
| 1549 | main.log.warn( "Not all intents installed" ) |
| 1550 | if intentState: |
| 1551 | break |
| 1552 | else: |
| 1553 | #Dumping intent summary |
| 1554 | main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) ) |
| 1555 | |
| 1556 | |
| 1557 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 1558 | onpass="INTENTS INSTALLED", |
| 1559 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 1560 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1561 | main.step( "Verify Ping across all hosts" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1562 | pingResult = main.FALSE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1563 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1564 | pingResult = main.Mininet1.pingall( timeout=main.pingTimeout ) |
| 1565 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1566 | main.log.warn("First pingall failed. Retrying...") |
| 1567 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1568 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1569 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1570 | time2 = time.time() |
| 1571 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1572 | main.log.report( |
| 1573 | "Time taken for Ping All: " + |
| 1574 | str( timeDiff ) + |
| 1575 | " seconds" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1576 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1577 | onpass="PING ALL PASS", |
| 1578 | onfail="PING ALL FAIL" ) |
| 1579 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 1580 | caseResult = linkUp and pingResult |
| 1581 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1582 | onpass="Link Up Test PASS", |
| 1583 | onfail="Link Up Test FAIL" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1584 | # Printing what exactly failed |
| 1585 | if not linkUp: |
| 1586 | main.log.debug( "Link down was not discovered correctly" ) |
| 1587 | if not pingResult: |
| 1588 | main.log.debug( "Pingall failed" ) |
| 1589 | if not intentState: |
| 1590 | main.log.debug( "Intents are not all installed" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1591 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 1592 | if not caseResult and main.failSwitch: |
| 1593 | main.log.report("Stopping test") |
| 1594 | main.stop( email=main.emailOnStop ) |
| 1595 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1596 | def CASE71( self, main ): |
| 1597 | """ |
| 1598 | Randomly bring some core links down and verify ping all ( Point Intents-Att Topo) |
| 1599 | """ |
| 1600 | import random |
| 1601 | main.randomLink1 = [] |
| 1602 | main.randomLink2 = [] |
| 1603 | main.randomLink3 = [] |
| 1604 | link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ] |
| 1605 | link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' ) |
| 1606 | link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ] |
| 1607 | link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' ) |
| 1608 | link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ] |
| 1609 | link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' ) |
| 1610 | switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ] |
| 1611 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 1612 | |
| 1613 | main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" ) |
| 1614 | main.log.report( "___________________________________________________________________________" ) |
| 1615 | main.case( "Point intents - Randomly bring some core links down and verify ping all" ) |
| 1616 | main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" ) |
| 1617 | if ( int( switchLinksToToggle ) == |
| 1618 | 0 or int( switchLinksToToggle ) > 5 ): |
| 1619 | main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" ) |
| 1620 | #main.cleanup() |
| 1621 | #main.exit() |
| 1622 | else: |
| 1623 | main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" ) |
| 1624 | |
| 1625 | main.step( "Cut links on Core devices using user provided range" ) |
| 1626 | main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) ) |
| 1627 | main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) ) |
| 1628 | main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) ) |
| 1629 | for i in range( int( switchLinksToToggle ) ): |
| 1630 | main.Mininet1.link( |
| 1631 | END1=link1End1, |
| 1632 | END2=main.randomLink1[ i ], |
| 1633 | OPTION="down" ) |
| 1634 | time.sleep( link_sleep ) |
| 1635 | main.Mininet1.link( |
| 1636 | END1=link2End1, |
| 1637 | END2=main.randomLink2[ i ], |
| 1638 | OPTION="down" ) |
| 1639 | time.sleep( link_sleep ) |
| 1640 | main.Mininet1.link( |
| 1641 | END1=link3End1, |
| 1642 | END2=main.randomLink3[ i ], |
| 1643 | OPTION="down" ) |
| 1644 | time.sleep( link_sleep ) |
| 1645 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1646 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1647 | linkDown = main.ONOSbench.checkStatus( |
| 1648 | topology_output, main.numMNswitches, str( |
| 1649 | int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) ) |
| 1650 | utilities.assert_equals( |
| 1651 | expect=main.TRUE, |
| 1652 | actual=linkDown, |
| 1653 | onpass="Link Down discovered properly", |
| 1654 | onfail="Link down was not discovered in " + |
| 1655 | str( link_sleep ) + |
| 1656 | " seconds" ) |
| 1657 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1658 | main.step("Verify intents are installed") |
GlennRC | 1dde171 | 2015-10-02 11:03:08 -0700 | [diff] [blame^] | 1659 | # Giving onos multiple chances to install intents |
| 1660 | for i in range( main.intentCheck ): |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1661 | if i != 0: |
| 1662 | main.log.warn( "Verification failed. Retrying..." ) |
| 1663 | main.log.info("Giving onos some time...") |
| 1664 | time.sleep( main.checkIntentsDelay ) |
| 1665 | |
| 1666 | intentState = main.TRUE |
| 1667 | for e in range(int(main.numCtrls)): |
| 1668 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 1669 | intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\ |
| 1670 | intentState |
| 1671 | if not intentState: |
| 1672 | main.log.warn( "Not all intents installed" ) |
| 1673 | if intentState: |
| 1674 | break |
| 1675 | else: |
| 1676 | #Dumping intent summary |
| 1677 | main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) ) |
| 1678 | |
| 1679 | |
| 1680 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 1681 | onpass="INTENTS INSTALLED", |
| 1682 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 1683 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1684 | main.step( "Verify Ping across all hosts" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1685 | pingResult = main.FALSE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1686 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1687 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
| 1688 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1689 | main.log.warn("First pingall failed. Retrying...") |
| 1690 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1691 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1692 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1693 | time2 = time.time() |
| 1694 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1695 | main.log.report( |
| 1696 | "Time taken for Ping All: " + |
| 1697 | str( timeDiff ) + |
| 1698 | " seconds" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1699 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1700 | onpass="PING ALL PASS", |
| 1701 | onfail="PING ALL FAIL" ) |
| 1702 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 1703 | caseResult = linkDown and pingResult and intentState |
| 1704 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1705 | onpass="Random Link cut Test PASS", |
| 1706 | onfail="Random Link cut Test FAIL" ) |
| 1707 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1708 | # Printing what exactly failed |
| 1709 | if not linkDown: |
| 1710 | main.log.debug( "Link down was not discovered correctly" ) |
| 1711 | if not pingResult: |
| 1712 | main.log.debug( "Pingall failed" ) |
| 1713 | if not intentState: |
| 1714 | main.log.debug( "Intents are not all installed" ) |
| 1715 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 1716 | if not caseResult and main.failSwitch: |
| 1717 | main.log.report("Stopping test") |
| 1718 | main.stop( email=main.emailOnStop ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1719 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1720 | def CASE81( self, main ): |
| 1721 | """ |
| 1722 | Bring the core links up that are down and verify ping all ( Point Intents-Att Topo ) |
| 1723 | """ |
| 1724 | import random |
| 1725 | link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ] |
| 1726 | link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ] |
| 1727 | link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ] |
| 1728 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 1729 | switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ] |
| 1730 | |
| 1731 | main.log.report( |
| 1732 | "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" ) |
| 1733 | main.log.report( |
| 1734 | "__________________________________________________________________" ) |
| 1735 | main.case( |
| 1736 | "Point intents - Bring the core links up that are down and verify ping all" ) |
| 1737 | main.step( "Bring randomly cut links on Core devices up" ) |
| 1738 | for i in range( int( switchLinksToToggle ) ): |
| 1739 | main.Mininet1.link( |
| 1740 | END1=link1End1, |
| 1741 | END2=main.randomLink1[ i ], |
| 1742 | OPTION="up" ) |
| 1743 | time.sleep( link_sleep ) |
| 1744 | main.Mininet1.link( |
| 1745 | END1=link2End1, |
| 1746 | END2=main.randomLink2[ i ], |
| 1747 | OPTION="up" ) |
| 1748 | time.sleep( link_sleep ) |
| 1749 | main.Mininet1.link( |
| 1750 | END1=link3End1, |
| 1751 | END2=main.randomLink3[ i ], |
| 1752 | OPTION="up" ) |
| 1753 | time.sleep( link_sleep ) |
| 1754 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1755 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1756 | linkUp = main.ONOSbench.checkStatus( |
| 1757 | topology_output, |
| 1758 | main.numMNswitches, |
| 1759 | str( main.numMNlinks ) ) |
| 1760 | utilities.assert_equals( |
| 1761 | expect=main.TRUE, |
| 1762 | actual=linkUp, |
| 1763 | onpass="Link up discovered properly", |
| 1764 | onfail="Link up was not discovered in " + |
| 1765 | str( link_sleep ) + |
| 1766 | " seconds" ) |
| 1767 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1768 | main.step("Verify intents are installed") |
GlennRC | 1dde171 | 2015-10-02 11:03:08 -0700 | [diff] [blame^] | 1769 | # Giving onos multiple chances to install intents |
| 1770 | for i in range( main.intentCheck ): |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1771 | if i != 0: |
| 1772 | main.log.warn( "Verification failed. Retrying..." ) |
| 1773 | main.log.info("Giving onos some time...") |
| 1774 | time.sleep( main.checkIntentsDelay ) |
| 1775 | |
| 1776 | intentState = main.TRUE |
| 1777 | for e in range(int(main.numCtrls)): |
| 1778 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 1779 | intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\ |
| 1780 | intentState |
| 1781 | if not intentState: |
| 1782 | main.log.warn( "Not all intents installed" ) |
| 1783 | if intentState: |
| 1784 | break |
| 1785 | else: |
| 1786 | #Dumping intent summary |
| 1787 | main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) ) |
| 1788 | |
| 1789 | |
| 1790 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 1791 | onpass="INTENTS INSTALLED", |
| 1792 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 1793 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1794 | main.step( "Verify Ping across all hosts" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1795 | pingResult = main.FALSE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1796 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1797 | pingResult = main.Mininet1.pingall( timeout=main.pingTimeout ) |
| 1798 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1799 | main.log.warn("First pingall failed. Retrying...") |
| 1800 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1801 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1802 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1803 | time2 = time.time() |
| 1804 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1805 | main.log.report( |
| 1806 | "Time taken for Ping All: " + |
| 1807 | str( timeDiff ) + |
| 1808 | " seconds" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1809 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1810 | onpass="PING ALL PASS", |
| 1811 | onfail="PING ALL FAIL" ) |
| 1812 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 1813 | caseResult = linkUp and pingResult |
| 1814 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1815 | onpass="Link Up Test PASS", |
| 1816 | onfail="Link Up Test FAIL" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1817 | # Printing what exactly failed |
| 1818 | if not linkUp: |
| 1819 | main.log.debug( "Link down was not discovered correctly" ) |
| 1820 | if not pingResult: |
| 1821 | main.log.debug( "Pingall failed" ) |
| 1822 | if not intentState: |
| 1823 | main.log.debug( "Intents are not all installed" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1824 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 1825 | if not caseResult and main.failSwitch: |
| 1826 | main.log.report("Stopping test") |
| 1827 | main.stop( email=main.emailOnStop ) |
| 1828 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1829 | def CASE72( self, main ): |
| 1830 | """ |
| 1831 | Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo) |
| 1832 | """ |
| 1833 | import random |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1834 | import itertools |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1835 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1836 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1837 | main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" ) |
| 1838 | main.log.report( "___________________________________________________________________________" ) |
| 1839 | main.case( "Host intents - Randomly bring some core links down and verify ping all" ) |
| 1840 | switches = [] |
| 1841 | switchesComb = [] |
| 1842 | for i in range( main.numMNswitches ): |
| 1843 | switches.append('s%d'%(i+1)) |
| 1844 | switchesLinksComb = list(itertools.combinations(switches,2)) |
| 1845 | main.randomLinks = random.sample(switchesLinksComb, 5 ) |
| 1846 | print main.randomLinks |
| 1847 | main.step( "Cut links on random devices" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1848 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1849 | for switch in main.randomLinks: |
| 1850 | main.Mininet1.link( |
| 1851 | END1=switch[0], |
| 1852 | END2=switch[1], |
| 1853 | OPTION="down") |
| 1854 | time.sleep( link_sleep ) |
| 1855 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1856 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1857 | linkDown = main.ONOSbench.checkStatus( |
| 1858 | topology_output, main.numMNswitches, str( |
| 1859 | int( main.numMNlinks ) - 5 * 2 ) ) |
| 1860 | utilities.assert_equals( |
| 1861 | expect=main.TRUE, |
| 1862 | actual=linkDown, |
| 1863 | onpass="Link Down discovered properly", |
| 1864 | onfail="Link down was not discovered in " + |
| 1865 | str( link_sleep ) + |
| 1866 | " seconds" ) |
| 1867 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1868 | main.step("Verify intents are installed") |
GlennRC | 1dde171 | 2015-10-02 11:03:08 -0700 | [diff] [blame^] | 1869 | # Giving onos multiple chances to install intents |
| 1870 | for i in range( main.intentCheck ): |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1871 | if i != 0: |
| 1872 | main.log.warn( "Verification failed. Retrying..." ) |
| 1873 | main.log.info("Giving onos some time...") |
| 1874 | time.sleep( main.checkIntentsDelay ) |
| 1875 | |
| 1876 | intentState = main.TRUE |
| 1877 | for e in range(int(main.numCtrls)): |
| 1878 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 1879 | intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\ |
| 1880 | intentState |
| 1881 | if not intentState: |
| 1882 | main.log.warn( "Not all intents installed" ) |
| 1883 | if intentState: |
| 1884 | break |
| 1885 | else: |
| 1886 | #Dumping intent summary |
| 1887 | main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) ) |
| 1888 | |
| 1889 | |
| 1890 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 1891 | onpass="INTENTS INSTALLED", |
| 1892 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 1893 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1894 | main.step( "Verify Ping across all hosts" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1895 | pingResult = main.FALSE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1896 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1897 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
| 1898 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1899 | main.log.warn("First pingall failed. Retrying...") |
| 1900 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1901 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1902 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1903 | time2 = time.time() |
| 1904 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1905 | main.log.report( |
| 1906 | "Time taken for Ping All: " + |
| 1907 | str( timeDiff ) + |
| 1908 | " seconds" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1909 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1910 | onpass="PING ALL PASS", |
| 1911 | onfail="PING ALL FAIL" ) |
| 1912 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 1913 | caseResult = linkDown and pingResult and intentState |
| 1914 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1915 | onpass="Random Link cut Test PASS", |
| 1916 | onfail="Random Link cut Test FAIL" ) |
| 1917 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1918 | # Printing what exactly failed |
| 1919 | if not linkDown: |
| 1920 | main.log.debug( "Link down was not discovered correctly" ) |
| 1921 | if not pingResult: |
| 1922 | main.log.debug( "Pingall failed" ) |
| 1923 | if not intentState: |
| 1924 | main.log.debug( "Intents are not all installed" ) |
| 1925 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 1926 | if not caseResult and main.failSwitch: |
| 1927 | main.log.report("Stopping test") |
| 1928 | main.stop( email=main.emailOnStop ) |
| 1929 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1930 | def CASE82( self, main ): |
| 1931 | """ |
| 1932 | Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo ) |
| 1933 | """ |
| 1934 | import random |
| 1935 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1936 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1937 | main.log.report( |
| 1938 | "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" ) |
| 1939 | main.log.report( |
| 1940 | "__________________________________________________________________" ) |
| 1941 | main.case( |
| 1942 | "Host intents - Bring the core links up that are down and verify ping all" ) |
| 1943 | main.step( "Bring randomly cut links on devices up" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1944 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1945 | for switch in main.randomLinks: |
| 1946 | main.Mininet1.link( |
| 1947 | END1=switch[0], |
| 1948 | END2=switch[1], |
| 1949 | OPTION="up") |
| 1950 | time.sleep( link_sleep ) |
| 1951 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1952 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1953 | linkUp = main.ONOSbench.checkStatus( |
| 1954 | topology_output, |
| 1955 | main.numMNswitches, |
| 1956 | str( main.numMNlinks ) ) |
| 1957 | utilities.assert_equals( |
| 1958 | expect=main.TRUE, |
| 1959 | actual=linkUp, |
| 1960 | onpass="Link up discovered properly", |
| 1961 | onfail="Link up was not discovered in " + |
| 1962 | str( link_sleep ) + |
| 1963 | " seconds" ) |
| 1964 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1965 | main.step("Verify intents are installed") |
GlennRC | 1dde171 | 2015-10-02 11:03:08 -0700 | [diff] [blame^] | 1966 | # Giving onos multiple chances to install intents |
| 1967 | for i in range( main.intentCheck ): |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1968 | if i != 0: |
| 1969 | main.log.warn( "Verification failed. Retrying..." ) |
| 1970 | main.log.info("Giving onos some time...") |
| 1971 | time.sleep( main.checkIntentsDelay ) |
| 1972 | |
| 1973 | intentState = main.TRUE |
| 1974 | for e in range(int(main.numCtrls)): |
| 1975 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 1976 | intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\ |
| 1977 | intentState |
| 1978 | if not intentState: |
| 1979 | main.log.warn( "Not all intents installed" ) |
| 1980 | if intentState: |
| 1981 | break |
| 1982 | else: |
| 1983 | #Dumping intent summary |
| 1984 | main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) ) |
| 1985 | |
| 1986 | |
| 1987 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 1988 | onpass="INTENTS INSTALLED", |
| 1989 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 1990 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1991 | main.step( "Verify Ping across all hosts" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1992 | pingResult = main.FALSE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1993 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1994 | pingResult = main.Mininet1.pingall( timeout=main.pingTimeout ) |
| 1995 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1996 | main.log.warn("First pingall failed. Retrying...") |
| 1997 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 1998 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 1999 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2000 | time2 = time.time() |
| 2001 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2002 | main.log.report( |
| 2003 | "Time taken for Ping All: " + |
| 2004 | str( timeDiff ) + |
| 2005 | " seconds" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2006 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2007 | onpass="PING ALL PASS", |
| 2008 | onfail="PING ALL FAIL" ) |
| 2009 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2010 | caseResult = linkUp and pingResult |
| 2011 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2012 | onpass="Link Up Test PASS", |
| 2013 | onfail="Link Up Test FAIL" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2014 | # Printing what exactly failed |
| 2015 | if not linkUp: |
| 2016 | main.log.debug( "Link down was not discovered correctly" ) |
| 2017 | if not pingResult: |
| 2018 | main.log.debug( "Pingall failed" ) |
| 2019 | if not intentState: |
| 2020 | main.log.debug( "Intents are not all installed" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2021 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2022 | if not caseResult and main.failSwitch: |
| 2023 | main.log.report("Stopping test") |
| 2024 | main.stop( email=main.emailOnStop ) |
| 2025 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2026 | def CASE73( self, main ): |
| 2027 | """ |
| 2028 | Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo) |
| 2029 | """ |
| 2030 | import random |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2031 | import itertools |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2032 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2033 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2034 | main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" ) |
| 2035 | main.log.report( "___________________________________________________________________________" ) |
| 2036 | main.case( "Point intents - Randomly bring some core links down and verify ping all" ) |
| 2037 | switches = [] |
| 2038 | switchesComb = [] |
| 2039 | for i in range( main.numMNswitches ): |
| 2040 | switches.append('s%d'%(i+1)) |
| 2041 | switchesLinksComb = list(itertools.combinations(switches,2)) |
| 2042 | main.randomLinks = random.sample(switchesLinksComb, 5 ) |
| 2043 | print main.randomLinks |
| 2044 | main.step( "Cut links on random devices" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2045 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2046 | for switch in main.randomLinks: |
| 2047 | main.Mininet1.link( |
| 2048 | END1=switch[0], |
| 2049 | END2=switch[1], |
| 2050 | OPTION="down") |
| 2051 | time.sleep( link_sleep ) |
| 2052 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 2053 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2054 | linkDown = main.ONOSbench.checkStatus( |
| 2055 | topology_output, main.numMNswitches, str( |
| 2056 | int( main.numMNlinks ) - 5 * 2 ) ) |
| 2057 | utilities.assert_equals( |
| 2058 | expect=main.TRUE, |
| 2059 | actual=linkDown, |
| 2060 | onpass="Link Down discovered properly", |
| 2061 | onfail="Link down was not discovered in " + |
| 2062 | str( link_sleep ) + |
| 2063 | " seconds" ) |
| 2064 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2065 | main.step("Verify intents are installed") |
GlennRC | 1dde171 | 2015-10-02 11:03:08 -0700 | [diff] [blame^] | 2066 | # Giving onos multiple chances to install intents |
| 2067 | for i in range( main.intentCheck ): |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2068 | if i != 0: |
| 2069 | main.log.warn( "Verification failed. Retrying..." ) |
| 2070 | main.log.info("Giving onos some time...") |
| 2071 | time.sleep( main.checkIntentsDelay ) |
| 2072 | |
| 2073 | intentState = main.TRUE |
| 2074 | for e in range(int(main.numCtrls)): |
| 2075 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 2076 | intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\ |
| 2077 | intentState |
| 2078 | if not intentState: |
| 2079 | main.log.warn( "Not all intents installed" ) |
| 2080 | if intentState: |
| 2081 | break |
| 2082 | else: |
| 2083 | #Dumping intent summary |
| 2084 | main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) ) |
| 2085 | |
| 2086 | |
| 2087 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 2088 | onpass="INTENTS INSTALLED", |
| 2089 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 2090 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2091 | main.step( "Verify Ping across all hosts" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2092 | pingResult = main.FALSE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2093 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2094 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
| 2095 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2096 | main.log.warn("First pingall failed. Retrying...") |
| 2097 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2098 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2099 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2100 | time2 = time.time() |
| 2101 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2102 | main.log.report( |
| 2103 | "Time taken for Ping All: " + |
| 2104 | str( timeDiff ) + |
| 2105 | " seconds" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2106 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2107 | onpass="PING ALL PASS", |
| 2108 | onfail="PING ALL FAIL" ) |
| 2109 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2110 | caseResult = linkDown and pingResult and intentState |
| 2111 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2112 | onpass="Random Link cut Test PASS", |
| 2113 | onfail="Random Link cut Test FAIL" ) |
| 2114 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2115 | # Printing what exactly failed |
| 2116 | if not linkDown: |
| 2117 | main.log.debug( "Link down was not discovered correctly" ) |
| 2118 | if not pingResult: |
| 2119 | main.log.debug( "Pingall failed" ) |
| 2120 | if not intentState: |
| 2121 | main.log.debug( "Intents are not all installed" ) |
| 2122 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2123 | if not caseResult and main.failSwitch: |
| 2124 | main.log.report("Stopping test") |
| 2125 | main.stop( email=main.emailOnStop ) |
| 2126 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2127 | def CASE83( self, main ): |
| 2128 | """ |
| 2129 | Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo ) |
| 2130 | """ |
| 2131 | import random |
| 2132 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2133 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2134 | main.log.report( |
| 2135 | "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" ) |
| 2136 | main.log.report( |
| 2137 | "__________________________________________________________________" ) |
| 2138 | main.case( |
| 2139 | "Point intents - Bring the core links up that are down and verify ping all" ) |
| 2140 | main.step( "Bring randomly cut links on devices up" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2141 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2142 | for switch in main.randomLinks: |
| 2143 | main.Mininet1.link( |
| 2144 | END1=switch[0], |
| 2145 | END2=switch[1], |
| 2146 | OPTION="up") |
| 2147 | time.sleep( link_sleep ) |
| 2148 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 2149 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2150 | linkUp = main.ONOSbench.checkStatus( |
| 2151 | topology_output, |
| 2152 | main.numMNswitches, |
| 2153 | str( main.numMNlinks ) ) |
| 2154 | utilities.assert_equals( |
| 2155 | expect=main.TRUE, |
| 2156 | actual=linkUp, |
| 2157 | onpass="Link up discovered properly", |
| 2158 | onfail="Link up was not discovered in " + |
| 2159 | str( link_sleep ) + |
| 2160 | " seconds" ) |
| 2161 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2162 | main.step("Verify intents are installed") |
GlennRC | 1dde171 | 2015-10-02 11:03:08 -0700 | [diff] [blame^] | 2163 | # Giving onos multiple chances to install intents |
| 2164 | for i in range( main.intentCheck ): |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2165 | if i != 0: |
| 2166 | main.log.warn( "Verification failed. Retrying..." ) |
| 2167 | main.log.info("Giving onos some time...") |
| 2168 | time.sleep( main.checkIntentsDelay ) |
| 2169 | |
| 2170 | intentState = main.TRUE |
| 2171 | for e in range(int(main.numCtrls)): |
| 2172 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 2173 | intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\ |
| 2174 | intentState |
| 2175 | if not intentState: |
| 2176 | main.log.warn( "Not all intents installed" ) |
| 2177 | if intentState: |
| 2178 | break |
| 2179 | else: |
| 2180 | #Dumping intent summary |
| 2181 | main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) ) |
| 2182 | |
| 2183 | |
| 2184 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 2185 | onpass="INTENTS INSTALLED", |
| 2186 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 2187 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2188 | main.step( "Verify Ping across all hosts" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2189 | pingResult = main.FALSE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2190 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2191 | pingResult = main.Mininet1.pingall( timeout=main.pingTimeout ) |
| 2192 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2193 | main.log.warn("First pingall failed. Retrying...") |
| 2194 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2195 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2196 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2197 | time2 = time.time() |
| 2198 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2199 | main.log.report( |
| 2200 | "Time taken for Ping All: " + |
| 2201 | str( timeDiff ) + |
| 2202 | " seconds" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2203 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2204 | onpass="PING ALL PASS", |
| 2205 | onfail="PING ALL FAIL" ) |
| 2206 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2207 | caseResult = linkUp and pingResult |
| 2208 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2209 | onpass="Link Up Test PASS", |
| 2210 | onfail="Link Up Test FAIL" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2211 | # Printing what exactly failed |
| 2212 | if not linkUp: |
| 2213 | main.log.debug( "Link down was not discovered correctly" ) |
| 2214 | if not pingResult: |
| 2215 | main.log.debug( "Pingall failed" ) |
| 2216 | if not intentState: |
| 2217 | main.log.debug( "Intents are not all installed" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2218 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2219 | if not caseResult and main.failSwitch: |
| 2220 | main.log.report("Stopping test") |
| 2221 | main.stop( email=main.emailOnStop ) |
| 2222 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2223 | def CASE74( self, main ): |
| 2224 | """ |
| 2225 | Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo) |
| 2226 | """ |
| 2227 | import random |
| 2228 | main.randomLink1 = [] |
| 2229 | main.randomLink2 = [] |
| 2230 | main.randomLink3 = [] |
| 2231 | main.randomLink4 = [] |
| 2232 | link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ] |
| 2233 | link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' ) |
| 2234 | link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' ) |
| 2235 | link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ] |
| 2236 | link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' ) |
| 2237 | link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' ) |
| 2238 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 2239 | main.pingTimeout = 400 |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2240 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2241 | main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" ) |
| 2242 | main.log.report( "___________________________________________________________________________" ) |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 2243 | 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] | 2244 | linkIndex = range(4) |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 2245 | linkIndexS9 = random.sample(linkIndex,1)[0] |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2246 | linkIndex.remove(linkIndexS9) |
| 2247 | linkIndexS10 = random.sample(linkIndex,1)[0] |
| 2248 | main.randomLink1 = link1End2top[linkIndexS9] |
| 2249 | main.randomLink2 = link2End2top[linkIndexS10] |
| 2250 | main.randomLink3 = random.sample(link1End2bot,1)[0] |
| 2251 | main.randomLink4 = random.sample(link2End2bot,1)[0] |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 2252 | |
| 2253 | # Work around for link state propagation delay. Added some sleep time. |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2254 | # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" ) |
| 2255 | # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" ) |
| 2256 | main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" ) |
| 2257 | time.sleep( link_sleep ) |
| 2258 | main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" ) |
| 2259 | time.sleep( link_sleep ) |
| 2260 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 2261 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2262 | linkDown = main.ONOSbench.checkStatus( |
| 2263 | topology_output, main.numMNswitches, str( |
Hari Krishna | 390d470 | 2015-08-21 14:37:46 -0700 | [diff] [blame] | 2264 | int( main.numMNlinks ) - 4 )) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2265 | utilities.assert_equals( |
| 2266 | expect=main.TRUE, |
| 2267 | actual=linkDown, |
| 2268 | onpass="Link Down discovered properly", |
| 2269 | onfail="Link down was not discovered in " + |
| 2270 | str( link_sleep ) + |
| 2271 | " seconds" ) |
| 2272 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2273 | main.step("Verify intents are installed") |
GlennRC | 1dde171 | 2015-10-02 11:03:08 -0700 | [diff] [blame^] | 2274 | # Giving onos multiple chances to install intents |
| 2275 | for i in range( main.intentCheck ): |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2276 | if i != 0: |
| 2277 | main.log.warn( "Verification failed. Retrying..." ) |
| 2278 | main.log.info("Giving onos some time...") |
| 2279 | time.sleep( main.checkIntentsDelay ) |
| 2280 | |
| 2281 | intentState = main.TRUE |
| 2282 | for e in range(int(main.numCtrls)): |
| 2283 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 2284 | intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\ |
| 2285 | intentState |
| 2286 | if not intentState: |
| 2287 | main.log.warn( "Not all intents installed" ) |
| 2288 | if intentState: |
| 2289 | break |
| 2290 | else: |
| 2291 | #Dumping intent summary |
| 2292 | main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) ) |
| 2293 | |
| 2294 | |
| 2295 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 2296 | onpass="INTENTS INSTALLED", |
| 2297 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 2298 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2299 | main.step( "Verify Ping across all hosts" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2300 | pingResult = main.FALSE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2301 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2302 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
| 2303 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2304 | main.log.warn("First pingall failed. Retrying...") |
| 2305 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2306 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2307 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2308 | time2 = time.time() |
| 2309 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2310 | main.log.report( |
| 2311 | "Time taken for Ping All: " + |
| 2312 | str( timeDiff ) + |
| 2313 | " seconds" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2314 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2315 | onpass="PING ALL PASS", |
| 2316 | onfail="PING ALL FAIL" ) |
| 2317 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2318 | caseResult = linkDown and pingResult and intentState |
| 2319 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2320 | onpass="Random Link cut Test PASS", |
| 2321 | onfail="Random Link cut Test FAIL" ) |
| 2322 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2323 | # Printing what exactly failed |
| 2324 | if not linkDown: |
| 2325 | main.log.debug( "Link down was not discovered correctly" ) |
| 2326 | if not pingResult: |
| 2327 | main.log.debug( "Pingall failed" ) |
| 2328 | if not intentState: |
| 2329 | main.log.debug( "Intents are not all installed" ) |
| 2330 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2331 | if not caseResult and main.failSwitch: |
| 2332 | main.log.report("Stopping test") |
| 2333 | main.stop( email=main.emailOnStop ) |
| 2334 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2335 | def CASE84( self, main ): |
| 2336 | """ |
| 2337 | Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo ) |
| 2338 | """ |
| 2339 | import random |
| 2340 | link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ] |
| 2341 | link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ] |
| 2342 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 2343 | main.log.report( |
| 2344 | "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" ) |
| 2345 | main.log.report( |
| 2346 | "__________________________________________________________________" ) |
| 2347 | main.case( |
| 2348 | "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] | 2349 | |
| 2350 | # Work around for link state propagation delay. Added some sleep time. |
| 2351 | # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" ) |
| 2352 | # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2353 | main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" ) |
| 2354 | time.sleep( link_sleep ) |
| 2355 | main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" ) |
| 2356 | time.sleep( link_sleep ) |
| 2357 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 2358 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2359 | linkUp = main.ONOSbench.checkStatus( |
| 2360 | topology_output, |
| 2361 | main.numMNswitches, |
| 2362 | str( main.numMNlinks ) ) |
| 2363 | utilities.assert_equals( |
| 2364 | expect=main.TRUE, |
| 2365 | actual=linkUp, |
| 2366 | onpass="Link up discovered properly", |
| 2367 | onfail="Link up was not discovered in " + |
| 2368 | str( link_sleep ) + |
| 2369 | " seconds" ) |
| 2370 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2371 | main.step("Verify intents are installed") |
GlennRC | 1dde171 | 2015-10-02 11:03:08 -0700 | [diff] [blame^] | 2372 | # Giving onos multiple chances to install intents |
| 2373 | for i in range( main.intentCheck ): |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2374 | if i != 0: |
| 2375 | main.log.warn( "Verification failed. Retrying..." ) |
| 2376 | main.log.info("Giving onos some time...") |
| 2377 | time.sleep( main.checkIntentsDelay ) |
| 2378 | |
| 2379 | intentState = main.TRUE |
| 2380 | for e in range(int(main.numCtrls)): |
| 2381 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 2382 | intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\ |
| 2383 | intentState |
| 2384 | if not intentState: |
| 2385 | main.log.warn( "Not all intents installed" ) |
| 2386 | if intentState: |
| 2387 | break |
| 2388 | else: |
| 2389 | #Dumping intent summary |
| 2390 | main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) ) |
| 2391 | |
| 2392 | |
| 2393 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 2394 | onpass="INTENTS INSTALLED", |
| 2395 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 2396 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2397 | main.step( "Verify Ping across all hosts" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2398 | pingResult = main.FALSE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2399 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2400 | pingResult = main.Mininet1.pingall( timeout=main.pingTimeout ) |
| 2401 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2402 | main.log.warn("First pingall failed. Retrying...") |
| 2403 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2404 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2405 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2406 | time2 = time.time() |
| 2407 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2408 | main.log.report( |
| 2409 | "Time taken for Ping All: " + |
| 2410 | str( timeDiff ) + |
| 2411 | " seconds" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2412 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2413 | onpass="PING ALL PASS", |
| 2414 | onfail="PING ALL FAIL" ) |
| 2415 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2416 | caseResult = linkUp and pingResult |
| 2417 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2418 | onpass="Link Up Test PASS", |
| 2419 | onfail="Link Up Test FAIL" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2420 | # Printing what exactly failed |
| 2421 | if not linkUp: |
| 2422 | main.log.debug( "Link down was not discovered correctly" ) |
| 2423 | if not pingResult: |
| 2424 | main.log.debug( "Pingall failed" ) |
| 2425 | if not intentState: |
| 2426 | main.log.debug( "Intents are not all installed" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2427 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2428 | if not caseResult and main.failSwitch: |
| 2429 | main.log.report("Stopping test") |
| 2430 | main.stop( email=main.emailOnStop ) |
| 2431 | |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 2432 | def CASE75( self, main ): |
| 2433 | """ |
| 2434 | Randomly bring some core links down and verify ping all ( Point Intents-Spine Topo) |
| 2435 | """ |
| 2436 | import random |
| 2437 | main.randomLink1 = [] |
| 2438 | main.randomLink2 = [] |
| 2439 | main.randomLink3 = [] |
| 2440 | main.randomLink4 = [] |
| 2441 | link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ] |
| 2442 | link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' ) |
| 2443 | link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' ) |
| 2444 | link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ] |
| 2445 | link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' ) |
| 2446 | link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' ) |
| 2447 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 2448 | main.pingTimeout = 400 |
| 2449 | |
| 2450 | main.log.report( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" ) |
| 2451 | main.log.report( "___________________________________________________________________________" ) |
| 2452 | main.case( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" ) |
| 2453 | linkIndex = range(4) |
| 2454 | linkIndexS9 = random.sample(linkIndex,1)[0] |
| 2455 | linkIndex.remove(linkIndexS9) |
| 2456 | linkIndexS10 = random.sample(linkIndex,1)[0] |
| 2457 | main.randomLink1 = link1End2top[linkIndexS9] |
| 2458 | main.randomLink2 = link2End2top[linkIndexS10] |
| 2459 | main.randomLink3 = random.sample(link1End2bot,1)[0] |
| 2460 | main.randomLink4 = random.sample(link2End2bot,1)[0] |
| 2461 | |
| 2462 | # Work around for link state propagation delay. Added some sleep time. |
| 2463 | # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" ) |
| 2464 | # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" ) |
| 2465 | main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" ) |
| 2466 | time.sleep( link_sleep ) |
| 2467 | main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" ) |
| 2468 | time.sleep( link_sleep ) |
| 2469 | |
| 2470 | topology_output = main.ONOScli1.topology() |
| 2471 | linkDown = main.ONOSbench.checkStatus( |
| 2472 | topology_output, main.numMNswitches, str( |
Hari Krishna | 390d470 | 2015-08-21 14:37:46 -0700 | [diff] [blame] | 2473 | int( main.numMNlinks ) - 4 )) |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 2474 | utilities.assert_equals( |
| 2475 | expect=main.TRUE, |
| 2476 | actual=linkDown, |
| 2477 | onpass="Link Down discovered properly", |
| 2478 | onfail="Link down was not discovered in " + |
| 2479 | str( link_sleep ) + |
| 2480 | " seconds" ) |
| 2481 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2482 | main.step("Verify intents are installed") |
GlennRC | 1dde171 | 2015-10-02 11:03:08 -0700 | [diff] [blame^] | 2483 | # Giving onos multiple chances to install intents |
| 2484 | for i in range( main.intentCheck ): |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2485 | if i != 0: |
| 2486 | main.log.warn( "Verification failed. Retrying..." ) |
| 2487 | main.log.info("Giving onos some time...") |
| 2488 | time.sleep( main.checkIntentsDelay ) |
| 2489 | |
| 2490 | intentState = main.TRUE |
| 2491 | for e in range(int(main.numCtrls)): |
| 2492 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 2493 | intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\ |
| 2494 | intentState |
| 2495 | if not intentState: |
| 2496 | main.log.warn( "Not all intents installed" ) |
| 2497 | if intentState: |
| 2498 | break |
| 2499 | else: |
| 2500 | #Dumping intent summary |
| 2501 | main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) ) |
| 2502 | |
| 2503 | |
| 2504 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 2505 | onpass="INTENTS INSTALLED", |
| 2506 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 2507 | |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 2508 | main.step( "Verify Ping across all hosts" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2509 | pingResult = main.FALSE |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 2510 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2511 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
| 2512 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2513 | main.log.warn("First pingall failed. Retrying...") |
| 2514 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2515 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2516 | |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 2517 | time2 = time.time() |
| 2518 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2519 | main.log.report( |
| 2520 | "Time taken for Ping All: " + |
| 2521 | str( timeDiff ) + |
| 2522 | " seconds" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2523 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 2524 | onpass="PING ALL PASS", |
| 2525 | onfail="PING ALL FAIL" ) |
| 2526 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2527 | caseResult = linkDown and pingResult and intentState |
| 2528 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 2529 | onpass="Random Link cut Test PASS", |
| 2530 | onfail="Random Link cut Test FAIL" ) |
| 2531 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2532 | # Printing what exactly failed |
| 2533 | if not linkDown: |
| 2534 | main.log.debug( "Link down was not discovered correctly" ) |
| 2535 | if not pingResult: |
| 2536 | main.log.debug( "Pingall failed" ) |
| 2537 | if not intentState: |
| 2538 | main.log.debug( "Intents are not all installed" ) |
| 2539 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2540 | if not caseResult and main.failSwitch: |
| 2541 | main.log.report("Stopping test") |
| 2542 | main.stop( email=main.emailOnStop ) |
| 2543 | |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 2544 | def CASE85( self, main ): |
| 2545 | """ |
| 2546 | Bring the core links up that are down and verify ping all ( Point Intents-Spine Topo ) |
| 2547 | """ |
| 2548 | import random |
| 2549 | link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ] |
| 2550 | link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ] |
| 2551 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 2552 | main.log.report( |
| 2553 | "Bring the core links up that are down and verify ping all (Point Intents-Spine Topo" ) |
| 2554 | main.log.report( |
| 2555 | "__________________________________________________________________" ) |
| 2556 | main.case( |
| 2557 | "Point intents - Bring the core links up that are down and verify ping all" ) |
| 2558 | |
| 2559 | # Work around for link state propagation delay. Added some sleep time. |
| 2560 | # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" ) |
| 2561 | # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" ) |
| 2562 | main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" ) |
| 2563 | time.sleep( link_sleep ) |
| 2564 | main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" ) |
| 2565 | time.sleep( link_sleep ) |
| 2566 | |
| 2567 | topology_output = main.ONOScli1.topology() |
| 2568 | linkUp = main.ONOSbench.checkStatus( |
| 2569 | topology_output, |
| 2570 | main.numMNswitches, |
| 2571 | str( main.numMNlinks ) ) |
| 2572 | utilities.assert_equals( |
| 2573 | expect=main.TRUE, |
| 2574 | actual=linkUp, |
| 2575 | onpass="Link up discovered properly", |
| 2576 | onfail="Link up was not discovered in " + |
| 2577 | str( link_sleep ) + |
| 2578 | " seconds" ) |
| 2579 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2580 | main.step("Verify intents are installed") |
GlennRC | 1dde171 | 2015-10-02 11:03:08 -0700 | [diff] [blame^] | 2581 | # Giving onos multiple chances to install intents |
| 2582 | for i in range( main.intentCheck ): |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2583 | if i != 0: |
| 2584 | main.log.warn( "Verification failed. Retrying..." ) |
| 2585 | main.log.info("Giving onos some time...") |
| 2586 | time.sleep( main.checkIntentsDelay ) |
| 2587 | |
| 2588 | intentState = main.TRUE |
| 2589 | for e in range(int(main.numCtrls)): |
| 2590 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 2591 | intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\ |
| 2592 | intentState |
| 2593 | if not intentState: |
| 2594 | main.log.warn( "Not all intents installed" ) |
| 2595 | if intentState: |
| 2596 | break |
| 2597 | else: |
| 2598 | #Dumping intent summary |
| 2599 | main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) ) |
| 2600 | |
| 2601 | |
| 2602 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 2603 | onpass="INTENTS INSTALLED", |
| 2604 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 2605 | |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 2606 | main.step( "Verify Ping across all hosts" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2607 | pingResult = main.FALSE |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 2608 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2609 | pingResult = main.Mininet1.pingall( timeout=main.pingTimeout ) |
| 2610 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2611 | main.log.warn("First pingall failed. Retrying...") |
| 2612 | time1 = time.time() |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2613 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2614 | |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 2615 | time2 = time.time() |
| 2616 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2617 | main.log.report( |
| 2618 | "Time taken for Ping All: " + |
| 2619 | str( timeDiff ) + |
| 2620 | " seconds" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2621 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 2622 | onpass="PING ALL PASS", |
| 2623 | onfail="PING ALL FAIL" ) |
| 2624 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2625 | caseResult = linkUp and pingResult |
| 2626 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 2627 | onpass="Link Up Test PASS", |
| 2628 | onfail="Link Up Test FAIL" ) |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 2629 | # Printing what exactly failed |
| 2630 | if not linkUp: |
| 2631 | main.log.debug( "Link down was not discovered correctly" ) |
| 2632 | if not pingResult: |
| 2633 | main.log.debug( "Pingall failed" ) |
| 2634 | if not intentState: |
| 2635 | main.log.debug( "Intents are not all installed" ) |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 2636 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2637 | if not caseResult and main.failSwitch: |
| 2638 | main.log.report("Stopping test") |
| 2639 | main.stop( email=main.emailOnStop ) |
| 2640 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2641 | def CASE170( self ): |
| 2642 | """ |
| 2643 | IPv6 ping all with some core links down( Host Intents-Att Topo) |
| 2644 | """ |
| 2645 | main.log.report( "IPv6 ping all with some core links down( Host Intents-Att Topo )" ) |
| 2646 | main.log.report( "_________________________________________________" ) |
| 2647 | import itertools |
| 2648 | import time |
| 2649 | main.case( "IPv6 ping all with some core links down( Host Intents-Att Topo )" ) |
| 2650 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2651 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2652 | pingResult = main.FALSE |
| 2653 | time1 = time.time() |
| 2654 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2655 | if not pingResult: |
| 2656 | main.log.warn("Failed to ping Ipv6 hosts. Retrying...") |
| 2657 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2658 | time2 = time.time() |
| 2659 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2660 | main.log.report( |
| 2661 | "Time taken for IPv6 Ping All: " + |
| 2662 | str( timeDiff ) + |
| 2663 | " seconds" ) |
| 2664 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2665 | onpass="PING ALL PASS", |
| 2666 | onfail="PING ALL FAIL" ) |
| 2667 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2668 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2669 | utilities.assert_equals( |
| 2670 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2671 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2672 | onpass="IPv6 Ping across 300 host intents test PASS", |
| 2673 | onfail="IPv6 Ping across 300 host intents test FAIL" ) |
| 2674 | |
| 2675 | def CASE180( self ): |
| 2676 | """ |
| 2677 | IPv6 ping all with after core links back up( Host Intents-Att Topo) |
| 2678 | """ |
| 2679 | main.log.report( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" ) |
| 2680 | main.log.report( "_________________________________________________" ) |
| 2681 | import itertools |
| 2682 | import time |
| 2683 | main.case( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" ) |
| 2684 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2685 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2686 | pingResult = main.FALSE |
| 2687 | time1 = time.time() |
| 2688 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2689 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2690 | main.log.warn("First ping failed. Retrying...") |
| 2691 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2692 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2693 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2694 | time2 = time.time() |
| 2695 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2696 | main.log.report( |
| 2697 | "Time taken for IPv6 Ping All: " + |
| 2698 | str( timeDiff ) + |
| 2699 | " seconds" ) |
| 2700 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2701 | onpass="PING ALL PASS", |
| 2702 | onfail="PING ALL FAIL" ) |
| 2703 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2704 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2705 | utilities.assert_equals( |
| 2706 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2707 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2708 | onpass="IPv6 Ping across 300 host intents test PASS", |
| 2709 | onfail="IPv6 Ping across 300 host intents test FAIL" ) |
| 2710 | |
| 2711 | def CASE171( self ): |
| 2712 | """ |
| 2713 | IPv6 ping all with some core links down( Point Intents-Att Topo) |
| 2714 | """ |
| 2715 | main.log.report( "IPv6 ping all with some core links down( Point Intents-Att Topo )" ) |
| 2716 | main.log.report( "_________________________________________________" ) |
| 2717 | import itertools |
| 2718 | import time |
| 2719 | main.case( "IPv6 ping all with some core links down( Point Intents-Att Topo )" ) |
| 2720 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2721 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2722 | pingResult = main.FALSE |
| 2723 | time1 = time.time() |
| 2724 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2725 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2726 | main.log.warn("First ping failed. Retrying...") |
| 2727 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2728 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2729 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2730 | time2 = time.time() |
| 2731 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2732 | main.log.report( |
| 2733 | "Time taken for IPv6 Ping All: " + |
| 2734 | str( timeDiff ) + |
| 2735 | " seconds" ) |
| 2736 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2737 | onpass="PING ALL PASS", |
| 2738 | onfail="PING ALL FAIL" ) |
| 2739 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2740 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2741 | utilities.assert_equals( |
| 2742 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2743 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2744 | onpass="IPv6 Ping across 600 point intents test PASS", |
| 2745 | onfail="IPv6 Ping across 600 point intents test FAIL" ) |
| 2746 | |
| 2747 | def CASE181( self ): |
| 2748 | """ |
| 2749 | IPv6 ping all with after core links back up( Point Intents-Att Topo) |
| 2750 | """ |
| 2751 | main.log.report( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" ) |
| 2752 | main.log.report( "_________________________________________________" ) |
| 2753 | import itertools |
| 2754 | import time |
| 2755 | main.case( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" ) |
| 2756 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2757 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2758 | pingResult = main.FALSE |
| 2759 | time1 = time.time() |
| 2760 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2761 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2762 | main.log.warn("First ping failed. Retrying...") |
| 2763 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2764 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2765 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2766 | time2 = time.time() |
| 2767 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2768 | main.log.report( |
| 2769 | "Time taken for IPv6 Ping All: " + |
| 2770 | str( timeDiff ) + |
| 2771 | " seconds" ) |
| 2772 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2773 | onpass="PING ALL PASS", |
| 2774 | onfail="PING ALL FAIL" ) |
| 2775 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2776 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2777 | utilities.assert_equals( |
| 2778 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2779 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2780 | onpass="IPv6 Ping across 600 Point intents test PASS", |
| 2781 | onfail="IPv6 Ping across 600 Point intents test FAIL" ) |
| 2782 | |
| 2783 | def CASE172( self ): |
| 2784 | """ |
| 2785 | IPv6 ping all with some core links down( Host Intents-Chordal Topo) |
| 2786 | """ |
| 2787 | main.log.report( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" ) |
| 2788 | main.log.report( "_________________________________________________" ) |
| 2789 | import itertools |
| 2790 | import time |
| 2791 | main.case( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" ) |
| 2792 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2793 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2794 | pingResult = main.FALSE |
| 2795 | time1 = time.time() |
| 2796 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2797 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2798 | main.log.warn("First ping failed. Retrying...") |
| 2799 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2800 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2801 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2802 | time2 = time.time() |
| 2803 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2804 | main.log.report( |
| 2805 | "Time taken for IPv6 Ping All: " + |
| 2806 | str( timeDiff ) + |
| 2807 | " seconds" ) |
| 2808 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2809 | onpass="PING ALL PASS", |
| 2810 | onfail="PING ALL FAIL" ) |
| 2811 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2812 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2813 | utilities.assert_equals( |
| 2814 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2815 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2816 | onpass="IPv6 Ping across 300 host intents test PASS", |
| 2817 | onfail="IPv6 Ping across 300 host intents test FAIL" ) |
| 2818 | |
| 2819 | def CASE182( self ): |
| 2820 | """ |
| 2821 | IPv6 ping all with after core links back up( Host Intents-Chordal Topo) |
| 2822 | """ |
| 2823 | main.log.report( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" ) |
| 2824 | main.log.report( "_________________________________________________" ) |
| 2825 | import itertools |
| 2826 | import time |
| 2827 | main.case( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" ) |
| 2828 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2829 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2830 | pingResult = main.FALSE |
| 2831 | time1 = time.time() |
| 2832 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2833 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2834 | main.log.warn("First ping failed. Retrying...") |
| 2835 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2836 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2837 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2838 | time2 = time.time() |
| 2839 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2840 | main.log.report( |
| 2841 | "Time taken for IPv6 Ping All: " + |
| 2842 | str( timeDiff ) + |
| 2843 | " seconds" ) |
| 2844 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2845 | onpass="PING ALL PASS", |
| 2846 | onfail="PING ALL FAIL" ) |
| 2847 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2848 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2849 | utilities.assert_equals( |
| 2850 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2851 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2852 | onpass="IPv6 Ping across 300 host intents test PASS", |
| 2853 | onfail="IPv6 Ping across 300 host intents test FAIL" ) |
| 2854 | |
| 2855 | def CASE173( self ): |
| 2856 | """ |
| 2857 | IPv6 ping all with some core links down( Point Intents-Chordal Topo) |
| 2858 | """ |
| 2859 | main.log.report( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" ) |
| 2860 | main.log.report( "_________________________________________________" ) |
| 2861 | import itertools |
| 2862 | import time |
| 2863 | main.case( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" ) |
| 2864 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2865 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2866 | pingResult = main.FALSE |
| 2867 | time1 = time.time() |
| 2868 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2869 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2870 | main.log.warn("First ping failed. Retrying...") |
| 2871 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2872 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2873 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2874 | time2 = time.time() |
| 2875 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2876 | main.log.report( |
| 2877 | "Time taken for IPv6 Ping All: " + |
| 2878 | str( timeDiff ) + |
| 2879 | " seconds" ) |
| 2880 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2881 | onpass="PING ALL PASS", |
| 2882 | onfail="PING ALL FAIL" ) |
| 2883 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2884 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2885 | utilities.assert_equals( |
| 2886 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2887 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2888 | onpass="IPv6 Ping across 600 point intents test PASS", |
| 2889 | onfail="IPv6 Ping across 600 point intents test FAIL" ) |
| 2890 | |
| 2891 | def CASE183( self ): |
| 2892 | """ |
| 2893 | IPv6 ping all with after core links back up( Point Intents-Chordal Topo) |
| 2894 | """ |
| 2895 | main.log.report( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" ) |
| 2896 | main.log.report( "_________________________________________________" ) |
| 2897 | import itertools |
| 2898 | import time |
| 2899 | main.case( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" ) |
| 2900 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2901 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2902 | pingResult = main.FALSE |
| 2903 | time1 = time.time() |
| 2904 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2905 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2906 | main.log.warn("First ping failed. Retrying...") |
| 2907 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2908 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2909 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2910 | time2 = time.time() |
| 2911 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2912 | main.log.report( |
| 2913 | "Time taken for IPv6 Ping All: " + |
| 2914 | str( timeDiff ) + |
| 2915 | " seconds" ) |
| 2916 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2917 | onpass="PING ALL PASS", |
| 2918 | onfail="PING ALL FAIL" ) |
| 2919 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2920 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2921 | utilities.assert_equals( |
| 2922 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2923 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2924 | onpass="IPv6 Ping across 600 Point intents test PASS", |
| 2925 | onfail="IPv6 Ping across 600 Point intents test FAIL" ) |
| 2926 | |
| 2927 | def CASE174( self ): |
| 2928 | """ |
| 2929 | IPv6 ping all with some core links down( Host Intents-Spine Topo) |
| 2930 | """ |
| 2931 | main.log.report( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" ) |
| 2932 | main.log.report( "_________________________________________________" ) |
| 2933 | import itertools |
| 2934 | import time |
| 2935 | main.case( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" ) |
| 2936 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2937 | hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ] |
| 2938 | pingResult = main.FALSE |
| 2939 | time1 = time.time() |
| 2940 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2941 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2942 | main.log.warn("First ping failed. Retrying...") |
| 2943 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2944 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2945 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2946 | time2 = time.time() |
| 2947 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2948 | main.log.report( |
| 2949 | "Time taken for IPv6 Ping All: " + |
| 2950 | str( timeDiff ) + |
| 2951 | " seconds" ) |
| 2952 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2953 | onpass="PING ALL PASS", |
| 2954 | onfail="PING ALL FAIL" ) |
| 2955 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2956 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2957 | utilities.assert_equals( |
| 2958 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2959 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2960 | onpass="IPv6 Ping across 2278 host intents test PASS", |
| 2961 | onfail="IPv6 Ping across 2278 host intents test FAIL" ) |
| 2962 | |
| 2963 | def CASE184( self ): |
| 2964 | """ |
| 2965 | IPv6 ping all with after core links back up( Host Intents-Spine Topo) |
| 2966 | """ |
| 2967 | main.log.report( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" ) |
| 2968 | main.log.report( "_________________________________________________" ) |
| 2969 | import itertools |
| 2970 | import time |
| 2971 | main.case( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" ) |
| 2972 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2973 | hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ] |
| 2974 | pingResult = main.FALSE |
| 2975 | time1 = time.time() |
| 2976 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2977 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2978 | main.log.warn("First ping failed. Retrying...") |
| 2979 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2980 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 2981 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2982 | time2 = time.time() |
| 2983 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2984 | main.log.report( |
| 2985 | "Time taken for IPv6 Ping All: " + |
| 2986 | str( timeDiff ) + |
| 2987 | " seconds" ) |
| 2988 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2989 | onpass="PING ALL PASS", |
| 2990 | onfail="PING ALL FAIL" ) |
| 2991 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2992 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2993 | utilities.assert_equals( |
| 2994 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 2995 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2996 | onpass="IPv6 Ping across 2278 host intents test PASS", |
| 2997 | onfail="IPv6 Ping across 2278 host intents test FAIL" ) |
| 2998 | |
| 2999 | def CASE175( self ): |
| 3000 | """ |
| 3001 | IPv6 ping all with some core links down( Point Intents-Spine Topo) |
| 3002 | """ |
| 3003 | main.log.report( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" ) |
| 3004 | main.log.report( "_________________________________________________" ) |
| 3005 | import itertools |
| 3006 | import time |
| 3007 | main.case( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" ) |
| 3008 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 3009 | hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ] |
| 3010 | pingResult = main.FALSE |
| 3011 | time1 = time.time() |
| 3012 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 3013 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3014 | main.log.warn("First ping failed. Retrying...") |
| 3015 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 3016 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3017 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3018 | time2 = time.time() |
| 3019 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 3020 | main.log.report( |
| 3021 | "Time taken for IPv6 Ping All: " + |
| 3022 | str( timeDiff ) + |
| 3023 | " seconds" ) |
| 3024 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 3025 | onpass="PING ALL PASS", |
| 3026 | onfail="PING ALL FAIL" ) |
| 3027 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 3028 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3029 | utilities.assert_equals( |
| 3030 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 3031 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3032 | onpass="IPv6 Ping across 4556 point intents test PASS", |
| 3033 | onfail="IPv6 Ping across 4556 point intents test FAIL" ) |
| 3034 | |
| 3035 | def CASE185( self ): |
| 3036 | """ |
| 3037 | IPv6 ping all with after core links back up( Point Intents-Spine Topo) |
| 3038 | """ |
| 3039 | main.log.report( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" ) |
| 3040 | main.log.report( "_________________________________________________" ) |
| 3041 | import itertools |
| 3042 | import time |
| 3043 | main.case( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" ) |
| 3044 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 3045 | hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ] |
| 3046 | pingResult = main.FALSE |
| 3047 | time1 = time.time() |
| 3048 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 3049 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3050 | main.log.warn("First ping failed. Retrying...") |
| 3051 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 3052 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3053 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3054 | time2 = time.time() |
| 3055 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 3056 | main.log.report( |
| 3057 | "Time taken for IPv6 Ping All: " + |
| 3058 | str( timeDiff ) + |
| 3059 | " seconds" ) |
| 3060 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 3061 | onpass="PING ALL PASS", |
| 3062 | onfail="PING ALL FAIL" ) |
| 3063 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 3064 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3065 | utilities.assert_equals( |
| 3066 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 3067 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3068 | onpass="IPv6 Ping across 4556 Point intents test PASS", |
| 3069 | onfail="IPv6 Ping across 4556 Point intents test FAIL" ) |
| 3070 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3071 | def CASE90( self ): |
| 3072 | """ |
| 3073 | Install 600 point intents and verify ping all (Att Topology) |
| 3074 | """ |
| 3075 | main.log.report( "Add 600 point intents and verify pingall (Att Topology)" ) |
| 3076 | main.log.report( "_______________________________________" ) |
| 3077 | import itertools |
| 3078 | import time |
| 3079 | main.case( "Install 600 point intents" ) |
| 3080 | main.step( "Add point Intents" ) |
| 3081 | intentResult = main.TRUE |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3082 | deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) ) |
| 3083 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3084 | intentIdList = [] |
| 3085 | time1 = time.time() |
| 3086 | for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ): |
| 3087 | pool = [] |
| 3088 | for cli in main.CLIs: |
| 3089 | if i >= len( deviceCombos ): |
| 3090 | break |
| 3091 | t = main.Thread( target=cli.addPointIntent, |
| 3092 | threadID=main.threadID, |
| 3093 | name="addPointIntent", |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3094 | 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] | 3095 | pool.append(t) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3096 | t.start() |
| 3097 | i = i + 1 |
| 3098 | main.threadID = main.threadID + 1 |
| 3099 | for thread in pool: |
| 3100 | thread.join() |
| 3101 | intentIdList.append(thread.result) |
| 3102 | time2 = time.time() |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 3103 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3104 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 3105 | # Saving intent ids to check intents in later case |
| 3106 | main.intentIds = list(intentIdList) |
| 3107 | |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3108 | main.step("Verify intents are installed") |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3109 | |
GlennRC | 1dde171 | 2015-10-02 11:03:08 -0700 | [diff] [blame^] | 3110 | # Giving onos multiple chances to install intents |
| 3111 | for i in range( main.intentCheck ): |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3112 | if i != 0: |
| 3113 | main.log.warn( "Verification failed. Retrying..." ) |
| 3114 | main.log.info("Waiting for onos to install intents...") |
| 3115 | time.sleep( main.checkIntentsDelay ) |
| 3116 | |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3117 | intentState = main.TRUE |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3118 | for e in range(int(main.numCtrls)): |
| 3119 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 3120 | intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\ |
| 3121 | intentState |
| 3122 | if not intentState: |
| 3123 | main.log.warn( "Not all intents installed" ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3124 | if intentState: |
| 3125 | break |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3126 | else: |
| 3127 | #Dumping intent summary |
| 3128 | main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3129 | |
| 3130 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 3131 | onpass="INTENTS INSTALLED", |
| 3132 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 3133 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3134 | main.step( "Verify Ping across all hosts" ) |
| 3135 | pingResult = main.FALSE |
| 3136 | time1 = time.time() |
| 3137 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 3138 | time2 = time.time() |
| 3139 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 3140 | main.log.report( |
| 3141 | "Time taken for Ping All: " + |
| 3142 | str( timeDiff ) + |
| 3143 | " seconds" ) |
| 3144 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 3145 | onpass="PING tALL PASS", |
| 3146 | onfail="PING ALL FAIL" ) |
| 3147 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 3148 | caseResult = ( intentState and pingResult ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3149 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3150 | utilities.assert_equals( |
| 3151 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 3152 | actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3153 | onpass="Install 600 point Intents and Ping All test PASS", |
| 3154 | onfail="Install 600 point Intents and Ping All test FAIL" ) |
| 3155 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 3156 | if not intentState: |
| 3157 | main.log.debug( "Intents failed to install completely" ) |
| 3158 | if not pingResult: |
| 3159 | main.log.debug( "Pingall failed" ) |
| 3160 | |
| 3161 | if not caseResult and main.failSwitch: |
| 3162 | main.log.report("Stopping test") |
| 3163 | main.stop( email=main.emailOnStop ) |
| 3164 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3165 | def CASE91( self ): |
| 3166 | """ |
| 3167 | Install 600 point intents and verify ping all (Chordal Topology) |
| 3168 | """ |
| 3169 | main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" ) |
| 3170 | main.log.report( "_______________________________________" ) |
| 3171 | import itertools |
| 3172 | import time |
| 3173 | main.case( "Install 600 point intents" ) |
| 3174 | main.step( "Add point Intents" ) |
| 3175 | intentResult = main.TRUE |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3176 | deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) ) |
| 3177 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3178 | intentIdList = [] |
| 3179 | time1 = time.time() |
| 3180 | for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ): |
| 3181 | pool = [] |
| 3182 | for cli in main.CLIs: |
| 3183 | if i >= len( deviceCombos ): |
| 3184 | break |
| 3185 | t = main.Thread( target=cli.addPointIntent, |
| 3186 | threadID=main.threadID, |
| 3187 | name="addPointIntent", |
Hari Krishna | 55b171b | 2015-09-02 09:46:03 -0700 | [diff] [blame] | 3188 | 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] | 3189 | pool.append(t) |
| 3190 | #time.sleep(1) |
| 3191 | t.start() |
| 3192 | i = i + 1 |
| 3193 | main.threadID = main.threadID + 1 |
| 3194 | for thread in pool: |
| 3195 | thread.join() |
| 3196 | intentIdList.append(thread.result) |
| 3197 | time2 = time.time() |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 3198 | main.log.info( "Time for adding point intents: %2f seconds" %(time2-time1) ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3199 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 3200 | # Saving intent ids to check intents in later case |
| 3201 | main.intentIds = list(intentIdList) |
| 3202 | |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3203 | main.step("Verify intents are installed") |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3204 | |
GlennRC | 1dde171 | 2015-10-02 11:03:08 -0700 | [diff] [blame^] | 3205 | # Giving onos multiple chances to install intents |
| 3206 | for i in range( main.intentCheck ): |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3207 | if i != 0: |
| 3208 | main.log.warn( "Verification failed. Retrying..." ) |
| 3209 | main.log.info("Waiting for onos to install intents...") |
| 3210 | time.sleep( main.checkIntentsDelay ) |
| 3211 | |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3212 | intentState = main.TRUE |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3213 | for e in range(int(main.numCtrls)): |
| 3214 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 3215 | intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\ |
| 3216 | intentState |
| 3217 | if not intentState: |
| 3218 | main.log.warn( "Not all intents installed" ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3219 | if intentState: |
| 3220 | break |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3221 | else: |
| 3222 | #Dumping intent summary |
| 3223 | main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3224 | |
| 3225 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 3226 | onpass="INTENTS INSTALLED", |
| 3227 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 3228 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3229 | main.step( "Verify Ping across all hosts" ) |
| 3230 | pingResult = main.FALSE |
| 3231 | time1 = time.time() |
| 3232 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 3233 | time2 = time.time() |
| 3234 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 3235 | main.log.report( |
| 3236 | "Time taken for Ping All: " + |
| 3237 | str( timeDiff ) + |
| 3238 | " seconds" ) |
| 3239 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 3240 | onpass="PING ALL PASS", |
| 3241 | onfail="PING ALL FAIL" ) |
| 3242 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 3243 | caseResult = ( intentState and pingResult ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3244 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3245 | utilities.assert_equals( |
| 3246 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 3247 | actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3248 | onpass="Install 600 point Intents and Ping All test PASS", |
| 3249 | onfail="Install 600 point Intents and Ping All test FAIL" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3250 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 3251 | if not intentState: |
| 3252 | main.log.debug( "Intents failed to install completely" ) |
| 3253 | if not pingResult: |
| 3254 | main.log.debug( "Pingall failed" ) |
| 3255 | |
| 3256 | if not caseResult and main.failSwitch: |
| 3257 | main.log.report("Stopping test") |
| 3258 | main.stop( email=main.emailOnStop ) |
| 3259 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3260 | def CASE92( self ): |
| 3261 | """ |
| 3262 | Install 4556 point intents and verify ping all (Spine Topology) |
| 3263 | """ |
| 3264 | main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" ) |
| 3265 | main.log.report( "_______________________________________" ) |
| 3266 | import itertools |
| 3267 | import time |
| 3268 | main.case( "Install 4556 point intents" ) |
| 3269 | main.step( "Add point Intents" ) |
| 3270 | intentResult = main.TRUE |
| 3271 | main.pingTimeout = 600 |
| 3272 | for i in range(len(main.hostMACs)): |
| 3273 | main.MACsDict[main.deviceDPIDs[i+10]] = main.hostMACs[i].split('/')[0] |
| 3274 | print main.MACsDict |
| 3275 | deviceCombos = list( itertools.permutations( main.deviceDPIDs[10:], 2 ) ) |
| 3276 | intentIdList = [] |
| 3277 | time1 = time.time() |
| 3278 | for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ): |
| 3279 | pool = [] |
| 3280 | for cli in main.CLIs: |
| 3281 | if i >= len( deviceCombos ): |
| 3282 | break |
| 3283 | t = main.Thread( target=cli.addPointIntent, |
| 3284 | threadID=main.threadID, |
| 3285 | name="addPointIntent", |
Hari Krishna | 55b171b | 2015-09-02 09:46:03 -0700 | [diff] [blame] | 3286 | 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] | 3287 | pool.append(t) |
| 3288 | #time.sleep(1) |
| 3289 | t.start() |
| 3290 | i = i + 1 |
| 3291 | main.threadID = main.threadID + 1 |
| 3292 | for thread in pool: |
| 3293 | thread.join() |
| 3294 | intentIdList.append(thread.result) |
| 3295 | time2 = time.time() |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 3296 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3297 | |
GlennRC | fcfdc4f | 2015-09-30 16:01:57 -0700 | [diff] [blame] | 3298 | # Saving intent ids to check intents in later case |
| 3299 | main.intentIds = list(intentIdList) |
| 3300 | |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3301 | main.step("Verify intents are installed") |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3302 | |
GlennRC | 1dde171 | 2015-10-02 11:03:08 -0700 | [diff] [blame^] | 3303 | # Giving onos multiple chances to install intents |
| 3304 | for i in range( main.intentCheck ): |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3305 | if i != 0: |
| 3306 | main.log.warn( "Verification failed. Retrying..." ) |
| 3307 | main.log.info("Waiting for onos to install intents...") |
| 3308 | time.sleep( main.checkIntentsDelay ) |
| 3309 | |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3310 | intentState = main.TRUE |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3311 | for e in range(int(main.numCtrls)): |
| 3312 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 3313 | intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\ |
| 3314 | intentState |
| 3315 | if not intentState: |
| 3316 | main.log.warn( "Not all intents installed" ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3317 | if intentState: |
| 3318 | break |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3319 | else: |
| 3320 | #Dumping intent summary |
| 3321 | main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3322 | |
| 3323 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 3324 | onpass="INTENTS INSTALLED", |
| 3325 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 3326 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3327 | main.step( "Verify Ping across all hosts" ) |
| 3328 | pingResult = main.FALSE |
| 3329 | time1 = time.time() |
| 3330 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 3331 | time2 = time.time() |
| 3332 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 3333 | main.log.report( |
| 3334 | "Time taken for Ping All: " + |
| 3335 | str( timeDiff ) + |
| 3336 | " seconds" ) |
| 3337 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 3338 | onpass="PING ALL PASS", |
| 3339 | onfail="PING ALL FAIL" ) |
| 3340 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 3341 | caseResult = ( intentState and pingResult ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3342 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3343 | utilities.assert_equals( |
| 3344 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 3345 | actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3346 | onpass="Install 4556 point Intents and Ping All test PASS", |
| 3347 | onfail="Install 4556 point Intents and Ping All test FAIL" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3348 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 3349 | if not intentState: |
| 3350 | main.log.debug( "Intents failed to install completely" ) |
| 3351 | if not pingResult: |
| 3352 | main.log.debug( "Pingall failed" ) |
| 3353 | |
| 3354 | if not caseResult and main.failSwitch: |
| 3355 | main.log.report("Stopping test") |
| 3356 | main.stop( email=main.emailOnStop ) |
| 3357 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3358 | def CASE93( self ): |
| 3359 | """ |
| 3360 | Install multi-single point intents and verify Ping all works |
| 3361 | for att topology |
| 3362 | """ |
| 3363 | import copy |
| 3364 | import time |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3365 | from collections import Counter |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3366 | main.log.report( "Install multi-single point intents and verify Ping all" ) |
| 3367 | main.log.report( "___________________________________________" ) |
| 3368 | main.case( "Install multi-single point intents and Ping all" ) |
| 3369 | deviceDPIDsCopy = copy.copy(main.deviceDPIDs) |
| 3370 | portIngressList = ['1']*(len(deviceDPIDsCopy) - 1) |
| 3371 | intentIdList = [] |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3372 | main.log.info( "MACsDict" + str(main.MACsDict) ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3373 | time1 = time.time() |
| 3374 | for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)): |
| 3375 | pool = [] |
| 3376 | for cli in main.CLIs: |
| 3377 | egressDevice = deviceDPIDsCopy[i] |
| 3378 | ingressDeviceList = copy.copy(deviceDPIDsCopy) |
| 3379 | ingressDeviceList.remove(egressDevice) |
| 3380 | if i >= len( deviceDPIDsCopy ): |
| 3381 | break |
| 3382 | t = main.Thread( target=cli.addMultipointToSinglepointIntent, |
| 3383 | threadID=main.threadID, |
| 3384 | name="addMultipointToSinglepointIntent", |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3385 | args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)]) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3386 | pool.append(t) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3387 | t.start() |
| 3388 | i = i + 1 |
| 3389 | main.threadID = main.threadID + 1 |
| 3390 | for thread in pool: |
| 3391 | thread.join() |
| 3392 | intentIdList.append(thread.result) |
| 3393 | time2 = time.time() |
| 3394 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3395 | |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3396 | main.step("Verify intents are installed") |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3397 | |
GlennRC | 1dde171 | 2015-10-02 11:03:08 -0700 | [diff] [blame^] | 3398 | # Giving onos multiple chances to install intents |
| 3399 | for i in range( main.intentCheck ): |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3400 | if i != 0: |
| 3401 | main.log.warn( "Verification failed. Retrying..." ) |
| 3402 | main.log.info("Waiting for onos to install intents...") |
| 3403 | time.sleep( main.checkIntentsDelay ) |
| 3404 | |
| 3405 | intentState = main.TRUE |
| 3406 | for e in range(int(main.numCtrls)): |
| 3407 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 3408 | intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\ |
| 3409 | intentState |
| 3410 | if not intentState: |
| 3411 | main.log.warn( "Not all intents installed" ) |
| 3412 | if intentState: |
| 3413 | break |
| 3414 | else: |
| 3415 | #Dumping intent summary |
| 3416 | main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) ) |
| 3417 | |
| 3418 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 3419 | onpass="INTENTS INSTALLED", |
| 3420 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 3421 | |
| 3422 | main.log.info( "Checking flows state" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3423 | checkFlowsState = main.ONOScli1.checkFlowsState() |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3424 | # Giving onos time to return the state of the flows |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3425 | time.sleep(50) |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3426 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3427 | main.step( "Verify Ping across all hosts" ) |
| 3428 | pingResult = main.FALSE |
| 3429 | time1 = time.time() |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3430 | pingResult = main.Mininet1.pingall( timeout=main.pingTimeout ) |
| 3431 | if not pingResult: |
| 3432 | time1 = time.time() |
| 3433 | main.log.warn("First pingall failed. Retrying") |
| 3434 | pingResult = main.Mininet1.pingall( timeout=main.pingTimeout ) |
| 3435 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3436 | time2 = time.time() |
| 3437 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 3438 | main.log.report( |
| 3439 | "Time taken for Ping All: " + |
| 3440 | str( timeDiff ) + |
| 3441 | " seconds" ) |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3442 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 3443 | caseResult = ( checkFlowsState and pingResult and intentState ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3444 | utilities.assert_equals( |
| 3445 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 3446 | actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3447 | onpass="Install 25 multi to single point Intents and Ping All test PASS", |
| 3448 | 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] | 3449 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3450 | def CASE94( self ): |
| 3451 | """ |
| 3452 | Install multi-single point intents and verify Ping all works |
| 3453 | for Chordal topology |
| 3454 | """ |
| 3455 | import copy |
| 3456 | import time |
| 3457 | main.log.report( "Install multi-single point intents and verify Ping all" ) |
| 3458 | main.log.report( "___________________________________________" ) |
| 3459 | main.case( "Install multi-single point intents and Ping all" ) |
| 3460 | deviceDPIDsCopy = copy.copy(main.deviceDPIDs) |
| 3461 | portIngressList = ['1']*(len(deviceDPIDsCopy) - 1) |
| 3462 | intentIdList = [] |
| 3463 | print "MACsDict", main.MACsDict |
| 3464 | time1 = time.time() |
| 3465 | for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)): |
| 3466 | pool = [] |
| 3467 | for cli in main.CLIs: |
| 3468 | egressDevice = deviceDPIDsCopy[i] |
| 3469 | ingressDeviceList = copy.copy(deviceDPIDsCopy) |
| 3470 | ingressDeviceList.remove(egressDevice) |
| 3471 | if i >= len( deviceDPIDsCopy ): |
| 3472 | break |
| 3473 | t = main.Thread( target=cli.addMultipointToSinglepointIntent, |
| 3474 | threadID=main.threadID, |
| 3475 | name="addMultipointToSinglepointIntent", |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3476 | args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)]) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3477 | pool.append(t) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3478 | t.start() |
| 3479 | i = i + 1 |
| 3480 | main.threadID = main.threadID + 1 |
| 3481 | for thread in pool: |
| 3482 | thread.join() |
| 3483 | intentIdList.append(thread.result) |
| 3484 | time2 = time.time() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3485 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3486 | |
| 3487 | main.step("Verify intents are installed") |
| 3488 | |
GlennRC | 1dde171 | 2015-10-02 11:03:08 -0700 | [diff] [blame^] | 3489 | # Giving onos multiple chances to install intents |
| 3490 | for i in range( main.intentCheck ): |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3491 | if i != 0: |
| 3492 | main.log.warn( "Verification failed. Retrying..." ) |
| 3493 | main.log.info("Waiting for onos to install intents...") |
| 3494 | time.sleep( main.checkIntentsDelay ) |
| 3495 | |
| 3496 | intentState = main.TRUE |
| 3497 | for e in range(int(main.numCtrls)): |
| 3498 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 3499 | intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\ |
| 3500 | intentState |
| 3501 | if not intentState: |
| 3502 | main.log.warn( "Not all intents installed" ) |
| 3503 | if intentState: |
| 3504 | break |
| 3505 | else: |
| 3506 | #Dumping intent summary |
| 3507 | main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) ) |
| 3508 | |
| 3509 | |
| 3510 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 3511 | onpass="INTENTS INSTALLED", |
| 3512 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 3513 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3514 | main.step( "Verify Ping across all hosts" ) |
| 3515 | pingResult = main.FALSE |
| 3516 | time1 = time.time() |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3517 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout) |
| 3518 | if not pingResult: |
| 3519 | main.log.info( "First pingall failed. Retrying..." ) |
| 3520 | time1 = time.time() |
| 3521 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3522 | time2 = time.time() |
| 3523 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 3524 | main.log.report( |
| 3525 | "Time taken for Ping All: " + |
| 3526 | str( timeDiff ) + |
| 3527 | " seconds" ) |
| 3528 | |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3529 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 3530 | caseResult = ( pingResult and intentState ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3531 | utilities.assert_equals( |
| 3532 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 3533 | actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3534 | onpass="Install 25 multi to single point Intents and Ping All test PASS", |
| 3535 | 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] | 3536 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3537 | #def CASE95 multi-single point intent for Spine |
| 3538 | |
| 3539 | def CASE96( self ): |
| 3540 | """ |
| 3541 | Install single-multi point intents and verify Ping all works |
| 3542 | for att topology |
| 3543 | """ |
| 3544 | import copy |
| 3545 | main.log.report( "Install single-multi point intents and verify Ping all" ) |
| 3546 | main.log.report( "___________________________________________" ) |
| 3547 | main.case( "Install single-multi point intents and Ping all" ) |
| 3548 | deviceDPIDsCopy = copy.copy(main.deviceDPIDs) |
| 3549 | portEgressList = ['1']*(len(deviceDPIDsCopy) - 1) |
| 3550 | intentIdList = [] |
| 3551 | print "MACsDict", main.MACsDict |
| 3552 | time1 = time.time() |
| 3553 | for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)): |
| 3554 | pool = [] |
| 3555 | for cli in main.CLIs: |
| 3556 | ingressDevice = deviceDPIDsCopy[i] |
| 3557 | egressDeviceList = copy.copy(deviceDPIDsCopy) |
| 3558 | egressDeviceList.remove(ingressDevice) |
| 3559 | if i >= len( deviceDPIDsCopy ): |
| 3560 | break |
| 3561 | t = main.Thread( target=cli.addSinglepointToMultipointIntent, |
| 3562 | threadID=main.threadID, |
| 3563 | name="addSinglepointToMultipointIntent", |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3564 | args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice)]) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3565 | pool.append(t) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3566 | t.start() |
| 3567 | i = i + 1 |
| 3568 | main.threadID = main.threadID + 1 |
| 3569 | for thread in pool: |
| 3570 | thread.join() |
| 3571 | intentIdList.append(thread.result) |
| 3572 | time2 = time.time() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3573 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3574 | |
| 3575 | main.step("Verify intents are installed") |
| 3576 | |
GlennRC | 1dde171 | 2015-10-02 11:03:08 -0700 | [diff] [blame^] | 3577 | # Giving onos multiple chances to install intents |
| 3578 | for i in range( main.intentCheck ): |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3579 | if i != 0: |
| 3580 | main.log.warn( "Verification failed. Retrying..." ) |
| 3581 | main.log.info("Waiting for onos to install intents...") |
| 3582 | time.sleep( main.checkIntentsDelay ) |
| 3583 | |
| 3584 | intentState = main.TRUE |
| 3585 | for e in range(int(main.numCtrls)): |
| 3586 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 3587 | intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\ |
| 3588 | intentState |
| 3589 | if not intentState: |
| 3590 | main.log.warn( "Not all intents installed" ) |
| 3591 | if intentState: |
| 3592 | break |
| 3593 | else: |
| 3594 | #Dumping intent summary |
| 3595 | main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) ) |
| 3596 | |
| 3597 | |
| 3598 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 3599 | onpass="INTENTS INSTALLED", |
| 3600 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 3601 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3602 | main.step( "Verify Ping across all hosts" ) |
| 3603 | pingResult = main.FALSE |
| 3604 | time1 = time.time() |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3605 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout) |
| 3606 | if not pingResult: |
| 3607 | main.log.info( "First pingall failed. Retrying..." ) |
| 3608 | time1 = time.time() |
| 3609 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3610 | time2 = time.time() |
| 3611 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 3612 | main.log.report( |
| 3613 | "Time taken for Ping All: " + |
| 3614 | str( timeDiff ) + |
| 3615 | " seconds" ) |
| 3616 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 3617 | caseResult = ( pingResult and intentState ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3618 | utilities.assert_equals( |
| 3619 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 3620 | actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3621 | onpass="Install 25 single to multi point Intents and Ping All test PASS", |
| 3622 | onfail="Install 25 single to multi point Intents and Ping All test FAIL" ) |
| 3623 | |
| 3624 | def CASE97( self ): |
| 3625 | """ |
| 3626 | Install single-multi point intents and verify Ping all works |
| 3627 | for Chordal topology |
| 3628 | """ |
| 3629 | import copy |
| 3630 | main.log.report( "Install single-multi point intents and verify Ping all" ) |
| 3631 | main.log.report( "___________________________________________" ) |
| 3632 | main.case( "Install single-multi point intents and Ping all" ) |
| 3633 | deviceDPIDsCopy = copy.copy(main.deviceDPIDs) |
| 3634 | portEgressList = ['1']*(len(deviceDPIDsCopy) - 1) |
| 3635 | intentIdList = [] |
| 3636 | print "MACsDict", main.MACsDict |
| 3637 | time1 = time.time() |
| 3638 | for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)): |
| 3639 | pool = [] |
| 3640 | for cli in main.CLIs: |
| 3641 | ingressDevice = deviceDPIDsCopy[i] |
| 3642 | egressDeviceList = copy.copy(deviceDPIDsCopy) |
| 3643 | egressDeviceList.remove(ingressDevice) |
| 3644 | if i >= len( deviceDPIDsCopy ): |
| 3645 | break |
| 3646 | t = main.Thread( target=cli.addSinglepointToMultipointIntent, |
| 3647 | threadID=main.threadID, |
| 3648 | name="addSinglepointToMultipointIntent", |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3649 | args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice),'']) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3650 | pool.append(t) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3651 | t.start() |
| 3652 | i = i + 1 |
| 3653 | main.threadID = main.threadID + 1 |
| 3654 | for thread in pool: |
| 3655 | thread.join() |
| 3656 | intentIdList.append(thread.result) |
| 3657 | time2 = time.time() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3658 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3659 | |
| 3660 | main.step("Verify intents are installed") |
| 3661 | |
GlennRC | 1dde171 | 2015-10-02 11:03:08 -0700 | [diff] [blame^] | 3662 | # Giving onos multiple chances to install intents |
| 3663 | for i in range( main.intentCheck ): |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3664 | if i != 0: |
| 3665 | main.log.warn( "Verification failed. Retrying..." ) |
| 3666 | main.log.info("Waiting for onos to install intents...") |
| 3667 | time.sleep( main.checkIntentsDelay ) |
| 3668 | |
| 3669 | intentState = main.TRUE |
| 3670 | for e in range(int(main.numCtrls)): |
| 3671 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 3672 | intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\ |
| 3673 | intentState |
| 3674 | if not intentState: |
| 3675 | main.log.warn( "Not all intents installed" ) |
| 3676 | if intentState: |
| 3677 | break |
| 3678 | else: |
| 3679 | #Dumping intent summary |
| 3680 | main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) ) |
| 3681 | |
| 3682 | |
| 3683 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 3684 | onpass="INTENTS INSTALLED", |
| 3685 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 3686 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3687 | main.step( "Verify Ping across all hosts" ) |
| 3688 | pingResult = main.FALSE |
| 3689 | time1 = time.time() |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3690 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout) |
| 3691 | if not pingResult: |
| 3692 | main.log.info( "First pingall failed. Retrying..." ) |
| 3693 | time1 = time.time() |
| 3694 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3695 | time2 = time.time() |
| 3696 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 3697 | main.log.report( |
| 3698 | "Time taken for Ping All: " + |
| 3699 | str( timeDiff ) + |
| 3700 | " seconds" ) |
| 3701 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 3702 | caseResult = ( pingResult and intentState ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3703 | utilities.assert_equals( |
| 3704 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 3705 | actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3706 | onpass="Install 25 single to multi point Intents and Ping All test PASS", |
| 3707 | onfail="Install 25 single to multi point Intents and Ping All test FAIL" ) |
| 3708 | |
| 3709 | def CASE98( self ): |
| 3710 | """ |
| 3711 | Install single-multi point intents and verify Ping all works |
| 3712 | for Spine topology |
| 3713 | """ |
| 3714 | import copy |
| 3715 | main.log.report( "Install single-multi point intents and verify Ping all" ) |
| 3716 | main.log.report( "___________________________________________" ) |
| 3717 | main.case( "Install single-multi point intents and Ping all" ) |
| 3718 | deviceDPIDsCopy = copy.copy( main.deviceDPIDs ) |
| 3719 | deviceDPIDsCopy = deviceDPIDsCopy[ 10: ] |
| 3720 | portEgressList = [ '1' ]*(len(deviceDPIDsCopy) - 1) |
| 3721 | intentIdList = [] |
| 3722 | MACsDictCopy = {} |
| 3723 | for i in range( len( deviceDPIDsCopy ) ): |
| 3724 | MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ] |
| 3725 | |
| 3726 | print "deviceDPIDsCopy", deviceDPIDsCopy |
| 3727 | print "" |
| 3728 | print "MACsDictCopy", MACsDictCopy |
| 3729 | time1 = time.time() |
| 3730 | for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)): |
| 3731 | pool = [] |
| 3732 | for cli in main.CLIs: |
| 3733 | if i >= len( deviceDPIDsCopy ): |
| 3734 | break |
| 3735 | ingressDevice = deviceDPIDsCopy[i] |
| 3736 | egressDeviceList = copy.copy(deviceDPIDsCopy) |
| 3737 | egressDeviceList.remove(ingressDevice) |
| 3738 | t = main.Thread( target=cli.addSinglepointToMultipointIntent, |
| 3739 | threadID=main.threadID, |
| 3740 | name="addSinglepointToMultipointIntent", |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3741 | args =[ingressDevice,egressDeviceList,'1',portEgressList,'',MACsDictCopy.get(ingressDevice),'']) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3742 | pool.append(t) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3743 | t.start() |
| 3744 | i = i + 1 |
| 3745 | main.threadID = main.threadID + 1 |
| 3746 | for thread in pool: |
| 3747 | thread.join() |
| 3748 | intentIdList.append(thread.result) |
| 3749 | time2 = time.time() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3750 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3751 | |
| 3752 | main.step("Verify intents are installed") |
| 3753 | |
GlennRC | 1dde171 | 2015-10-02 11:03:08 -0700 | [diff] [blame^] | 3754 | # Giving onos multiple chances to install intents |
| 3755 | for i in range( main.intentCheck ): |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3756 | if i != 0: |
| 3757 | main.log.warn( "Verification failed. Retrying..." ) |
| 3758 | main.log.info("Waiting for onos to install intents...") |
| 3759 | time.sleep( main.checkIntentsDelay ) |
| 3760 | |
| 3761 | intentState = main.TRUE |
| 3762 | for e in range(int(main.numCtrls)): |
| 3763 | main.log.info( "Checking intents on CLI %s" % (e+1) ) |
| 3764 | intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\ |
| 3765 | intentState |
| 3766 | if not intentState: |
| 3767 | main.log.warn( "Not all intents installed" ) |
| 3768 | if intentState: |
| 3769 | break |
| 3770 | else: |
| 3771 | #Dumping intent summary |
| 3772 | main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) ) |
| 3773 | |
| 3774 | |
| 3775 | utilities.assert_equals( expect=main.TRUE, actual=intentState, |
| 3776 | onpass="INTENTS INSTALLED", |
| 3777 | onfail="SOME INTENTS NOT INSTALLED" ) |
| 3778 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3779 | main.step( "Verify Ping across all hosts" ) |
| 3780 | pingResult = main.FALSE |
| 3781 | time1 = time.time() |
GlennRC | db2c842 | 2015-09-29 12:21:59 -0700 | [diff] [blame] | 3782 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout) |
| 3783 | if not pingResult: |
| 3784 | main.log.info( "First pingall failed. Retrying..." ) |
| 3785 | time1 = time.time() |
| 3786 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3787 | time2 = time.time() |
| 3788 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 3789 | main.log.report( |
| 3790 | "Time taken for Ping All: " + |
| 3791 | str( timeDiff ) + |
| 3792 | " seconds" ) |
| 3793 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 3794 | caseResult = ( pingResult and intentState ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3795 | utilities.assert_equals( |
| 3796 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 3797 | actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3798 | onpass="Install 25 single to multi point Intents and Ping All test PASS", |
| 3799 | onfail="Install 25 single to multi point Intents and Ping All test FAIL" ) |
| 3800 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3801 | def CASE190( self ): |
| 3802 | """ |
| 3803 | Verify IPv6 ping across 600 Point intents (Att Topology) |
| 3804 | """ |
| 3805 | main.log.report( "Verify IPv6 ping across 600 Point intents (Att Topology)" ) |
| 3806 | main.log.report( "_________________________________________________" ) |
| 3807 | import itertools |
| 3808 | import time |
| 3809 | main.case( "IPv6 ping all 600 Point intents" ) |
| 3810 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 3811 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 3812 | pingResult = main.FALSE |
| 3813 | time1 = time.time() |
| 3814 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 3815 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3816 | main.log.warn("First pingall failed. Retrying...") |
| 3817 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 3818 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
| 3819 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3820 | time2 = time.time() |
| 3821 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 3822 | main.log.report( |
| 3823 | "Time taken for IPv6 Ping All: " + |
| 3824 | str( timeDiff ) + |
| 3825 | " seconds" ) |
| 3826 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 3827 | onpass="PING ALL PASS", |
| 3828 | onfail="PING ALL FAIL" ) |
| 3829 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 3830 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3831 | utilities.assert_equals( |
| 3832 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 3833 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3834 | onpass="IPv6 Ping across 600 Point intents test PASS", |
| 3835 | onfail="IPv6 Ping across 600 Point intents test FAIL" ) |
| 3836 | |
| 3837 | def CASE191( self ): |
| 3838 | """ |
| 3839 | Verify IPv6 ping across 600 Point intents (Chordal Topology) |
| 3840 | """ |
| 3841 | main.log.report( "Verify IPv6 ping across 600 Point intents (Chordal Topology)" ) |
| 3842 | main.log.report( "_________________________________________________" ) |
| 3843 | import itertools |
| 3844 | import time |
| 3845 | main.case( "IPv6 ping all 600 Point intents" ) |
| 3846 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 3847 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 3848 | pingResult = main.FALSE |
| 3849 | time1 = time.time() |
| 3850 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 3851 | if not pingResult: |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3852 | main.log.warn("First pingall failed. Retrying...") |
| 3853 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 3854 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3855 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3856 | time2 = time.time() |
| 3857 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 3858 | main.log.report( |
| 3859 | "Time taken for IPv6 Ping All: " + |
| 3860 | str( timeDiff ) + |
| 3861 | " seconds" ) |
| 3862 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 3863 | onpass="PING ALL PASS", |
| 3864 | onfail="PING ALL FAIL" ) |
| 3865 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 3866 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3867 | utilities.assert_equals( |
| 3868 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 3869 | actual=caseResult, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3870 | onpass="IPv6 Ping across 600 Point intents test PASS", |
| 3871 | onfail="IPv6 Ping across 600 Point intents test FAIL" ) |
| 3872 | |
| 3873 | def CASE192( self ): |
| 3874 | """ |
| 3875 | Verify IPv6 ping across 4556 Point intents (Spine Topology) |
| 3876 | """ |
| 3877 | main.log.report( "Verify IPv6 ping across 4556 Point intents (Spine Topology)" ) |
| 3878 | main.log.report( "_________________________________________________" ) |
| 3879 | import itertools |
| 3880 | import time |
Hari Krishna | 310efca | 2015-09-03 09:43:16 -0700 | [diff] [blame] | 3881 | main.case( "IPv6 ping all 4556 Point intents" ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3882 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 3883 | hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ] |
| 3884 | pingResult = main.FALSE |
| 3885 | time1 = time.time() |
| 3886 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | a8d786a | 2015-09-23 17:40:11 -0700 | [diff] [blame] | 3887 | if not pingResult: |
| 3888 | main.log.warn("First pingall failed. Retrying...") |
| 3889 | time1 = time.time() |
| 3890 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
| 3891 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3892 | time2 = time.time() |
| 3893 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 3894 | main.log.report( |
| 3895 | "Time taken for IPv6 Ping All: " + |
| 3896 | str( timeDiff ) + |
| 3897 | " seconds" ) |
| 3898 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 3899 | onpass="PING ALL PASS", |
| 3900 | onfail="PING ALL FAIL" ) |
| 3901 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 3902 | caseResult = pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3903 | utilities.assert_equals( |
| 3904 | expect=main.TRUE, |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 3905 | actual=caseResult, |
Hari Krishna | 310efca | 2015-09-03 09:43:16 -0700 | [diff] [blame] | 3906 | onpass="IPv6 Ping across 4556 Point intents test PASS", |
| 3907 | onfail="IPv6 Ping across 4556 Point intents test FAIL" ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3908 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3909 | def CASE10( self ): |
| 3910 | import time |
GlennRC | c6cd2a6 | 2015-08-10 16:08:22 -0700 | [diff] [blame] | 3911 | import re |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3912 | """ |
| 3913 | Remove all Intents |
| 3914 | """ |
| 3915 | main.log.report( "Remove all intents that were installed previously" ) |
| 3916 | main.log.report( "______________________________________________" ) |
| 3917 | main.log.info( "Remove all intents" ) |
| 3918 | main.case( "Removing intents" ) |
Hari Krishna | ad0c520 | 2015-09-01 14:26:49 -0700 | [diff] [blame] | 3919 | purgeDelay = int( main.params[ "timers" ][ "IntentPurgeDelay" ] ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3920 | main.step( "Obtain the intent id's first" ) |
| 3921 | intentsList = main.ONOScli1.getAllIntentIds() |
| 3922 | ansi_escape = re.compile( r'\x1b[^m]*m' ) |
| 3923 | intentsList = ansi_escape.sub( '', intentsList ) |
| 3924 | intentsList = intentsList.replace( |
| 3925 | " onos:intents | grep id=", |
| 3926 | "" ).replace( |
| 3927 | "id=", |
| 3928 | "" ).replace( |
| 3929 | "\r\r", |
| 3930 | "" ) |
| 3931 | intentsList = intentsList.splitlines() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3932 | intentIdList = [] |
| 3933 | step1Result = main.TRUE |
| 3934 | moreIntents = main.TRUE |
| 3935 | removeIntentCount = 0 |
| 3936 | intentsCount = len(intentsList) |
| 3937 | main.log.info ( "Current number of intents: " + str(intentsCount) ) |
| 3938 | if ( len( intentsList ) > 1 ): |
| 3939 | results = main.TRUE |
| 3940 | main.log.info("Removing intent...") |
| 3941 | while moreIntents: |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 3942 | # 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] | 3943 | if removeIntentCount == 5: |
| 3944 | break |
| 3945 | removeIntentCount = removeIntentCount + 1 |
| 3946 | intentsList1 = main.ONOScli1.getAllIntentIds() |
| 3947 | if len( intentsList1 ) == 0: |
| 3948 | break |
| 3949 | ansi_escape = re.compile( r'\x1b[^m]*m' ) |
| 3950 | intentsList1 = ansi_escape.sub( '', intentsList1 ) |
| 3951 | intentsList1 = intentsList1.replace( |
| 3952 | " onos:intents | grep id=", |
| 3953 | "" ).replace( |
| 3954 | " state=", |
| 3955 | "" ).replace( |
| 3956 | "\r\r", |
| 3957 | "" ) |
| 3958 | intentsList1 = intentsList1.splitlines() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3959 | main.log.info ( "Round %d intents to remove: " %(removeIntentCount) ) |
| 3960 | print intentsList1 |
| 3961 | intentIdList1 = [] |
| 3962 | if ( len( intentsList1 ) > 0 ): |
| 3963 | moreIntents = main.TRUE |
| 3964 | for i in range( len( intentsList1 ) ): |
| 3965 | intentsTemp1 = intentsList1[ i ].split( ',' ) |
| 3966 | intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] ) |
| 3967 | main.log.info ( "Leftover Intent IDs: " + str(intentIdList1) ) |
| 3968 | main.log.info ( "Length of Leftover Intents list: " + str(len(intentIdList1)) ) |
| 3969 | time1 = time.time() |
| 3970 | for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ): |
| 3971 | pool = [] |
| 3972 | for cli in main.CLIs: |
| 3973 | if i >= len( intentIdList1 ): |
| 3974 | break |
| 3975 | t = main.Thread( target=cli.removeIntent, |
| 3976 | threadID=main.threadID, |
| 3977 | name="removeIntent", |
| 3978 | args=[intentIdList1[i],'org.onosproject.cli',False,False]) |
| 3979 | pool.append(t) |
| 3980 | t.start() |
| 3981 | i = i + 1 |
| 3982 | main.threadID = main.threadID + 1 |
| 3983 | for thread in pool: |
| 3984 | thread.join() |
| 3985 | intentIdList.append(thread.result) |
| 3986 | #time.sleep(2) |
| 3987 | time2 = time.time() |
| 3988 | main.log.info("Time for removing host intents: %2f seconds" %(time2-time1)) |
Hari Krishna | ad0c520 | 2015-09-01 14:26:49 -0700 | [diff] [blame] | 3989 | time.sleep( purgeDelay ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3990 | main.log.info("Purging WITHDRAWN Intents") |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 3991 | purgeResult = main.ONOScli1.purgeWithdrawnIntents() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3992 | else: |
| 3993 | time.sleep(10) |
| 3994 | if len( main.ONOScli1.intents()): |
| 3995 | continue |
| 3996 | break |
Hari Krishna | ad0c520 | 2015-09-01 14:26:49 -0700 | [diff] [blame] | 3997 | time.sleep( purgeDelay ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3998 | else: |
| 3999 | print "Removed %d intents" %(intentsCount) |
| 4000 | step1Result = main.TRUE |
| 4001 | else: |
| 4002 | print "No Intent IDs found in Intents list: ", intentsList |
| 4003 | step1Result = main.FALSE |
| 4004 | |
| 4005 | print main.ONOScli1.intents() |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 4006 | caseResult = step1Result |
| 4007 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 4008 | onpass="Intent removal test successful", |
| 4009 | onfail="Intent removal test failed" ) |
| 4010 | |
| 4011 | def CASE12( self, main ): |
| 4012 | """ |
| 4013 | Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it |
| 4014 | """ |
| 4015 | import re |
| 4016 | import copy |
| 4017 | import time |
| 4018 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 4019 | threadID = 0 |
| 4020 | |
| 4021 | main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" ) |
| 4022 | main.log.report( "_____________________________________________________" ) |
| 4023 | main.case( "Enable Intent based Reactive forwarding and Verify ping all" ) |
| 4024 | main.step( "Enable intent based Reactive forwarding" ) |
| 4025 | installResult = main.FALSE |
| 4026 | feature = "onos-app-ifwd" |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 4027 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 4028 | pool = [] |
| 4029 | time1 = time.time() |
| 4030 | for cli,feature in main.CLIs: |
| 4031 | t = main.Thread(target=cli,threadID=threadID, |
| 4032 | name="featureInstall",args=[feature]) |
| 4033 | pool.append(t) |
| 4034 | t.start() |
| 4035 | threadID = threadID + 1 |
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 | results = [] |
| 4038 | for thread in pool: |
| 4039 | thread.join() |
| 4040 | results.append(thread.result) |
| 4041 | time2 = time.time() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 4042 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 4043 | if( all(result == main.TRUE for result in results) == False): |
| 4044 | main.log.info("Did not install onos-app-ifwd feature properly") |
| 4045 | #main.cleanup() |
| 4046 | #main.exit() |
| 4047 | else: |
| 4048 | main.log.info("Successful feature:install onos-app-ifwd") |
| 4049 | installResult = main.TRUE |
| 4050 | 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] | 4051 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 4052 | main.step( "Verify Pingall" ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 4053 | pingResult = main.FALSE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 4054 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 4055 | pingResult = main.Mininet1.pingall(timeout=600) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 4056 | time2 = time.time() |
| 4057 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 4058 | main.log.report( |
| 4059 | "Time taken for Ping All: " + |
| 4060 | str( timeDiff ) + |
| 4061 | " seconds" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 4062 | |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 4063 | if pingResult == main.TRUE: |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 4064 | main.log.report( "Pingall Test in Reactive mode successful" ) |
| 4065 | else: |
| 4066 | main.log.report( "Pingall Test in Reactive mode failed" ) |
| 4067 | |
| 4068 | main.step( "Disable Intent based Reactive forwarding" ) |
| 4069 | uninstallResult = main.FALSE |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 4070 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 4071 | pool = [] |
| 4072 | time1 = time.time() |
| 4073 | for cli,feature in main.CLIs: |
| 4074 | t = main.Thread(target=cli,threadID=threadID, |
| 4075 | name="featureUninstall",args=[feature]) |
| 4076 | pool.append(t) |
| 4077 | t.start() |
| 4078 | threadID = threadID + 1 |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 4079 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 4080 | results = [] |
| 4081 | for thread in pool: |
| 4082 | thread.join() |
| 4083 | results.append(thread.result) |
| 4084 | time2 = time.time() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 4085 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 4086 | if( all(result == main.TRUE for result in results) == False): |
| 4087 | main.log.info("Did not uninstall onos-app-ifwd feature properly") |
| 4088 | uninstallResult = main.FALSE |
| 4089 | #main.cleanup() |
| 4090 | #main.exit() |
| 4091 | else: |
| 4092 | main.log.info("Successful feature:uninstall onos-app-ifwd") |
| 4093 | uninstallResult = main.TRUE |
| 4094 | main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1)) |
| 4095 | |
| 4096 | # Waiting for reative flows to be cleared. |
| 4097 | time.sleep( 10 ) |
| 4098 | |
GlennRC | bddd58f | 2015-10-01 15:45:25 -0700 | [diff] [blame] | 4099 | caseResult = installResult and pingResult and uninstallResult |
| 4100 | utilities.assert_equals( expect=main.TRUE, actual=caseResult, |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 4101 | onpass="Intent based Reactive forwarding Pingall test PASS", |
| 4102 | onfail="Intent based Reactive forwarding Pingall test FAIL" ) |