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