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