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'] |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 35 | main.newTopo = "" |
| 36 | main.CLIs = [] |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 37 | |
| 38 | for i in range( 1, int(main.numCtrls) + 1 ): |
| 39 | main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 40 | |
| 41 | main.case( "Set up test environment" ) |
| 42 | main.log.report( "Set up test environment" ) |
| 43 | main.log.report( "_______________________" ) |
| 44 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 45 | main.step( "Apply Cell environment for ONOS" ) |
| 46 | if ( main.onoscell ): |
| 47 | cellName = main.onoscell |
| 48 | cell_result = main.ONOSbench.setCell( cellName ) |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 49 | utilities.assert_equals( expect=main.TRUE, actual=cell_result, |
| 50 | onpass="Test step PASS", |
| 51 | onfail="Test step FAIL" ) |
| 52 | else: |
| 53 | main.log.error( "Please provide onoscell option at TestON CLI to run CHO tests" ) |
| 54 | main.log.error( "Example: ~/TestON/bin/cli.py run OnosCHO onoscell <cellName>" ) |
| 55 | main.clean() |
| 56 | main.exit() |
| 57 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 58 | main.step( "Git checkout and pull " + git_branch ) |
| 59 | if git_pull == 'on': |
| 60 | checkout_result = main.ONOSbench.gitCheckout( git_branch ) |
| 61 | pull_result = main.ONOSbench.gitPull() |
| 62 | cp_result = ( checkout_result and pull_result ) |
| 63 | else: |
| 64 | checkout_result = main.TRUE |
| 65 | pull_result = main.TRUE |
| 66 | main.log.info( "Skipped git checkout and pull" ) |
| 67 | cp_result = ( checkout_result and pull_result ) |
| 68 | utilities.assert_equals( expect=main.TRUE, actual=cp_result, |
| 69 | onpass="Test step PASS", |
| 70 | onfail="Test step FAIL" ) |
| 71 | |
| 72 | main.step( "mvn clean & install" ) |
| 73 | if git_pull == 'on': |
| 74 | mvn_result = main.ONOSbench.cleanInstall() |
| 75 | utilities.assert_equals( expect=main.TRUE, actual=mvn_result, |
| 76 | onpass="Test step PASS", |
| 77 | onfail="Test step FAIL" ) |
| 78 | else: |
| 79 | mvn_result = main.TRUE |
| 80 | main.log.info("Skipped mvn clean install as git pull is disabled in params file") |
| 81 | |
| 82 | main.ONOSbench.getVersion( report=True ) |
| 83 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 84 | main.step( "Create ONOS package" ) |
| 85 | packageResult = main.ONOSbench.onosPackage() |
| 86 | utilities.assert_equals( expect=main.TRUE, actual=packageResult, |
| 87 | onpass="Test step PASS", |
| 88 | onfail="Test step FAIL" ) |
| 89 | |
| 90 | main.step( "Uninstall ONOS package on all Nodes" ) |
| 91 | uninstallResult = main.TRUE |
| 92 | for i in range( int( main.numCtrls ) ): |
| 93 | main.log.info( "Uninstalling package on ONOS Node IP: " + main.onosIPs[i] ) |
| 94 | u_result = main.ONOSbench.onosUninstall( main.onosIPs[i] ) |
| 95 | utilities.assert_equals( expect=main.TRUE, actual=u_result, |
| 96 | onpass="Test step PASS", |
| 97 | onfail="Test step FAIL" ) |
| 98 | uninstallResult = ( uninstallResult and u_result ) |
| 99 | |
| 100 | main.step( "Install ONOS package on all Nodes" ) |
| 101 | installResult = main.TRUE |
| 102 | for i in range( int( main.numCtrls ) ): |
| 103 | main.log.info( "Intsalling package on ONOS Node IP: " + main.onosIPs[i] ) |
| 104 | i_result = main.ONOSbench.onosInstall( node=main.onosIPs[i] ) |
| 105 | utilities.assert_equals( expect=main.TRUE, actual=i_result, |
| 106 | onpass="Test step PASS", |
| 107 | onfail="Test step FAIL" ) |
| 108 | installResult = ( installResult and i_result ) |
| 109 | |
| 110 | main.step( "Verify ONOS nodes UP status" ) |
| 111 | statusResult = main.TRUE |
| 112 | for i in range( int( main.numCtrls ) ): |
| 113 | main.log.info( "ONOS Node " + main.onosIPs[i] + " status:" ) |
| 114 | onos_status = main.ONOSbench.onosStatus( node=main.onosIPs[i] ) |
| 115 | utilities.assert_equals( expect=main.TRUE, actual=onos_status, |
| 116 | onpass="Test step PASS", |
| 117 | onfail="Test step FAIL" ) |
| 118 | statusResult = ( statusResult and onos_status ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 119 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 120 | main.step( "Start ONOS CLI on all nodes" ) |
| 121 | cliResult = main.TRUE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 122 | main.log.step(" Start ONOS cli using thread ") |
| 123 | startCliResult = main.TRUE |
| 124 | pool = [] |
| 125 | time1 = time.time() |
| 126 | for i in range( int( main.numCtrls) ): |
| 127 | t = main.Thread( target=main.CLIs[i].startOnosCli, |
| 128 | threadID=main.threadID, |
| 129 | name="startOnosCli", |
| 130 | args=[ main.onosIPs[i], karafTimeout ] ) |
| 131 | pool.append(t) |
| 132 | t.start() |
| 133 | main.threadID = main.threadID + 1 |
| 134 | for t in pool: |
| 135 | t.join() |
| 136 | startCliResult = startCliResult and t.result |
| 137 | time2 = time.time() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 138 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 139 | if not startCliResult: |
| 140 | main.log.info("ONOS CLI did not start up properly") |
| 141 | main.cleanup() |
| 142 | main.exit() |
| 143 | else: |
| 144 | main.log.info("Successful CLI startup") |
| 145 | startCliResult = main.TRUE |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 146 | |
| 147 | main.step( "Set IPv6 cfg parameters for Neighbor Discovery" ) |
| 148 | cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.proxyarp.ProxyArp", "ipv6NeighborDiscovery", "true" ) |
| 149 | cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "ipv6NeighborDiscovery", "true" ) |
| 150 | cfgResult = cfgResult1 and cfgResult2 |
| 151 | utilities.assert_equals( expect=main.TRUE, actual=cfgResult, |
| 152 | onpass="ipv6NeighborDiscovery cfg is set to true", |
| 153 | onfail="Failed to cfg set ipv6NeighborDiscovery" ) |
| 154 | |
| 155 | case1Result = installResult and uninstallResult and statusResult and startCliResult and cfgResult |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 156 | main.log.info("Time for connecting to CLI: %2f seconds" %(time2-time1)) |
| 157 | utilities.assert_equals( expect=main.TRUE, actual=case1Result, |
| 158 | onpass="Set up test environment PASS", |
| 159 | onfail="Set up test environment FAIL" ) |
| 160 | |
| 161 | def CASE20( self, main ): |
| 162 | """ |
| 163 | This test script Loads a new Topology (Att) on CHO setup and balances all switches |
| 164 | """ |
| 165 | import re |
| 166 | import time |
| 167 | import copy |
| 168 | |
| 169 | main.numMNswitches = int ( main.params[ 'TOPO1' ][ 'numSwitches' ] ) |
| 170 | main.numMNlinks = int ( main.params[ 'TOPO1' ][ 'numLinks' ] ) |
| 171 | main.numMNhosts = int ( main.params[ 'TOPO1' ][ 'numHosts' ] ) |
| 172 | main.pingTimeout = 300 |
| 173 | main.log.report( |
| 174 | "Load Att topology and Balance all Mininet switches across controllers" ) |
| 175 | main.log.report( |
| 176 | "________________________________________________________________________" ) |
| 177 | main.case( |
| 178 | "Assign and Balance all Mininet switches across controllers" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 179 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 180 | main.step( "Stop any previous Mininet network topology" ) |
| 181 | cliResult = main.TRUE |
| 182 | if main.newTopo == main.params['TOPO3']['topo']: |
| 183 | stopStatus = main.Mininet1.stopNet( fileName = "topoSpine" ) |
| 184 | |
| 185 | main.step( "Start Mininet with Att topology" ) |
| 186 | main.newTopo = main.params['TOPO1']['topo'] |
GlennRC | c6cd2a6 | 2015-08-10 16:08:22 -0700 | [diff] [blame] | 187 | mininetDir = main.Mininet1.home + "/custom/" |
| 188 | topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo |
| 189 | main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to") |
| 190 | topoPath = mininetDir + main.newTopo |
| 191 | startStatus = main.Mininet1.startNet(topoFile = topoPath) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 192 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 193 | main.step( "Assign switches to controllers" ) |
| 194 | for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 ) |
| 195 | main.Mininet1.assignSwController( |
| 196 | sw="s" + str( i ), |
Hari Krishna | 1006577 | 2015-07-10 15:55:53 -0700 | [diff] [blame] | 197 | ip=main.onosIPs ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 198 | |
| 199 | switch_mastership = main.TRUE |
| 200 | for i in range( 1, ( main.numMNswitches + 1 ) ): |
| 201 | response = main.Mininet1.getSwController( "s" + str( i ) ) |
| 202 | print( "Response is " + str( response ) ) |
| 203 | if re.search( "tcp:" + main.onosIPs[0], response ): |
| 204 | switch_mastership = switch_mastership and main.TRUE |
| 205 | else: |
| 206 | switch_mastership = main.FALSE |
| 207 | |
| 208 | if switch_mastership == main.TRUE: |
| 209 | main.log.report( "Controller assignment successfull" ) |
| 210 | else: |
| 211 | main.log.report( "Controller assignment failed" ) |
| 212 | |
| 213 | time.sleep(30) # waiting here to make sure topology converges across all nodes |
| 214 | |
| 215 | main.step( "Balance devices across controllers" ) |
| 216 | balanceResult = main.ONOScli1.balanceMasters() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 217 | # giving some breathing time for ONOS to complete re-balance |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 218 | time.sleep( 5 ) |
| 219 | |
| 220 | topology_output = main.ONOScli1.topology() |
| 221 | topology_result = main.ONOSbench.getTopology( topology_output ) |
| 222 | case2Result = ( switch_mastership and startStatus ) |
| 223 | utilities.assert_equals( |
| 224 | expect=main.TRUE, |
| 225 | actual=case2Result, |
| 226 | onpass="Starting new Att topology test PASS", |
| 227 | onfail="Starting new Att topology test FAIL" ) |
| 228 | |
| 229 | def CASE21( self, main ): |
| 230 | """ |
| 231 | This test script Loads a new Topology (Chordal) on CHO setup and balances all switches |
| 232 | """ |
| 233 | import re |
| 234 | import time |
| 235 | import copy |
| 236 | |
| 237 | main.newTopo = main.params['TOPO2']['topo'] |
| 238 | main.numMNswitches = int ( main.params[ 'TOPO2' ][ 'numSwitches' ] ) |
| 239 | main.numMNlinks = int ( main.params[ 'TOPO2' ][ 'numLinks' ] ) |
| 240 | main.numMNhosts = int ( main.params[ 'TOPO2' ][ 'numHosts' ] ) |
| 241 | main.pingTimeout = 300 |
| 242 | main.log.report( |
| 243 | "Load Chordal topology and Balance all Mininet switches across controllers" ) |
| 244 | main.log.report( |
| 245 | "________________________________________________________________________" ) |
| 246 | main.case( |
| 247 | "Assign and Balance all Mininet switches across controllers" ) |
| 248 | |
| 249 | main.step( "Stop any previous Mininet network topology" ) |
| 250 | stopStatus = main.Mininet1.stopNet(fileName = "topoAtt" ) |
| 251 | |
GlennRC | c6cd2a6 | 2015-08-10 16:08:22 -0700 | [diff] [blame] | 252 | main.step("Start Mininet with Chordal topology") |
| 253 | mininetDir = main.Mininet1.home + "/custom/" |
| 254 | topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo |
| 255 | main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to") |
| 256 | topoPath = mininetDir + main.newTopo |
| 257 | startStatus = main.Mininet1.startNet(topoFile = topoPath) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 258 | |
| 259 | main.step( "Assign switches to controllers" ) |
| 260 | |
| 261 | for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 ) |
| 262 | main.Mininet1.assignSwController( |
| 263 | sw="s" + str( i ), |
Hari Krishna | 1006577 | 2015-07-10 15:55:53 -0700 | [diff] [blame] | 264 | ip=main.onosIPs ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 265 | |
| 266 | switch_mastership = main.TRUE |
| 267 | for i in range( 1, ( main.numMNswitches + 1 ) ): |
| 268 | response = main.Mininet1.getSwController( "s" + str( i ) ) |
| 269 | print( "Response is " + str( response ) ) |
| 270 | if re.search( "tcp:" + main.onosIPs[0], response ): |
| 271 | switch_mastership = switch_mastership and main.TRUE |
| 272 | else: |
| 273 | switch_mastership = main.FALSE |
| 274 | |
| 275 | if switch_mastership == main.TRUE: |
| 276 | main.log.report( "Controller assignment successfull" ) |
| 277 | else: |
| 278 | main.log.report( "Controller assignment failed" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 279 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 280 | main.step( "Balance devices across controllers" ) |
| 281 | balanceResult = main.ONOScli1.balanceMasters() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 282 | # giving some breathing time for ONOS to complete re-balance |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 283 | time.sleep( 5 ) |
| 284 | |
| 285 | case21Result = switch_mastership |
| 286 | time.sleep(30) |
| 287 | utilities.assert_equals( |
| 288 | expect=main.TRUE, |
| 289 | actual=case21Result, |
| 290 | onpass="Starting new Chordal topology test PASS", |
| 291 | onfail="Starting new Chordal topology test FAIL" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 292 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 293 | def CASE22( self, main ): |
| 294 | """ |
| 295 | This test script Loads a new Topology (Spine) on CHO setup and balances all switches |
| 296 | """ |
| 297 | import re |
| 298 | import time |
| 299 | import copy |
| 300 | |
| 301 | main.newTopo = main.params['TOPO3']['topo'] |
| 302 | main.numMNswitches = int ( main.params[ 'TOPO3' ][ 'numSwitches' ] ) |
| 303 | main.numMNlinks = int ( main.params[ 'TOPO3' ][ 'numLinks' ] ) |
| 304 | main.numMNhosts = int ( main.params[ 'TOPO3' ][ 'numHosts' ] ) |
| 305 | main.pingTimeout = 600 |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 306 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 307 | main.log.report( |
| 308 | "Load Spine and Leaf topology and Balance all Mininet switches across controllers" ) |
| 309 | main.log.report( |
| 310 | "________________________________________________________________________" ) |
| 311 | main.case( |
| 312 | "Assign and Balance all Mininet switches across controllers" ) |
| 313 | main.step( "Stop any previous Mininet network topology" ) |
| 314 | stopStatus = main.Mininet1.stopNet(fileName = "topoChordal" ) |
GlennRC | c6cd2a6 | 2015-08-10 16:08:22 -0700 | [diff] [blame] | 315 | |
| 316 | main.step("Start Mininet with Spine topology") |
| 317 | mininetDir = main.Mininet1.home + "/custom/" |
| 318 | topoPath = main.testDir + "/" + main.TEST + "/Dependencies/" + main.newTopo |
| 319 | main.ONOSbench.secureCopy(main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to") |
| 320 | topoPath = mininetDir + main.newTopo |
| 321 | startStatus = main.Mininet1.startNet(topoFile = topoPath) |
| 322 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 323 | time.sleep(60) |
| 324 | main.step( "Assign switches to controllers" ) |
| 325 | |
| 326 | for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 ) |
| 327 | main.Mininet1.assignSwController( |
| 328 | sw="s" + str( i ), |
Hari Krishna | 1006577 | 2015-07-10 15:55:53 -0700 | [diff] [blame] | 329 | ip=main.onosIPs ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 330 | |
| 331 | switch_mastership = main.TRUE |
| 332 | for i in range( 1, ( main.numMNswitches + 1 ) ): |
| 333 | response = main.Mininet1.getSwController( "s" + str( i ) ) |
| 334 | print( "Response is " + str( response ) ) |
| 335 | if re.search( "tcp:" + main.onosIPs[0], response ): |
| 336 | switch_mastership = switch_mastership and main.TRUE |
| 337 | else: |
| 338 | switch_mastership = main.FALSE |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 339 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 340 | if switch_mastership == main.TRUE: |
| 341 | main.log.report( "Controller assignment successfull" ) |
| 342 | else: |
| 343 | main.log.report( "Controller assignment failed" ) |
| 344 | time.sleep( 5 ) |
| 345 | |
| 346 | main.step( "Balance devices across controllers" ) |
| 347 | for i in range( int( main.numCtrls ) ): |
| 348 | balanceResult = main.ONOScli1.balanceMasters() |
| 349 | # giving some breathing time for ONOS to complete re-balance |
| 350 | time.sleep( 3 ) |
| 351 | |
| 352 | case22Result = switch_mastership |
| 353 | time.sleep(60) |
| 354 | utilities.assert_equals( |
| 355 | expect=main.TRUE, |
| 356 | actual=case22Result, |
| 357 | onpass="Starting new Spine topology test PASS", |
| 358 | onfail="Starting new Spine topology test FAIL" ) |
| 359 | |
| 360 | def CASE3( self, main ): |
| 361 | """ |
| 362 | This Test case will be extended to collect and store more data related |
| 363 | ONOS state. |
| 364 | """ |
| 365 | import re |
| 366 | import copy |
| 367 | main.deviceDPIDs = [] |
| 368 | main.hostMACs = [] |
| 369 | main.deviceLinks = [] |
| 370 | main.deviceActiveLinksCount = [] |
| 371 | main.devicePortsEnabledCount = [] |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 372 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 373 | main.log.report( |
| 374 | "Collect and Store topology details from ONOS before running any Tests" ) |
| 375 | main.log.report( |
| 376 | "____________________________________________________________________" ) |
| 377 | main.case( "Collect and Store Topology Details from ONOS" ) |
| 378 | main.step( "Collect and store current number of switches and links" ) |
| 379 | topology_output = main.ONOScli1.topology() |
| 380 | topology_result = main.ONOSbench.getTopology( topology_output ) |
| 381 | numOnosDevices = topology_result[ 'devices' ] |
| 382 | numOnosLinks = topology_result[ 'links' ] |
| 383 | topoResult = main.TRUE |
| 384 | |
| 385 | if ( ( main.numMNswitches == int(numOnosDevices) ) and ( main.numMNlinks == int(numOnosLinks) ) ): |
| 386 | main.step( "Store Device DPIDs" ) |
| 387 | for i in range( 1, (main.numMNswitches+1) ): |
| 388 | main.deviceDPIDs.append( "of:00000000000000" + format( i, '02x' ) ) |
| 389 | print "Device DPIDs in Store: \n", str( main.deviceDPIDs ) |
| 390 | |
| 391 | main.step( "Store Host MACs" ) |
| 392 | for i in range( 1, ( main.numMNhosts + 1 ) ): |
| 393 | main.hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" ) |
| 394 | print "Host MACs in Store: \n", str( main.hostMACs ) |
| 395 | main.MACsDict = {} |
| 396 | print "Creating dictionary of DPID and HostMacs" |
| 397 | for i in range(len(main.hostMACs)): |
| 398 | main.MACsDict[main.deviceDPIDs[i]] = main.hostMACs[i].split('/')[0] |
| 399 | print main.MACsDict |
| 400 | main.step( "Collect and store all Devices Links" ) |
| 401 | linksResult = main.ONOScli1.links( jsonFormat=False ) |
| 402 | ansi_escape = re.compile( r'\x1b[^m]*m' ) |
| 403 | linksResult = ansi_escape.sub( '', linksResult ) |
| 404 | linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" ) |
| 405 | linksResult = linksResult.splitlines() |
| 406 | main.deviceLinks = copy.copy( linksResult ) |
| 407 | print "Device Links Stored: \n", str( main.deviceLinks ) |
| 408 | # this will be asserted to check with the params provided count of |
| 409 | # links |
| 410 | print "Length of Links Store", len( main.deviceLinks ) |
| 411 | |
| 412 | main.step( "Collect and store each Device ports enabled Count" ) |
| 413 | time1 = time.time() |
| 414 | for i in xrange(1,(main.numMNswitches + 1), int( main.numCtrls ) ): |
| 415 | pool = [] |
| 416 | for cli in main.CLIs: |
| 417 | if i >= main.numMNswitches + 1: |
| 418 | break |
| 419 | dpid = "of:00000000000000" + format( i,'02x' ) |
| 420 | t = main.Thread(target = cli.getDevicePortsEnabledCount,threadID = main.threadID, name = "getDevicePortsEnabledCount",args = [dpid]) |
| 421 | t.start() |
| 422 | pool.append(t) |
| 423 | i = i + 1 |
| 424 | main.threadID = main.threadID + 1 |
| 425 | for thread in pool: |
| 426 | thread.join() |
| 427 | portResult = thread.result |
| 428 | main.devicePortsEnabledCount.append( portResult ) |
| 429 | print "Device Enabled Port Counts Stored: \n", str( main.devicePortsEnabledCount ) |
| 430 | time2 = time.time() |
| 431 | main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1)) |
| 432 | |
| 433 | main.step( "Collect and store each Device active links Count" ) |
| 434 | time1 = time.time() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 435 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 436 | for i in xrange( 1,( main.numMNswitches + 1 ), int( main.numCtrls) ): |
| 437 | pool = [] |
| 438 | for cli in main.CLIs: |
| 439 | if i >= main.numMNswitches + 1: |
| 440 | break |
| 441 | dpid = "of:00000000000000" + format( i,'02x' ) |
| 442 | t = main.Thread( target = cli.getDeviceLinksActiveCount, |
| 443 | threadID = main.threadID, |
| 444 | name = "getDevicePortsEnabledCount", |
| 445 | args = [dpid]) |
| 446 | t.start() |
| 447 | pool.append(t) |
| 448 | i = i + 1 |
| 449 | main.threadID = main.threadID + 1 |
| 450 | for thread in pool: |
| 451 | thread.join() |
| 452 | linkCountResult = thread.result |
| 453 | main.deviceActiveLinksCount.append( linkCountResult ) |
| 454 | print "Device Active Links Count Stored: \n", str( main.deviceActiveLinksCount ) |
| 455 | time2 = time.time() |
| 456 | main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1)) |
| 457 | |
| 458 | else: |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 459 | main.log.info("Devices (expected): %s, Links (expected): %s" % |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 460 | ( str( main.numMNswitches ), str( main.numMNlinks ) ) ) |
| 461 | main.log.info("Devices (actual): %s, Links (actual): %s" % |
| 462 | ( numOnosDevices , numOnosLinks ) ) |
| 463 | main.log.info("Topology does not match, exiting CHO test...") |
| 464 | topoResult = main.FALSE |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 465 | # It's better exit here from running the test |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 466 | main.cleanup() |
| 467 | main.exit() |
| 468 | |
| 469 | # just returning TRUE for now as this one just collects data |
| 470 | case3Result = topoResult |
| 471 | utilities.assert_equals( expect=main.TRUE, actual=case3Result, |
| 472 | onpass="Saving ONOS topology data test PASS", |
| 473 | onfail="Saving ONOS topology data test FAIL" ) |
| 474 | |
| 475 | def CASE40( self, main ): |
| 476 | """ |
| 477 | Verify Reactive forwarding (Att Topology) |
| 478 | """ |
| 479 | import re |
| 480 | import copy |
| 481 | import time |
| 482 | main.log.report( "Verify Reactive forwarding (Att Topology)" ) |
| 483 | main.log.report( "______________________________________________" ) |
| 484 | main.case( "Enable Reactive forwarding and Verify ping all" ) |
| 485 | main.step( "Enable Reactive forwarding" ) |
| 486 | installResult = main.TRUE |
| 487 | # Activate fwd app |
| 488 | appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" ) |
| 489 | appCheck = main.TRUE |
| 490 | pool = [] |
| 491 | for cli in main.CLIs: |
| 492 | t = main.Thread( target=cli.appToIDCheck, |
| 493 | name="appToIDCheck-" + str( i ), |
| 494 | args=[] ) |
| 495 | pool.append( t ) |
| 496 | t.start() |
| 497 | for t in pool: |
| 498 | t.join() |
| 499 | appCheck = appCheck and t.result |
| 500 | utilities.assert_equals( expect=main.TRUE, actual=appCheck, |
| 501 | onpass="App Ids seem to be correct", |
| 502 | onfail="Something is wrong with app Ids" ) |
| 503 | if appCheck != main.TRUE: |
| 504 | main.log.warn( main.CLIs[0].apps() ) |
| 505 | main.log.warn( main.CLIs[0].appIDs() ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 506 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 507 | time.sleep( 10 ) |
| 508 | |
| 509 | main.step( "Verify Pingall" ) |
| 510 | ping_result = main.FALSE |
| 511 | time1 = time.time() |
| 512 | ping_result = main.Mininet1.pingall( timeout=main.pingTimeout ) |
GlennRC | f07c44a | 2015-09-18 13:33:46 -0700 | [diff] [blame] | 513 | if not ping_result: |
| 514 | main.log.warn("First pingall failed. Trying again...") |
| 515 | ping_result = main.Mininet1.pingall( timeout=main.pingTimeout) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 516 | time2 = time.time() |
| 517 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 518 | main.log.report( |
| 519 | "Time taken for Ping All: " + |
| 520 | str( timeDiff ) + |
| 521 | " seconds" ) |
| 522 | |
| 523 | if ping_result == main.TRUE: |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 524 | main.log.report( "IPv4 Pingall Test in Reactive mode successful" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 525 | else: |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 526 | main.log.report( "IPv4 Pingall Test in Reactive mode failed" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 527 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 528 | case40Result = appCheck and ping_result |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 529 | utilities.assert_equals( expect=main.TRUE, actual=case40Result, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 530 | onpass="Reactive Mode IPv4 Pingall test PASS", |
| 531 | onfail="Reactive Mode IPv4 Pingall test FAIL" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 532 | |
| 533 | def CASE41( self, main ): |
| 534 | """ |
| 535 | Verify Reactive forwarding (Chordal Topology) |
| 536 | """ |
| 537 | import re |
| 538 | import copy |
| 539 | import time |
| 540 | main.log.report( "Verify Reactive forwarding (Chordal Topology)" ) |
| 541 | main.log.report( "______________________________________________" ) |
| 542 | main.case( "Enable Reactive forwarding and Verify ping all" ) |
| 543 | main.step( "Enable Reactive forwarding" ) |
| 544 | installResult = main.TRUE |
| 545 | # Activate fwd app |
| 546 | appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" ) |
| 547 | |
| 548 | appCheck = main.TRUE |
| 549 | pool = [] |
| 550 | for cli in main.CLIs: |
| 551 | t = main.Thread( target=cli.appToIDCheck, |
| 552 | name="appToIDCheck-" + str( i ), |
| 553 | args=[] ) |
| 554 | pool.append( t ) |
| 555 | t.start() |
| 556 | for t in pool: |
| 557 | t.join() |
| 558 | appCheck = appCheck and t.result |
| 559 | utilities.assert_equals( expect=main.TRUE, actual=appCheck, |
| 560 | onpass="App Ids seem to be correct", |
| 561 | onfail="Something is wrong with app Ids" ) |
| 562 | if appCheck != main.TRUE: |
| 563 | main.log.warn( main.CLIs[0].apps() ) |
| 564 | main.log.warn( main.CLIs[0].appIDs() ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 565 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 566 | time.sleep( 10 ) |
| 567 | |
| 568 | main.step( "Verify Pingall" ) |
| 569 | ping_result = main.FALSE |
| 570 | time1 = time.time() |
| 571 | ping_result = main.Mininet1.pingall( timeout=main.pingTimeout ) |
GlennRC | f07c44a | 2015-09-18 13:33:46 -0700 | [diff] [blame] | 572 | if not ping_result: |
| 573 | main.log.warn("First pingall failed. Trying again...") |
| 574 | ping_result = main.Mininet1.pingall( timeout=main.pingTimeout ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 575 | time2 = time.time() |
| 576 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 577 | main.log.report( |
| 578 | "Time taken for Ping All: " + |
| 579 | str( timeDiff ) + |
| 580 | " seconds" ) |
| 581 | |
| 582 | if ping_result == main.TRUE: |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 583 | main.log.report( "IPv4 Pingall Test in Reactive mode successful" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 584 | else: |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 585 | main.log.report( "IPv4 Pingall Test in Reactive mode failed" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 586 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 587 | case41Result = appCheck and ping_result |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 588 | utilities.assert_equals( expect=main.TRUE, actual=case41Result, |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 589 | onpass="Reactive Mode IPv4 Pingall test PASS", |
| 590 | onfail="Reactive Mode IPv4 Pingall test FAIL" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 591 | |
| 592 | def CASE42( self, main ): |
| 593 | """ |
| 594 | Verify Reactive forwarding (Spine Topology) |
| 595 | """ |
| 596 | import re |
| 597 | import copy |
| 598 | import time |
| 599 | main.log.report( "Verify Reactive forwarding (Spine Topology)" ) |
| 600 | main.log.report( "______________________________________________" ) |
| 601 | main.case( "Enable Reactive forwarding and Verify ping all" ) |
| 602 | main.step( "Enable Reactive forwarding" ) |
| 603 | installResult = main.TRUE |
| 604 | # Activate fwd app |
| 605 | appResults = main.CLIs[0].activateApp( "org.onosproject.fwd" ) |
| 606 | |
| 607 | appCheck = main.TRUE |
| 608 | pool = [] |
| 609 | for cli in main.CLIs: |
| 610 | t = main.Thread( target=cli.appToIDCheck, |
| 611 | name="appToIDCheck-" + str( i ), |
| 612 | args=[] ) |
| 613 | pool.append( t ) |
| 614 | t.start() |
| 615 | for t in pool: |
| 616 | t.join() |
| 617 | appCheck = appCheck and t.result |
| 618 | utilities.assert_equals( expect=main.TRUE, actual=appCheck, |
| 619 | onpass="App Ids seem to be correct", |
| 620 | onfail="Something is wrong with app Ids" ) |
| 621 | if appCheck != main.TRUE: |
| 622 | main.log.warn( main.CLIs[0].apps() ) |
| 623 | main.log.warn( main.CLIs[0].appIDs() ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 624 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 625 | time.sleep( 10 ) |
| 626 | |
| 627 | main.step( "Verify Pingall" ) |
| 628 | ping_result = main.FALSE |
| 629 | time1 = time.time() |
| 630 | ping_result = main.Mininet1.pingall( timeout=main.pingTimeout ) |
GlennRC | f07c44a | 2015-09-18 13:33:46 -0700 | [diff] [blame] | 631 | if not ping_result: |
| 632 | main.log.warn("First pingall failed. Trying again...") |
| 633 | ping_result = main.Mininet1.pingall( timeout=main.pingTimeout ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 634 | time2 = time.time() |
| 635 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 636 | main.log.report( |
| 637 | "Time taken for Ping All: " + |
| 638 | str( timeDiff ) + |
| 639 | " seconds" ) |
| 640 | |
| 641 | if ping_result == main.TRUE: |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 642 | main.log.report( "IPv4 Pingall Test in Reactive mode successful" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 643 | else: |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 644 | main.log.report( "IPv4 Pingall Test in Reactive mode failed" ) |
| 645 | |
| 646 | case42Result = appCheck and ping_result |
| 647 | utilities.assert_equals( expect=main.TRUE, actual=case42Result, |
| 648 | onpass="Reactive Mode IPv4 Pingall test PASS", |
| 649 | onfail="Reactive Mode IPv4 Pingall test FAIL" ) |
| 650 | |
| 651 | def CASE140( self, main ): |
| 652 | """ |
| 653 | Verify IPv6 Reactive forwarding (Att Topology) |
| 654 | """ |
| 655 | import re |
| 656 | import copy |
| 657 | import time |
| 658 | main.log.report( "Verify IPv6 Reactive forwarding (Att Topology)" ) |
| 659 | main.log.report( "______________________________________________" ) |
| 660 | main.case( "Enable IPv6 Reactive forwarding and Verify ping all" ) |
| 661 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 662 | |
| 663 | main.step( "Set IPv6 cfg parameters for Reactive forwarding" ) |
| 664 | cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" ) |
| 665 | cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" ) |
| 666 | cfgResult = cfgResult1 and cfgResult2 |
| 667 | utilities.assert_equals( expect=main.TRUE, actual=cfgResult, |
| 668 | onpass="Reactive mode ipv6Fowarding cfg is set to true", |
| 669 | onfail="Failed to cfg set Reactive mode ipv6Fowarding" ) |
| 670 | |
| 671 | main.step( "Verify IPv6 Pingall" ) |
| 672 | ping_result = main.FALSE |
| 673 | time1 = time.time() |
GlennRC | f07c44a | 2015-09-18 13:33:46 -0700 | [diff] [blame] | 674 | ping_result = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout) |
| 675 | if not ping_result: |
| 676 | main.log.warn("First pingall failed. Trying again..") |
| 677 | ping_result = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 678 | time2 = time.time() |
| 679 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 680 | main.log.report( |
| 681 | "Time taken for IPv6 Ping All: " + |
| 682 | str( timeDiff ) + |
| 683 | " seconds" ) |
| 684 | |
| 685 | if ping_result == main.TRUE: |
| 686 | main.log.report( "IPv6 Pingall Test in Reactive mode successful" ) |
| 687 | else: |
| 688 | main.log.report( "IPv6 Pingall Test in Reactive mode failed" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 689 | |
| 690 | main.step( "Disable Reactive forwarding" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 691 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 692 | main.log.info( "Uninstall reactive forwarding app" ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 693 | appCheck = main.TRUE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 694 | appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" ) |
| 695 | pool = [] |
| 696 | for cli in main.CLIs: |
| 697 | t = main.Thread( target=cli.appToIDCheck, |
| 698 | name="appToIDCheck-" + str( i ), |
| 699 | args=[] ) |
| 700 | pool.append( t ) |
| 701 | t.start() |
| 702 | |
| 703 | for t in pool: |
| 704 | t.join() |
| 705 | appCheck = appCheck and t.result |
| 706 | utilities.assert_equals( expect=main.TRUE, actual=appCheck, |
| 707 | onpass="App Ids seem to be correct", |
| 708 | onfail="Something is wrong with app Ids" ) |
| 709 | if appCheck != main.TRUE: |
| 710 | main.log.warn( main.CLIs[0].apps() ) |
| 711 | main.log.warn( main.CLIs[0].appIDs() ) |
| 712 | |
| 713 | # Waiting for reative flows to be cleared. |
| 714 | time.sleep( 30 ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 715 | case140Result = appCheck and cfgResult and ping_result |
| 716 | utilities.assert_equals( expect=main.TRUE, actual=case140Result, |
| 717 | onpass="Reactive Mode IPv6 Pingall test PASS", |
| 718 | onfail="Reactive Mode IPv6 Pingall test FAIL" ) |
| 719 | |
| 720 | def CASE141( self, main ): |
| 721 | """ |
| 722 | Verify IPv6 Reactive forwarding (Chordal Topology) |
| 723 | """ |
| 724 | import re |
| 725 | import copy |
| 726 | import time |
| 727 | main.log.report( "Verify IPv6 Reactive forwarding (Chordal Topology)" ) |
| 728 | main.log.report( "______________________________________________" ) |
| 729 | main.case( "Enable IPv6 Reactive forwarding and Verify ping all" ) |
| 730 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 731 | |
| 732 | main.step( "Set IPv6 cfg parameters for Reactive forwarding" ) |
| 733 | cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" ) |
| 734 | cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" ) |
| 735 | cfgResult = cfgResult1 and cfgResult2 |
| 736 | utilities.assert_equals( expect=main.TRUE, actual=cfgResult, |
| 737 | onpass="Reactive mode ipv6Fowarding cfg is set to true", |
| 738 | onfail="Failed to cfg set Reactive mode ipv6Fowarding" ) |
| 739 | |
| 740 | main.step( "Verify IPv6 Pingall" ) |
| 741 | ping_result = main.FALSE |
| 742 | time1 = time.time() |
GlennRC | f07c44a | 2015-09-18 13:33:46 -0700 | [diff] [blame] | 743 | ping_result = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout) |
| 744 | if not ping_result: |
| 745 | main.log.warn("First pingall failed. Trying again..") |
| 746 | ping_result = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 747 | time2 = time.time() |
| 748 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 749 | main.log.report( |
| 750 | "Time taken for IPv6 Ping All: " + |
| 751 | str( timeDiff ) + |
| 752 | " seconds" ) |
| 753 | |
| 754 | if ping_result == main.TRUE: |
| 755 | main.log.report( "IPv6 Pingall Test in Reactive mode successful" ) |
| 756 | else: |
| 757 | main.log.report( "IPv6 Pingall Test in Reactive mode failed" ) |
| 758 | |
| 759 | main.step( "Disable Reactive forwarding" ) |
| 760 | |
| 761 | main.log.info( "Uninstall reactive forwarding app" ) |
| 762 | appCheck = main.TRUE |
| 763 | appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" ) |
| 764 | pool = [] |
| 765 | for cli in main.CLIs: |
| 766 | t = main.Thread( target=cli.appToIDCheck, |
| 767 | name="appToIDCheck-" + str( i ), |
| 768 | args=[] ) |
| 769 | pool.append( t ) |
| 770 | t.start() |
| 771 | |
| 772 | for t in pool: |
| 773 | t.join() |
| 774 | appCheck = appCheck and t.result |
| 775 | utilities.assert_equals( expect=main.TRUE, actual=appCheck, |
| 776 | onpass="App Ids seem to be correct", |
| 777 | onfail="Something is wrong with app Ids" ) |
| 778 | if appCheck != main.TRUE: |
| 779 | main.log.warn( main.CLIs[0].apps() ) |
| 780 | main.log.warn( main.CLIs[0].appIDs() ) |
| 781 | |
| 782 | # Waiting for reative flows to be cleared. |
| 783 | time.sleep( 30 ) |
| 784 | case140Result = appCheck and cfgResult and ping_result |
| 785 | utilities.assert_equals( expect=main.TRUE, actual=case140Result, |
| 786 | onpass="Reactive Mode IPv6 Pingall test PASS", |
| 787 | onfail="Reactive Mode IPv6 Pingall test FAIL" ) |
| 788 | |
| 789 | def CASE142( self, main ): |
| 790 | """ |
| 791 | Verify IPv6 Reactive forwarding (Spine Topology) |
| 792 | """ |
| 793 | import re |
| 794 | import copy |
| 795 | import time |
| 796 | main.log.report( "Verify IPv6 Reactive forwarding (Spine Topology)" ) |
| 797 | main.log.report( "______________________________________________" ) |
| 798 | main.case( "Enable IPv6 Reactive forwarding and Verify ping all" ) |
| 799 | # Spine topology do not have hosts h1-h10 |
| 800 | hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ] |
| 801 | main.step( "Set IPv6 cfg parameters for Reactive forwarding" ) |
| 802 | cfgResult1 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" ) |
| 803 | cfgResult2 = main.CLIs[0].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" ) |
| 804 | cfgResult = cfgResult1 and cfgResult2 |
| 805 | utilities.assert_equals( expect=main.TRUE, actual=cfgResult, |
| 806 | onpass="Reactive mode ipv6Fowarding cfg is set to true", |
| 807 | onfail="Failed to cfg set Reactive mode ipv6Fowarding" ) |
| 808 | |
| 809 | main.step( "Verify IPv6 Pingall" ) |
| 810 | ping_result = main.FALSE |
| 811 | time1 = time.time() |
GlennRC | f07c44a | 2015-09-18 13:33:46 -0700 | [diff] [blame] | 812 | ping_result = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout) |
| 813 | if not ping_result: |
| 814 | main.log.warn("First pingall failed. Trying again..") |
| 815 | ping_result = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 816 | time2 = time.time() |
| 817 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 818 | main.log.report( |
| 819 | "Time taken for IPv6 Ping All: " + |
| 820 | str( timeDiff ) + |
| 821 | " seconds" ) |
| 822 | |
| 823 | if ping_result == main.TRUE: |
| 824 | main.log.report( "IPv6 Pingall Test in Reactive mode successful" ) |
| 825 | else: |
| 826 | main.log.report( "IPv6 Pingall Test in Reactive mode failed" ) |
| 827 | |
| 828 | main.step( "Disable Reactive forwarding" ) |
| 829 | |
| 830 | main.log.info( "Uninstall reactive forwarding app" ) |
| 831 | appCheck = main.TRUE |
| 832 | appResults = appResults and main.CLIs[0].deactivateApp( "org.onosproject.fwd" ) |
| 833 | pool = [] |
| 834 | for cli in main.CLIs: |
| 835 | t = main.Thread( target=cli.appToIDCheck, |
| 836 | name="appToIDCheck-" + str( i ), |
| 837 | args=[] ) |
| 838 | pool.append( t ) |
| 839 | t.start() |
| 840 | |
| 841 | for t in pool: |
| 842 | t.join() |
| 843 | appCheck = appCheck and t.result |
| 844 | utilities.assert_equals( expect=main.TRUE, actual=appCheck, |
| 845 | onpass="App Ids seem to be correct", |
| 846 | onfail="Something is wrong with app Ids" ) |
| 847 | if appCheck != main.TRUE: |
| 848 | main.log.warn( main.CLIs[0].apps() ) |
| 849 | main.log.warn( main.CLIs[0].appIDs() ) |
| 850 | |
| 851 | # Waiting for reative flows to be cleared. |
| 852 | time.sleep( 30 ) |
| 853 | case142Result = appCheck and cfgResult and ping_result |
| 854 | utilities.assert_equals( expect=main.TRUE, actual=case142Result, |
| 855 | onpass="Reactive Mode IPv6 Pingall test PASS", |
| 856 | onfail="Reactive Mode IPv6 Pingall test FAIL" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 857 | |
| 858 | def CASE5( self, main ): |
| 859 | """ |
| 860 | Compare current ONOS topology with reference data |
| 861 | """ |
| 862 | import re |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 863 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 864 | devicesDPIDTemp = [] |
| 865 | hostMACsTemp = [] |
| 866 | deviceLinksTemp = [] |
| 867 | deviceActiveLinksCountTemp = [] |
| 868 | devicePortsEnabledCountTemp = [] |
| 869 | |
| 870 | main.log.report( |
| 871 | "Compare ONOS topology with reference data in Stores" ) |
| 872 | main.log.report( "__________________________________________________" ) |
| 873 | main.case( "Compare ONOS topology with reference data" ) |
| 874 | |
| 875 | main.step( "Compare current Device ports enabled with reference" ) |
| 876 | time1 = time.time() |
| 877 | for i in xrange( 1,(main.numMNswitches + 1), int( main.numCtrls ) ): |
| 878 | pool = [] |
| 879 | for cli in main.CLIs: |
| 880 | if i >= main.numMNswitches + 1: |
| 881 | break |
| 882 | dpid = "of:00000000000000" + format( i,'02x' ) |
| 883 | t = main.Thread(target = cli.getDevicePortsEnabledCount, |
| 884 | threadID = main.threadID, |
| 885 | name = "getDevicePortsEnabledCount", |
| 886 | args = [dpid]) |
| 887 | t.start() |
| 888 | pool.append(t) |
| 889 | i = i + 1 |
| 890 | main.threadID = main.threadID + 1 |
| 891 | for thread in pool: |
| 892 | thread.join() |
| 893 | portResult = thread.result |
| 894 | #portTemp = re.split( r'\t+', portResult ) |
| 895 | #portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" ) |
| 896 | devicePortsEnabledCountTemp.append( portResult ) |
| 897 | |
| 898 | time2 = time.time() |
| 899 | main.log.info("Time for counting enabled ports of the switches: %2f seconds" %(time2-time1)) |
| 900 | main.log.info ( |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 901 | "Device Enabled ports EXPECTED: %s" % |
| 902 | str( main.devicePortsEnabledCount ) ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 903 | main.log.info ( |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 904 | "Device Enabled ports ACTUAL: %s" % |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 905 | str( devicePortsEnabledCountTemp ) ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 906 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 907 | if ( cmp( main.devicePortsEnabledCount, |
| 908 | devicePortsEnabledCountTemp ) == 0 ): |
| 909 | stepResult1 = main.TRUE |
| 910 | else: |
| 911 | stepResult1 = main.FALSE |
| 912 | |
| 913 | main.step( "Compare Device active links with reference" ) |
| 914 | time1 = time.time() |
| 915 | for i in xrange( 1, ( main.numMNswitches + 1) , int( main.numCtrls ) ): |
| 916 | pool = [] |
| 917 | for cli in main.CLIs: |
| 918 | if i >= main.numMNswitches + 1: |
| 919 | break |
| 920 | dpid = "of:00000000000000" + format( i,'02x' ) |
| 921 | t = main.Thread(target = cli.getDeviceLinksActiveCount, |
| 922 | threadID = main.threadID, |
| 923 | name = "getDeviceLinksActiveCount", |
| 924 | args = [dpid]) |
| 925 | t.start() |
| 926 | pool.append(t) |
| 927 | i = i + 1 |
| 928 | main.threadID = main.threadID + 1 |
| 929 | for thread in pool: |
| 930 | thread.join() |
| 931 | linkCountResult = thread.result |
| 932 | #linkCountTemp = re.split( r'\t+', linkCountResult ) |
| 933 | #linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" ) |
| 934 | deviceActiveLinksCountTemp.append( linkCountResult ) |
| 935 | |
| 936 | time2 = time.time() |
| 937 | main.log.info("Time for counting all enabled links of the switches: %2f seconds" %(time2-time1)) |
| 938 | main.log.info ( |
| 939 | "Device Active links EXPECTED: %s" % |
| 940 | str( main.deviceActiveLinksCount ) ) |
| 941 | main.log.info ( |
| 942 | "Device Active links ACTUAL: %s" % str( deviceActiveLinksCountTemp ) ) |
| 943 | if ( cmp( main.deviceActiveLinksCount, deviceActiveLinksCountTemp ) == 0 ): |
| 944 | stepResult2 = main.TRUE |
| 945 | else: |
| 946 | stepResult2 = main.FALSE |
| 947 | |
| 948 | """ |
| 949 | place holder for comparing devices, hosts, paths and intents if required. |
| 950 | Links and ports data would be incorrect with out devices anyways. |
| 951 | """ |
| 952 | case5Result = ( stepResult1 and stepResult2 ) |
| 953 | utilities.assert_equals( expect=main.TRUE, actual=case5Result, |
| 954 | onpass="Compare Topology test PASS", |
| 955 | onfail="Compare Topology test FAIL" ) |
| 956 | |
| 957 | def CASE60( self ): |
| 958 | """ |
| 959 | Install 300 host intents and verify ping all (Att Topology) |
| 960 | """ |
| 961 | main.log.report( "Add 300 host intents and verify pingall (Att Topology)" ) |
| 962 | main.log.report( "_______________________________________" ) |
| 963 | import itertools |
| 964 | import time |
| 965 | main.case( "Install 300 host intents" ) |
| 966 | main.step( "Add host Intents" ) |
| 967 | intentResult = main.TRUE |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 968 | hostCombos = list( itertools.combinations( main.hostMACs, 2 ) ) |
| 969 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 970 | intentIdList = [] |
| 971 | time1 = time.time() |
| 972 | for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ): |
| 973 | pool = [] |
| 974 | for cli in main.CLIs: |
| 975 | if i >= len( hostCombos ): |
| 976 | break |
| 977 | t = main.Thread( target=cli.addHostIntent, |
| 978 | threadID=main.threadID, |
| 979 | name="addHostIntent", |
| 980 | args=[hostCombos[i][0],hostCombos[i][1]]) |
| 981 | pool.append(t) |
| 982 | t.start() |
| 983 | i = i + 1 |
| 984 | main.threadID = main.threadID + 1 |
| 985 | for thread in pool: |
| 986 | thread.join() |
| 987 | intentIdList.append(thread.result) |
| 988 | time2 = time.time() |
| 989 | main.log.info("Time for adding host intents: %2f seconds" %(time2-time1)) |
| 990 | |
| 991 | intentResult = main.TRUE |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 992 | intentsJson = main.ONOScli1.intents() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 993 | getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList, |
| 994 | intentsJson = intentsJson) |
| 995 | print "len of intent ID", str(len(intentIdList)) |
| 996 | print "len of intent state results", str(len(getIntentStateResult)) |
| 997 | print getIntentStateResult |
| 998 | # Takes awhile for all the onos to get the intents |
| 999 | time.sleep( 30 ) |
| 1000 | """intentState = main.TRUE |
| 1001 | for i in getIntentStateResult: |
| 1002 | if getIntentStateResult.get( 'state' ) != 'INSTALLED': |
| 1003 | """ |
| 1004 | |
| 1005 | |
| 1006 | main.step( "Verify Ping across all hosts" ) |
| 1007 | pingResult = main.FALSE |
| 1008 | time1 = time.time() |
| 1009 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 1010 | time2 = time.time() |
| 1011 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1012 | main.log.report( |
| 1013 | "Time taken for Ping All: " + |
| 1014 | str( timeDiff ) + |
| 1015 | " seconds" ) |
| 1016 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 1017 | onpass="PING ALL PASS", |
| 1018 | onfail="PING ALL FAIL" ) |
| 1019 | |
| 1020 | case60Result = ( intentResult and pingResult ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1021 | utilities.assert_equals( |
| 1022 | expect=main.TRUE, |
| 1023 | actual=case60Result, |
| 1024 | onpass="Install 300 Host Intents and Ping All test PASS", |
| 1025 | onfail="Install 300 Host Intents and Ping All test FAIL" ) |
| 1026 | |
| 1027 | def CASE61( self ): |
| 1028 | """ |
| 1029 | Install 600 host intents and verify ping all for Chordal Topology |
| 1030 | """ |
| 1031 | main.log.report( "Add 600 host intents and verify pingall (Chordal Topo)" ) |
| 1032 | main.log.report( "_______________________________________" ) |
| 1033 | import itertools |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1034 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1035 | main.case( "Install 600 host intents" ) |
| 1036 | main.step( "Add host Intents" ) |
| 1037 | intentResult = main.TRUE |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1038 | hostCombos = list( itertools.combinations( main.hostMACs, 2 ) ) |
| 1039 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1040 | intentIdList = [] |
| 1041 | time1 = time.time() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1042 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1043 | for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ): |
| 1044 | pool = [] |
| 1045 | for cli in main.CLIs: |
| 1046 | if i >= len( hostCombos ): |
| 1047 | break |
| 1048 | t = main.Thread( target=cli.addHostIntent, |
| 1049 | threadID=main.threadID, |
| 1050 | name="addHostIntent", |
| 1051 | args=[hostCombos[i][0],hostCombos[i][1]]) |
| 1052 | pool.append(t) |
| 1053 | t.start() |
| 1054 | i = i + 1 |
| 1055 | main.threadID = main.threadID + 1 |
| 1056 | for thread in pool: |
| 1057 | thread.join() |
| 1058 | intentIdList.append(thread.result) |
| 1059 | time2 = time.time() |
| 1060 | main.log.info("Time for adding host intents: %2f seconds" %(time2-time1)) |
| 1061 | intentResult = main.TRUE |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1062 | intentsJson = main.ONOScli1.intents() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1063 | getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList, |
| 1064 | intentsJson = intentsJson) |
| 1065 | print getIntentStateResult |
| 1066 | |
| 1067 | main.step( "Verify Ping across all hosts" ) |
| 1068 | pingResult = main.FALSE |
| 1069 | time1 = time.time() |
| 1070 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 1071 | time2 = time.time() |
| 1072 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1073 | main.log.report( |
| 1074 | "Time taken for Ping All: " + |
| 1075 | str( timeDiff ) + |
| 1076 | " seconds" ) |
| 1077 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 1078 | onpass="PING ALL PASS", |
| 1079 | onfail="PING ALL FAIL" ) |
| 1080 | |
| 1081 | case14Result = ( intentResult and pingResult ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1082 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1083 | utilities.assert_equals( |
| 1084 | expect=main.TRUE, |
| 1085 | actual=case14Result, |
| 1086 | onpass="Install 300 Host Intents and Ping All test PASS", |
| 1087 | onfail="Install 300 Host Intents and Ping All test FAIL" ) |
| 1088 | |
| 1089 | def CASE62( self ): |
| 1090 | """ |
| 1091 | Install 2278 host intents and verify ping all for Spine Topology |
| 1092 | """ |
| 1093 | main.log.report( "Add 2278 host intents and verify pingall (Spine Topo)" ) |
| 1094 | main.log.report( "_______________________________________" ) |
| 1095 | import itertools |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1096 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1097 | main.case( "Install 2278 host intents" ) |
| 1098 | main.step( "Add host Intents" ) |
| 1099 | intentResult = main.TRUE |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1100 | hostCombos = list( itertools.combinations( main.hostMACs, 2 ) ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1101 | main.pingTimeout = 300 |
| 1102 | intentIdList = [] |
| 1103 | time1 = time.time() |
| 1104 | for i in xrange( 0, len( hostCombos ), int(main.numCtrls) ): |
| 1105 | pool = [] |
| 1106 | for cli in main.CLIs: |
| 1107 | if i >= len( hostCombos ): |
| 1108 | break |
| 1109 | t = main.Thread( target=cli.addHostIntent, |
| 1110 | threadID=main.threadID, |
| 1111 | name="addHostIntent", |
| 1112 | args=[hostCombos[i][0],hostCombos[i][1]]) |
| 1113 | pool.append(t) |
| 1114 | t.start() |
| 1115 | i = i + 1 |
| 1116 | main.threadID = main.threadID + 1 |
| 1117 | for thread in pool: |
| 1118 | thread.join() |
| 1119 | intentIdList.append(thread.result) |
| 1120 | time2 = time.time() |
| 1121 | main.log.info("Time for adding host intents: %2f seconds" %(time2-time1)) |
| 1122 | intentResult = main.TRUE |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1123 | intentsJson = main.ONOScli1.intents() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1124 | getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList, |
| 1125 | intentsJson = intentsJson) |
| 1126 | print getIntentStateResult |
| 1127 | |
| 1128 | main.step( "Verify Ping across all hosts" ) |
| 1129 | pingResult = main.FALSE |
| 1130 | time1 = time.time() |
| 1131 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 1132 | time2 = time.time() |
| 1133 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1134 | main.log.report( |
| 1135 | "Time taken for Ping All: " + |
| 1136 | str( timeDiff ) + |
| 1137 | " seconds" ) |
| 1138 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 1139 | onpass="PING ALL PASS", |
| 1140 | onfail="PING ALL FAIL" ) |
| 1141 | |
| 1142 | case15Result = ( intentResult and pingResult ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1143 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1144 | utilities.assert_equals( |
| 1145 | expect=main.TRUE, |
| 1146 | actual=case15Result, |
| 1147 | onpass="Install 2278 Host Intents and Ping All test PASS", |
| 1148 | onfail="Install 2278 Host Intents and Ping All test FAIL" ) |
| 1149 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 1150 | def CASE160( self ): |
| 1151 | """ |
| 1152 | Verify IPv6 ping across 300 host intents (Att Topology) |
| 1153 | """ |
| 1154 | main.log.report( "Verify IPv6 ping across 300 host intents (Att Topology)" ) |
| 1155 | main.log.report( "_________________________________________________" ) |
| 1156 | import itertools |
| 1157 | import time |
| 1158 | main.case( "IPv6 ping all 300 host intents" ) |
| 1159 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 1160 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 1161 | pingResult = main.FALSE |
| 1162 | time1 = time.time() |
| 1163 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
| 1164 | time2 = time.time() |
| 1165 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1166 | main.log.report( |
| 1167 | "Time taken for IPv6 Ping All: " + |
| 1168 | str( timeDiff ) + |
| 1169 | " seconds" ) |
| 1170 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 1171 | onpass="PING ALL PASS", |
| 1172 | onfail="PING ALL FAIL" ) |
| 1173 | |
| 1174 | case160Result = pingResult |
| 1175 | utilities.assert_equals( |
| 1176 | expect=main.TRUE, |
| 1177 | actual=case160Result, |
| 1178 | onpass="IPv6 Ping across 300 host intents test PASS", |
| 1179 | onfail="IPv6 Ping across 300 host intents test FAIL" ) |
| 1180 | |
| 1181 | def CASE161( self ): |
| 1182 | """ |
| 1183 | Verify IPv6 ping across 600 host intents (Chordal Topology) |
| 1184 | """ |
| 1185 | main.log.report( "Verify IPv6 ping across 600 host intents (Chordal Topology)" ) |
| 1186 | main.log.report( "_________________________________________________" ) |
| 1187 | import itertools |
| 1188 | import time |
| 1189 | main.case( "IPv6 ping all 600 host intents" ) |
| 1190 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 1191 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 1192 | pingResult = main.FALSE |
| 1193 | time1 = time.time() |
| 1194 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
| 1195 | time2 = time.time() |
| 1196 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1197 | main.log.report( |
| 1198 | "Time taken for IPv6 Ping All: " + |
| 1199 | str( timeDiff ) + |
| 1200 | " seconds" ) |
| 1201 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 1202 | onpass="PING ALL PASS", |
| 1203 | onfail="PING ALL FAIL" ) |
| 1204 | |
| 1205 | case161Result = pingResult |
| 1206 | utilities.assert_equals( |
| 1207 | expect=main.TRUE, |
| 1208 | actual=case161Result, |
| 1209 | onpass="IPv6 Ping across 600 host intents test PASS", |
| 1210 | onfail="IPv6 Ping across 600 host intents test FAIL" ) |
| 1211 | |
| 1212 | def CASE162( self ): |
| 1213 | """ |
| 1214 | Verify IPv6 ping across 2278 host intents (Spine Topology) |
| 1215 | """ |
| 1216 | main.log.report( "Verify IPv6 ping across 2278 host intents (Spine Topology)" ) |
| 1217 | main.log.report( "_________________________________________________" ) |
| 1218 | import itertools |
| 1219 | import time |
| 1220 | main.case( "IPv6 ping all 600 host intents" ) |
| 1221 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 1222 | hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ] |
| 1223 | pingResult = main.FALSE |
| 1224 | time1 = time.time() |
| 1225 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
| 1226 | time2 = time.time() |
| 1227 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1228 | main.log.report( |
| 1229 | "Time taken for IPv6 Ping All: " + |
| 1230 | str( timeDiff ) + |
| 1231 | " seconds" ) |
| 1232 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 1233 | onpass="PING ALL PASS", |
| 1234 | onfail="PING ALL FAIL" ) |
| 1235 | |
| 1236 | case162Result = pingResult |
| 1237 | utilities.assert_equals( |
| 1238 | expect=main.TRUE, |
| 1239 | actual=case162Result, |
| 1240 | onpass="IPv6 Ping across 600 host intents test PASS", |
| 1241 | onfail="IPv6 Ping across 600 host intents test FAIL" ) |
| 1242 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1243 | def CASE70( self, main ): |
| 1244 | """ |
| 1245 | Randomly bring some core links down and verify ping all ( Host Intents-Att Topo) |
| 1246 | """ |
| 1247 | import random |
| 1248 | main.randomLink1 = [] |
| 1249 | main.randomLink2 = [] |
| 1250 | main.randomLink3 = [] |
| 1251 | link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ] |
| 1252 | link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' ) |
| 1253 | link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ] |
| 1254 | link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' ) |
| 1255 | link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ] |
| 1256 | link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' ) |
| 1257 | switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ] |
| 1258 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 1259 | |
| 1260 | main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" ) |
| 1261 | main.log.report( "___________________________________________________________________________" ) |
| 1262 | main.case( "Host intents - Randomly bring some core links down and verify ping all" ) |
| 1263 | main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" ) |
| 1264 | if ( int( switchLinksToToggle ) == |
| 1265 | 0 or int( switchLinksToToggle ) > 5 ): |
| 1266 | main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" ) |
| 1267 | #main.cleanup() |
| 1268 | #main.exit() |
| 1269 | else: |
| 1270 | main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" ) |
| 1271 | |
| 1272 | main.step( "Cut links on Core devices using user provided range" ) |
| 1273 | main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) ) |
| 1274 | main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) ) |
| 1275 | main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) ) |
| 1276 | for i in range( int( switchLinksToToggle ) ): |
| 1277 | main.Mininet1.link( |
| 1278 | END1=link1End1, |
| 1279 | END2=main.randomLink1[ i ], |
| 1280 | OPTION="down" ) |
| 1281 | time.sleep( link_sleep ) |
| 1282 | main.Mininet1.link( |
| 1283 | END1=link2End1, |
| 1284 | END2=main.randomLink2[ i ], |
| 1285 | OPTION="down" ) |
| 1286 | time.sleep( link_sleep ) |
| 1287 | main.Mininet1.link( |
| 1288 | END1=link3End1, |
| 1289 | END2=main.randomLink3[ i ], |
| 1290 | OPTION="down" ) |
| 1291 | time.sleep( link_sleep ) |
| 1292 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1293 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1294 | linkDown = main.ONOSbench.checkStatus( |
| 1295 | topology_output, main.numMNswitches, str( |
| 1296 | int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) ) |
| 1297 | utilities.assert_equals( |
| 1298 | expect=main.TRUE, |
| 1299 | actual=linkDown, |
| 1300 | onpass="Link Down discovered properly", |
| 1301 | onfail="Link down was not discovered in " + |
| 1302 | str( link_sleep ) + |
| 1303 | " seconds" ) |
| 1304 | |
| 1305 | main.step( "Verify Ping across all hosts" ) |
| 1306 | pingResultLinkDown = main.FALSE |
| 1307 | time1 = time.time() |
| 1308 | pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout ) |
| 1309 | time2 = time.time() |
| 1310 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1311 | main.log.report( |
| 1312 | "Time taken for Ping All: " + |
| 1313 | str( timeDiff ) + |
| 1314 | " seconds" ) |
| 1315 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown, |
| 1316 | onpass="PING ALL PASS", |
| 1317 | onfail="PING ALL FAIL" ) |
| 1318 | |
| 1319 | caseResult70 = linkDown and pingResultLinkDown |
| 1320 | utilities.assert_equals( expect=main.TRUE, actual=caseResult70, |
| 1321 | onpass="Random Link cut Test PASS", |
| 1322 | onfail="Random Link cut Test FAIL" ) |
| 1323 | |
| 1324 | def CASE80( self, main ): |
| 1325 | """ |
| 1326 | Bring the core links up that are down and verify ping all ( Host Intents-Att Topo ) |
| 1327 | """ |
| 1328 | import random |
| 1329 | link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ] |
| 1330 | link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ] |
| 1331 | link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ] |
| 1332 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 1333 | switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ] |
| 1334 | |
| 1335 | main.log.report( |
| 1336 | "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" ) |
| 1337 | main.log.report( |
| 1338 | "__________________________________________________________________" ) |
| 1339 | main.case( |
| 1340 | "Host intents - Bring the core links up that are down and verify ping all" ) |
| 1341 | main.step( "Bring randomly cut links on Core devices up" ) |
| 1342 | for i in range( int( switchLinksToToggle ) ): |
| 1343 | main.Mininet1.link( |
| 1344 | END1=link1End1, |
| 1345 | END2=main.randomLink1[ i ], |
| 1346 | OPTION="up" ) |
| 1347 | time.sleep( link_sleep ) |
| 1348 | main.Mininet1.link( |
| 1349 | END1=link2End1, |
| 1350 | END2=main.randomLink2[ i ], |
| 1351 | OPTION="up" ) |
| 1352 | time.sleep( link_sleep ) |
| 1353 | main.Mininet1.link( |
| 1354 | END1=link3End1, |
| 1355 | END2=main.randomLink3[ i ], |
| 1356 | OPTION="up" ) |
| 1357 | time.sleep( link_sleep ) |
| 1358 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1359 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1360 | linkUp = main.ONOSbench.checkStatus( |
| 1361 | topology_output, |
| 1362 | main.numMNswitches, |
| 1363 | str( main.numMNlinks ) ) |
| 1364 | utilities.assert_equals( |
| 1365 | expect=main.TRUE, |
| 1366 | actual=linkUp, |
| 1367 | onpass="Link up discovered properly", |
| 1368 | onfail="Link up was not discovered in " + |
| 1369 | str( link_sleep ) + |
| 1370 | " seconds" ) |
| 1371 | |
| 1372 | main.step( "Verify Ping across all hosts" ) |
| 1373 | pingResultLinkUp = main.FALSE |
| 1374 | time1 = time.time() |
| 1375 | pingResultLinkUp = main.Mininet1.pingall( timeout=main.pingTimeout ) |
| 1376 | time2 = time.time() |
| 1377 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1378 | main.log.report( |
| 1379 | "Time taken for Ping All: " + |
| 1380 | str( timeDiff ) + |
| 1381 | " seconds" ) |
| 1382 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp, |
| 1383 | onpass="PING ALL PASS", |
| 1384 | onfail="PING ALL FAIL" ) |
| 1385 | |
| 1386 | caseResult80 = linkUp and pingResultLinkUp |
| 1387 | utilities.assert_equals( expect=main.TRUE, actual=caseResult80, |
| 1388 | onpass="Link Up Test PASS", |
| 1389 | onfail="Link Up Test FAIL" ) |
| 1390 | |
| 1391 | def CASE71( self, main ): |
| 1392 | """ |
| 1393 | Randomly bring some core links down and verify ping all ( Point Intents-Att Topo) |
| 1394 | """ |
| 1395 | import random |
| 1396 | main.randomLink1 = [] |
| 1397 | main.randomLink2 = [] |
| 1398 | main.randomLink3 = [] |
| 1399 | link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ] |
| 1400 | link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' ) |
| 1401 | link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ] |
| 1402 | link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' ) |
| 1403 | link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ] |
| 1404 | link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' ) |
| 1405 | switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ] |
| 1406 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 1407 | |
| 1408 | main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" ) |
| 1409 | main.log.report( "___________________________________________________________________________" ) |
| 1410 | main.case( "Point intents - Randomly bring some core links down and verify ping all" ) |
| 1411 | main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" ) |
| 1412 | if ( int( switchLinksToToggle ) == |
| 1413 | 0 or int( switchLinksToToggle ) > 5 ): |
| 1414 | main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" ) |
| 1415 | #main.cleanup() |
| 1416 | #main.exit() |
| 1417 | else: |
| 1418 | main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" ) |
| 1419 | |
| 1420 | main.step( "Cut links on Core devices using user provided range" ) |
| 1421 | main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) ) |
| 1422 | main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) ) |
| 1423 | main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) ) |
| 1424 | for i in range( int( switchLinksToToggle ) ): |
| 1425 | main.Mininet1.link( |
| 1426 | END1=link1End1, |
| 1427 | END2=main.randomLink1[ i ], |
| 1428 | OPTION="down" ) |
| 1429 | time.sleep( link_sleep ) |
| 1430 | main.Mininet1.link( |
| 1431 | END1=link2End1, |
| 1432 | END2=main.randomLink2[ i ], |
| 1433 | OPTION="down" ) |
| 1434 | time.sleep( link_sleep ) |
| 1435 | main.Mininet1.link( |
| 1436 | END1=link3End1, |
| 1437 | END2=main.randomLink3[ i ], |
| 1438 | OPTION="down" ) |
| 1439 | time.sleep( link_sleep ) |
| 1440 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1441 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1442 | linkDown = main.ONOSbench.checkStatus( |
| 1443 | topology_output, main.numMNswitches, str( |
| 1444 | int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) ) |
| 1445 | utilities.assert_equals( |
| 1446 | expect=main.TRUE, |
| 1447 | actual=linkDown, |
| 1448 | onpass="Link Down discovered properly", |
| 1449 | onfail="Link down was not discovered in " + |
| 1450 | str( link_sleep ) + |
| 1451 | " seconds" ) |
| 1452 | |
| 1453 | main.step( "Verify Ping across all hosts" ) |
| 1454 | pingResultLinkDown = main.FALSE |
| 1455 | time1 = time.time() |
| 1456 | pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout) |
| 1457 | time2 = time.time() |
| 1458 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1459 | main.log.report( |
| 1460 | "Time taken for Ping All: " + |
| 1461 | str( timeDiff ) + |
| 1462 | " seconds" ) |
| 1463 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown, |
| 1464 | onpass="PING ALL PASS", |
| 1465 | onfail="PING ALL FAIL" ) |
| 1466 | |
| 1467 | caseResult71 = linkDown and pingResultLinkDown |
| 1468 | utilities.assert_equals( expect=main.TRUE, actual=caseResult71, |
| 1469 | onpass="Random Link cut Test PASS", |
| 1470 | onfail="Random Link cut Test FAIL" ) |
| 1471 | |
| 1472 | def CASE81( self, main ): |
| 1473 | """ |
| 1474 | Bring the core links up that are down and verify ping all ( Point Intents-Att Topo ) |
| 1475 | """ |
| 1476 | import random |
| 1477 | link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ] |
| 1478 | link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ] |
| 1479 | link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ] |
| 1480 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 1481 | switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ] |
| 1482 | |
| 1483 | main.log.report( |
| 1484 | "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" ) |
| 1485 | main.log.report( |
| 1486 | "__________________________________________________________________" ) |
| 1487 | main.case( |
| 1488 | "Point intents - Bring the core links up that are down and verify ping all" ) |
| 1489 | main.step( "Bring randomly cut links on Core devices up" ) |
| 1490 | for i in range( int( switchLinksToToggle ) ): |
| 1491 | main.Mininet1.link( |
| 1492 | END1=link1End1, |
| 1493 | END2=main.randomLink1[ i ], |
| 1494 | OPTION="up" ) |
| 1495 | time.sleep( link_sleep ) |
| 1496 | main.Mininet1.link( |
| 1497 | END1=link2End1, |
| 1498 | END2=main.randomLink2[ i ], |
| 1499 | OPTION="up" ) |
| 1500 | time.sleep( link_sleep ) |
| 1501 | main.Mininet1.link( |
| 1502 | END1=link3End1, |
| 1503 | END2=main.randomLink3[ i ], |
| 1504 | OPTION="up" ) |
| 1505 | time.sleep( link_sleep ) |
| 1506 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1507 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1508 | linkUp = main.ONOSbench.checkStatus( |
| 1509 | topology_output, |
| 1510 | main.numMNswitches, |
| 1511 | str( main.numMNlinks ) ) |
| 1512 | utilities.assert_equals( |
| 1513 | expect=main.TRUE, |
| 1514 | actual=linkUp, |
| 1515 | onpass="Link up discovered properly", |
| 1516 | onfail="Link up was not discovered in " + |
| 1517 | str( link_sleep ) + |
| 1518 | " seconds" ) |
| 1519 | |
| 1520 | main.step( "Verify Ping across all hosts" ) |
| 1521 | pingResultLinkUp = main.FALSE |
| 1522 | time1 = time.time() |
| 1523 | pingResultLinkUp = main.Mininet1.pingall(timeout = main.pingTimeout ) |
| 1524 | time2 = time.time() |
| 1525 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1526 | main.log.report( |
| 1527 | "Time taken for Ping All: " + |
| 1528 | str( timeDiff ) + |
| 1529 | " seconds" ) |
| 1530 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp, |
| 1531 | onpass="PING ALL PASS", |
| 1532 | onfail="PING ALL FAIL" ) |
| 1533 | |
| 1534 | caseResult81 = linkUp and pingResultLinkUp |
| 1535 | utilities.assert_equals( expect=main.TRUE, actual=caseResult81, |
| 1536 | onpass="Link Up Test PASS", |
| 1537 | onfail="Link Up Test FAIL" ) |
| 1538 | |
| 1539 | def CASE72( self, main ): |
| 1540 | """ |
| 1541 | Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo) |
| 1542 | """ |
| 1543 | import random |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1544 | import itertools |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1545 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1546 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1547 | main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" ) |
| 1548 | main.log.report( "___________________________________________________________________________" ) |
| 1549 | main.case( "Host intents - Randomly bring some core links down and verify ping all" ) |
| 1550 | switches = [] |
| 1551 | switchesComb = [] |
| 1552 | for i in range( main.numMNswitches ): |
| 1553 | switches.append('s%d'%(i+1)) |
| 1554 | switchesLinksComb = list(itertools.combinations(switches,2)) |
| 1555 | main.randomLinks = random.sample(switchesLinksComb, 5 ) |
| 1556 | print main.randomLinks |
| 1557 | main.step( "Cut links on random devices" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1558 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1559 | for switch in main.randomLinks: |
| 1560 | main.Mininet1.link( |
| 1561 | END1=switch[0], |
| 1562 | END2=switch[1], |
| 1563 | OPTION="down") |
| 1564 | time.sleep( link_sleep ) |
| 1565 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1566 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1567 | linkDown = main.ONOSbench.checkStatus( |
| 1568 | topology_output, main.numMNswitches, str( |
| 1569 | int( main.numMNlinks ) - 5 * 2 ) ) |
| 1570 | utilities.assert_equals( |
| 1571 | expect=main.TRUE, |
| 1572 | actual=linkDown, |
| 1573 | onpass="Link Down discovered properly", |
| 1574 | onfail="Link down was not discovered in " + |
| 1575 | str( link_sleep ) + |
| 1576 | " seconds" ) |
| 1577 | |
| 1578 | main.step( "Verify Ping across all hosts" ) |
| 1579 | pingResultLinkDown = main.FALSE |
| 1580 | time1 = time.time() |
| 1581 | pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 1582 | time2 = time.time() |
| 1583 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1584 | main.log.report( |
| 1585 | "Time taken for Ping All: " + |
| 1586 | str( timeDiff ) + |
| 1587 | " seconds" ) |
| 1588 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown, |
| 1589 | onpass="PING ALL PASS", |
| 1590 | onfail="PING ALL FAIL" ) |
| 1591 | |
| 1592 | caseResult71 = pingResultLinkDown |
| 1593 | utilities.assert_equals( expect=main.TRUE, actual=caseResult71, |
| 1594 | onpass="Random Link cut Test PASS", |
| 1595 | onfail="Random Link cut Test FAIL" ) |
| 1596 | |
| 1597 | def CASE82( self, main ): |
| 1598 | """ |
| 1599 | Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo ) |
| 1600 | """ |
| 1601 | import random |
| 1602 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1603 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1604 | main.log.report( |
| 1605 | "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" ) |
| 1606 | main.log.report( |
| 1607 | "__________________________________________________________________" ) |
| 1608 | main.case( |
| 1609 | "Host intents - Bring the core links up that are down and verify ping all" ) |
| 1610 | main.step( "Bring randomly cut links on devices up" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1611 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1612 | for switch in main.randomLinks: |
| 1613 | main.Mininet1.link( |
| 1614 | END1=switch[0], |
| 1615 | END2=switch[1], |
| 1616 | OPTION="up") |
| 1617 | time.sleep( link_sleep ) |
| 1618 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1619 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1620 | linkUp = main.ONOSbench.checkStatus( |
| 1621 | topology_output, |
| 1622 | main.numMNswitches, |
| 1623 | str( main.numMNlinks ) ) |
| 1624 | utilities.assert_equals( |
| 1625 | expect=main.TRUE, |
| 1626 | actual=linkUp, |
| 1627 | onpass="Link up discovered properly", |
| 1628 | onfail="Link up was not discovered in " + |
| 1629 | str( link_sleep ) + |
| 1630 | " seconds" ) |
| 1631 | |
| 1632 | main.step( "Verify Ping across all hosts" ) |
| 1633 | pingResultLinkUp = main.FALSE |
| 1634 | time1 = time.time() |
| 1635 | pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 1636 | time2 = time.time() |
| 1637 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1638 | main.log.report( |
| 1639 | "Time taken for Ping All: " + |
| 1640 | str( timeDiff ) + |
| 1641 | " seconds" ) |
| 1642 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp, |
| 1643 | onpass="PING ALL PASS", |
| 1644 | onfail="PING ALL FAIL" ) |
| 1645 | |
| 1646 | caseResult82 = linkUp and pingResultLinkUp |
| 1647 | utilities.assert_equals( expect=main.TRUE, actual=caseResult82, |
| 1648 | onpass="Link Up Test PASS", |
| 1649 | onfail="Link Up Test FAIL" ) |
| 1650 | |
| 1651 | def CASE73( self, main ): |
| 1652 | """ |
| 1653 | Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo) |
| 1654 | """ |
| 1655 | import random |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1656 | import itertools |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1657 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1658 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1659 | main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" ) |
| 1660 | main.log.report( "___________________________________________________________________________" ) |
| 1661 | main.case( "Point intents - Randomly bring some core links down and verify ping all" ) |
| 1662 | switches = [] |
| 1663 | switchesComb = [] |
| 1664 | for i in range( main.numMNswitches ): |
| 1665 | switches.append('s%d'%(i+1)) |
| 1666 | switchesLinksComb = list(itertools.combinations(switches,2)) |
| 1667 | main.randomLinks = random.sample(switchesLinksComb, 5 ) |
| 1668 | print main.randomLinks |
| 1669 | main.step( "Cut links on random devices" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1670 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1671 | for switch in main.randomLinks: |
| 1672 | main.Mininet1.link( |
| 1673 | END1=switch[0], |
| 1674 | END2=switch[1], |
| 1675 | OPTION="down") |
| 1676 | time.sleep( link_sleep ) |
| 1677 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1678 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1679 | linkDown = main.ONOSbench.checkStatus( |
| 1680 | topology_output, main.numMNswitches, str( |
| 1681 | int( main.numMNlinks ) - 5 * 2 ) ) |
| 1682 | utilities.assert_equals( |
| 1683 | expect=main.TRUE, |
| 1684 | actual=linkDown, |
| 1685 | onpass="Link Down discovered properly", |
| 1686 | onfail="Link down was not discovered in " + |
| 1687 | str( link_sleep ) + |
| 1688 | " seconds" ) |
| 1689 | |
| 1690 | main.step( "Verify Ping across all hosts" ) |
| 1691 | pingResultLinkDown = main.FALSE |
| 1692 | time1 = time.time() |
| 1693 | pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 1694 | time2 = time.time() |
| 1695 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1696 | main.log.report( |
| 1697 | "Time taken for Ping All: " + |
| 1698 | str( timeDiff ) + |
| 1699 | " seconds" ) |
| 1700 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown, |
| 1701 | onpass="PING ALL PASS", |
| 1702 | onfail="PING ALL FAIL" ) |
| 1703 | |
| 1704 | caseResult73 = pingResultLinkDown |
| 1705 | utilities.assert_equals( expect=main.TRUE, actual=caseResult73, |
| 1706 | onpass="Random Link cut Test PASS", |
| 1707 | onfail="Random Link cut Test FAIL" ) |
| 1708 | |
| 1709 | def CASE83( self, main ): |
| 1710 | """ |
| 1711 | Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo ) |
| 1712 | """ |
| 1713 | import random |
| 1714 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1715 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1716 | main.log.report( |
| 1717 | "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" ) |
| 1718 | main.log.report( |
| 1719 | "__________________________________________________________________" ) |
| 1720 | main.case( |
| 1721 | "Point intents - Bring the core links up that are down and verify ping all" ) |
| 1722 | main.step( "Bring randomly cut links on devices up" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1723 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1724 | for switch in main.randomLinks: |
| 1725 | main.Mininet1.link( |
| 1726 | END1=switch[0], |
| 1727 | END2=switch[1], |
| 1728 | OPTION="up") |
| 1729 | time.sleep( link_sleep ) |
| 1730 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1731 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1732 | linkUp = main.ONOSbench.checkStatus( |
| 1733 | topology_output, |
| 1734 | main.numMNswitches, |
| 1735 | str( main.numMNlinks ) ) |
| 1736 | utilities.assert_equals( |
| 1737 | expect=main.TRUE, |
| 1738 | actual=linkUp, |
| 1739 | onpass="Link up discovered properly", |
| 1740 | onfail="Link up was not discovered in " + |
| 1741 | str( link_sleep ) + |
| 1742 | " seconds" ) |
| 1743 | |
| 1744 | main.step( "Verify Ping across all hosts" ) |
| 1745 | pingResultLinkUp = main.FALSE |
| 1746 | time1 = time.time() |
| 1747 | pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 1748 | time2 = time.time() |
| 1749 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1750 | main.log.report( |
| 1751 | "Time taken for Ping All: " + |
| 1752 | str( timeDiff ) + |
| 1753 | " seconds" ) |
| 1754 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp, |
| 1755 | onpass="PING ALL PASS", |
| 1756 | onfail="PING ALL FAIL" ) |
| 1757 | |
| 1758 | caseResult83 = linkUp and pingResultLinkUp |
| 1759 | utilities.assert_equals( expect=main.TRUE, actual=caseResult83, |
| 1760 | onpass="Link Up Test PASS", |
| 1761 | onfail="Link Up Test FAIL" ) |
| 1762 | |
| 1763 | def CASE74( self, main ): |
| 1764 | """ |
| 1765 | Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo) |
| 1766 | """ |
| 1767 | import random |
| 1768 | main.randomLink1 = [] |
| 1769 | main.randomLink2 = [] |
| 1770 | main.randomLink3 = [] |
| 1771 | main.randomLink4 = [] |
| 1772 | link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ] |
| 1773 | link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' ) |
| 1774 | link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' ) |
| 1775 | link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ] |
| 1776 | link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' ) |
| 1777 | link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' ) |
| 1778 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 1779 | main.pingTimeout = 400 |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1780 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1781 | main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" ) |
| 1782 | main.log.report( "___________________________________________________________________________" ) |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 1783 | 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] | 1784 | linkIndex = range(4) |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1785 | linkIndexS9 = random.sample(linkIndex,1)[0] |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1786 | linkIndex.remove(linkIndexS9) |
| 1787 | linkIndexS10 = random.sample(linkIndex,1)[0] |
| 1788 | main.randomLink1 = link1End2top[linkIndexS9] |
| 1789 | main.randomLink2 = link2End2top[linkIndexS10] |
| 1790 | main.randomLink3 = random.sample(link1End2bot,1)[0] |
| 1791 | main.randomLink4 = random.sample(link2End2bot,1)[0] |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1792 | |
| 1793 | # Work around for link state propagation delay. Added some sleep time. |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1794 | # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" ) |
| 1795 | # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" ) |
| 1796 | main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" ) |
| 1797 | time.sleep( link_sleep ) |
| 1798 | main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" ) |
| 1799 | time.sleep( link_sleep ) |
| 1800 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1801 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1802 | linkDown = main.ONOSbench.checkStatus( |
| 1803 | topology_output, main.numMNswitches, str( |
Hari Krishna | 390d470 | 2015-08-21 14:37:46 -0700 | [diff] [blame] | 1804 | int( main.numMNlinks ) - 4 )) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1805 | utilities.assert_equals( |
| 1806 | expect=main.TRUE, |
| 1807 | actual=linkDown, |
| 1808 | onpass="Link Down discovered properly", |
| 1809 | onfail="Link down was not discovered in " + |
| 1810 | str( link_sleep ) + |
| 1811 | " seconds" ) |
| 1812 | |
| 1813 | main.step( "Verify Ping across all hosts" ) |
| 1814 | pingResultLinkDown = main.FALSE |
| 1815 | time1 = time.time() |
| 1816 | pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 1817 | time2 = time.time() |
| 1818 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1819 | main.log.report( |
| 1820 | "Time taken for Ping All: " + |
| 1821 | str( timeDiff ) + |
| 1822 | " seconds" ) |
| 1823 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown, |
| 1824 | onpass="PING ALL PASS", |
| 1825 | onfail="PING ALL FAIL" ) |
| 1826 | |
| 1827 | caseResult74 = linkDown and pingResultLinkDown |
| 1828 | utilities.assert_equals( expect=main.TRUE, actual=caseResult74, |
| 1829 | onpass="Random Link cut Test PASS", |
| 1830 | onfail="Random Link cut Test FAIL" ) |
| 1831 | |
| 1832 | def CASE84( self, main ): |
| 1833 | """ |
| 1834 | Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo ) |
| 1835 | """ |
| 1836 | import random |
| 1837 | link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ] |
| 1838 | link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ] |
| 1839 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 1840 | main.log.report( |
| 1841 | "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" ) |
| 1842 | main.log.report( |
| 1843 | "__________________________________________________________________" ) |
| 1844 | main.case( |
| 1845 | "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] | 1846 | |
| 1847 | # Work around for link state propagation delay. Added some sleep time. |
| 1848 | # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" ) |
| 1849 | # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1850 | main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" ) |
| 1851 | time.sleep( link_sleep ) |
| 1852 | main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" ) |
| 1853 | time.sleep( link_sleep ) |
| 1854 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1855 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1856 | linkUp = main.ONOSbench.checkStatus( |
| 1857 | topology_output, |
| 1858 | main.numMNswitches, |
| 1859 | str( main.numMNlinks ) ) |
| 1860 | utilities.assert_equals( |
| 1861 | expect=main.TRUE, |
| 1862 | actual=linkUp, |
| 1863 | onpass="Link up discovered properly", |
| 1864 | onfail="Link up was not discovered in " + |
| 1865 | str( link_sleep ) + |
| 1866 | " seconds" ) |
| 1867 | |
| 1868 | main.step( "Verify Ping across all hosts" ) |
| 1869 | pingResultLinkUp = main.FALSE |
| 1870 | time1 = time.time() |
| 1871 | pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 1872 | time2 = time.time() |
| 1873 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1874 | main.log.report( |
| 1875 | "Time taken for Ping All: " + |
| 1876 | str( timeDiff ) + |
| 1877 | " seconds" ) |
| 1878 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp, |
| 1879 | onpass="PING ALL PASS", |
| 1880 | onfail="PING ALL FAIL" ) |
| 1881 | |
| 1882 | caseResult84 = linkUp and pingResultLinkUp |
| 1883 | utilities.assert_equals( expect=main.TRUE, actual=caseResult84, |
| 1884 | onpass="Link Up Test PASS", |
| 1885 | onfail="Link Up Test FAIL" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1886 | |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 1887 | def CASE75( self, main ): |
| 1888 | """ |
| 1889 | Randomly bring some core links down and verify ping all ( Point Intents-Spine Topo) |
| 1890 | """ |
| 1891 | import random |
| 1892 | main.randomLink1 = [] |
| 1893 | main.randomLink2 = [] |
| 1894 | main.randomLink3 = [] |
| 1895 | main.randomLink4 = [] |
| 1896 | link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ] |
| 1897 | link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' ) |
| 1898 | link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' ) |
| 1899 | link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ] |
| 1900 | link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' ) |
| 1901 | link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' ) |
| 1902 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 1903 | main.pingTimeout = 400 |
| 1904 | |
| 1905 | main.log.report( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" ) |
| 1906 | main.log.report( "___________________________________________________________________________" ) |
| 1907 | main.case( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" ) |
| 1908 | linkIndex = range(4) |
| 1909 | linkIndexS9 = random.sample(linkIndex,1)[0] |
| 1910 | linkIndex.remove(linkIndexS9) |
| 1911 | linkIndexS10 = random.sample(linkIndex,1)[0] |
| 1912 | main.randomLink1 = link1End2top[linkIndexS9] |
| 1913 | main.randomLink2 = link2End2top[linkIndexS10] |
| 1914 | main.randomLink3 = random.sample(link1End2bot,1)[0] |
| 1915 | main.randomLink4 = random.sample(link2End2bot,1)[0] |
| 1916 | |
| 1917 | # Work around for link state propagation delay. Added some sleep time. |
| 1918 | # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" ) |
| 1919 | # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" ) |
| 1920 | main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" ) |
| 1921 | time.sleep( link_sleep ) |
| 1922 | main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" ) |
| 1923 | time.sleep( link_sleep ) |
| 1924 | |
| 1925 | topology_output = main.ONOScli1.topology() |
| 1926 | linkDown = main.ONOSbench.checkStatus( |
| 1927 | topology_output, main.numMNswitches, str( |
Hari Krishna | 390d470 | 2015-08-21 14:37:46 -0700 | [diff] [blame] | 1928 | int( main.numMNlinks ) - 4 )) |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 1929 | utilities.assert_equals( |
| 1930 | expect=main.TRUE, |
| 1931 | actual=linkDown, |
| 1932 | onpass="Link Down discovered properly", |
| 1933 | onfail="Link down was not discovered in " + |
| 1934 | str( link_sleep ) + |
| 1935 | " seconds" ) |
| 1936 | |
| 1937 | main.step( "Verify Ping across all hosts" ) |
| 1938 | pingResultLinkDown = main.FALSE |
| 1939 | time1 = time.time() |
| 1940 | pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 1941 | time2 = time.time() |
| 1942 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1943 | main.log.report( |
| 1944 | "Time taken for Ping All: " + |
| 1945 | str( timeDiff ) + |
| 1946 | " seconds" ) |
| 1947 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown, |
| 1948 | onpass="PING ALL PASS", |
| 1949 | onfail="PING ALL FAIL" ) |
| 1950 | |
| 1951 | caseResult75 = linkDown and pingResultLinkDown |
| 1952 | utilities.assert_equals( expect=main.TRUE, actual=caseResult75, |
| 1953 | onpass="Random Link cut Test PASS", |
| 1954 | onfail="Random Link cut Test FAIL" ) |
| 1955 | |
| 1956 | def CASE85( self, main ): |
| 1957 | """ |
| 1958 | Bring the core links up that are down and verify ping all ( Point Intents-Spine Topo ) |
| 1959 | """ |
| 1960 | import random |
| 1961 | link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ] |
| 1962 | link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ] |
| 1963 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 1964 | main.log.report( |
| 1965 | "Bring the core links up that are down and verify ping all (Point Intents-Spine Topo" ) |
| 1966 | main.log.report( |
| 1967 | "__________________________________________________________________" ) |
| 1968 | main.case( |
| 1969 | "Point intents - Bring the core links up that are down and verify ping all" ) |
| 1970 | |
| 1971 | # Work around for link state propagation delay. Added some sleep time. |
| 1972 | # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" ) |
| 1973 | # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" ) |
| 1974 | main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" ) |
| 1975 | time.sleep( link_sleep ) |
| 1976 | main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" ) |
| 1977 | time.sleep( link_sleep ) |
| 1978 | |
| 1979 | topology_output = main.ONOScli1.topology() |
| 1980 | linkUp = main.ONOSbench.checkStatus( |
| 1981 | topology_output, |
| 1982 | main.numMNswitches, |
| 1983 | str( main.numMNlinks ) ) |
| 1984 | utilities.assert_equals( |
| 1985 | expect=main.TRUE, |
| 1986 | actual=linkUp, |
| 1987 | onpass="Link up discovered properly", |
| 1988 | onfail="Link up was not discovered in " + |
| 1989 | str( link_sleep ) + |
| 1990 | " seconds" ) |
| 1991 | |
| 1992 | main.step( "Verify Ping across all hosts" ) |
| 1993 | pingResultLinkUp = main.FALSE |
| 1994 | time1 = time.time() |
| 1995 | pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 1996 | time2 = time.time() |
| 1997 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1998 | main.log.report( |
| 1999 | "Time taken for Ping All: " + |
| 2000 | str( timeDiff ) + |
| 2001 | " seconds" ) |
| 2002 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp, |
| 2003 | onpass="PING ALL PASS", |
| 2004 | onfail="PING ALL FAIL" ) |
| 2005 | |
| 2006 | caseResult85 = linkUp and pingResultLinkUp |
| 2007 | utilities.assert_equals( expect=main.TRUE, actual=caseResult85, |
| 2008 | onpass="Link Up Test PASS", |
| 2009 | onfail="Link Up Test FAIL" ) |
| 2010 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2011 | def CASE170( self ): |
| 2012 | """ |
| 2013 | IPv6 ping all with some core links down( Host Intents-Att Topo) |
| 2014 | """ |
| 2015 | main.log.report( "IPv6 ping all with some core links down( Host Intents-Att Topo )" ) |
| 2016 | main.log.report( "_________________________________________________" ) |
| 2017 | import itertools |
| 2018 | import time |
| 2019 | main.case( "IPv6 ping all with some core links down( Host Intents-Att Topo )" ) |
| 2020 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2021 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2022 | pingResult = main.FALSE |
| 2023 | time1 = time.time() |
| 2024 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
| 2025 | time2 = time.time() |
| 2026 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2027 | main.log.report( |
| 2028 | "Time taken for IPv6 Ping All: " + |
| 2029 | str( timeDiff ) + |
| 2030 | " seconds" ) |
| 2031 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2032 | onpass="PING ALL PASS", |
| 2033 | onfail="PING ALL FAIL" ) |
| 2034 | |
| 2035 | case170Result = pingResult |
| 2036 | utilities.assert_equals( |
| 2037 | expect=main.TRUE, |
| 2038 | actual=case170Result, |
| 2039 | onpass="IPv6 Ping across 300 host intents test PASS", |
| 2040 | onfail="IPv6 Ping across 300 host intents test FAIL" ) |
| 2041 | |
| 2042 | def CASE180( self ): |
| 2043 | """ |
| 2044 | IPv6 ping all with after core links back up( Host Intents-Att Topo) |
| 2045 | """ |
| 2046 | main.log.report( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" ) |
| 2047 | main.log.report( "_________________________________________________" ) |
| 2048 | import itertools |
| 2049 | import time |
| 2050 | main.case( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" ) |
| 2051 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2052 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2053 | pingResult = main.FALSE |
| 2054 | time1 = time.time() |
| 2055 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
| 2056 | time2 = time.time() |
| 2057 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2058 | main.log.report( |
| 2059 | "Time taken for IPv6 Ping All: " + |
| 2060 | str( timeDiff ) + |
| 2061 | " seconds" ) |
| 2062 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2063 | onpass="PING ALL PASS", |
| 2064 | onfail="PING ALL FAIL" ) |
| 2065 | |
| 2066 | case180Result = pingResult |
| 2067 | utilities.assert_equals( |
| 2068 | expect=main.TRUE, |
| 2069 | actual=case180Result, |
| 2070 | onpass="IPv6 Ping across 300 host intents test PASS", |
| 2071 | onfail="IPv6 Ping across 300 host intents test FAIL" ) |
| 2072 | |
| 2073 | def CASE171( self ): |
| 2074 | """ |
| 2075 | IPv6 ping all with some core links down( Point Intents-Att Topo) |
| 2076 | """ |
| 2077 | main.log.report( "IPv6 ping all with some core links down( Point Intents-Att Topo )" ) |
| 2078 | main.log.report( "_________________________________________________" ) |
| 2079 | import itertools |
| 2080 | import time |
| 2081 | main.case( "IPv6 ping all with some core links down( Point Intents-Att Topo )" ) |
| 2082 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2083 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2084 | pingResult = main.FALSE |
| 2085 | time1 = time.time() |
| 2086 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
| 2087 | time2 = time.time() |
| 2088 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2089 | main.log.report( |
| 2090 | "Time taken for IPv6 Ping All: " + |
| 2091 | str( timeDiff ) + |
| 2092 | " seconds" ) |
| 2093 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2094 | onpass="PING ALL PASS", |
| 2095 | onfail="PING ALL FAIL" ) |
| 2096 | |
| 2097 | case171Result = pingResult |
| 2098 | utilities.assert_equals( |
| 2099 | expect=main.TRUE, |
| 2100 | actual=case171Result, |
| 2101 | onpass="IPv6 Ping across 600 point intents test PASS", |
| 2102 | onfail="IPv6 Ping across 600 point intents test FAIL" ) |
| 2103 | |
| 2104 | def CASE181( self ): |
| 2105 | """ |
| 2106 | IPv6 ping all with after core links back up( Point Intents-Att Topo) |
| 2107 | """ |
| 2108 | main.log.report( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" ) |
| 2109 | main.log.report( "_________________________________________________" ) |
| 2110 | import itertools |
| 2111 | import time |
| 2112 | main.case( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" ) |
| 2113 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2114 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2115 | pingResult = main.FALSE |
| 2116 | time1 = time.time() |
| 2117 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
| 2118 | time2 = time.time() |
| 2119 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2120 | main.log.report( |
| 2121 | "Time taken for IPv6 Ping All: " + |
| 2122 | str( timeDiff ) + |
| 2123 | " seconds" ) |
| 2124 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2125 | onpass="PING ALL PASS", |
| 2126 | onfail="PING ALL FAIL" ) |
| 2127 | |
| 2128 | case181Result = pingResult |
| 2129 | utilities.assert_equals( |
| 2130 | expect=main.TRUE, |
| 2131 | actual=case181Result, |
| 2132 | onpass="IPv6 Ping across 600 Point intents test PASS", |
| 2133 | onfail="IPv6 Ping across 600 Point intents test FAIL" ) |
| 2134 | |
| 2135 | def CASE172( self ): |
| 2136 | """ |
| 2137 | IPv6 ping all with some core links down( Host Intents-Chordal Topo) |
| 2138 | """ |
| 2139 | main.log.report( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" ) |
| 2140 | main.log.report( "_________________________________________________" ) |
| 2141 | import itertools |
| 2142 | import time |
| 2143 | main.case( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" ) |
| 2144 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2145 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2146 | pingResult = main.FALSE |
| 2147 | time1 = time.time() |
| 2148 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
| 2149 | time2 = time.time() |
| 2150 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2151 | main.log.report( |
| 2152 | "Time taken for IPv6 Ping All: " + |
| 2153 | str( timeDiff ) + |
| 2154 | " seconds" ) |
| 2155 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2156 | onpass="PING ALL PASS", |
| 2157 | onfail="PING ALL FAIL" ) |
| 2158 | |
| 2159 | case172Result = pingResult |
| 2160 | utilities.assert_equals( |
| 2161 | expect=main.TRUE, |
| 2162 | actual=case172Result, |
| 2163 | onpass="IPv6 Ping across 300 host intents test PASS", |
| 2164 | onfail="IPv6 Ping across 300 host intents test FAIL" ) |
| 2165 | |
| 2166 | def CASE182( self ): |
| 2167 | """ |
| 2168 | IPv6 ping all with after core links back up( Host Intents-Chordal Topo) |
| 2169 | """ |
| 2170 | main.log.report( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" ) |
| 2171 | main.log.report( "_________________________________________________" ) |
| 2172 | import itertools |
| 2173 | import time |
| 2174 | main.case( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" ) |
| 2175 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2176 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2177 | pingResult = main.FALSE |
| 2178 | time1 = time.time() |
| 2179 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
| 2180 | time2 = time.time() |
| 2181 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2182 | main.log.report( |
| 2183 | "Time taken for IPv6 Ping All: " + |
| 2184 | str( timeDiff ) + |
| 2185 | " seconds" ) |
| 2186 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2187 | onpass="PING ALL PASS", |
| 2188 | onfail="PING ALL FAIL" ) |
| 2189 | |
| 2190 | case182Result = pingResult |
| 2191 | utilities.assert_equals( |
| 2192 | expect=main.TRUE, |
| 2193 | actual=case182Result, |
| 2194 | onpass="IPv6 Ping across 300 host intents test PASS", |
| 2195 | onfail="IPv6 Ping across 300 host intents test FAIL" ) |
| 2196 | |
| 2197 | def CASE173( self ): |
| 2198 | """ |
| 2199 | IPv6 ping all with some core links down( Point Intents-Chordal Topo) |
| 2200 | """ |
| 2201 | main.log.report( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" ) |
| 2202 | main.log.report( "_________________________________________________" ) |
| 2203 | import itertools |
| 2204 | import time |
| 2205 | main.case( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" ) |
| 2206 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2207 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2208 | pingResult = main.FALSE |
| 2209 | time1 = time.time() |
| 2210 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
| 2211 | time2 = time.time() |
| 2212 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2213 | main.log.report( |
| 2214 | "Time taken for IPv6 Ping All: " + |
| 2215 | str( timeDiff ) + |
| 2216 | " seconds" ) |
| 2217 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2218 | onpass="PING ALL PASS", |
| 2219 | onfail="PING ALL FAIL" ) |
| 2220 | |
| 2221 | case173Result = pingResult |
| 2222 | utilities.assert_equals( |
| 2223 | expect=main.TRUE, |
| 2224 | actual=case173Result, |
| 2225 | onpass="IPv6 Ping across 600 point intents test PASS", |
| 2226 | onfail="IPv6 Ping across 600 point intents test FAIL" ) |
| 2227 | |
| 2228 | def CASE183( self ): |
| 2229 | """ |
| 2230 | IPv6 ping all with after core links back up( Point Intents-Chordal Topo) |
| 2231 | """ |
| 2232 | main.log.report( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" ) |
| 2233 | main.log.report( "_________________________________________________" ) |
| 2234 | import itertools |
| 2235 | import time |
| 2236 | main.case( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" ) |
| 2237 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2238 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2239 | pingResult = main.FALSE |
| 2240 | time1 = time.time() |
| 2241 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
| 2242 | time2 = time.time() |
| 2243 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2244 | main.log.report( |
| 2245 | "Time taken for IPv6 Ping All: " + |
| 2246 | str( timeDiff ) + |
| 2247 | " seconds" ) |
| 2248 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2249 | onpass="PING ALL PASS", |
| 2250 | onfail="PING ALL FAIL" ) |
| 2251 | |
| 2252 | case183Result = pingResult |
| 2253 | utilities.assert_equals( |
| 2254 | expect=main.TRUE, |
| 2255 | actual=case183Result, |
| 2256 | onpass="IPv6 Ping across 600 Point intents test PASS", |
| 2257 | onfail="IPv6 Ping across 600 Point intents test FAIL" ) |
| 2258 | |
| 2259 | def CASE174( self ): |
| 2260 | """ |
| 2261 | IPv6 ping all with some core links down( Host Intents-Spine Topo) |
| 2262 | """ |
| 2263 | main.log.report( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" ) |
| 2264 | main.log.report( "_________________________________________________" ) |
| 2265 | import itertools |
| 2266 | import time |
| 2267 | main.case( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" ) |
| 2268 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2269 | hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ] |
| 2270 | pingResult = main.FALSE |
| 2271 | time1 = time.time() |
| 2272 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
| 2273 | time2 = time.time() |
| 2274 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2275 | main.log.report( |
| 2276 | "Time taken for IPv6 Ping All: " + |
| 2277 | str( timeDiff ) + |
| 2278 | " seconds" ) |
| 2279 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2280 | onpass="PING ALL PASS", |
| 2281 | onfail="PING ALL FAIL" ) |
| 2282 | |
| 2283 | case174Result = pingResult |
| 2284 | utilities.assert_equals( |
| 2285 | expect=main.TRUE, |
| 2286 | actual=case174Result, |
| 2287 | onpass="IPv6 Ping across 2278 host intents test PASS", |
| 2288 | onfail="IPv6 Ping across 2278 host intents test FAIL" ) |
| 2289 | |
| 2290 | def CASE184( self ): |
| 2291 | """ |
| 2292 | IPv6 ping all with after core links back up( Host Intents-Spine Topo) |
| 2293 | """ |
| 2294 | main.log.report( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" ) |
| 2295 | main.log.report( "_________________________________________________" ) |
| 2296 | import itertools |
| 2297 | import time |
| 2298 | main.case( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" ) |
| 2299 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2300 | hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ] |
| 2301 | pingResult = main.FALSE |
| 2302 | time1 = time.time() |
| 2303 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
| 2304 | time2 = time.time() |
| 2305 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2306 | main.log.report( |
| 2307 | "Time taken for IPv6 Ping All: " + |
| 2308 | str( timeDiff ) + |
| 2309 | " seconds" ) |
| 2310 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2311 | onpass="PING ALL PASS", |
| 2312 | onfail="PING ALL FAIL" ) |
| 2313 | |
| 2314 | case184Result = pingResult |
| 2315 | utilities.assert_equals( |
| 2316 | expect=main.TRUE, |
| 2317 | actual=case184Result, |
| 2318 | onpass="IPv6 Ping across 2278 host intents test PASS", |
| 2319 | onfail="IPv6 Ping across 2278 host intents test FAIL" ) |
| 2320 | |
| 2321 | def CASE175( self ): |
| 2322 | """ |
| 2323 | IPv6 ping all with some core links down( Point Intents-Spine Topo) |
| 2324 | """ |
| 2325 | main.log.report( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" ) |
| 2326 | main.log.report( "_________________________________________________" ) |
| 2327 | import itertools |
| 2328 | import time |
| 2329 | main.case( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" ) |
| 2330 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2331 | hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ] |
| 2332 | pingResult = main.FALSE |
| 2333 | time1 = time.time() |
| 2334 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
| 2335 | time2 = time.time() |
| 2336 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2337 | main.log.report( |
| 2338 | "Time taken for IPv6 Ping All: " + |
| 2339 | str( timeDiff ) + |
| 2340 | " seconds" ) |
| 2341 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2342 | onpass="PING ALL PASS", |
| 2343 | onfail="PING ALL FAIL" ) |
| 2344 | |
| 2345 | case175Result = pingResult |
| 2346 | utilities.assert_equals( |
| 2347 | expect=main.TRUE, |
| 2348 | actual=case175Result, |
| 2349 | onpass="IPv6 Ping across 4556 point intents test PASS", |
| 2350 | onfail="IPv6 Ping across 4556 point intents test FAIL" ) |
| 2351 | |
| 2352 | def CASE185( self ): |
| 2353 | """ |
| 2354 | IPv6 ping all with after core links back up( Point Intents-Spine Topo) |
| 2355 | """ |
| 2356 | main.log.report( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" ) |
| 2357 | main.log.report( "_________________________________________________" ) |
| 2358 | import itertools |
| 2359 | import time |
| 2360 | main.case( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" ) |
| 2361 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2362 | hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ] |
| 2363 | pingResult = main.FALSE |
| 2364 | time1 = time.time() |
| 2365 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
| 2366 | time2 = time.time() |
| 2367 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2368 | main.log.report( |
| 2369 | "Time taken for IPv6 Ping All: " + |
| 2370 | str( timeDiff ) + |
| 2371 | " seconds" ) |
| 2372 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2373 | onpass="PING ALL PASS", |
| 2374 | onfail="PING ALL FAIL" ) |
| 2375 | |
| 2376 | case183Result = pingResult |
| 2377 | utilities.assert_equals( |
| 2378 | expect=main.TRUE, |
| 2379 | actual=case183Result, |
| 2380 | onpass="IPv6 Ping across 4556 Point intents test PASS", |
| 2381 | onfail="IPv6 Ping across 4556 Point intents test FAIL" ) |
| 2382 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2383 | def CASE90( self ): |
| 2384 | """ |
| 2385 | Install 600 point intents and verify ping all (Att Topology) |
| 2386 | """ |
| 2387 | main.log.report( "Add 600 point intents and verify pingall (Att Topology)" ) |
| 2388 | main.log.report( "_______________________________________" ) |
| 2389 | import itertools |
| 2390 | import time |
| 2391 | main.case( "Install 600 point intents" ) |
| 2392 | main.step( "Add point Intents" ) |
| 2393 | intentResult = main.TRUE |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2394 | deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) ) |
| 2395 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2396 | intentIdList = [] |
| 2397 | time1 = time.time() |
| 2398 | for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ): |
| 2399 | pool = [] |
| 2400 | for cli in main.CLIs: |
| 2401 | if i >= len( deviceCombos ): |
| 2402 | break |
| 2403 | t = main.Thread( target=cli.addPointIntent, |
| 2404 | threadID=main.threadID, |
| 2405 | name="addPointIntent", |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2406 | 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] | 2407 | pool.append(t) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2408 | t.start() |
| 2409 | i = i + 1 |
| 2410 | main.threadID = main.threadID + 1 |
| 2411 | for thread in pool: |
| 2412 | thread.join() |
| 2413 | intentIdList.append(thread.result) |
| 2414 | time2 = time.time() |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 2415 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2416 | intentResult = main.TRUE |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 2417 | intentsJson = main.ONOScli1.intents() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2418 | getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList, |
| 2419 | intentsJson = intentsJson) |
| 2420 | print getIntentStateResult |
| 2421 | # Takes awhile for all the onos to get the intents |
| 2422 | time.sleep(60) |
| 2423 | main.step( "Verify Ping across all hosts" ) |
| 2424 | pingResult = main.FALSE |
| 2425 | time1 = time.time() |
| 2426 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 2427 | time2 = time.time() |
| 2428 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2429 | main.log.report( |
| 2430 | "Time taken for Ping All: " + |
| 2431 | str( timeDiff ) + |
| 2432 | " seconds" ) |
| 2433 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2434 | onpass="PING tALL PASS", |
| 2435 | onfail="PING ALL FAIL" ) |
| 2436 | |
| 2437 | case90Result = ( intentResult and pingResult ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2438 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2439 | utilities.assert_equals( |
| 2440 | expect=main.TRUE, |
| 2441 | actual=case90Result, |
| 2442 | onpass="Install 600 point Intents and Ping All test PASS", |
| 2443 | onfail="Install 600 point Intents and Ping All test FAIL" ) |
| 2444 | |
| 2445 | def CASE91( self ): |
| 2446 | """ |
| 2447 | Install 600 point intents and verify ping all (Chordal Topology) |
| 2448 | """ |
| 2449 | main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" ) |
| 2450 | main.log.report( "_______________________________________" ) |
| 2451 | import itertools |
| 2452 | import time |
| 2453 | main.case( "Install 600 point intents" ) |
| 2454 | main.step( "Add point Intents" ) |
| 2455 | intentResult = main.TRUE |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2456 | deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) ) |
| 2457 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2458 | intentIdList = [] |
| 2459 | time1 = time.time() |
| 2460 | for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ): |
| 2461 | pool = [] |
| 2462 | for cli in main.CLIs: |
| 2463 | if i >= len( deviceCombos ): |
| 2464 | break |
| 2465 | t = main.Thread( target=cli.addPointIntent, |
| 2466 | threadID=main.threadID, |
| 2467 | name="addPointIntent", |
Hari Krishna | 55b171b | 2015-09-02 09:46:03 -0700 | [diff] [blame] | 2468 | 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] | 2469 | pool.append(t) |
| 2470 | #time.sleep(1) |
| 2471 | t.start() |
| 2472 | i = i + 1 |
| 2473 | main.threadID = main.threadID + 1 |
| 2474 | for thread in pool: |
| 2475 | thread.join() |
| 2476 | intentIdList.append(thread.result) |
| 2477 | time2 = time.time() |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 2478 | main.log.info( "Time for adding point intents: %2f seconds" %(time2-time1) ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2479 | intentResult = main.TRUE |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 2480 | intentsJson = main.ONOScli1.intents() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2481 | getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList, |
| 2482 | intentsJson = intentsJson) |
| 2483 | print getIntentStateResult |
| 2484 | # Takes awhile for all the onos to get the intents |
| 2485 | time.sleep(30) |
| 2486 | main.step( "Verify Ping across all hosts" ) |
| 2487 | pingResult = main.FALSE |
| 2488 | time1 = time.time() |
| 2489 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 2490 | time2 = time.time() |
| 2491 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2492 | main.log.report( |
| 2493 | "Time taken for Ping All: " + |
| 2494 | str( timeDiff ) + |
| 2495 | " seconds" ) |
| 2496 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2497 | onpass="PING ALL PASS", |
| 2498 | onfail="PING ALL FAIL" ) |
| 2499 | |
| 2500 | case91Result = ( intentResult and pingResult ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2501 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2502 | utilities.assert_equals( |
| 2503 | expect=main.TRUE, |
| 2504 | actual=case91Result, |
| 2505 | onpass="Install 600 point Intents and Ping All test PASS", |
| 2506 | onfail="Install 600 point Intents and Ping All test FAIL" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2507 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2508 | def CASE92( self ): |
| 2509 | """ |
| 2510 | Install 4556 point intents and verify ping all (Spine Topology) |
| 2511 | """ |
| 2512 | main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" ) |
| 2513 | main.log.report( "_______________________________________" ) |
| 2514 | import itertools |
| 2515 | import time |
| 2516 | main.case( "Install 4556 point intents" ) |
| 2517 | main.step( "Add point Intents" ) |
| 2518 | intentResult = main.TRUE |
| 2519 | main.pingTimeout = 600 |
| 2520 | for i in range(len(main.hostMACs)): |
| 2521 | main.MACsDict[main.deviceDPIDs[i+10]] = main.hostMACs[i].split('/')[0] |
| 2522 | print main.MACsDict |
| 2523 | deviceCombos = list( itertools.permutations( main.deviceDPIDs[10:], 2 ) ) |
| 2524 | intentIdList = [] |
| 2525 | time1 = time.time() |
| 2526 | for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ): |
| 2527 | pool = [] |
| 2528 | for cli in main.CLIs: |
| 2529 | if i >= len( deviceCombos ): |
| 2530 | break |
| 2531 | t = main.Thread( target=cli.addPointIntent, |
| 2532 | threadID=main.threadID, |
| 2533 | name="addPointIntent", |
Hari Krishna | 55b171b | 2015-09-02 09:46:03 -0700 | [diff] [blame] | 2534 | 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] | 2535 | pool.append(t) |
| 2536 | #time.sleep(1) |
| 2537 | t.start() |
| 2538 | i = i + 1 |
| 2539 | main.threadID = main.threadID + 1 |
| 2540 | for thread in pool: |
| 2541 | thread.join() |
| 2542 | intentIdList.append(thread.result) |
| 2543 | time2 = time.time() |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 2544 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2545 | intentResult = main.TRUE |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 2546 | intentsJson = main.ONOScli1.intents() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2547 | getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList, |
| 2548 | intentsJson = intentsJson) |
| 2549 | #print getIntentStateResult |
| 2550 | # Takes awhile for all the onos to get the intents |
| 2551 | time.sleep(60) |
| 2552 | main.step( "Verify Ping across all hosts" ) |
| 2553 | pingResult = main.FALSE |
| 2554 | time1 = time.time() |
| 2555 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 2556 | time2 = time.time() |
| 2557 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2558 | main.log.report( |
| 2559 | "Time taken for Ping All: " + |
| 2560 | str( timeDiff ) + |
| 2561 | " seconds" ) |
| 2562 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2563 | onpass="PING ALL PASS", |
| 2564 | onfail="PING ALL FAIL" ) |
| 2565 | |
| 2566 | case92Result = ( intentResult and pingResult ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2567 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2568 | utilities.assert_equals( |
| 2569 | expect=main.TRUE, |
| 2570 | actual=case92Result, |
| 2571 | onpass="Install 4556 point Intents and Ping All test PASS", |
| 2572 | onfail="Install 4556 point Intents and Ping All test FAIL" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2573 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2574 | def CASE93( self ): |
| 2575 | """ |
| 2576 | Install multi-single point intents and verify Ping all works |
| 2577 | for att topology |
| 2578 | """ |
| 2579 | import copy |
| 2580 | import time |
| 2581 | main.log.report( "Install multi-single point intents and verify Ping all" ) |
| 2582 | main.log.report( "___________________________________________" ) |
| 2583 | main.case( "Install multi-single point intents and Ping all" ) |
| 2584 | deviceDPIDsCopy = copy.copy(main.deviceDPIDs) |
| 2585 | portIngressList = ['1']*(len(deviceDPIDsCopy) - 1) |
| 2586 | intentIdList = [] |
| 2587 | print "MACsDict", main.MACsDict |
| 2588 | time1 = time.time() |
| 2589 | for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)): |
| 2590 | pool = [] |
| 2591 | for cli in main.CLIs: |
| 2592 | egressDevice = deviceDPIDsCopy[i] |
| 2593 | ingressDeviceList = copy.copy(deviceDPIDsCopy) |
| 2594 | ingressDeviceList.remove(egressDevice) |
| 2595 | if i >= len( deviceDPIDsCopy ): |
| 2596 | break |
| 2597 | t = main.Thread( target=cli.addMultipointToSinglepointIntent, |
| 2598 | threadID=main.threadID, |
| 2599 | name="addMultipointToSinglepointIntent", |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2600 | args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)]) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2601 | pool.append(t) |
| 2602 | #time.sleep(1) |
| 2603 | t.start() |
| 2604 | i = i + 1 |
| 2605 | main.threadID = main.threadID + 1 |
| 2606 | for thread in pool: |
| 2607 | thread.join() |
| 2608 | intentIdList.append(thread.result) |
| 2609 | time2 = time.time() |
| 2610 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
| 2611 | time.sleep(30) |
| 2612 | print "getting all intents ID" |
| 2613 | intentIdTemp = main.ONOScli1.getAllIntentsId() |
| 2614 | print intentIdTemp |
| 2615 | print len(intentIdList) |
| 2616 | print intentIdList |
| 2617 | checkIntentStateResult = main.TRUE |
| 2618 | print "Checking intents state" |
| 2619 | checkIntentStateResult = main.ONOScli1.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult |
| 2620 | checkIntentStateResult = main.ONOScli2.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult |
| 2621 | checkIntentStateResult = main.ONOScli3.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult |
| 2622 | checkIntentStateResult = main.ONOScli4.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult |
| 2623 | checkIntentStateResult = main.ONOScli5.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2624 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2625 | if checkIntentStateResult: |
| 2626 | main.log.info( "All intents are installed correctly " ) |
| 2627 | |
| 2628 | print "Checking flows state " |
| 2629 | checkFlowsState = main.ONOScli1.checkFlowsState() |
| 2630 | time.sleep(50) |
| 2631 | main.step( "Verify Ping across all hosts" ) |
| 2632 | pingResult = main.FALSE |
| 2633 | time1 = time.time() |
| 2634 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 2635 | time2 = time.time() |
| 2636 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2637 | main.log.report( |
| 2638 | "Time taken for Ping All: " + |
| 2639 | str( timeDiff ) + |
| 2640 | " seconds" ) |
| 2641 | checkFlowsState = main.ONOScli1.checkFlowsState() |
| 2642 | case93Result = pingResult |
| 2643 | utilities.assert_equals( |
| 2644 | expect=main.TRUE, |
| 2645 | actual=case93Result, |
| 2646 | onpass="Install 25 multi to single point Intents and Ping All test PASS", |
| 2647 | 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] | 2648 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2649 | def CASE94( self ): |
| 2650 | """ |
| 2651 | Install multi-single point intents and verify Ping all works |
| 2652 | for Chordal topology |
| 2653 | """ |
| 2654 | import copy |
| 2655 | import time |
| 2656 | main.log.report( "Install multi-single point intents and verify Ping all" ) |
| 2657 | main.log.report( "___________________________________________" ) |
| 2658 | main.case( "Install multi-single point intents and Ping all" ) |
| 2659 | deviceDPIDsCopy = copy.copy(main.deviceDPIDs) |
| 2660 | portIngressList = ['1']*(len(deviceDPIDsCopy) - 1) |
| 2661 | intentIdList = [] |
| 2662 | print "MACsDict", main.MACsDict |
| 2663 | time1 = time.time() |
| 2664 | for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)): |
| 2665 | pool = [] |
| 2666 | for cli in main.CLIs: |
| 2667 | egressDevice = deviceDPIDsCopy[i] |
| 2668 | ingressDeviceList = copy.copy(deviceDPIDsCopy) |
| 2669 | ingressDeviceList.remove(egressDevice) |
| 2670 | if i >= len( deviceDPIDsCopy ): |
| 2671 | break |
| 2672 | t = main.Thread( target=cli.addMultipointToSinglepointIntent, |
| 2673 | threadID=main.threadID, |
| 2674 | name="addMultipointToSinglepointIntent", |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2675 | args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)]) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2676 | pool.append(t) |
| 2677 | #time.sleep(1) |
| 2678 | t.start() |
| 2679 | i = i + 1 |
| 2680 | main.threadID = main.threadID + 1 |
| 2681 | for thread in pool: |
| 2682 | thread.join() |
| 2683 | intentIdList.append(thread.result) |
| 2684 | time2 = time.time() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2685 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2686 | time.sleep(5) |
| 2687 | main.step( "Verify Ping across all hosts" ) |
| 2688 | pingResult = main.FALSE |
| 2689 | time1 = time.time() |
| 2690 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 2691 | time2 = time.time() |
| 2692 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2693 | main.log.report( |
| 2694 | "Time taken for Ping All: " + |
| 2695 | str( timeDiff ) + |
| 2696 | " seconds" ) |
| 2697 | |
| 2698 | case94Result = pingResult |
| 2699 | utilities.assert_equals( |
| 2700 | expect=main.TRUE, |
| 2701 | actual=case94Result, |
| 2702 | onpass="Install 25 multi to single point Intents and Ping All test PASS", |
| 2703 | 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] | 2704 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2705 | #def CASE95 multi-single point intent for Spine |
| 2706 | |
| 2707 | def CASE96( self ): |
| 2708 | """ |
| 2709 | Install single-multi point intents and verify Ping all works |
| 2710 | for att topology |
| 2711 | """ |
| 2712 | import copy |
| 2713 | main.log.report( "Install single-multi point intents and verify Ping all" ) |
| 2714 | main.log.report( "___________________________________________" ) |
| 2715 | main.case( "Install single-multi point intents and Ping all" ) |
| 2716 | deviceDPIDsCopy = copy.copy(main.deviceDPIDs) |
| 2717 | portEgressList = ['1']*(len(deviceDPIDsCopy) - 1) |
| 2718 | intentIdList = [] |
| 2719 | print "MACsDict", main.MACsDict |
| 2720 | time1 = time.time() |
| 2721 | for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)): |
| 2722 | pool = [] |
| 2723 | for cli in main.CLIs: |
| 2724 | ingressDevice = deviceDPIDsCopy[i] |
| 2725 | egressDeviceList = copy.copy(deviceDPIDsCopy) |
| 2726 | egressDeviceList.remove(ingressDevice) |
| 2727 | if i >= len( deviceDPIDsCopy ): |
| 2728 | break |
| 2729 | t = main.Thread( target=cli.addSinglepointToMultipointIntent, |
| 2730 | threadID=main.threadID, |
| 2731 | name="addSinglepointToMultipointIntent", |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2732 | args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice)]) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2733 | pool.append(t) |
| 2734 | #time.sleep(1) |
| 2735 | t.start() |
| 2736 | i = i + 1 |
| 2737 | main.threadID = main.threadID + 1 |
| 2738 | for thread in pool: |
| 2739 | thread.join() |
| 2740 | intentIdList.append(thread.result) |
| 2741 | time2 = time.time() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2742 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2743 | time.sleep(5) |
| 2744 | main.step( "Verify Ping across all hosts" ) |
| 2745 | pingResult = main.FALSE |
| 2746 | time1 = time.time() |
| 2747 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 2748 | time2 = time.time() |
| 2749 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2750 | main.log.report( |
| 2751 | "Time taken for Ping All: " + |
| 2752 | str( timeDiff ) + |
| 2753 | " seconds" ) |
| 2754 | |
| 2755 | case96Result = pingResult |
| 2756 | utilities.assert_equals( |
| 2757 | expect=main.TRUE, |
| 2758 | actual=case96Result, |
| 2759 | onpass="Install 25 single to multi point Intents and Ping All test PASS", |
| 2760 | onfail="Install 25 single to multi point Intents and Ping All test FAIL" ) |
| 2761 | |
| 2762 | def CASE97( self ): |
| 2763 | """ |
| 2764 | Install single-multi point intents and verify Ping all works |
| 2765 | for Chordal topology |
| 2766 | """ |
| 2767 | import copy |
| 2768 | main.log.report( "Install single-multi point intents and verify Ping all" ) |
| 2769 | main.log.report( "___________________________________________" ) |
| 2770 | main.case( "Install single-multi point intents and Ping all" ) |
| 2771 | deviceDPIDsCopy = copy.copy(main.deviceDPIDs) |
| 2772 | portEgressList = ['1']*(len(deviceDPIDsCopy) - 1) |
| 2773 | intentIdList = [] |
| 2774 | print "MACsDict", main.MACsDict |
| 2775 | time1 = time.time() |
| 2776 | for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)): |
| 2777 | pool = [] |
| 2778 | for cli in main.CLIs: |
| 2779 | ingressDevice = deviceDPIDsCopy[i] |
| 2780 | egressDeviceList = copy.copy(deviceDPIDsCopy) |
| 2781 | egressDeviceList.remove(ingressDevice) |
| 2782 | if i >= len( deviceDPIDsCopy ): |
| 2783 | break |
| 2784 | t = main.Thread( target=cli.addSinglepointToMultipointIntent, |
| 2785 | threadID=main.threadID, |
| 2786 | name="addSinglepointToMultipointIntent", |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2787 | args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice),'']) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2788 | pool.append(t) |
| 2789 | #time.sleep(1) |
| 2790 | t.start() |
| 2791 | i = i + 1 |
| 2792 | main.threadID = main.threadID + 1 |
| 2793 | for thread in pool: |
| 2794 | thread.join() |
| 2795 | intentIdList.append(thread.result) |
| 2796 | time2 = time.time() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2797 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2798 | time.sleep(5) |
| 2799 | main.step( "Verify Ping across all hosts" ) |
| 2800 | pingResult = main.FALSE |
| 2801 | time1 = time.time() |
| 2802 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 2803 | time2 = time.time() |
| 2804 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2805 | main.log.report( |
| 2806 | "Time taken for Ping All: " + |
| 2807 | str( timeDiff ) + |
| 2808 | " seconds" ) |
| 2809 | |
| 2810 | case97Result = pingResult |
| 2811 | utilities.assert_equals( |
| 2812 | expect=main.TRUE, |
| 2813 | actual=case97Result, |
| 2814 | onpass="Install 25 single to multi point Intents and Ping All test PASS", |
| 2815 | onfail="Install 25 single to multi point Intents and Ping All test FAIL" ) |
| 2816 | |
| 2817 | def CASE98( self ): |
| 2818 | """ |
| 2819 | Install single-multi point intents and verify Ping all works |
| 2820 | for Spine topology |
| 2821 | """ |
| 2822 | import copy |
| 2823 | main.log.report( "Install single-multi point intents and verify Ping all" ) |
| 2824 | main.log.report( "___________________________________________" ) |
| 2825 | main.case( "Install single-multi point intents and Ping all" ) |
| 2826 | deviceDPIDsCopy = copy.copy( main.deviceDPIDs ) |
| 2827 | deviceDPIDsCopy = deviceDPIDsCopy[ 10: ] |
| 2828 | portEgressList = [ '1' ]*(len(deviceDPIDsCopy) - 1) |
| 2829 | intentIdList = [] |
| 2830 | MACsDictCopy = {} |
| 2831 | for i in range( len( deviceDPIDsCopy ) ): |
| 2832 | MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ] |
| 2833 | |
| 2834 | print "deviceDPIDsCopy", deviceDPIDsCopy |
| 2835 | print "" |
| 2836 | print "MACsDictCopy", MACsDictCopy |
| 2837 | time1 = time.time() |
| 2838 | for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)): |
| 2839 | pool = [] |
| 2840 | for cli in main.CLIs: |
| 2841 | if i >= len( deviceDPIDsCopy ): |
| 2842 | break |
| 2843 | ingressDevice = deviceDPIDsCopy[i] |
| 2844 | egressDeviceList = copy.copy(deviceDPIDsCopy) |
| 2845 | egressDeviceList.remove(ingressDevice) |
| 2846 | t = main.Thread( target=cli.addSinglepointToMultipointIntent, |
| 2847 | threadID=main.threadID, |
| 2848 | name="addSinglepointToMultipointIntent", |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2849 | args =[ingressDevice,egressDeviceList,'1',portEgressList,'',MACsDictCopy.get(ingressDevice),'']) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2850 | pool.append(t) |
| 2851 | #time.sleep(1) |
| 2852 | t.start() |
| 2853 | i = i + 1 |
| 2854 | main.threadID = main.threadID + 1 |
| 2855 | for thread in pool: |
| 2856 | thread.join() |
| 2857 | intentIdList.append(thread.result) |
| 2858 | time2 = time.time() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2859 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2860 | time.sleep(5) |
| 2861 | main.step( "Verify Ping across all hosts" ) |
| 2862 | pingResult = main.FALSE |
| 2863 | time1 = time.time() |
| 2864 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 2865 | time2 = time.time() |
| 2866 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2867 | main.log.report( |
| 2868 | "Time taken for Ping All: " + |
| 2869 | str( timeDiff ) + |
| 2870 | " seconds" ) |
| 2871 | |
| 2872 | case98Result = pingResult |
| 2873 | utilities.assert_equals( |
| 2874 | expect=main.TRUE, |
| 2875 | actual=case98Result, |
| 2876 | onpass="Install 25 single to multi point Intents and Ping All test PASS", |
| 2877 | onfail="Install 25 single to multi point Intents and Ping All test FAIL" ) |
| 2878 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2879 | def CASE190( self ): |
| 2880 | """ |
| 2881 | Verify IPv6 ping across 600 Point intents (Att Topology) |
| 2882 | """ |
| 2883 | main.log.report( "Verify IPv6 ping across 600 Point intents (Att Topology)" ) |
| 2884 | main.log.report( "_________________________________________________" ) |
| 2885 | import itertools |
| 2886 | import time |
| 2887 | main.case( "IPv6 ping all 600 Point intents" ) |
| 2888 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2889 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2890 | pingResult = main.FALSE |
| 2891 | time1 = time.time() |
| 2892 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
| 2893 | time2 = time.time() |
| 2894 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2895 | main.log.report( |
| 2896 | "Time taken for IPv6 Ping All: " + |
| 2897 | str( timeDiff ) + |
| 2898 | " seconds" ) |
| 2899 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2900 | onpass="PING ALL PASS", |
| 2901 | onfail="PING ALL FAIL" ) |
| 2902 | |
| 2903 | case160Result = pingResult |
| 2904 | utilities.assert_equals( |
| 2905 | expect=main.TRUE, |
| 2906 | actual=case160Result, |
| 2907 | onpass="IPv6 Ping across 600 Point intents test PASS", |
| 2908 | onfail="IPv6 Ping across 600 Point intents test FAIL" ) |
| 2909 | |
| 2910 | def CASE191( self ): |
| 2911 | """ |
| 2912 | Verify IPv6 ping across 600 Point intents (Chordal Topology) |
| 2913 | """ |
| 2914 | main.log.report( "Verify IPv6 ping across 600 Point intents (Chordal Topology)" ) |
| 2915 | main.log.report( "_________________________________________________" ) |
| 2916 | import itertools |
| 2917 | import time |
| 2918 | main.case( "IPv6 ping all 600 Point intents" ) |
| 2919 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2920 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2921 | pingResult = main.FALSE |
| 2922 | time1 = time.time() |
| 2923 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
| 2924 | time2 = time.time() |
| 2925 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2926 | main.log.report( |
| 2927 | "Time taken for IPv6 Ping All: " + |
| 2928 | str( timeDiff ) + |
| 2929 | " seconds" ) |
| 2930 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2931 | onpass="PING ALL PASS", |
| 2932 | onfail="PING ALL FAIL" ) |
| 2933 | |
| 2934 | case191Result = pingResult |
| 2935 | utilities.assert_equals( |
| 2936 | expect=main.TRUE, |
| 2937 | actual=case191Result, |
| 2938 | onpass="IPv6 Ping across 600 Point intents test PASS", |
| 2939 | onfail="IPv6 Ping across 600 Point intents test FAIL" ) |
| 2940 | |
| 2941 | def CASE192( self ): |
| 2942 | """ |
| 2943 | Verify IPv6 ping across 4556 Point intents (Spine Topology) |
| 2944 | """ |
| 2945 | main.log.report( "Verify IPv6 ping across 4556 Point intents (Spine Topology)" ) |
| 2946 | main.log.report( "_________________________________________________" ) |
| 2947 | import itertools |
| 2948 | import time |
Hari Krishna | 310efca | 2015-09-03 09:43:16 -0700 | [diff] [blame] | 2949 | main.case( "IPv6 ping all 4556 Point intents" ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2950 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2951 | hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ] |
| 2952 | pingResult = main.FALSE |
| 2953 | time1 = time.time() |
| 2954 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
| 2955 | time2 = time.time() |
| 2956 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2957 | main.log.report( |
| 2958 | "Time taken for IPv6 Ping All: " + |
| 2959 | str( timeDiff ) + |
| 2960 | " seconds" ) |
| 2961 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2962 | onpass="PING ALL PASS", |
| 2963 | onfail="PING ALL FAIL" ) |
| 2964 | |
| 2965 | case192Result = pingResult |
| 2966 | utilities.assert_equals( |
| 2967 | expect=main.TRUE, |
| 2968 | actual=case192Result, |
Hari Krishna | 310efca | 2015-09-03 09:43:16 -0700 | [diff] [blame] | 2969 | onpass="IPv6 Ping across 4556 Point intents test PASS", |
| 2970 | onfail="IPv6 Ping across 4556 Point intents test FAIL" ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2971 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2972 | def CASE10( self ): |
| 2973 | import time |
GlennRC | c6cd2a6 | 2015-08-10 16:08:22 -0700 | [diff] [blame] | 2974 | import re |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2975 | """ |
| 2976 | Remove all Intents |
| 2977 | """ |
| 2978 | main.log.report( "Remove all intents that were installed previously" ) |
| 2979 | main.log.report( "______________________________________________" ) |
| 2980 | main.log.info( "Remove all intents" ) |
| 2981 | main.case( "Removing intents" ) |
Hari Krishna | ad0c520 | 2015-09-01 14:26:49 -0700 | [diff] [blame] | 2982 | purgeDelay = int( main.params[ "timers" ][ "IntentPurgeDelay" ] ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2983 | main.step( "Obtain the intent id's first" ) |
| 2984 | intentsList = main.ONOScli1.getAllIntentIds() |
| 2985 | ansi_escape = re.compile( r'\x1b[^m]*m' ) |
| 2986 | intentsList = ansi_escape.sub( '', intentsList ) |
| 2987 | intentsList = intentsList.replace( |
| 2988 | " onos:intents | grep id=", |
| 2989 | "" ).replace( |
| 2990 | "id=", |
| 2991 | "" ).replace( |
| 2992 | "\r\r", |
| 2993 | "" ) |
| 2994 | intentsList = intentsList.splitlines() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2995 | intentIdList = [] |
| 2996 | step1Result = main.TRUE |
| 2997 | moreIntents = main.TRUE |
| 2998 | removeIntentCount = 0 |
| 2999 | intentsCount = len(intentsList) |
| 3000 | main.log.info ( "Current number of intents: " + str(intentsCount) ) |
| 3001 | if ( len( intentsList ) > 1 ): |
| 3002 | results = main.TRUE |
| 3003 | main.log.info("Removing intent...") |
| 3004 | while moreIntents: |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 3005 | # 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] | 3006 | if removeIntentCount == 5: |
| 3007 | break |
| 3008 | removeIntentCount = removeIntentCount + 1 |
| 3009 | intentsList1 = main.ONOScli1.getAllIntentIds() |
| 3010 | if len( intentsList1 ) == 0: |
| 3011 | break |
| 3012 | ansi_escape = re.compile( r'\x1b[^m]*m' ) |
| 3013 | intentsList1 = ansi_escape.sub( '', intentsList1 ) |
| 3014 | intentsList1 = intentsList1.replace( |
| 3015 | " onos:intents | grep id=", |
| 3016 | "" ).replace( |
| 3017 | " state=", |
| 3018 | "" ).replace( |
| 3019 | "\r\r", |
| 3020 | "" ) |
| 3021 | intentsList1 = intentsList1.splitlines() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3022 | main.log.info ( "Round %d intents to remove: " %(removeIntentCount) ) |
| 3023 | print intentsList1 |
| 3024 | intentIdList1 = [] |
| 3025 | if ( len( intentsList1 ) > 0 ): |
| 3026 | moreIntents = main.TRUE |
| 3027 | for i in range( len( intentsList1 ) ): |
| 3028 | intentsTemp1 = intentsList1[ i ].split( ',' ) |
| 3029 | intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] ) |
| 3030 | main.log.info ( "Leftover Intent IDs: " + str(intentIdList1) ) |
| 3031 | main.log.info ( "Length of Leftover Intents list: " + str(len(intentIdList1)) ) |
| 3032 | time1 = time.time() |
| 3033 | for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ): |
| 3034 | pool = [] |
| 3035 | for cli in main.CLIs: |
| 3036 | if i >= len( intentIdList1 ): |
| 3037 | break |
| 3038 | t = main.Thread( target=cli.removeIntent, |
| 3039 | threadID=main.threadID, |
| 3040 | name="removeIntent", |
| 3041 | args=[intentIdList1[i],'org.onosproject.cli',False,False]) |
| 3042 | pool.append(t) |
| 3043 | t.start() |
| 3044 | i = i + 1 |
| 3045 | main.threadID = main.threadID + 1 |
| 3046 | for thread in pool: |
| 3047 | thread.join() |
| 3048 | intentIdList.append(thread.result) |
| 3049 | #time.sleep(2) |
| 3050 | time2 = time.time() |
| 3051 | main.log.info("Time for removing host intents: %2f seconds" %(time2-time1)) |
Hari Krishna | ad0c520 | 2015-09-01 14:26:49 -0700 | [diff] [blame] | 3052 | time.sleep( purgeDelay ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3053 | main.log.info("Purging WITHDRAWN Intents") |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 3054 | purgeResult = main.ONOScli1.purgeWithdrawnIntents() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3055 | else: |
| 3056 | time.sleep(10) |
| 3057 | if len( main.ONOScli1.intents()): |
| 3058 | continue |
| 3059 | break |
Hari Krishna | ad0c520 | 2015-09-01 14:26:49 -0700 | [diff] [blame] | 3060 | time.sleep( purgeDelay ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3061 | else: |
| 3062 | print "Removed %d intents" %(intentsCount) |
| 3063 | step1Result = main.TRUE |
| 3064 | else: |
| 3065 | print "No Intent IDs found in Intents list: ", intentsList |
| 3066 | step1Result = main.FALSE |
| 3067 | |
| 3068 | print main.ONOScli1.intents() |
| 3069 | caseResult10 = step1Result |
| 3070 | utilities.assert_equals( expect=main.TRUE, actual=caseResult10, |
| 3071 | onpass="Intent removal test successful", |
| 3072 | onfail="Intent removal test failed" ) |
| 3073 | |
| 3074 | def CASE12( self, main ): |
| 3075 | """ |
| 3076 | Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it |
| 3077 | """ |
| 3078 | import re |
| 3079 | import copy |
| 3080 | import time |
| 3081 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3082 | threadID = 0 |
| 3083 | |
| 3084 | main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" ) |
| 3085 | main.log.report( "_____________________________________________________" ) |
| 3086 | main.case( "Enable Intent based Reactive forwarding and Verify ping all" ) |
| 3087 | main.step( "Enable intent based Reactive forwarding" ) |
| 3088 | installResult = main.FALSE |
| 3089 | feature = "onos-app-ifwd" |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 3090 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3091 | pool = [] |
| 3092 | time1 = time.time() |
| 3093 | for cli,feature in main.CLIs: |
| 3094 | t = main.Thread(target=cli,threadID=threadID, |
| 3095 | name="featureInstall",args=[feature]) |
| 3096 | pool.append(t) |
| 3097 | t.start() |
| 3098 | threadID = threadID + 1 |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3099 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3100 | results = [] |
| 3101 | for thread in pool: |
| 3102 | thread.join() |
| 3103 | results.append(thread.result) |
| 3104 | time2 = time.time() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3105 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3106 | if( all(result == main.TRUE for result in results) == False): |
| 3107 | main.log.info("Did not install onos-app-ifwd feature properly") |
| 3108 | #main.cleanup() |
| 3109 | #main.exit() |
| 3110 | else: |
| 3111 | main.log.info("Successful feature:install onos-app-ifwd") |
| 3112 | installResult = main.TRUE |
| 3113 | 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] | 3114 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3115 | main.step( "Verify Pingall" ) |
| 3116 | ping_result = main.FALSE |
| 3117 | time1 = time.time() |
| 3118 | ping_result = main.Mininet1.pingall(timeout=600) |
| 3119 | time2 = time.time() |
| 3120 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 3121 | main.log.report( |
| 3122 | "Time taken for Ping All: " + |
| 3123 | str( timeDiff ) + |
| 3124 | " seconds" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3125 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3126 | if ping_result == main.TRUE: |
| 3127 | main.log.report( "Pingall Test in Reactive mode successful" ) |
| 3128 | else: |
| 3129 | main.log.report( "Pingall Test in Reactive mode failed" ) |
| 3130 | |
| 3131 | main.step( "Disable Intent based Reactive forwarding" ) |
| 3132 | uninstallResult = main.FALSE |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3133 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3134 | pool = [] |
| 3135 | time1 = time.time() |
| 3136 | for cli,feature in main.CLIs: |
| 3137 | t = main.Thread(target=cli,threadID=threadID, |
| 3138 | name="featureUninstall",args=[feature]) |
| 3139 | pool.append(t) |
| 3140 | t.start() |
| 3141 | threadID = threadID + 1 |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3142 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3143 | results = [] |
| 3144 | for thread in pool: |
| 3145 | thread.join() |
| 3146 | results.append(thread.result) |
| 3147 | time2 = time.time() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3148 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3149 | if( all(result == main.TRUE for result in results) == False): |
| 3150 | main.log.info("Did not uninstall onos-app-ifwd feature properly") |
| 3151 | uninstallResult = main.FALSE |
| 3152 | #main.cleanup() |
| 3153 | #main.exit() |
| 3154 | else: |
| 3155 | main.log.info("Successful feature:uninstall onos-app-ifwd") |
| 3156 | uninstallResult = main.TRUE |
| 3157 | main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1)) |
| 3158 | |
| 3159 | # Waiting for reative flows to be cleared. |
| 3160 | time.sleep( 10 ) |
| 3161 | |
| 3162 | case11Result = installResult and ping_result and uninstallResult |
| 3163 | utilities.assert_equals( expect=main.TRUE, actual=case11Result, |
| 3164 | onpass="Intent based Reactive forwarding Pingall test PASS", |
| 3165 | onfail="Intent based Reactive forwarding Pingall test FAIL" ) |