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