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