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" ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 510 | pingResult = main.FALSE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 511 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 512 | pingResult = main.Mininet1.pingall( timeout=main.pingTimeout ) |
| 513 | if not pingResult: |
GlennRC | f07c44a | 2015-09-18 13:33:46 -0700 | [diff] [blame] | 514 | main.log.warn("First pingall failed. Trying again...") |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 515 | pingResult = 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 | |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 523 | if pingResult == 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 | |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 528 | case40Result = appCheck and pingResult |
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" ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 569 | pingResult = main.FALSE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 570 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 571 | pingResult = main.Mininet1.pingall( timeout=main.pingTimeout ) |
| 572 | if not pingResult: |
GlennRC | f07c44a | 2015-09-18 13:33:46 -0700 | [diff] [blame] | 573 | main.log.warn("First pingall failed. Trying again...") |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 574 | pingResult = 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 | |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 582 | if pingResult == 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 | |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 587 | case41Result = appCheck and pingResult |
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" ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 628 | pingResult = main.FALSE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 629 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 630 | pingResult = main.Mininet1.pingall( timeout=main.pingTimeout ) |
| 631 | if not pingResult: |
GlennRC | f07c44a | 2015-09-18 13:33:46 -0700 | [diff] [blame] | 632 | main.log.warn("First pingall failed. Trying again...") |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 633 | pingResult = 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 | |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 641 | if pingResult == 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 | |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 646 | case42Result = appCheck and pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 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" ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 672 | pingResult = main.FALSE |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 673 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 674 | pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout) |
| 675 | if not pingResult: |
GlennRC | f07c44a | 2015-09-18 13:33:46 -0700 | [diff] [blame] | 676 | main.log.warn("First pingall failed. Trying again..") |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 677 | pingResult = 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 | |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 685 | if pingResult == main.TRUE: |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 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 ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 715 | case140Result = appCheck and cfgResult and pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 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" ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 741 | pingResult = main.FALSE |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 742 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 743 | pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout) |
| 744 | if not pingResult: |
GlennRC | f07c44a | 2015-09-18 13:33:46 -0700 | [diff] [blame] | 745 | main.log.warn("First pingall failed. Trying again..") |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 746 | pingResult = 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 | |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 754 | if pingResult == main.TRUE: |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 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 ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 784 | case140Result = appCheck and cfgResult and pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 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" ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 810 | pingResult = main.FALSE |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 811 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 812 | pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout) |
| 813 | if not pingResult: |
GlennRC | f07c44a | 2015-09-18 13:33:46 -0700 | [diff] [blame] | 814 | main.log.warn("First pingall failed. Trying again..") |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 815 | pingResult = 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 | |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 823 | if pingResult == main.TRUE: |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 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 ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 853 | case142Result = appCheck and cfgResult and pingResult |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 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::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 1164 | if not pingResult: |
| 1165 | main.log.warn("Failed to ping Ipv6 hosts. Retrying...") |
| 1166 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 1167 | time2 = time.time() |
| 1168 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1169 | main.log.report( |
| 1170 | "Time taken for IPv6 Ping All: " + |
| 1171 | str( timeDiff ) + |
| 1172 | " seconds" ) |
| 1173 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 1174 | onpass="PING ALL PASS", |
| 1175 | onfail="PING ALL FAIL" ) |
| 1176 | |
| 1177 | case160Result = pingResult |
| 1178 | utilities.assert_equals( |
| 1179 | expect=main.TRUE, |
| 1180 | actual=case160Result, |
| 1181 | onpass="IPv6 Ping across 300 host intents test PASS", |
| 1182 | onfail="IPv6 Ping across 300 host intents test FAIL" ) |
| 1183 | |
| 1184 | def CASE161( self ): |
| 1185 | """ |
| 1186 | Verify IPv6 ping across 600 host intents (Chordal Topology) |
| 1187 | """ |
| 1188 | main.log.report( "Verify IPv6 ping across 600 host intents (Chordal Topology)" ) |
| 1189 | main.log.report( "_________________________________________________" ) |
| 1190 | import itertools |
| 1191 | import time |
| 1192 | main.case( "IPv6 ping all 600 host intents" ) |
| 1193 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 1194 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 1195 | pingResult = main.FALSE |
| 1196 | time1 = time.time() |
| 1197 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 1198 | if not pingResult: |
| 1199 | main.log.warn("Failed to ping Ipv6 hosts. Retrying...") |
| 1200 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 1201 | time2 = time.time() |
| 1202 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1203 | main.log.report( |
| 1204 | "Time taken for IPv6 Ping All: " + |
| 1205 | str( timeDiff ) + |
| 1206 | " seconds" ) |
| 1207 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 1208 | onpass="PING ALL PASS", |
| 1209 | onfail="PING ALL FAIL" ) |
| 1210 | |
| 1211 | case161Result = pingResult |
| 1212 | utilities.assert_equals( |
| 1213 | expect=main.TRUE, |
| 1214 | actual=case161Result, |
| 1215 | onpass="IPv6 Ping across 600 host intents test PASS", |
| 1216 | onfail="IPv6 Ping across 600 host intents test FAIL" ) |
| 1217 | |
| 1218 | def CASE162( self ): |
| 1219 | """ |
| 1220 | Verify IPv6 ping across 2278 host intents (Spine Topology) |
| 1221 | """ |
| 1222 | main.log.report( "Verify IPv6 ping across 2278 host intents (Spine Topology)" ) |
| 1223 | main.log.report( "_________________________________________________" ) |
| 1224 | import itertools |
| 1225 | import time |
| 1226 | main.case( "IPv6 ping all 600 host intents" ) |
| 1227 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 1228 | hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ] |
| 1229 | pingResult = main.FALSE |
| 1230 | time1 = time.time() |
| 1231 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 1232 | if not pingResult: |
| 1233 | main.log.warn("Failed to ping Ipv6 hosts. Retrying...") |
| 1234 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 1235 | time2 = time.time() |
| 1236 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1237 | main.log.report( |
| 1238 | "Time taken for IPv6 Ping All: " + |
| 1239 | str( timeDiff ) + |
| 1240 | " seconds" ) |
| 1241 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 1242 | onpass="PING ALL PASS", |
| 1243 | onfail="PING ALL FAIL" ) |
| 1244 | |
| 1245 | case162Result = pingResult |
| 1246 | utilities.assert_equals( |
| 1247 | expect=main.TRUE, |
| 1248 | actual=case162Result, |
| 1249 | onpass="IPv6 Ping across 600 host intents test PASS", |
| 1250 | onfail="IPv6 Ping across 600 host intents test FAIL" ) |
| 1251 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1252 | def CASE70( self, main ): |
| 1253 | """ |
| 1254 | Randomly bring some core links down and verify ping all ( Host Intents-Att Topo) |
| 1255 | """ |
| 1256 | import random |
| 1257 | main.randomLink1 = [] |
| 1258 | main.randomLink2 = [] |
| 1259 | main.randomLink3 = [] |
| 1260 | link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ] |
| 1261 | link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' ) |
| 1262 | link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ] |
| 1263 | link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' ) |
| 1264 | link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ] |
| 1265 | link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' ) |
| 1266 | switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ] |
| 1267 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 1268 | |
| 1269 | main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Att Topo)" ) |
| 1270 | main.log.report( "___________________________________________________________________________" ) |
| 1271 | main.case( "Host intents - Randomly bring some core links down and verify ping all" ) |
| 1272 | main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" ) |
| 1273 | if ( int( switchLinksToToggle ) == |
| 1274 | 0 or int( switchLinksToToggle ) > 5 ): |
| 1275 | main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" ) |
| 1276 | #main.cleanup() |
| 1277 | #main.exit() |
| 1278 | else: |
| 1279 | main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" ) |
| 1280 | |
| 1281 | main.step( "Cut links on Core devices using user provided range" ) |
| 1282 | main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) ) |
| 1283 | main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) ) |
| 1284 | main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) ) |
| 1285 | for i in range( int( switchLinksToToggle ) ): |
| 1286 | main.Mininet1.link( |
| 1287 | END1=link1End1, |
| 1288 | END2=main.randomLink1[ i ], |
| 1289 | OPTION="down" ) |
| 1290 | time.sleep( link_sleep ) |
| 1291 | main.Mininet1.link( |
| 1292 | END1=link2End1, |
| 1293 | END2=main.randomLink2[ i ], |
| 1294 | OPTION="down" ) |
| 1295 | time.sleep( link_sleep ) |
| 1296 | main.Mininet1.link( |
| 1297 | END1=link3End1, |
| 1298 | END2=main.randomLink3[ i ], |
| 1299 | OPTION="down" ) |
| 1300 | time.sleep( link_sleep ) |
| 1301 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1302 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1303 | linkDown = main.ONOSbench.checkStatus( |
| 1304 | topology_output, main.numMNswitches, str( |
| 1305 | int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) ) |
| 1306 | utilities.assert_equals( |
| 1307 | expect=main.TRUE, |
| 1308 | actual=linkDown, |
| 1309 | onpass="Link Down discovered properly", |
| 1310 | onfail="Link down was not discovered in " + |
| 1311 | str( link_sleep ) + |
| 1312 | " seconds" ) |
| 1313 | |
| 1314 | main.step( "Verify Ping across all hosts" ) |
| 1315 | pingResultLinkDown = main.FALSE |
| 1316 | time1 = time.time() |
| 1317 | pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout ) |
| 1318 | time2 = time.time() |
| 1319 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1320 | main.log.report( |
| 1321 | "Time taken for Ping All: " + |
| 1322 | str( timeDiff ) + |
| 1323 | " seconds" ) |
| 1324 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown, |
| 1325 | onpass="PING ALL PASS", |
| 1326 | onfail="PING ALL FAIL" ) |
| 1327 | |
| 1328 | caseResult70 = linkDown and pingResultLinkDown |
| 1329 | utilities.assert_equals( expect=main.TRUE, actual=caseResult70, |
| 1330 | onpass="Random Link cut Test PASS", |
| 1331 | onfail="Random Link cut Test FAIL" ) |
| 1332 | |
| 1333 | def CASE80( self, main ): |
| 1334 | """ |
| 1335 | Bring the core links up that are down and verify ping all ( Host Intents-Att Topo ) |
| 1336 | """ |
| 1337 | import random |
| 1338 | link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ] |
| 1339 | link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ] |
| 1340 | link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ] |
| 1341 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 1342 | switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ] |
| 1343 | |
| 1344 | main.log.report( |
| 1345 | "Bring the core links up that are down and verify ping all (Host Intents-Att Topo" ) |
| 1346 | main.log.report( |
| 1347 | "__________________________________________________________________" ) |
| 1348 | main.case( |
| 1349 | "Host intents - Bring the core links up that are down and verify ping all" ) |
| 1350 | main.step( "Bring randomly cut links on Core devices up" ) |
| 1351 | for i in range( int( switchLinksToToggle ) ): |
| 1352 | main.Mininet1.link( |
| 1353 | END1=link1End1, |
| 1354 | END2=main.randomLink1[ i ], |
| 1355 | OPTION="up" ) |
| 1356 | time.sleep( link_sleep ) |
| 1357 | main.Mininet1.link( |
| 1358 | END1=link2End1, |
| 1359 | END2=main.randomLink2[ i ], |
| 1360 | OPTION="up" ) |
| 1361 | time.sleep( link_sleep ) |
| 1362 | main.Mininet1.link( |
| 1363 | END1=link3End1, |
| 1364 | END2=main.randomLink3[ i ], |
| 1365 | OPTION="up" ) |
| 1366 | time.sleep( link_sleep ) |
| 1367 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1368 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1369 | linkUp = main.ONOSbench.checkStatus( |
| 1370 | topology_output, |
| 1371 | main.numMNswitches, |
| 1372 | str( main.numMNlinks ) ) |
| 1373 | utilities.assert_equals( |
| 1374 | expect=main.TRUE, |
| 1375 | actual=linkUp, |
| 1376 | onpass="Link up discovered properly", |
| 1377 | onfail="Link up was not discovered in " + |
| 1378 | str( link_sleep ) + |
| 1379 | " seconds" ) |
| 1380 | |
| 1381 | main.step( "Verify Ping across all hosts" ) |
| 1382 | pingResultLinkUp = main.FALSE |
| 1383 | time1 = time.time() |
| 1384 | pingResultLinkUp = main.Mininet1.pingall( timeout=main.pingTimeout ) |
| 1385 | time2 = time.time() |
| 1386 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1387 | main.log.report( |
| 1388 | "Time taken for Ping All: " + |
| 1389 | str( timeDiff ) + |
| 1390 | " seconds" ) |
| 1391 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp, |
| 1392 | onpass="PING ALL PASS", |
| 1393 | onfail="PING ALL FAIL" ) |
| 1394 | |
| 1395 | caseResult80 = linkUp and pingResultLinkUp |
| 1396 | utilities.assert_equals( expect=main.TRUE, actual=caseResult80, |
| 1397 | onpass="Link Up Test PASS", |
| 1398 | onfail="Link Up Test FAIL" ) |
| 1399 | |
| 1400 | def CASE71( self, main ): |
| 1401 | """ |
| 1402 | Randomly bring some core links down and verify ping all ( Point Intents-Att Topo) |
| 1403 | """ |
| 1404 | import random |
| 1405 | main.randomLink1 = [] |
| 1406 | main.randomLink2 = [] |
| 1407 | main.randomLink3 = [] |
| 1408 | link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ] |
| 1409 | link1End2 = main.params[ 'ATTCORELINKS' ][ 'linkS3b' ].split( ',' ) |
| 1410 | link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ] |
| 1411 | link2End2 = main.params[ 'ATTCORELINKS' ][ 'linkS14b' ].split( ',' ) |
| 1412 | link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ] |
| 1413 | link3End2 = main.params[ 'ATTCORELINKS' ][ 'linkS18b' ].split( ',' ) |
| 1414 | switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ] |
| 1415 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 1416 | |
| 1417 | main.log.report( "Randomly bring some core links down and verify ping all (Point Intents-Att Topo)" ) |
| 1418 | main.log.report( "___________________________________________________________________________" ) |
| 1419 | main.case( "Point intents - Randomly bring some core links down and verify ping all" ) |
| 1420 | main.step( "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" ) |
| 1421 | if ( int( switchLinksToToggle ) == |
| 1422 | 0 or int( switchLinksToToggle ) > 5 ): |
| 1423 | main.log.info( "Please check your PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" ) |
| 1424 | #main.cleanup() |
| 1425 | #main.exit() |
| 1426 | else: |
| 1427 | main.log.info( "User provided Core switch links range to toggle is correct, proceeding to run the test" ) |
| 1428 | |
| 1429 | main.step( "Cut links on Core devices using user provided range" ) |
| 1430 | main.randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) ) |
| 1431 | main.randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) ) |
| 1432 | main.randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) ) |
| 1433 | for i in range( int( switchLinksToToggle ) ): |
| 1434 | main.Mininet1.link( |
| 1435 | END1=link1End1, |
| 1436 | END2=main.randomLink1[ i ], |
| 1437 | OPTION="down" ) |
| 1438 | time.sleep( link_sleep ) |
| 1439 | main.Mininet1.link( |
| 1440 | END1=link2End1, |
| 1441 | END2=main.randomLink2[ i ], |
| 1442 | OPTION="down" ) |
| 1443 | time.sleep( link_sleep ) |
| 1444 | main.Mininet1.link( |
| 1445 | END1=link3End1, |
| 1446 | END2=main.randomLink3[ i ], |
| 1447 | OPTION="down" ) |
| 1448 | time.sleep( link_sleep ) |
| 1449 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1450 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1451 | linkDown = main.ONOSbench.checkStatus( |
| 1452 | topology_output, main.numMNswitches, str( |
| 1453 | int( main.numMNlinks ) - int( switchLinksToToggle ) * 6 ) ) |
| 1454 | utilities.assert_equals( |
| 1455 | expect=main.TRUE, |
| 1456 | actual=linkDown, |
| 1457 | onpass="Link Down discovered properly", |
| 1458 | onfail="Link down was not discovered in " + |
| 1459 | str( link_sleep ) + |
| 1460 | " seconds" ) |
| 1461 | |
| 1462 | main.step( "Verify Ping across all hosts" ) |
| 1463 | pingResultLinkDown = main.FALSE |
| 1464 | time1 = time.time() |
| 1465 | pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout) |
| 1466 | time2 = time.time() |
| 1467 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1468 | main.log.report( |
| 1469 | "Time taken for Ping All: " + |
| 1470 | str( timeDiff ) + |
| 1471 | " seconds" ) |
| 1472 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown, |
| 1473 | onpass="PING ALL PASS", |
| 1474 | onfail="PING ALL FAIL" ) |
| 1475 | |
| 1476 | caseResult71 = linkDown and pingResultLinkDown |
| 1477 | utilities.assert_equals( expect=main.TRUE, actual=caseResult71, |
| 1478 | onpass="Random Link cut Test PASS", |
| 1479 | onfail="Random Link cut Test FAIL" ) |
| 1480 | |
| 1481 | def CASE81( self, main ): |
| 1482 | """ |
| 1483 | Bring the core links up that are down and verify ping all ( Point Intents-Att Topo ) |
| 1484 | """ |
| 1485 | import random |
| 1486 | link1End1 = main.params[ 'ATTCORELINKS' ][ 'linkS3a' ] |
| 1487 | link2End1 = main.params[ 'ATTCORELINKS' ][ 'linkS14a' ] |
| 1488 | link3End1 = main.params[ 'ATTCORELINKS' ][ 'linkS18a' ] |
| 1489 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 1490 | switchLinksToToggle = main.params[ 'ATTCORELINKS' ][ 'toggleLinks' ] |
| 1491 | |
| 1492 | main.log.report( |
| 1493 | "Bring the core links up that are down and verify ping all ( Point Intents-Att Topo" ) |
| 1494 | main.log.report( |
| 1495 | "__________________________________________________________________" ) |
| 1496 | main.case( |
| 1497 | "Point intents - Bring the core links up that are down and verify ping all" ) |
| 1498 | main.step( "Bring randomly cut links on Core devices up" ) |
| 1499 | for i in range( int( switchLinksToToggle ) ): |
| 1500 | main.Mininet1.link( |
| 1501 | END1=link1End1, |
| 1502 | END2=main.randomLink1[ i ], |
| 1503 | OPTION="up" ) |
| 1504 | time.sleep( link_sleep ) |
| 1505 | main.Mininet1.link( |
| 1506 | END1=link2End1, |
| 1507 | END2=main.randomLink2[ i ], |
| 1508 | OPTION="up" ) |
| 1509 | time.sleep( link_sleep ) |
| 1510 | main.Mininet1.link( |
| 1511 | END1=link3End1, |
| 1512 | END2=main.randomLink3[ i ], |
| 1513 | OPTION="up" ) |
| 1514 | time.sleep( link_sleep ) |
| 1515 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1516 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1517 | linkUp = main.ONOSbench.checkStatus( |
| 1518 | topology_output, |
| 1519 | main.numMNswitches, |
| 1520 | str( main.numMNlinks ) ) |
| 1521 | utilities.assert_equals( |
| 1522 | expect=main.TRUE, |
| 1523 | actual=linkUp, |
| 1524 | onpass="Link up discovered properly", |
| 1525 | onfail="Link up was not discovered in " + |
| 1526 | str( link_sleep ) + |
| 1527 | " seconds" ) |
| 1528 | |
| 1529 | main.step( "Verify Ping across all hosts" ) |
| 1530 | pingResultLinkUp = main.FALSE |
| 1531 | time1 = time.time() |
| 1532 | pingResultLinkUp = main.Mininet1.pingall(timeout = main.pingTimeout ) |
| 1533 | time2 = time.time() |
| 1534 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1535 | main.log.report( |
| 1536 | "Time taken for Ping All: " + |
| 1537 | str( timeDiff ) + |
| 1538 | " seconds" ) |
| 1539 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp, |
| 1540 | onpass="PING ALL PASS", |
| 1541 | onfail="PING ALL FAIL" ) |
| 1542 | |
| 1543 | caseResult81 = linkUp and pingResultLinkUp |
| 1544 | utilities.assert_equals( expect=main.TRUE, actual=caseResult81, |
| 1545 | onpass="Link Up Test PASS", |
| 1546 | onfail="Link Up Test FAIL" ) |
| 1547 | |
| 1548 | def CASE72( self, main ): |
| 1549 | """ |
| 1550 | Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo) |
| 1551 | """ |
| 1552 | import random |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1553 | import itertools |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1554 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1555 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1556 | main.log.report( "Randomly bring some core links down and verify ping all (Host Intents-Chordal Topo)" ) |
| 1557 | main.log.report( "___________________________________________________________________________" ) |
| 1558 | main.case( "Host intents - Randomly bring some core links down and verify ping all" ) |
| 1559 | switches = [] |
| 1560 | switchesComb = [] |
| 1561 | for i in range( main.numMNswitches ): |
| 1562 | switches.append('s%d'%(i+1)) |
| 1563 | switchesLinksComb = list(itertools.combinations(switches,2)) |
| 1564 | main.randomLinks = random.sample(switchesLinksComb, 5 ) |
| 1565 | print main.randomLinks |
| 1566 | main.step( "Cut links on random devices" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1567 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1568 | for switch in main.randomLinks: |
| 1569 | main.Mininet1.link( |
| 1570 | END1=switch[0], |
| 1571 | END2=switch[1], |
| 1572 | OPTION="down") |
| 1573 | time.sleep( link_sleep ) |
| 1574 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1575 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1576 | linkDown = main.ONOSbench.checkStatus( |
| 1577 | topology_output, main.numMNswitches, str( |
| 1578 | int( main.numMNlinks ) - 5 * 2 ) ) |
| 1579 | utilities.assert_equals( |
| 1580 | expect=main.TRUE, |
| 1581 | actual=linkDown, |
| 1582 | onpass="Link Down discovered properly", |
| 1583 | onfail="Link down was not discovered in " + |
| 1584 | str( link_sleep ) + |
| 1585 | " seconds" ) |
| 1586 | |
| 1587 | main.step( "Verify Ping across all hosts" ) |
| 1588 | pingResultLinkDown = main.FALSE |
| 1589 | time1 = time.time() |
| 1590 | pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 1591 | time2 = time.time() |
| 1592 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1593 | main.log.report( |
| 1594 | "Time taken for Ping All: " + |
| 1595 | str( timeDiff ) + |
| 1596 | " seconds" ) |
| 1597 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown, |
| 1598 | onpass="PING ALL PASS", |
| 1599 | onfail="PING ALL FAIL" ) |
| 1600 | |
| 1601 | caseResult71 = pingResultLinkDown |
| 1602 | utilities.assert_equals( expect=main.TRUE, actual=caseResult71, |
| 1603 | onpass="Random Link cut Test PASS", |
| 1604 | onfail="Random Link cut Test FAIL" ) |
| 1605 | |
| 1606 | def CASE82( self, main ): |
| 1607 | """ |
| 1608 | Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo ) |
| 1609 | """ |
| 1610 | import random |
| 1611 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1612 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1613 | main.log.report( |
| 1614 | "Bring the core links up that are down and verify ping all (Host Intents-Chordal Topo" ) |
| 1615 | main.log.report( |
| 1616 | "__________________________________________________________________" ) |
| 1617 | main.case( |
| 1618 | "Host intents - Bring the core links up that are down and verify ping all" ) |
| 1619 | main.step( "Bring randomly cut links on devices up" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1620 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1621 | for switch in main.randomLinks: |
| 1622 | main.Mininet1.link( |
| 1623 | END1=switch[0], |
| 1624 | END2=switch[1], |
| 1625 | OPTION="up") |
| 1626 | time.sleep( link_sleep ) |
| 1627 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1628 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1629 | linkUp = main.ONOSbench.checkStatus( |
| 1630 | topology_output, |
| 1631 | main.numMNswitches, |
| 1632 | str( main.numMNlinks ) ) |
| 1633 | utilities.assert_equals( |
| 1634 | expect=main.TRUE, |
| 1635 | actual=linkUp, |
| 1636 | onpass="Link up discovered properly", |
| 1637 | onfail="Link up was not discovered in " + |
| 1638 | str( link_sleep ) + |
| 1639 | " seconds" ) |
| 1640 | |
| 1641 | main.step( "Verify Ping across all hosts" ) |
| 1642 | pingResultLinkUp = main.FALSE |
| 1643 | time1 = time.time() |
| 1644 | pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 1645 | time2 = time.time() |
| 1646 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1647 | main.log.report( |
| 1648 | "Time taken for Ping All: " + |
| 1649 | str( timeDiff ) + |
| 1650 | " seconds" ) |
| 1651 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp, |
| 1652 | onpass="PING ALL PASS", |
| 1653 | onfail="PING ALL FAIL" ) |
| 1654 | |
| 1655 | caseResult82 = linkUp and pingResultLinkUp |
| 1656 | utilities.assert_equals( expect=main.TRUE, actual=caseResult82, |
| 1657 | onpass="Link Up Test PASS", |
| 1658 | onfail="Link Up Test FAIL" ) |
| 1659 | |
| 1660 | def CASE73( self, main ): |
| 1661 | """ |
| 1662 | Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo) |
| 1663 | """ |
| 1664 | import random |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1665 | import itertools |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1666 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1667 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1668 | main.log.report( "Randomly bring some core links down and verify ping all ( Point Intents-Chordal Topo)" ) |
| 1669 | main.log.report( "___________________________________________________________________________" ) |
| 1670 | main.case( "Point intents - Randomly bring some core links down and verify ping all" ) |
| 1671 | switches = [] |
| 1672 | switchesComb = [] |
| 1673 | for i in range( main.numMNswitches ): |
| 1674 | switches.append('s%d'%(i+1)) |
| 1675 | switchesLinksComb = list(itertools.combinations(switches,2)) |
| 1676 | main.randomLinks = random.sample(switchesLinksComb, 5 ) |
| 1677 | print main.randomLinks |
| 1678 | main.step( "Cut links on random devices" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1679 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1680 | for switch in main.randomLinks: |
| 1681 | main.Mininet1.link( |
| 1682 | END1=switch[0], |
| 1683 | END2=switch[1], |
| 1684 | OPTION="down") |
| 1685 | time.sleep( link_sleep ) |
| 1686 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1687 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1688 | linkDown = main.ONOSbench.checkStatus( |
| 1689 | topology_output, main.numMNswitches, str( |
| 1690 | int( main.numMNlinks ) - 5 * 2 ) ) |
| 1691 | utilities.assert_equals( |
| 1692 | expect=main.TRUE, |
| 1693 | actual=linkDown, |
| 1694 | onpass="Link Down discovered properly", |
| 1695 | onfail="Link down was not discovered in " + |
| 1696 | str( link_sleep ) + |
| 1697 | " seconds" ) |
| 1698 | |
| 1699 | main.step( "Verify Ping across all hosts" ) |
| 1700 | pingResultLinkDown = main.FALSE |
| 1701 | time1 = time.time() |
| 1702 | pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 1703 | time2 = time.time() |
| 1704 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1705 | main.log.report( |
| 1706 | "Time taken for Ping All: " + |
| 1707 | str( timeDiff ) + |
| 1708 | " seconds" ) |
| 1709 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown, |
| 1710 | onpass="PING ALL PASS", |
| 1711 | onfail="PING ALL FAIL" ) |
| 1712 | |
| 1713 | caseResult73 = pingResultLinkDown |
| 1714 | utilities.assert_equals( expect=main.TRUE, actual=caseResult73, |
| 1715 | onpass="Random Link cut Test PASS", |
| 1716 | onfail="Random Link cut Test FAIL" ) |
| 1717 | |
| 1718 | def CASE83( self, main ): |
| 1719 | """ |
| 1720 | Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo ) |
| 1721 | """ |
| 1722 | import random |
| 1723 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1724 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1725 | main.log.report( |
| 1726 | "Bring the core links up that are down and verify ping all ( Point Intents-Chordal Topo" ) |
| 1727 | main.log.report( |
| 1728 | "__________________________________________________________________" ) |
| 1729 | main.case( |
| 1730 | "Point intents - Bring the core links up that are down and verify ping all" ) |
| 1731 | main.step( "Bring randomly cut links on devices up" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1732 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1733 | for switch in main.randomLinks: |
| 1734 | main.Mininet1.link( |
| 1735 | END1=switch[0], |
| 1736 | END2=switch[1], |
| 1737 | OPTION="up") |
| 1738 | time.sleep( link_sleep ) |
| 1739 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1740 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1741 | linkUp = main.ONOSbench.checkStatus( |
| 1742 | topology_output, |
| 1743 | main.numMNswitches, |
| 1744 | str( main.numMNlinks ) ) |
| 1745 | utilities.assert_equals( |
| 1746 | expect=main.TRUE, |
| 1747 | actual=linkUp, |
| 1748 | onpass="Link up discovered properly", |
| 1749 | onfail="Link up was not discovered in " + |
| 1750 | str( link_sleep ) + |
| 1751 | " seconds" ) |
| 1752 | |
| 1753 | main.step( "Verify Ping across all hosts" ) |
| 1754 | pingResultLinkUp = main.FALSE |
| 1755 | time1 = time.time() |
| 1756 | pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 1757 | time2 = time.time() |
| 1758 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1759 | main.log.report( |
| 1760 | "Time taken for Ping All: " + |
| 1761 | str( timeDiff ) + |
| 1762 | " seconds" ) |
| 1763 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp, |
| 1764 | onpass="PING ALL PASS", |
| 1765 | onfail="PING ALL FAIL" ) |
| 1766 | |
| 1767 | caseResult83 = linkUp and pingResultLinkUp |
| 1768 | utilities.assert_equals( expect=main.TRUE, actual=caseResult83, |
| 1769 | onpass="Link Up Test PASS", |
| 1770 | onfail="Link Up Test FAIL" ) |
| 1771 | |
| 1772 | def CASE74( self, main ): |
| 1773 | """ |
| 1774 | Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo) |
| 1775 | """ |
| 1776 | import random |
| 1777 | main.randomLink1 = [] |
| 1778 | main.randomLink2 = [] |
| 1779 | main.randomLink3 = [] |
| 1780 | main.randomLink4 = [] |
| 1781 | link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ] |
| 1782 | link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' ) |
| 1783 | link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' ) |
| 1784 | link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ] |
| 1785 | link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' ) |
| 1786 | link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' ) |
| 1787 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 1788 | main.pingTimeout = 400 |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1789 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1790 | main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" ) |
| 1791 | main.log.report( "___________________________________________________________________________" ) |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 1792 | 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] | 1793 | linkIndex = range(4) |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1794 | linkIndexS9 = random.sample(linkIndex,1)[0] |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1795 | linkIndex.remove(linkIndexS9) |
| 1796 | linkIndexS10 = random.sample(linkIndex,1)[0] |
| 1797 | main.randomLink1 = link1End2top[linkIndexS9] |
| 1798 | main.randomLink2 = link2End2top[linkIndexS10] |
| 1799 | main.randomLink3 = random.sample(link1End2bot,1)[0] |
| 1800 | main.randomLink4 = random.sample(link2End2bot,1)[0] |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1801 | |
| 1802 | # Work around for link state propagation delay. Added some sleep time. |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1803 | # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" ) |
| 1804 | # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" ) |
| 1805 | main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" ) |
| 1806 | time.sleep( link_sleep ) |
| 1807 | main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" ) |
| 1808 | time.sleep( link_sleep ) |
| 1809 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1810 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1811 | linkDown = main.ONOSbench.checkStatus( |
| 1812 | topology_output, main.numMNswitches, str( |
Hari Krishna | 390d470 | 2015-08-21 14:37:46 -0700 | [diff] [blame] | 1813 | int( main.numMNlinks ) - 4 )) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1814 | utilities.assert_equals( |
| 1815 | expect=main.TRUE, |
| 1816 | actual=linkDown, |
| 1817 | onpass="Link Down discovered properly", |
| 1818 | onfail="Link down was not discovered in " + |
| 1819 | str( link_sleep ) + |
| 1820 | " seconds" ) |
| 1821 | |
| 1822 | main.step( "Verify Ping across all hosts" ) |
| 1823 | pingResultLinkDown = main.FALSE |
| 1824 | time1 = time.time() |
| 1825 | pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 1826 | time2 = time.time() |
| 1827 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1828 | main.log.report( |
| 1829 | "Time taken for Ping All: " + |
| 1830 | str( timeDiff ) + |
| 1831 | " seconds" ) |
| 1832 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown, |
| 1833 | onpass="PING ALL PASS", |
| 1834 | onfail="PING ALL FAIL" ) |
| 1835 | |
| 1836 | caseResult74 = linkDown and pingResultLinkDown |
| 1837 | utilities.assert_equals( expect=main.TRUE, actual=caseResult74, |
| 1838 | onpass="Random Link cut Test PASS", |
| 1839 | onfail="Random Link cut Test FAIL" ) |
| 1840 | |
| 1841 | def CASE84( self, main ): |
| 1842 | """ |
| 1843 | Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo ) |
| 1844 | """ |
| 1845 | import random |
| 1846 | link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ] |
| 1847 | link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ] |
| 1848 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 1849 | main.log.report( |
| 1850 | "Bring the core links up that are down and verify ping all (Host Intents-Spine Topo" ) |
| 1851 | main.log.report( |
| 1852 | "__________________________________________________________________" ) |
| 1853 | main.case( |
| 1854 | "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] | 1855 | |
| 1856 | # Work around for link state propagation delay. Added some sleep time. |
| 1857 | # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" ) |
| 1858 | # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1859 | main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" ) |
| 1860 | time.sleep( link_sleep ) |
| 1861 | main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" ) |
| 1862 | time.sleep( link_sleep ) |
| 1863 | |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 1864 | topology_output = main.ONOScli1.topology() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 1865 | linkUp = main.ONOSbench.checkStatus( |
| 1866 | topology_output, |
| 1867 | main.numMNswitches, |
| 1868 | str( main.numMNlinks ) ) |
| 1869 | utilities.assert_equals( |
| 1870 | expect=main.TRUE, |
| 1871 | actual=linkUp, |
| 1872 | onpass="Link up discovered properly", |
| 1873 | onfail="Link up was not discovered in " + |
| 1874 | str( link_sleep ) + |
| 1875 | " seconds" ) |
| 1876 | |
| 1877 | main.step( "Verify Ping across all hosts" ) |
| 1878 | pingResultLinkUp = main.FALSE |
| 1879 | time1 = time.time() |
| 1880 | pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 1881 | time2 = time.time() |
| 1882 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1883 | main.log.report( |
| 1884 | "Time taken for Ping All: " + |
| 1885 | str( timeDiff ) + |
| 1886 | " seconds" ) |
| 1887 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp, |
| 1888 | onpass="PING ALL PASS", |
| 1889 | onfail="PING ALL FAIL" ) |
| 1890 | |
| 1891 | caseResult84 = linkUp and pingResultLinkUp |
| 1892 | utilities.assert_equals( expect=main.TRUE, actual=caseResult84, |
| 1893 | onpass="Link Up Test PASS", |
| 1894 | onfail="Link Up Test FAIL" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 1895 | |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 1896 | def CASE75( self, main ): |
| 1897 | """ |
| 1898 | Randomly bring some core links down and verify ping all ( Point Intents-Spine Topo) |
| 1899 | """ |
| 1900 | import random |
| 1901 | main.randomLink1 = [] |
| 1902 | main.randomLink2 = [] |
| 1903 | main.randomLink3 = [] |
| 1904 | main.randomLink4 = [] |
| 1905 | link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ] |
| 1906 | link1End2top = main.params[ 'SPINECORELINKS' ][ 'linkS9top' ].split( ',' ) |
| 1907 | link1End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS9bot' ].split( ',' ) |
| 1908 | link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ] |
| 1909 | link2End2top = main.params[ 'SPINECORELINKS' ][ 'linkS10top' ].split( ',' ) |
| 1910 | link2End2bot = main.params[ 'SPINECORELINKS' ][ 'linkS10bot' ].split( ',' ) |
| 1911 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 1912 | main.pingTimeout = 400 |
| 1913 | |
| 1914 | main.log.report( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" ) |
| 1915 | main.log.report( "___________________________________________________________________________" ) |
| 1916 | main.case( "Bring some core links down and verify ping all (Point Intents-Spine Topo)" ) |
| 1917 | linkIndex = range(4) |
| 1918 | linkIndexS9 = random.sample(linkIndex,1)[0] |
| 1919 | linkIndex.remove(linkIndexS9) |
| 1920 | linkIndexS10 = random.sample(linkIndex,1)[0] |
| 1921 | main.randomLink1 = link1End2top[linkIndexS9] |
| 1922 | main.randomLink2 = link2End2top[linkIndexS10] |
| 1923 | main.randomLink3 = random.sample(link1End2bot,1)[0] |
| 1924 | main.randomLink4 = random.sample(link2End2bot,1)[0] |
| 1925 | |
| 1926 | # Work around for link state propagation delay. Added some sleep time. |
| 1927 | # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="down" ) |
| 1928 | # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="down" ) |
| 1929 | main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="down" ) |
| 1930 | time.sleep( link_sleep ) |
| 1931 | main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" ) |
| 1932 | time.sleep( link_sleep ) |
| 1933 | |
| 1934 | topology_output = main.ONOScli1.topology() |
| 1935 | linkDown = main.ONOSbench.checkStatus( |
| 1936 | topology_output, main.numMNswitches, str( |
Hari Krishna | 390d470 | 2015-08-21 14:37:46 -0700 | [diff] [blame] | 1937 | int( main.numMNlinks ) - 4 )) |
Hari Krishna | b79d082 | 2015-08-20 09:48:43 -0700 | [diff] [blame] | 1938 | utilities.assert_equals( |
| 1939 | expect=main.TRUE, |
| 1940 | actual=linkDown, |
| 1941 | onpass="Link Down discovered properly", |
| 1942 | onfail="Link down was not discovered in " + |
| 1943 | str( link_sleep ) + |
| 1944 | " seconds" ) |
| 1945 | |
| 1946 | main.step( "Verify Ping across all hosts" ) |
| 1947 | pingResultLinkDown = main.FALSE |
| 1948 | time1 = time.time() |
| 1949 | pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 1950 | time2 = time.time() |
| 1951 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 1952 | main.log.report( |
| 1953 | "Time taken for Ping All: " + |
| 1954 | str( timeDiff ) + |
| 1955 | " seconds" ) |
| 1956 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown, |
| 1957 | onpass="PING ALL PASS", |
| 1958 | onfail="PING ALL FAIL" ) |
| 1959 | |
| 1960 | caseResult75 = linkDown and pingResultLinkDown |
| 1961 | utilities.assert_equals( expect=main.TRUE, actual=caseResult75, |
| 1962 | onpass="Random Link cut Test PASS", |
| 1963 | onfail="Random Link cut Test FAIL" ) |
| 1964 | |
| 1965 | def CASE85( self, main ): |
| 1966 | """ |
| 1967 | Bring the core links up that are down and verify ping all ( Point Intents-Spine Topo ) |
| 1968 | """ |
| 1969 | import random |
| 1970 | link1End1 = main.params[ 'SPINECORELINKS' ][ 'linkS9' ] |
| 1971 | link2End1 = main.params[ 'SPINECORELINKS' ][ 'linkS10' ] |
| 1972 | link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] ) |
| 1973 | main.log.report( |
| 1974 | "Bring the core links up that are down and verify ping all (Point Intents-Spine Topo" ) |
| 1975 | main.log.report( |
| 1976 | "__________________________________________________________________" ) |
| 1977 | main.case( |
| 1978 | "Point intents - Bring the core links up that are down and verify ping all" ) |
| 1979 | |
| 1980 | # Work around for link state propagation delay. Added some sleep time. |
| 1981 | # main.Mininet1.link( END1=link1End1, END2=main.randomLink1, OPTION="up" ) |
| 1982 | # main.Mininet1.link( END1=link2End1, END2=main.randomLink2, OPTION="up" ) |
| 1983 | main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" ) |
| 1984 | time.sleep( link_sleep ) |
| 1985 | main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" ) |
| 1986 | time.sleep( link_sleep ) |
| 1987 | |
| 1988 | topology_output = main.ONOScli1.topology() |
| 1989 | linkUp = main.ONOSbench.checkStatus( |
| 1990 | topology_output, |
| 1991 | main.numMNswitches, |
| 1992 | str( main.numMNlinks ) ) |
| 1993 | utilities.assert_equals( |
| 1994 | expect=main.TRUE, |
| 1995 | actual=linkUp, |
| 1996 | onpass="Link up discovered properly", |
| 1997 | onfail="Link up was not discovered in " + |
| 1998 | str( link_sleep ) + |
| 1999 | " seconds" ) |
| 2000 | |
| 2001 | main.step( "Verify Ping across all hosts" ) |
| 2002 | pingResultLinkUp = main.FALSE |
| 2003 | time1 = time.time() |
| 2004 | pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 2005 | time2 = time.time() |
| 2006 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2007 | main.log.report( |
| 2008 | "Time taken for Ping All: " + |
| 2009 | str( timeDiff ) + |
| 2010 | " seconds" ) |
| 2011 | utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp, |
| 2012 | onpass="PING ALL PASS", |
| 2013 | onfail="PING ALL FAIL" ) |
| 2014 | |
| 2015 | caseResult85 = linkUp and pingResultLinkUp |
| 2016 | utilities.assert_equals( expect=main.TRUE, actual=caseResult85, |
| 2017 | onpass="Link Up Test PASS", |
| 2018 | onfail="Link Up Test FAIL" ) |
| 2019 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2020 | def CASE170( self ): |
| 2021 | """ |
| 2022 | IPv6 ping all with some core links down( Host Intents-Att Topo) |
| 2023 | """ |
| 2024 | main.log.report( "IPv6 ping all with some core links down( Host Intents-Att Topo )" ) |
| 2025 | main.log.report( "_________________________________________________" ) |
| 2026 | import itertools |
| 2027 | import time |
| 2028 | main.case( "IPv6 ping all with some core links down( Host Intents-Att Topo )" ) |
| 2029 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2030 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2031 | pingResult = main.FALSE |
| 2032 | time1 = time.time() |
| 2033 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2034 | if not pingResult: |
| 2035 | main.log.warn("Failed to ping Ipv6 hosts. Retrying...") |
| 2036 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2037 | time2 = time.time() |
| 2038 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2039 | main.log.report( |
| 2040 | "Time taken for IPv6 Ping All: " + |
| 2041 | str( timeDiff ) + |
| 2042 | " seconds" ) |
| 2043 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2044 | onpass="PING ALL PASS", |
| 2045 | onfail="PING ALL FAIL" ) |
| 2046 | |
| 2047 | case170Result = pingResult |
| 2048 | utilities.assert_equals( |
| 2049 | expect=main.TRUE, |
| 2050 | actual=case170Result, |
| 2051 | onpass="IPv6 Ping across 300 host intents test PASS", |
| 2052 | onfail="IPv6 Ping across 300 host intents test FAIL" ) |
| 2053 | |
| 2054 | def CASE180( self ): |
| 2055 | """ |
| 2056 | IPv6 ping all with after core links back up( Host Intents-Att Topo) |
| 2057 | """ |
| 2058 | main.log.report( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" ) |
| 2059 | main.log.report( "_________________________________________________" ) |
| 2060 | import itertools |
| 2061 | import time |
| 2062 | main.case( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" ) |
| 2063 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2064 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2065 | pingResult = main.FALSE |
| 2066 | time1 = time.time() |
| 2067 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2068 | if not pingResult: |
| 2069 | main.log.warn("Failed to ping Ipv6 hosts. Retrying...") |
| 2070 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2071 | time2 = time.time() |
| 2072 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2073 | main.log.report( |
| 2074 | "Time taken for IPv6 Ping All: " + |
| 2075 | str( timeDiff ) + |
| 2076 | " seconds" ) |
| 2077 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2078 | onpass="PING ALL PASS", |
| 2079 | onfail="PING ALL FAIL" ) |
| 2080 | |
| 2081 | case180Result = pingResult |
| 2082 | utilities.assert_equals( |
| 2083 | expect=main.TRUE, |
| 2084 | actual=case180Result, |
| 2085 | onpass="IPv6 Ping across 300 host intents test PASS", |
| 2086 | onfail="IPv6 Ping across 300 host intents test FAIL" ) |
| 2087 | |
| 2088 | def CASE171( self ): |
| 2089 | """ |
| 2090 | IPv6 ping all with some core links down( Point Intents-Att Topo) |
| 2091 | """ |
| 2092 | main.log.report( "IPv6 ping all with some core links down( Point Intents-Att Topo )" ) |
| 2093 | main.log.report( "_________________________________________________" ) |
| 2094 | import itertools |
| 2095 | import time |
| 2096 | main.case( "IPv6 ping all with some core links down( Point Intents-Att Topo )" ) |
| 2097 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2098 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2099 | pingResult = main.FALSE |
| 2100 | time1 = time.time() |
| 2101 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2102 | if not pingResult: |
| 2103 | main.log.warn("Failed to ping Ipv6 hosts. Retrying...") |
| 2104 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2105 | time2 = time.time() |
| 2106 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2107 | main.log.report( |
| 2108 | "Time taken for IPv6 Ping All: " + |
| 2109 | str( timeDiff ) + |
| 2110 | " seconds" ) |
| 2111 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2112 | onpass="PING ALL PASS", |
| 2113 | onfail="PING ALL FAIL" ) |
| 2114 | |
| 2115 | case171Result = pingResult |
| 2116 | utilities.assert_equals( |
| 2117 | expect=main.TRUE, |
| 2118 | actual=case171Result, |
| 2119 | onpass="IPv6 Ping across 600 point intents test PASS", |
| 2120 | onfail="IPv6 Ping across 600 point intents test FAIL" ) |
| 2121 | |
| 2122 | def CASE181( self ): |
| 2123 | """ |
| 2124 | IPv6 ping all with after core links back up( Point Intents-Att Topo) |
| 2125 | """ |
| 2126 | main.log.report( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" ) |
| 2127 | main.log.report( "_________________________________________________" ) |
| 2128 | import itertools |
| 2129 | import time |
| 2130 | main.case( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" ) |
| 2131 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2132 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2133 | pingResult = main.FALSE |
| 2134 | time1 = time.time() |
| 2135 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2136 | if not pingResult: |
| 2137 | main.log.warn("Failed to ping Ipv6 hosts. Retrying...") |
| 2138 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2139 | time2 = time.time() |
| 2140 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2141 | main.log.report( |
| 2142 | "Time taken for IPv6 Ping All: " + |
| 2143 | str( timeDiff ) + |
| 2144 | " seconds" ) |
| 2145 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2146 | onpass="PING ALL PASS", |
| 2147 | onfail="PING ALL FAIL" ) |
| 2148 | |
| 2149 | case181Result = pingResult |
| 2150 | utilities.assert_equals( |
| 2151 | expect=main.TRUE, |
| 2152 | actual=case181Result, |
| 2153 | onpass="IPv6 Ping across 600 Point intents test PASS", |
| 2154 | onfail="IPv6 Ping across 600 Point intents test FAIL" ) |
| 2155 | |
| 2156 | def CASE172( self ): |
| 2157 | """ |
| 2158 | IPv6 ping all with some core links down( Host Intents-Chordal Topo) |
| 2159 | """ |
| 2160 | main.log.report( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" ) |
| 2161 | main.log.report( "_________________________________________________" ) |
| 2162 | import itertools |
| 2163 | import time |
| 2164 | main.case( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" ) |
| 2165 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2166 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2167 | pingResult = main.FALSE |
| 2168 | time1 = time.time() |
| 2169 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2170 | if not pingResult: |
| 2171 | main.log.warn("Failed to ping Ipv6 hosts. Retrying...") |
| 2172 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2173 | time2 = time.time() |
| 2174 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2175 | main.log.report( |
| 2176 | "Time taken for IPv6 Ping All: " + |
| 2177 | str( timeDiff ) + |
| 2178 | " seconds" ) |
| 2179 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2180 | onpass="PING ALL PASS", |
| 2181 | onfail="PING ALL FAIL" ) |
| 2182 | |
| 2183 | case172Result = pingResult |
| 2184 | utilities.assert_equals( |
| 2185 | expect=main.TRUE, |
| 2186 | actual=case172Result, |
| 2187 | onpass="IPv6 Ping across 300 host intents test PASS", |
| 2188 | onfail="IPv6 Ping across 300 host intents test FAIL" ) |
| 2189 | |
| 2190 | def CASE182( self ): |
| 2191 | """ |
| 2192 | IPv6 ping all with after core links back up( Host Intents-Chordal Topo) |
| 2193 | """ |
| 2194 | main.log.report( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" ) |
| 2195 | main.log.report( "_________________________________________________" ) |
| 2196 | import itertools |
| 2197 | import time |
| 2198 | main.case( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" ) |
| 2199 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2200 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2201 | pingResult = main.FALSE |
| 2202 | time1 = time.time() |
| 2203 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2204 | if not pingResult: |
| 2205 | main.log.warn("Failed to ping Ipv6 hosts. Retrying...") |
| 2206 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2207 | time2 = time.time() |
| 2208 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2209 | main.log.report( |
| 2210 | "Time taken for IPv6 Ping All: " + |
| 2211 | str( timeDiff ) + |
| 2212 | " seconds" ) |
| 2213 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2214 | onpass="PING ALL PASS", |
| 2215 | onfail="PING ALL FAIL" ) |
| 2216 | |
| 2217 | case182Result = pingResult |
| 2218 | utilities.assert_equals( |
| 2219 | expect=main.TRUE, |
| 2220 | actual=case182Result, |
| 2221 | onpass="IPv6 Ping across 300 host intents test PASS", |
| 2222 | onfail="IPv6 Ping across 300 host intents test FAIL" ) |
| 2223 | |
| 2224 | def CASE173( self ): |
| 2225 | """ |
| 2226 | IPv6 ping all with some core links down( Point Intents-Chordal Topo) |
| 2227 | """ |
| 2228 | main.log.report( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" ) |
| 2229 | main.log.report( "_________________________________________________" ) |
| 2230 | import itertools |
| 2231 | import time |
| 2232 | main.case( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" ) |
| 2233 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2234 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2235 | pingResult = main.FALSE |
| 2236 | time1 = time.time() |
| 2237 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2238 | if not pingResult: |
| 2239 | main.log.warn("Failed to ping Ipv6 hosts. Retrying...") |
| 2240 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2241 | time2 = time.time() |
| 2242 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2243 | main.log.report( |
| 2244 | "Time taken for IPv6 Ping All: " + |
| 2245 | str( timeDiff ) + |
| 2246 | " seconds" ) |
| 2247 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2248 | onpass="PING ALL PASS", |
| 2249 | onfail="PING ALL FAIL" ) |
| 2250 | |
| 2251 | case173Result = pingResult |
| 2252 | utilities.assert_equals( |
| 2253 | expect=main.TRUE, |
| 2254 | actual=case173Result, |
| 2255 | onpass="IPv6 Ping across 600 point intents test PASS", |
| 2256 | onfail="IPv6 Ping across 600 point intents test FAIL" ) |
| 2257 | |
| 2258 | def CASE183( self ): |
| 2259 | """ |
| 2260 | IPv6 ping all with after core links back up( Point Intents-Chordal Topo) |
| 2261 | """ |
| 2262 | main.log.report( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" ) |
| 2263 | main.log.report( "_________________________________________________" ) |
| 2264 | import itertools |
| 2265 | import time |
| 2266 | main.case( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" ) |
| 2267 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2268 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2269 | pingResult = main.FALSE |
| 2270 | time1 = time.time() |
| 2271 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2272 | if not pingResult: |
| 2273 | main.log.warn("Failed to ping Ipv6 hosts. Retrying...") |
| 2274 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2275 | time2 = time.time() |
| 2276 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2277 | main.log.report( |
| 2278 | "Time taken for IPv6 Ping All: " + |
| 2279 | str( timeDiff ) + |
| 2280 | " seconds" ) |
| 2281 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2282 | onpass="PING ALL PASS", |
| 2283 | onfail="PING ALL FAIL" ) |
| 2284 | |
| 2285 | case183Result = pingResult |
| 2286 | utilities.assert_equals( |
| 2287 | expect=main.TRUE, |
| 2288 | actual=case183Result, |
| 2289 | onpass="IPv6 Ping across 600 Point intents test PASS", |
| 2290 | onfail="IPv6 Ping across 600 Point intents test FAIL" ) |
| 2291 | |
| 2292 | def CASE174( self ): |
| 2293 | """ |
| 2294 | IPv6 ping all with some core links down( Host Intents-Spine Topo) |
| 2295 | """ |
| 2296 | main.log.report( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" ) |
| 2297 | main.log.report( "_________________________________________________" ) |
| 2298 | import itertools |
| 2299 | import time |
| 2300 | main.case( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" ) |
| 2301 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2302 | hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ] |
| 2303 | pingResult = main.FALSE |
| 2304 | time1 = time.time() |
| 2305 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2306 | if not pingResult: |
| 2307 | main.log.warn("Failed to ping Ipv6 hosts. Retrying...") |
| 2308 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2309 | time2 = time.time() |
| 2310 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2311 | main.log.report( |
| 2312 | "Time taken for IPv6 Ping All: " + |
| 2313 | str( timeDiff ) + |
| 2314 | " seconds" ) |
| 2315 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2316 | onpass="PING ALL PASS", |
| 2317 | onfail="PING ALL FAIL" ) |
| 2318 | |
| 2319 | case174Result = pingResult |
| 2320 | utilities.assert_equals( |
| 2321 | expect=main.TRUE, |
| 2322 | actual=case174Result, |
| 2323 | onpass="IPv6 Ping across 2278 host intents test PASS", |
| 2324 | onfail="IPv6 Ping across 2278 host intents test FAIL" ) |
| 2325 | |
| 2326 | def CASE184( self ): |
| 2327 | """ |
| 2328 | IPv6 ping all with after core links back up( Host Intents-Spine Topo) |
| 2329 | """ |
| 2330 | main.log.report( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" ) |
| 2331 | main.log.report( "_________________________________________________" ) |
| 2332 | import itertools |
| 2333 | import time |
| 2334 | main.case( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" ) |
| 2335 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2336 | hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ] |
| 2337 | pingResult = main.FALSE |
| 2338 | time1 = time.time() |
| 2339 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2340 | if not pingResult: |
| 2341 | main.log.warn("Failed to ping Ipv6 hosts. Retrying...") |
| 2342 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2343 | time2 = time.time() |
| 2344 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2345 | main.log.report( |
| 2346 | "Time taken for IPv6 Ping All: " + |
| 2347 | str( timeDiff ) + |
| 2348 | " seconds" ) |
| 2349 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2350 | onpass="PING ALL PASS", |
| 2351 | onfail="PING ALL FAIL" ) |
| 2352 | |
| 2353 | case184Result = pingResult |
| 2354 | utilities.assert_equals( |
| 2355 | expect=main.TRUE, |
| 2356 | actual=case184Result, |
| 2357 | onpass="IPv6 Ping across 2278 host intents test PASS", |
| 2358 | onfail="IPv6 Ping across 2278 host intents test FAIL" ) |
| 2359 | |
| 2360 | def CASE175( self ): |
| 2361 | """ |
| 2362 | IPv6 ping all with some core links down( Point Intents-Spine Topo) |
| 2363 | """ |
| 2364 | main.log.report( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" ) |
| 2365 | main.log.report( "_________________________________________________" ) |
| 2366 | import itertools |
| 2367 | import time |
| 2368 | main.case( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" ) |
| 2369 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2370 | hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ] |
| 2371 | pingResult = main.FALSE |
| 2372 | time1 = time.time() |
| 2373 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2374 | if not pingResult: |
| 2375 | main.log.warn("Failed to ping Ipv6 hosts. Retrying...") |
| 2376 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2377 | time2 = time.time() |
| 2378 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2379 | main.log.report( |
| 2380 | "Time taken for IPv6 Ping All: " + |
| 2381 | str( timeDiff ) + |
| 2382 | " seconds" ) |
| 2383 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2384 | onpass="PING ALL PASS", |
| 2385 | onfail="PING ALL FAIL" ) |
| 2386 | |
| 2387 | case175Result = pingResult |
| 2388 | utilities.assert_equals( |
| 2389 | expect=main.TRUE, |
| 2390 | actual=case175Result, |
| 2391 | onpass="IPv6 Ping across 4556 point intents test PASS", |
| 2392 | onfail="IPv6 Ping across 4556 point intents test FAIL" ) |
| 2393 | |
| 2394 | def CASE185( self ): |
| 2395 | """ |
| 2396 | IPv6 ping all with after core links back up( Point Intents-Spine Topo) |
| 2397 | """ |
| 2398 | main.log.report( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" ) |
| 2399 | main.log.report( "_________________________________________________" ) |
| 2400 | import itertools |
| 2401 | import time |
| 2402 | main.case( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" ) |
| 2403 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2404 | hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ] |
| 2405 | pingResult = main.FALSE |
| 2406 | time1 = time.time() |
| 2407 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2408 | if not pingResult: |
| 2409 | main.log.warn("Failed to ping Ipv6 hosts. Retrying...") |
| 2410 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2411 | time2 = time.time() |
| 2412 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2413 | main.log.report( |
| 2414 | "Time taken for IPv6 Ping All: " + |
| 2415 | str( timeDiff ) + |
| 2416 | " seconds" ) |
| 2417 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2418 | onpass="PING ALL PASS", |
| 2419 | onfail="PING ALL FAIL" ) |
| 2420 | |
| 2421 | case183Result = pingResult |
| 2422 | utilities.assert_equals( |
| 2423 | expect=main.TRUE, |
| 2424 | actual=case183Result, |
| 2425 | onpass="IPv6 Ping across 4556 Point intents test PASS", |
| 2426 | onfail="IPv6 Ping across 4556 Point intents test FAIL" ) |
| 2427 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2428 | def CASE90( self ): |
| 2429 | """ |
| 2430 | Install 600 point intents and verify ping all (Att Topology) |
| 2431 | """ |
| 2432 | main.log.report( "Add 600 point intents and verify pingall (Att Topology)" ) |
| 2433 | main.log.report( "_______________________________________" ) |
| 2434 | import itertools |
| 2435 | import time |
| 2436 | main.case( "Install 600 point intents" ) |
| 2437 | main.step( "Add point Intents" ) |
| 2438 | intentResult = main.TRUE |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2439 | deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) ) |
| 2440 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2441 | intentIdList = [] |
| 2442 | time1 = time.time() |
| 2443 | for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ): |
| 2444 | pool = [] |
| 2445 | for cli in main.CLIs: |
| 2446 | if i >= len( deviceCombos ): |
| 2447 | break |
| 2448 | t = main.Thread( target=cli.addPointIntent, |
| 2449 | threadID=main.threadID, |
| 2450 | name="addPointIntent", |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2451 | 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] | 2452 | pool.append(t) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2453 | t.start() |
| 2454 | i = i + 1 |
| 2455 | main.threadID = main.threadID + 1 |
| 2456 | for thread in pool: |
| 2457 | thread.join() |
| 2458 | intentIdList.append(thread.result) |
| 2459 | time2 = time.time() |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 2460 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2461 | intentResult = main.TRUE |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 2462 | intentsJson = main.ONOScli1.intents() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2463 | getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList, |
| 2464 | intentsJson = intentsJson) |
| 2465 | print getIntentStateResult |
| 2466 | # Takes awhile for all the onos to get the intents |
| 2467 | time.sleep(60) |
| 2468 | main.step( "Verify Ping across all hosts" ) |
| 2469 | pingResult = main.FALSE |
| 2470 | time1 = time.time() |
| 2471 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 2472 | time2 = time.time() |
| 2473 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2474 | main.log.report( |
| 2475 | "Time taken for Ping All: " + |
| 2476 | str( timeDiff ) + |
| 2477 | " seconds" ) |
| 2478 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2479 | onpass="PING tALL PASS", |
| 2480 | onfail="PING ALL FAIL" ) |
| 2481 | |
| 2482 | case90Result = ( intentResult and pingResult ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2483 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2484 | utilities.assert_equals( |
| 2485 | expect=main.TRUE, |
| 2486 | actual=case90Result, |
| 2487 | onpass="Install 600 point Intents and Ping All test PASS", |
| 2488 | onfail="Install 600 point Intents and Ping All test FAIL" ) |
| 2489 | |
| 2490 | def CASE91( self ): |
| 2491 | """ |
| 2492 | Install 600 point intents and verify ping all (Chordal Topology) |
| 2493 | """ |
| 2494 | main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" ) |
| 2495 | main.log.report( "_______________________________________" ) |
| 2496 | import itertools |
| 2497 | import time |
| 2498 | main.case( "Install 600 point intents" ) |
| 2499 | main.step( "Add point Intents" ) |
| 2500 | intentResult = main.TRUE |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2501 | deviceCombos = list( itertools.permutations( main.deviceDPIDs, 2 ) ) |
| 2502 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2503 | intentIdList = [] |
| 2504 | time1 = time.time() |
| 2505 | for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ): |
| 2506 | pool = [] |
| 2507 | for cli in main.CLIs: |
| 2508 | if i >= len( deviceCombos ): |
| 2509 | break |
| 2510 | t = main.Thread( target=cli.addPointIntent, |
| 2511 | threadID=main.threadID, |
| 2512 | name="addPointIntent", |
Hari Krishna | 55b171b | 2015-09-02 09:46:03 -0700 | [diff] [blame] | 2513 | 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] | 2514 | pool.append(t) |
| 2515 | #time.sleep(1) |
| 2516 | t.start() |
| 2517 | i = i + 1 |
| 2518 | main.threadID = main.threadID + 1 |
| 2519 | for thread in pool: |
| 2520 | thread.join() |
| 2521 | intentIdList.append(thread.result) |
| 2522 | time2 = time.time() |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 2523 | main.log.info( "Time for adding point intents: %2f seconds" %(time2-time1) ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2524 | intentResult = main.TRUE |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 2525 | intentsJson = main.ONOScli1.intents() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2526 | getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList, |
| 2527 | intentsJson = intentsJson) |
| 2528 | print getIntentStateResult |
| 2529 | # Takes awhile for all the onos to get the intents |
| 2530 | time.sleep(30) |
| 2531 | main.step( "Verify Ping across all hosts" ) |
| 2532 | pingResult = main.FALSE |
| 2533 | time1 = time.time() |
| 2534 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 2535 | time2 = time.time() |
| 2536 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2537 | main.log.report( |
| 2538 | "Time taken for Ping All: " + |
| 2539 | str( timeDiff ) + |
| 2540 | " seconds" ) |
| 2541 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2542 | onpass="PING ALL PASS", |
| 2543 | onfail="PING ALL FAIL" ) |
| 2544 | |
| 2545 | case91Result = ( intentResult and pingResult ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2546 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2547 | utilities.assert_equals( |
| 2548 | expect=main.TRUE, |
| 2549 | actual=case91Result, |
| 2550 | onpass="Install 600 point Intents and Ping All test PASS", |
| 2551 | onfail="Install 600 point Intents and Ping All test FAIL" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2552 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2553 | def CASE92( self ): |
| 2554 | """ |
| 2555 | Install 4556 point intents and verify ping all (Spine Topology) |
| 2556 | """ |
| 2557 | main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" ) |
| 2558 | main.log.report( "_______________________________________" ) |
| 2559 | import itertools |
| 2560 | import time |
| 2561 | main.case( "Install 4556 point intents" ) |
| 2562 | main.step( "Add point Intents" ) |
| 2563 | intentResult = main.TRUE |
| 2564 | main.pingTimeout = 600 |
| 2565 | for i in range(len(main.hostMACs)): |
| 2566 | main.MACsDict[main.deviceDPIDs[i+10]] = main.hostMACs[i].split('/')[0] |
| 2567 | print main.MACsDict |
| 2568 | deviceCombos = list( itertools.permutations( main.deviceDPIDs[10:], 2 ) ) |
| 2569 | intentIdList = [] |
| 2570 | time1 = time.time() |
| 2571 | for i in xrange( 0, len( deviceCombos ), int(main.numCtrls) ): |
| 2572 | pool = [] |
| 2573 | for cli in main.CLIs: |
| 2574 | if i >= len( deviceCombos ): |
| 2575 | break |
| 2576 | t = main.Thread( target=cli.addPointIntent, |
| 2577 | threadID=main.threadID, |
| 2578 | name="addPointIntent", |
Hari Krishna | 55b171b | 2015-09-02 09:46:03 -0700 | [diff] [blame] | 2579 | 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] | 2580 | pool.append(t) |
| 2581 | #time.sleep(1) |
| 2582 | t.start() |
| 2583 | i = i + 1 |
| 2584 | main.threadID = main.threadID + 1 |
| 2585 | for thread in pool: |
| 2586 | thread.join() |
| 2587 | intentIdList.append(thread.result) |
| 2588 | time2 = time.time() |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 2589 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2590 | intentResult = main.TRUE |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 2591 | intentsJson = main.ONOScli1.intents() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2592 | getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList, |
| 2593 | intentsJson = intentsJson) |
| 2594 | #print getIntentStateResult |
| 2595 | # Takes awhile for all the onos to get the intents |
| 2596 | time.sleep(60) |
| 2597 | main.step( "Verify Ping across all hosts" ) |
| 2598 | pingResult = main.FALSE |
| 2599 | time1 = time.time() |
| 2600 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 2601 | time2 = time.time() |
| 2602 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2603 | main.log.report( |
| 2604 | "Time taken for Ping All: " + |
| 2605 | str( timeDiff ) + |
| 2606 | " seconds" ) |
| 2607 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2608 | onpass="PING ALL PASS", |
| 2609 | onfail="PING ALL FAIL" ) |
| 2610 | |
| 2611 | case92Result = ( intentResult and pingResult ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2612 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2613 | utilities.assert_equals( |
| 2614 | expect=main.TRUE, |
| 2615 | actual=case92Result, |
| 2616 | onpass="Install 4556 point Intents and Ping All test PASS", |
| 2617 | onfail="Install 4556 point Intents and Ping All test FAIL" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2618 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2619 | def CASE93( self ): |
| 2620 | """ |
| 2621 | Install multi-single point intents and verify Ping all works |
| 2622 | for att topology |
| 2623 | """ |
| 2624 | import copy |
| 2625 | import time |
| 2626 | main.log.report( "Install multi-single point intents and verify Ping all" ) |
| 2627 | main.log.report( "___________________________________________" ) |
| 2628 | main.case( "Install multi-single point intents and Ping all" ) |
| 2629 | deviceDPIDsCopy = copy.copy(main.deviceDPIDs) |
| 2630 | portIngressList = ['1']*(len(deviceDPIDsCopy) - 1) |
| 2631 | intentIdList = [] |
| 2632 | print "MACsDict", main.MACsDict |
| 2633 | time1 = time.time() |
| 2634 | for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)): |
| 2635 | pool = [] |
| 2636 | for cli in main.CLIs: |
| 2637 | egressDevice = deviceDPIDsCopy[i] |
| 2638 | ingressDeviceList = copy.copy(deviceDPIDsCopy) |
| 2639 | ingressDeviceList.remove(egressDevice) |
| 2640 | if i >= len( deviceDPIDsCopy ): |
| 2641 | break |
| 2642 | t = main.Thread( target=cli.addMultipointToSinglepointIntent, |
| 2643 | threadID=main.threadID, |
| 2644 | name="addMultipointToSinglepointIntent", |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2645 | args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)]) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2646 | pool.append(t) |
| 2647 | #time.sleep(1) |
| 2648 | t.start() |
| 2649 | i = i + 1 |
| 2650 | main.threadID = main.threadID + 1 |
| 2651 | for thread in pool: |
| 2652 | thread.join() |
| 2653 | intentIdList.append(thread.result) |
| 2654 | time2 = time.time() |
| 2655 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
| 2656 | time.sleep(30) |
| 2657 | print "getting all intents ID" |
| 2658 | intentIdTemp = main.ONOScli1.getAllIntentsId() |
| 2659 | print intentIdTemp |
| 2660 | print len(intentIdList) |
| 2661 | print intentIdList |
| 2662 | checkIntentStateResult = main.TRUE |
| 2663 | print "Checking intents state" |
| 2664 | checkIntentStateResult = main.ONOScli1.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult |
| 2665 | checkIntentStateResult = main.ONOScli2.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult |
| 2666 | checkIntentStateResult = main.ONOScli3.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult |
| 2667 | checkIntentStateResult = main.ONOScli4.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult |
| 2668 | checkIntentStateResult = main.ONOScli5.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2669 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2670 | if checkIntentStateResult: |
| 2671 | main.log.info( "All intents are installed correctly " ) |
| 2672 | |
| 2673 | print "Checking flows state " |
| 2674 | checkFlowsState = main.ONOScli1.checkFlowsState() |
| 2675 | time.sleep(50) |
| 2676 | main.step( "Verify Ping across all hosts" ) |
| 2677 | pingResult = main.FALSE |
| 2678 | time1 = time.time() |
| 2679 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 2680 | time2 = time.time() |
| 2681 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2682 | main.log.report( |
| 2683 | "Time taken for Ping All: " + |
| 2684 | str( timeDiff ) + |
| 2685 | " seconds" ) |
| 2686 | checkFlowsState = main.ONOScli1.checkFlowsState() |
| 2687 | case93Result = pingResult |
| 2688 | utilities.assert_equals( |
| 2689 | expect=main.TRUE, |
| 2690 | actual=case93Result, |
| 2691 | onpass="Install 25 multi to single point Intents and Ping All test PASS", |
| 2692 | 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] | 2693 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2694 | def CASE94( self ): |
| 2695 | """ |
| 2696 | Install multi-single point intents and verify Ping all works |
| 2697 | for Chordal topology |
| 2698 | """ |
| 2699 | import copy |
| 2700 | import time |
| 2701 | main.log.report( "Install multi-single point intents and verify Ping all" ) |
| 2702 | main.log.report( "___________________________________________" ) |
| 2703 | main.case( "Install multi-single point intents and Ping all" ) |
| 2704 | deviceDPIDsCopy = copy.copy(main.deviceDPIDs) |
| 2705 | portIngressList = ['1']*(len(deviceDPIDsCopy) - 1) |
| 2706 | intentIdList = [] |
| 2707 | print "MACsDict", main.MACsDict |
| 2708 | time1 = time.time() |
| 2709 | for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)): |
| 2710 | pool = [] |
| 2711 | for cli in main.CLIs: |
| 2712 | egressDevice = deviceDPIDsCopy[i] |
| 2713 | ingressDeviceList = copy.copy(deviceDPIDsCopy) |
| 2714 | ingressDeviceList.remove(egressDevice) |
| 2715 | if i >= len( deviceDPIDsCopy ): |
| 2716 | break |
| 2717 | t = main.Thread( target=cli.addMultipointToSinglepointIntent, |
| 2718 | threadID=main.threadID, |
| 2719 | name="addMultipointToSinglepointIntent", |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2720 | args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)]) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2721 | pool.append(t) |
| 2722 | #time.sleep(1) |
| 2723 | t.start() |
| 2724 | i = i + 1 |
| 2725 | main.threadID = main.threadID + 1 |
| 2726 | for thread in pool: |
| 2727 | thread.join() |
| 2728 | intentIdList.append(thread.result) |
| 2729 | time2 = time.time() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2730 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2731 | time.sleep(5) |
| 2732 | main.step( "Verify Ping across all hosts" ) |
| 2733 | pingResult = main.FALSE |
| 2734 | time1 = time.time() |
| 2735 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 2736 | time2 = time.time() |
| 2737 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2738 | main.log.report( |
| 2739 | "Time taken for Ping All: " + |
| 2740 | str( timeDiff ) + |
| 2741 | " seconds" ) |
| 2742 | |
| 2743 | case94Result = pingResult |
| 2744 | utilities.assert_equals( |
| 2745 | expect=main.TRUE, |
| 2746 | actual=case94Result, |
| 2747 | onpass="Install 25 multi to single point Intents and Ping All test PASS", |
| 2748 | 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] | 2749 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2750 | #def CASE95 multi-single point intent for Spine |
| 2751 | |
| 2752 | def CASE96( self ): |
| 2753 | """ |
| 2754 | Install single-multi point intents and verify Ping all works |
| 2755 | for att topology |
| 2756 | """ |
| 2757 | import copy |
| 2758 | main.log.report( "Install single-multi point intents and verify Ping all" ) |
| 2759 | main.log.report( "___________________________________________" ) |
| 2760 | main.case( "Install single-multi point intents and Ping all" ) |
| 2761 | deviceDPIDsCopy = copy.copy(main.deviceDPIDs) |
| 2762 | portEgressList = ['1']*(len(deviceDPIDsCopy) - 1) |
| 2763 | intentIdList = [] |
| 2764 | print "MACsDict", main.MACsDict |
| 2765 | time1 = time.time() |
| 2766 | for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)): |
| 2767 | pool = [] |
| 2768 | for cli in main.CLIs: |
| 2769 | ingressDevice = deviceDPIDsCopy[i] |
| 2770 | egressDeviceList = copy.copy(deviceDPIDsCopy) |
| 2771 | egressDeviceList.remove(ingressDevice) |
| 2772 | if i >= len( deviceDPIDsCopy ): |
| 2773 | break |
| 2774 | t = main.Thread( target=cli.addSinglepointToMultipointIntent, |
| 2775 | threadID=main.threadID, |
| 2776 | name="addSinglepointToMultipointIntent", |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2777 | args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice)]) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2778 | pool.append(t) |
| 2779 | #time.sleep(1) |
| 2780 | t.start() |
| 2781 | i = i + 1 |
| 2782 | main.threadID = main.threadID + 1 |
| 2783 | for thread in pool: |
| 2784 | thread.join() |
| 2785 | intentIdList.append(thread.result) |
| 2786 | time2 = time.time() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2787 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2788 | time.sleep(5) |
| 2789 | main.step( "Verify Ping across all hosts" ) |
| 2790 | pingResult = main.FALSE |
| 2791 | time1 = time.time() |
| 2792 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 2793 | time2 = time.time() |
| 2794 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2795 | main.log.report( |
| 2796 | "Time taken for Ping All: " + |
| 2797 | str( timeDiff ) + |
| 2798 | " seconds" ) |
| 2799 | |
| 2800 | case96Result = pingResult |
| 2801 | utilities.assert_equals( |
| 2802 | expect=main.TRUE, |
| 2803 | actual=case96Result, |
| 2804 | onpass="Install 25 single to multi point Intents and Ping All test PASS", |
| 2805 | onfail="Install 25 single to multi point Intents and Ping All test FAIL" ) |
| 2806 | |
| 2807 | def CASE97( self ): |
| 2808 | """ |
| 2809 | Install single-multi point intents and verify Ping all works |
| 2810 | for Chordal topology |
| 2811 | """ |
| 2812 | import copy |
| 2813 | main.log.report( "Install single-multi point intents and verify Ping all" ) |
| 2814 | main.log.report( "___________________________________________" ) |
| 2815 | main.case( "Install single-multi point intents and Ping all" ) |
| 2816 | deviceDPIDsCopy = copy.copy(main.deviceDPIDs) |
| 2817 | portEgressList = ['1']*(len(deviceDPIDsCopy) - 1) |
| 2818 | intentIdList = [] |
| 2819 | print "MACsDict", main.MACsDict |
| 2820 | time1 = time.time() |
| 2821 | for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)): |
| 2822 | pool = [] |
| 2823 | for cli in main.CLIs: |
| 2824 | ingressDevice = deviceDPIDsCopy[i] |
| 2825 | egressDeviceList = copy.copy(deviceDPIDsCopy) |
| 2826 | egressDeviceList.remove(ingressDevice) |
| 2827 | if i >= len( deviceDPIDsCopy ): |
| 2828 | break |
| 2829 | t = main.Thread( target=cli.addSinglepointToMultipointIntent, |
| 2830 | threadID=main.threadID, |
| 2831 | name="addSinglepointToMultipointIntent", |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2832 | args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice),'']) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2833 | pool.append(t) |
| 2834 | #time.sleep(1) |
| 2835 | t.start() |
| 2836 | i = i + 1 |
| 2837 | main.threadID = main.threadID + 1 |
| 2838 | for thread in pool: |
| 2839 | thread.join() |
| 2840 | intentIdList.append(thread.result) |
| 2841 | time2 = time.time() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2842 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2843 | time.sleep(5) |
| 2844 | main.step( "Verify Ping across all hosts" ) |
| 2845 | pingResult = main.FALSE |
| 2846 | time1 = time.time() |
| 2847 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 2848 | time2 = time.time() |
| 2849 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2850 | main.log.report( |
| 2851 | "Time taken for Ping All: " + |
| 2852 | str( timeDiff ) + |
| 2853 | " seconds" ) |
| 2854 | |
| 2855 | case97Result = pingResult |
| 2856 | utilities.assert_equals( |
| 2857 | expect=main.TRUE, |
| 2858 | actual=case97Result, |
| 2859 | onpass="Install 25 single to multi point Intents and Ping All test PASS", |
| 2860 | onfail="Install 25 single to multi point Intents and Ping All test FAIL" ) |
| 2861 | |
| 2862 | def CASE98( self ): |
| 2863 | """ |
| 2864 | Install single-multi point intents and verify Ping all works |
| 2865 | for Spine topology |
| 2866 | """ |
| 2867 | import copy |
| 2868 | main.log.report( "Install single-multi point intents and verify Ping all" ) |
| 2869 | main.log.report( "___________________________________________" ) |
| 2870 | main.case( "Install single-multi point intents and Ping all" ) |
| 2871 | deviceDPIDsCopy = copy.copy( main.deviceDPIDs ) |
| 2872 | deviceDPIDsCopy = deviceDPIDsCopy[ 10: ] |
| 2873 | portEgressList = [ '1' ]*(len(deviceDPIDsCopy) - 1) |
| 2874 | intentIdList = [] |
| 2875 | MACsDictCopy = {} |
| 2876 | for i in range( len( deviceDPIDsCopy ) ): |
| 2877 | MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[i].split( '/' )[ 0 ] |
| 2878 | |
| 2879 | print "deviceDPIDsCopy", deviceDPIDsCopy |
| 2880 | print "" |
| 2881 | print "MACsDictCopy", MACsDictCopy |
| 2882 | time1 = time.time() |
| 2883 | for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)): |
| 2884 | pool = [] |
| 2885 | for cli in main.CLIs: |
| 2886 | if i >= len( deviceDPIDsCopy ): |
| 2887 | break |
| 2888 | ingressDevice = deviceDPIDsCopy[i] |
| 2889 | egressDeviceList = copy.copy(deviceDPIDsCopy) |
| 2890 | egressDeviceList.remove(ingressDevice) |
| 2891 | t = main.Thread( target=cli.addSinglepointToMultipointIntent, |
| 2892 | threadID=main.threadID, |
| 2893 | name="addSinglepointToMultipointIntent", |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2894 | args =[ingressDevice,egressDeviceList,'1',portEgressList,'',MACsDictCopy.get(ingressDevice),'']) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2895 | pool.append(t) |
| 2896 | #time.sleep(1) |
| 2897 | t.start() |
| 2898 | i = i + 1 |
| 2899 | main.threadID = main.threadID + 1 |
| 2900 | for thread in pool: |
| 2901 | thread.join() |
| 2902 | intentIdList.append(thread.result) |
| 2903 | time2 = time.time() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 2904 | main.log.info("Time for adding point intents: %2f seconds" %(time2-time1)) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 2905 | time.sleep(5) |
| 2906 | main.step( "Verify Ping across all hosts" ) |
| 2907 | pingResult = main.FALSE |
| 2908 | time1 = time.time() |
| 2909 | pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5) |
| 2910 | time2 = time.time() |
| 2911 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2912 | main.log.report( |
| 2913 | "Time taken for Ping All: " + |
| 2914 | str( timeDiff ) + |
| 2915 | " seconds" ) |
| 2916 | |
| 2917 | case98Result = pingResult |
| 2918 | utilities.assert_equals( |
| 2919 | expect=main.TRUE, |
| 2920 | actual=case98Result, |
| 2921 | onpass="Install 25 single to multi point Intents and Ping All test PASS", |
| 2922 | onfail="Install 25 single to multi point Intents and Ping All test FAIL" ) |
| 2923 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2924 | def CASE190( self ): |
| 2925 | """ |
| 2926 | Verify IPv6 ping across 600 Point intents (Att Topology) |
| 2927 | """ |
| 2928 | main.log.report( "Verify IPv6 ping across 600 Point intents (Att Topology)" ) |
| 2929 | main.log.report( "_________________________________________________" ) |
| 2930 | import itertools |
| 2931 | import time |
| 2932 | main.case( "IPv6 ping all 600 Point intents" ) |
| 2933 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2934 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2935 | pingResult = main.FALSE |
| 2936 | time1 = time.time() |
| 2937 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2938 | if not pingResult: |
| 2939 | main.log.warn("Failed to ping Ipv6 hosts. Retrying...") |
| 2940 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
| 2941 | |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2942 | time2 = time.time() |
| 2943 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2944 | main.log.report( |
| 2945 | "Time taken for IPv6 Ping All: " + |
| 2946 | str( timeDiff ) + |
| 2947 | " seconds" ) |
| 2948 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2949 | onpass="PING ALL PASS", |
| 2950 | onfail="PING ALL FAIL" ) |
| 2951 | |
| 2952 | case160Result = pingResult |
| 2953 | utilities.assert_equals( |
| 2954 | expect=main.TRUE, |
| 2955 | actual=case160Result, |
| 2956 | onpass="IPv6 Ping across 600 Point intents test PASS", |
| 2957 | onfail="IPv6 Ping across 600 Point intents test FAIL" ) |
| 2958 | |
| 2959 | def CASE191( self ): |
| 2960 | """ |
| 2961 | Verify IPv6 ping across 600 Point intents (Chordal Topology) |
| 2962 | """ |
| 2963 | main.log.report( "Verify IPv6 ping across 600 Point intents (Chordal Topology)" ) |
| 2964 | main.log.report( "_________________________________________________" ) |
| 2965 | import itertools |
| 2966 | import time |
| 2967 | main.case( "IPv6 ping all 600 Point intents" ) |
| 2968 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 2969 | hostList = [ ('h'+ str(x + 1)) for x in range (main.numMNhosts) ] |
| 2970 | pingResult = main.FALSE |
| 2971 | time1 = time.time() |
| 2972 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 2973 | if not pingResult: |
| 2974 | main.log.warn("Failed to ping Ipv6 hosts. Retrying...") |
| 2975 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 2976 | time2 = time.time() |
| 2977 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 2978 | main.log.report( |
| 2979 | "Time taken for IPv6 Ping All: " + |
| 2980 | str( timeDiff ) + |
| 2981 | " seconds" ) |
| 2982 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 2983 | onpass="PING ALL PASS", |
| 2984 | onfail="PING ALL FAIL" ) |
| 2985 | |
| 2986 | case191Result = pingResult |
| 2987 | utilities.assert_equals( |
| 2988 | expect=main.TRUE, |
| 2989 | actual=case191Result, |
| 2990 | onpass="IPv6 Ping across 600 Point intents test PASS", |
| 2991 | onfail="IPv6 Ping across 600 Point intents test FAIL" ) |
| 2992 | |
| 2993 | def CASE192( self ): |
| 2994 | """ |
| 2995 | Verify IPv6 ping across 4556 Point intents (Spine Topology) |
| 2996 | """ |
| 2997 | main.log.report( "Verify IPv6 ping across 4556 Point intents (Spine Topology)" ) |
| 2998 | main.log.report( "_________________________________________________" ) |
| 2999 | import itertools |
| 3000 | import time |
Hari Krishna | 310efca | 2015-09-03 09:43:16 -0700 | [diff] [blame] | 3001 | main.case( "IPv6 ping all 4556 Point intents" ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3002 | main.step( "Verify IPv6 Ping across all hosts" ) |
| 3003 | hostList = [ ('h'+ str(x + 11)) for x in range (main.numMNhosts) ] |
| 3004 | pingResult = main.FALSE |
| 3005 | time1 = time.time() |
| 3006 | pingResult = main.Mininet1.pingIpv6Hosts( hostList, prefix='1000::' ) |
| 3007 | time2 = time.time() |
| 3008 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 3009 | main.log.report( |
| 3010 | "Time taken for IPv6 Ping All: " + |
| 3011 | str( timeDiff ) + |
| 3012 | " seconds" ) |
| 3013 | utilities.assert_equals( expect=main.TRUE, actual=pingResult, |
| 3014 | onpass="PING ALL PASS", |
| 3015 | onfail="PING ALL FAIL" ) |
| 3016 | |
| 3017 | case192Result = pingResult |
| 3018 | utilities.assert_equals( |
| 3019 | expect=main.TRUE, |
| 3020 | actual=case192Result, |
Hari Krishna | 310efca | 2015-09-03 09:43:16 -0700 | [diff] [blame] | 3021 | onpass="IPv6 Ping across 4556 Point intents test PASS", |
| 3022 | onfail="IPv6 Ping across 4556 Point intents test FAIL" ) |
Hari Krishna | 4223dbd | 2015-08-13 16:29:53 -0700 | [diff] [blame] | 3023 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3024 | def CASE10( self ): |
| 3025 | import time |
GlennRC | c6cd2a6 | 2015-08-10 16:08:22 -0700 | [diff] [blame] | 3026 | import re |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3027 | """ |
| 3028 | Remove all Intents |
| 3029 | """ |
| 3030 | main.log.report( "Remove all intents that were installed previously" ) |
| 3031 | main.log.report( "______________________________________________" ) |
| 3032 | main.log.info( "Remove all intents" ) |
| 3033 | main.case( "Removing intents" ) |
Hari Krishna | ad0c520 | 2015-09-01 14:26:49 -0700 | [diff] [blame] | 3034 | purgeDelay = int( main.params[ "timers" ][ "IntentPurgeDelay" ] ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3035 | main.step( "Obtain the intent id's first" ) |
| 3036 | intentsList = main.ONOScli1.getAllIntentIds() |
| 3037 | ansi_escape = re.compile( r'\x1b[^m]*m' ) |
| 3038 | intentsList = ansi_escape.sub( '', intentsList ) |
| 3039 | intentsList = intentsList.replace( |
| 3040 | " onos:intents | grep id=", |
| 3041 | "" ).replace( |
| 3042 | "id=", |
| 3043 | "" ).replace( |
| 3044 | "\r\r", |
| 3045 | "" ) |
| 3046 | intentsList = intentsList.splitlines() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3047 | intentIdList = [] |
| 3048 | step1Result = main.TRUE |
| 3049 | moreIntents = main.TRUE |
| 3050 | removeIntentCount = 0 |
| 3051 | intentsCount = len(intentsList) |
| 3052 | main.log.info ( "Current number of intents: " + str(intentsCount) ) |
| 3053 | if ( len( intentsList ) > 1 ): |
| 3054 | results = main.TRUE |
| 3055 | main.log.info("Removing intent...") |
| 3056 | while moreIntents: |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 3057 | # 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] | 3058 | if removeIntentCount == 5: |
| 3059 | break |
| 3060 | removeIntentCount = removeIntentCount + 1 |
| 3061 | intentsList1 = main.ONOScli1.getAllIntentIds() |
| 3062 | if len( intentsList1 ) == 0: |
| 3063 | break |
| 3064 | ansi_escape = re.compile( r'\x1b[^m]*m' ) |
| 3065 | intentsList1 = ansi_escape.sub( '', intentsList1 ) |
| 3066 | intentsList1 = intentsList1.replace( |
| 3067 | " onos:intents | grep id=", |
| 3068 | "" ).replace( |
| 3069 | " state=", |
| 3070 | "" ).replace( |
| 3071 | "\r\r", |
| 3072 | "" ) |
| 3073 | intentsList1 = intentsList1.splitlines() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3074 | main.log.info ( "Round %d intents to remove: " %(removeIntentCount) ) |
| 3075 | print intentsList1 |
| 3076 | intentIdList1 = [] |
| 3077 | if ( len( intentsList1 ) > 0 ): |
| 3078 | moreIntents = main.TRUE |
| 3079 | for i in range( len( intentsList1 ) ): |
| 3080 | intentsTemp1 = intentsList1[ i ].split( ',' ) |
| 3081 | intentIdList1.append( intentsTemp1[ 0 ].split('=')[1] ) |
| 3082 | main.log.info ( "Leftover Intent IDs: " + str(intentIdList1) ) |
| 3083 | main.log.info ( "Length of Leftover Intents list: " + str(len(intentIdList1)) ) |
| 3084 | time1 = time.time() |
| 3085 | for i in xrange( 0, len( intentIdList1 ), int(main.numCtrls) ): |
| 3086 | pool = [] |
| 3087 | for cli in main.CLIs: |
| 3088 | if i >= len( intentIdList1 ): |
| 3089 | break |
| 3090 | t = main.Thread( target=cli.removeIntent, |
| 3091 | threadID=main.threadID, |
| 3092 | name="removeIntent", |
| 3093 | args=[intentIdList1[i],'org.onosproject.cli',False,False]) |
| 3094 | pool.append(t) |
| 3095 | t.start() |
| 3096 | i = i + 1 |
| 3097 | main.threadID = main.threadID + 1 |
| 3098 | for thread in pool: |
| 3099 | thread.join() |
| 3100 | intentIdList.append(thread.result) |
| 3101 | #time.sleep(2) |
| 3102 | time2 = time.time() |
| 3103 | main.log.info("Time for removing host intents: %2f seconds" %(time2-time1)) |
Hari Krishna | ad0c520 | 2015-09-01 14:26:49 -0700 | [diff] [blame] | 3104 | time.sleep( purgeDelay ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3105 | main.log.info("Purging WITHDRAWN Intents") |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 3106 | purgeResult = main.ONOScli1.purgeWithdrawnIntents() |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3107 | else: |
| 3108 | time.sleep(10) |
| 3109 | if len( main.ONOScli1.intents()): |
| 3110 | continue |
| 3111 | break |
Hari Krishna | ad0c520 | 2015-09-01 14:26:49 -0700 | [diff] [blame] | 3112 | time.sleep( purgeDelay ) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3113 | else: |
| 3114 | print "Removed %d intents" %(intentsCount) |
| 3115 | step1Result = main.TRUE |
| 3116 | else: |
| 3117 | print "No Intent IDs found in Intents list: ", intentsList |
| 3118 | step1Result = main.FALSE |
| 3119 | |
| 3120 | print main.ONOScli1.intents() |
| 3121 | caseResult10 = step1Result |
| 3122 | utilities.assert_equals( expect=main.TRUE, actual=caseResult10, |
| 3123 | onpass="Intent removal test successful", |
| 3124 | onfail="Intent removal test failed" ) |
| 3125 | |
| 3126 | def CASE12( self, main ): |
| 3127 | """ |
| 3128 | Enable onos-app-ifwd, Verify Intent based Reactive forwarding through ping all and Disable it |
| 3129 | """ |
| 3130 | import re |
| 3131 | import copy |
| 3132 | import time |
| 3133 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3134 | threadID = 0 |
| 3135 | |
| 3136 | main.log.report( "Enable Intent based Reactive forwarding and Verify ping all" ) |
| 3137 | main.log.report( "_____________________________________________________" ) |
| 3138 | main.case( "Enable Intent based Reactive forwarding and Verify ping all" ) |
| 3139 | main.step( "Enable intent based Reactive forwarding" ) |
| 3140 | installResult = main.FALSE |
| 3141 | feature = "onos-app-ifwd" |
Hari Krishna | 6185fc1 | 2015-07-13 15:42:31 -0700 | [diff] [blame] | 3142 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3143 | pool = [] |
| 3144 | time1 = time.time() |
| 3145 | for cli,feature in main.CLIs: |
| 3146 | t = main.Thread(target=cli,threadID=threadID, |
| 3147 | name="featureInstall",args=[feature]) |
| 3148 | pool.append(t) |
| 3149 | t.start() |
| 3150 | threadID = threadID + 1 |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3151 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3152 | results = [] |
| 3153 | for thread in pool: |
| 3154 | thread.join() |
| 3155 | results.append(thread.result) |
| 3156 | time2 = time.time() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3157 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3158 | if( all(result == main.TRUE for result in results) == False): |
| 3159 | main.log.info("Did not install onos-app-ifwd feature properly") |
| 3160 | #main.cleanup() |
| 3161 | #main.exit() |
| 3162 | else: |
| 3163 | main.log.info("Successful feature:install onos-app-ifwd") |
| 3164 | installResult = main.TRUE |
| 3165 | 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] | 3166 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3167 | main.step( "Verify Pingall" ) |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 3168 | pingResult = main.FALSE |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3169 | time1 = time.time() |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 3170 | pingResult = main.Mininet1.pingall(timeout=600) |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3171 | time2 = time.time() |
| 3172 | timeDiff = round( ( time2 - time1 ), 2 ) |
| 3173 | main.log.report( |
| 3174 | "Time taken for Ping All: " + |
| 3175 | str( timeDiff ) + |
| 3176 | " seconds" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3177 | |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 3178 | if pingResult == main.TRUE: |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3179 | main.log.report( "Pingall Test in Reactive mode successful" ) |
| 3180 | else: |
| 3181 | main.log.report( "Pingall Test in Reactive mode failed" ) |
| 3182 | |
| 3183 | main.step( "Disable Intent based Reactive forwarding" ) |
| 3184 | uninstallResult = main.FALSE |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3185 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3186 | pool = [] |
| 3187 | time1 = time.time() |
| 3188 | for cli,feature in main.CLIs: |
| 3189 | t = main.Thread(target=cli,threadID=threadID, |
| 3190 | name="featureUninstall",args=[feature]) |
| 3191 | pool.append(t) |
| 3192 | t.start() |
| 3193 | threadID = threadID + 1 |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3194 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3195 | results = [] |
| 3196 | for thread in pool: |
| 3197 | thread.join() |
| 3198 | results.append(thread.result) |
| 3199 | time2 = time.time() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 3200 | |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3201 | if( all(result == main.TRUE for result in results) == False): |
| 3202 | main.log.info("Did not uninstall onos-app-ifwd feature properly") |
| 3203 | uninstallResult = main.FALSE |
| 3204 | #main.cleanup() |
| 3205 | #main.exit() |
| 3206 | else: |
| 3207 | main.log.info("Successful feature:uninstall onos-app-ifwd") |
| 3208 | uninstallResult = main.TRUE |
| 3209 | main.log.info("Time for feature:uninstall onos-app-ifwd: %2f seconds" %(time2-time1)) |
| 3210 | |
| 3211 | # Waiting for reative flows to be cleared. |
| 3212 | time.sleep( 10 ) |
| 3213 | |
GlennRC | 626ba13 | 2015-09-18 16:16:31 -0700 | [diff] [blame] | 3214 | case11Result = installResult and pingResult and uninstallResult |
Hari Krishna | c195f3b | 2015-07-08 20:02:24 -0700 | [diff] [blame] | 3215 | utilities.assert_equals( expect=main.TRUE, actual=case11Result, |
| 3216 | onpass="Intent based Reactive forwarding Pingall test PASS", |
| 3217 | onfail="Intent based Reactive forwarding Pingall test FAIL" ) |