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