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