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