blob: 847e543937a353401ea02d5d2f9d52cf451a047e [file] [log] [blame]
Hari Krishnac195f3b2015-07-08 20:02:24 -07001import sys
2import os
3import re
4import time
5import json
6import itertools
7
8
Hari Krishna6185fc12015-07-13 15:42:31 -07009class CHOtest:
Hari Krishnac195f3b2015-07-08 20:02:24 -070010
11 def __init__( self ):
12 self.default = ''
13
14 def CASE1( self, main ):
15 """
16 Startup sequence:
Hari Krishna6185fc12015-07-13 15:42:31 -070017 apply cell <name>
Hari Krishnac195f3b2015-07-08 20:02:24 -070018 git pull
Hari Krishnac195f3b2015-07-08 20:02:24 -070019 onos-package
Hari Krishnac195f3b2015-07-08 20:02:24 -070020 onos-verify-cell
21 onos-uninstall
Hari Krishna6185fc12015-07-13 15:42:31 -070022 onos-install
Hari Krishnac195f3b2015-07-08 20:02:24 -070023 onos-start-cli
24 """
25 import time
You Wangb6586542016-02-26 09:25:56 -080026 import re
27 import imp
Hari Krishnac195f3b2015-07-08 20:02:24 -070028
29 global intentState
Devin Lim58046fa2017-07-05 16:55:00 -070030 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 Krishnac195f3b2015-07-08 20:02:24 -070037
Devin Lim58046fa2017-07-05 16:55:00 -070038 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 = ""
GlennRC9e7465e2015-10-02 13:50:36 -070061
Devin Lim58046fa2017-07-05 16:55:00 -070062 main.failSwitch = True if main.failSwitch == "on" else False
63 main.emailOnStop = True if main.emailOnStop == "on" else False
Hari Krishnac195f3b2015-07-08 20:02:24 -070064
Devin Lim58046fa2017-07-05 16:55:00 -070065 main.CHOtestFunctions = imp.load_source( wrapperFile,
66 main.dependencyPath +
67 wrapperFile +
68 ".py" )
You Wangb6586542016-02-26 09:25:56 -080069
Devin Lim58046fa2017-07-05 16:55:00 -070070 stepResult = main.testSetUp.envSetup()
71 except Exception as e:
72 main.testSetUp.envSetupException( e )
Hari Krishnac195f3b2015-07-08 20:02:24 -070073
Devin Lim58046fa2017-07-05 16:55:00 -070074 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>")
GlennRCef344fc2015-12-11 17:56:57 -080079 main.cleanup()
Hari Krishna6185fc12015-07-13 15:42:31 -070080 main.exit()
81
Devin Lim58046fa2017-07-05 16:55:00 -070082 setupResult = main.testSetUp.ONOSSetUp( Mininet=main.Mininet1, newCell=False, cellName=main.onoscell )
Hari Krishna4223dbd2015-08-13 16:29:53 -070083
84 main.step( "Set IPv6 cfg parameters for Neighbor Discovery" )
Jon Hallef0e2a12017-05-24 16:57:53 -070085 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 Krishna4223dbd2015-08-13 16:29:53 -070088 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 Lim58046fa2017-07-05 16:55:00 -070093 case1Result = setupResult and cfgResult
94 main.log.info( "Time for connecting to CLI: %2f seconds" % ( time.time() - time1 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -070095 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 Hallef0e2a12017-05-24 16:57:53 -0700101 This test script Loads a new Topology ( Att ) on CHO setup and balances all switches
Hari Krishnac195f3b2015-07-08 20:02:24 -0700102 """
103 import re
104 import time
105 import copy
106
GlennRC3de72232015-12-16 10:48:35 -0800107 main.prefix = 0
Jon Hallef0e2a12017-05-24 16:57:53 -0700108 main.numMNswitches = int( main.params[ 'TOPO1' ][ 'numSwitches' ] )
109 main.numMNlinks = int( main.params[ 'TOPO1' ][ 'numLinks' ] )
110 main.numMNhosts = int( main.params[ 'TOPO1' ][ 'numHosts' ] )
You Wangb6586542016-02-26 09:25:56 -0800111 main.pingTimeout = main.pingTimeoutSmallTopo
112
Hari Krishnac195f3b2015-07-08 20:02:24 -0700113 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 Hall4ba53f02015-07-29 13:07:41 -0700119
Hari Krishnac195f3b2015-07-08 20:02:24 -0700120 main.step( "Start Mininet with Att topology" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700121 main.newTopo = main.params[ 'TOPO1' ][ 'topo' ]
GlennRCc6cd2a62015-08-10 16:08:22 -0700122 mininetDir = main.Mininet1.home + "/custom/"
Devin Lim58046fa2017-07-05 16:55:00 -0700123 topoPath = main.dependencyPath + main.newTopo
Jon Hallef0e2a12017-05-24 16:57:53 -0700124 main.ONOSbench.secureCopy( main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700125 topoPath = mininetDir + main.newTopo
Jon Hallef0e2a12017-05-24 16:57:53 -0700126 startStatus = main.Mininet1.startNet( topoFile=topoPath )
Jon Hall4ba53f02015-07-29 13:07:41 -0700127
Hari Krishnac195f3b2015-07-08 20:02:24 -0700128 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 Lim58046fa2017-07-05 16:55:00 -0700132 ip=main.ONOSip )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700133
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 Lim58046fa2017-07-05 16:55:00 -0700138 if re.search( "tcp:" + main.ONOSip[ 0 ], response ):
Hari Krishnac195f3b2015-07-08 20:02:24 -0700139 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 Hallef0e2a12017-05-24 16:57:53 -0700148 time.sleep( 30 ) # waiting here to make sure topology converges across all nodes
Hari Krishnac195f3b2015-07-08 20:02:24 -0700149
150 main.step( "Balance devices across controllers" )
151 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700152 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700153 time.sleep( 5 )
154
155 topology_output = main.ONOScli1.topology()
You Wang24139872016-05-03 11:48:47 -0700156 topology_result = main.ONOScli1.getTopology( topology_output )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700157 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 Hallef0e2a12017-05-24 16:57:53 -0700166 This test script Loads a new Topology ( Chordal ) on CHO setup and balances all switches
Hari Krishnac195f3b2015-07-08 20:02:24 -0700167 """
168 import re
169 import time
170 import copy
171
GlennRC3de72232015-12-16 10:48:35 -0800172 main.prefix = 1
Jon Hallef0e2a12017-05-24 16:57:53 -0700173 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 Wangb6586542016-02-26 09:25:56 -0800177 main.pingTimeout = main.pingTimeoutSmallTopo
178
Hari Krishnac195f3b2015-07-08 20:02:24 -0700179 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 Hallef0e2a12017-05-24 16:57:53 -0700186 main.step( "Start Mininet with Chordal topology" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700187 mininetDir = main.Mininet1.home + "/custom/"
Devin Lim58046fa2017-07-05 16:55:00 -0700188 topoPath = main.dependencyPath + main.newTopo
Jon Hallef0e2a12017-05-24 16:57:53 -0700189 main.ONOSbench.secureCopy( main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700190 topoPath = mininetDir + main.newTopo
Jon Hallef0e2a12017-05-24 16:57:53 -0700191 startStatus = main.Mininet1.startNet( topoFile=topoPath )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700192
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 Lim58046fa2017-07-05 16:55:00 -0700198 ip=main.ONOSip )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700199
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 Lim58046fa2017-07-05 16:55:00 -0700204 if re.search( "tcp:" + main.ONOSip[ 0 ], response ):
Hari Krishnac195f3b2015-07-08 20:02:24 -0700205 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 Hall4ba53f02015-07-29 13:07:41 -0700213
Hari Krishnac195f3b2015-07-08 20:02:24 -0700214 main.step( "Balance devices across controllers" )
215 balanceResult = main.ONOScli1.balanceMasters()
Jon Hall4ba53f02015-07-29 13:07:41 -0700216 # giving some breathing time for ONOS to complete re-balance
Hari Krishnac195f3b2015-07-08 20:02:24 -0700217 time.sleep( 5 )
218
GlennRCbddd58f2015-10-01 15:45:25 -0700219 caseResult = switch_mastership
Jon Hallef0e2a12017-05-24 16:57:53 -0700220 time.sleep( 30 )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700221 utilities.assert_equals(
222 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700223 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700224 onpass="Starting new Chordal topology test PASS",
225 onfail="Starting new Chordal topology test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700226
Hari Krishnac195f3b2015-07-08 20:02:24 -0700227 def CASE22( self, main ):
228 """
Jon Hallef0e2a12017-05-24 16:57:53 -0700229 This test script Loads a new Topology ( Spine ) on CHO setup and balances all switches
Hari Krishnac195f3b2015-07-08 20:02:24 -0700230 """
231 import re
232 import time
233 import copy
234
GlennRC3de72232015-12-16 10:48:35 -0800235 main.prefix = 2
Jon Hallef0e2a12017-05-24 16:57:53 -0700236 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 Wangb6586542016-02-26 09:25:56 -0800240 main.pingTimeout = main.pingTimeoutLargeTopo
Jon Hall4ba53f02015-07-29 13:07:41 -0700241
Hari Krishnac195f3b2015-07-08 20:02:24 -0700242 main.log.report(
243 "Load Spine and Leaf topology and Balance all Mininet switches across controllers" )
244 main.log.report(
245 "________________________________________________________________________" )
GlennRC20fc6522015-12-23 23:26:57 -0800246 main.case( "Assign and Balance all Mininet switches across controllers" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700247
Jon Hallef0e2a12017-05-24 16:57:53 -0700248 main.step( "Start Mininet with Spine topology" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700249 mininetDir = main.Mininet1.home + "/custom/"
Devin Lim58046fa2017-07-05 16:55:00 -0700250 topoPath = main.dependencyPath + main.newTopo
Jon Hallef0e2a12017-05-24 16:57:53 -0700251 main.ONOSbench.secureCopy( main.Mininet1.user_name, main.Mininet1.ip_address, topoPath, mininetDir, direction="to" )
GlennRCc6cd2a62015-08-10 16:08:22 -0700252 topoPath = mininetDir + main.newTopo
Jon Hallef0e2a12017-05-24 16:57:53 -0700253 startStatus = main.Mininet1.startNet( topoFile=topoPath )
GlennRCc6cd2a62015-08-10 16:08:22 -0700254
Hari Krishnac195f3b2015-07-08 20:02:24 -0700255 for i in range( 1, ( main.numMNswitches + 1 ) ): # 1 to ( num of switches +1 )
256 main.Mininet1.assignSwController(
257 sw="s" + str( i ),
Devin Lim58046fa2017-07-05 16:55:00 -0700258 ip=main.ONOSip )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700259
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 Lim58046fa2017-07-05 16:55:00 -0700264 if re.search( "tcp:" + main.ONOSip[ 0 ], response ):
Hari Krishnac195f3b2015-07-08 20:02:24 -0700265 switch_mastership = switch_mastership and main.TRUE
266 else:
267 switch_mastership = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700268
Hari Krishnac195f3b2015-07-08 20:02:24 -0700269 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 Lim58046fa2017-07-05 16:55:00 -0700276 for i in range( main.numCtrls ):
Hari Krishnac195f3b2015-07-08 20:02:24 -0700277 balanceResult = main.ONOScli1.balanceMasters()
278 # giving some breathing time for ONOS to complete re-balance
279 time.sleep( 3 )
280
GlennRCbddd58f2015-10-01 15:45:25 -0700281 caseResult = switch_mastership
Jon Hallef0e2a12017-05-24 16:57:53 -0700282 time.sleep( 60 )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700283 utilities.assert_equals(
284 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -0700285 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -0700286 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 Hall4ba53f02015-07-29 13:07:41 -0700301
Hari Krishnac195f3b2015-07-08 20:02:24 -0700302 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 Wang24139872016-05-03 11:48:47 -0700309 topology_result = main.ONOScli1.getTopology( topology_output )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700310 numOnosDevices = topology_result[ 'devices' ]
311 numOnosLinks = topology_result[ 'links' ]
312 topoResult = main.TRUE
313
Jon Hallef0e2a12017-05-24 16:57:53 -0700314 for check in range( main.topoCheck ):
315 if ( ( main.numMNswitches == int( numOnosDevices ) ) and ( main.numMNlinks == int( numOnosLinks ) ) ):
GlennRCee8f3bf2015-12-14 16:18:39 -0800316 main.step( "Store Device DPIDs" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700317 for i in range( 1, ( main.numMNswitches + 1 ) ):
GlennRC20fc6522015-12-23 23:26:57 -0800318 main.deviceDPIDs.append( "of:00000000000000" + format( i, "02x" ) )
GlennRCee8f3bf2015-12-14 16:18:39 -0800319 print "Device DPIDs in Store: \n", str( main.deviceDPIDs )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700320
GlennRCee8f3bf2015-12-14 16:18:39 -0800321 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 Hallef0e2a12017-05-24 16:57:53 -0700327 for i in range( len( main.hostMACs ) ):
328 main.MACsDict[ main.deviceDPIDs[ i ] ] = main.hostMACs[ i ].split( '/' )[ 0 ]
GlennRCee8f3bf2015-12-14 16:18:39 -0800329 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 Krishnac195f3b2015-07-08 20:02:24 -0700341
GlennRCee8f3bf2015-12-14 16:18:39 -0800342 main.step( "Collect and store each Device ports enabled Count" )
343 time1 = time.time()
Devin Lim58046fa2017-07-05 16:55:00 -0700344 for i in xrange( 1, ( main.numMNswitches + 1 ), main.numCtrls ):
GlennRCee8f3bf2015-12-14 16:18:39 -0800345 pool = []
346 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -0700347 if i >= main.numMNswitches + 1:
GlennRCee8f3bf2015-12-14 16:18:39 -0800348 break
GlennRC20fc6522015-12-23 23:26:57 -0800349 dpid = "of:00000000000000" + format( i, "02x" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700350 t = main.Thread( target=cli.getDevicePortsEnabledCount, threadID=main.threadID, name="getDevicePortsEnabledCount", args=[ dpid ] )
GlennRCee8f3bf2015-12-14 16:18:39 -0800351 t.start()
Jon Hallef0e2a12017-05-24 16:57:53 -0700352 pool.append( t )
GlennRCee8f3bf2015-12-14 16:18:39 -0800353 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 Hallef0e2a12017-05-24 16:57:53 -0700361 main.log.info( "Time for counting enabled ports of the switches: %2f seconds" % ( time2 - time1 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700362
GlennRCee8f3bf2015-12-14 16:18:39 -0800363 main.step( "Collect and store each Device active links Count" )
364 time1 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -0700365
Devin Lim58046fa2017-07-05 16:55:00 -0700366 for i in xrange( 1, ( main.numMNswitches + 1 ), main.numCtrls ):
GlennRCee8f3bf2015-12-14 16:18:39 -0800367 pool = []
368 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -0700369 if i >= main.numMNswitches + 1:
GlennRCee8f3bf2015-12-14 16:18:39 -0800370 break
GlennRC20fc6522015-12-23 23:26:57 -0800371 dpid = "of:00000000000000" + format( i, "02x" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700372 t = main.Thread( target=cli.getDeviceLinksActiveCount,
373 threadID=main.threadID,
374 name="getDevicePortsEnabledCount",
375 args=[ dpid ] )
GlennRCee8f3bf2015-12-14 16:18:39 -0800376 t.start()
Jon Hallef0e2a12017-05-24 16:57:53 -0700377 pool.append( t )
GlennRCee8f3bf2015-12-14 16:18:39 -0800378 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 Hallef0e2a12017-05-24 16:57:53 -0700386 main.log.info( "Time for counting all enabled links of the switches: %2f seconds" % ( time2 - time1 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700387
GlennRCee8f3bf2015-12-14 16:18:39 -0800388 # Exit out of the topo check loop
389 break
390
391 else:
Jon Hallef0e2a12017-05-24 16:57:53 -0700392 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..." )
GlennRCee8f3bf2015-12-14 16:18:39 -0800397 topoResult = main.FALSE
Jon Hallef0e2a12017-05-24 16:57:53 -0700398 time.sleep( main.topoCheckDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700399
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
GlennRC20fc6522015-12-23 23:26:57 -0800406 def CASE200( self, main ):
407
408 import time
Devin Lim58046fa2017-07-05 16:55:00 -0700409 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
GlennRC20fc6522015-12-23 23:26:57 -0800419 main.log.report( "Clean up ONOS" )
Jon Hall6509dbf2016-06-21 17:01:17 -0700420 main.case( "Stop topology and remove hosts and devices" )
GlennRC20fc6522015-12-23 23:26:57 -0800421
Devin Lim58046fa2017-07-05 16:55:00 -0700422 main.Utils.mininetCleanup( False )
GlennRC20fc6522015-12-23 23:26:57 -0800423
GlennRC20fc6522015-12-23 23:26:57 -0800424 main.log.info( "Constructing host id list" )
425 hosts = []
426 for i in range( main.numMNhosts ):
Jon Hallef0e2a12017-05-24 16:57:53 -0700427 hosts.append( "h" + str( i + 1 ) )
GlennRC20fc6522015-12-23 23:26:57 -0800428
429 main.step( "Getting host ids" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700430 hostList = main.CLIs[ 0 ].getHostsId( hosts )
GlennRC20fc6522015-12-23 23:26:57 -0800431 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 Hallef0e2a12017-05-24 16:57:53 -0700437 hostResult = main.CLIs[ 0 ].removeHost( hostList )
GlennRC20fc6522015-12-23 23:26:57 -0800438 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 Hallef0e2a12017-05-24 16:57:53 -0700447 deviceList.append( "of:00000000000000" + format( i + 1, "02x" ) )
GlennRC20fc6522015-12-23 23:26:57 -0800448
449 main.step( "Removing devices" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700450 deviceResult = main.CLIs[ 0 ].removeDevice( deviceList )
GlennRC20fc6522015-12-23 23:26:57 -0800451 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 Hallef0e2a12017-05-24 16:57:53 -0700457 main.log.info( "Summary\n{}".format( main.CLIs[ 0 ].summary( jsonFormat=False ) ) )
GlennRC20fc6522015-12-23 23:26:57 -0800458
Hari Krishnac195f3b2015-07-08 20:02:24 -0700459 def CASE40( self, main ):
460 """
GlennRC15d164c2015-12-15 17:12:25 -0800461 Verify Reactive forwarding
Hari Krishnac195f3b2015-07-08 20:02:24 -0700462 """
Hari Krishnac195f3b2015-07-08 20:02:24 -0700463 import time
GlennRC15d164c2015-12-15 17:12:25 -0800464 main.log.report( "Verify Reactive forwarding" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700465 main.log.report( "______________________________________________" )
GlennRC15d164c2015-12-15 17:12:25 -0800466 main.case( "Enable Reactive forwarding, verify pingall, and disable reactive forwarding" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700467
GlennRC15d164c2015-12-15 17:12:25 -0800468 main.step( "Enable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700469 appResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
GlennRC15d164c2015-12-15 17:12:25 -0800470 utilities.assert_equals( expect=main.TRUE, actual=appResult,
471 onpass="Successfully install fwd app",
472 onfail="Failed to install fwd app" )
473
GlennRC6ac11b12015-10-21 17:41:28 -0700474 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700475 for i in range( main.numPings ):
GlennRC6ac11b12015-10-21 17:41:28 -0700476 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700477 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -0700478 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -0700479 main.log.warn( "First pingall failed. Retrying..." )
480 time.sleep( main.pingSleep )
GlennRC15d164c2015-12-15 17:12:25 -0800481 else:
482 break
GlennRC6ac11b12015-10-21 17:41:28 -0700483
Hari Krishnac195f3b2015-07-08 20:02:24 -0700484 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
GlennRC15d164c2015-12-15 17:12:25 -0800491 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700492 onpass="Reactive Mode IPv4 Pingall test PASS",
493 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700494
You Wangb6586542016-02-26 09:25:56 -0800495 if not pingResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -0700496 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -0800497 main.stop( email=main.emailOnStop )
498
GlennRC15d164c2015-12-15 17:12:25 -0800499 main.step( "Disable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700500 appResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
GlennRC15d164c2015-12-15 17:12:25 -0800501 utilities.assert_equals( expect=main.TRUE, actual=appResult,
GlennRC3de72232015-12-16 10:48:35 -0800502 onpass="Successfully deactivated fwd app",
GlennRC15d164c2015-12-15 17:12:25 -0800503 onfail="Failed to deactivate fwd app" )
504
Hari Krishnac195f3b2015-07-08 20:02:24 -0700505 def CASE41( self, main ):
506 """
Jon Hallef0e2a12017-05-24 16:57:53 -0700507 Verify Reactive forwarding ( Chordal Topology )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700508 """
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 Hallef0e2a12017-05-24 16:57:53 -0700518 appResults = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700519
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 Hallef0e2a12017-05-24 16:57:53 -0700535 main.log.warn( main.CLIs[ 0 ].apps() )
536 main.log.warn( main.CLIs[ 0 ].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700537
Hari Krishnac195f3b2015-07-08 20:02:24 -0700538 time.sleep( 10 )
539
GlennRC6ac11b12015-10-21 17:41:28 -0700540 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700541 for i in range( main.numPings ):
GlennRC6ac11b12015-10-21 17:41:28 -0700542 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700543 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -0700544 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -0700545 main.log.warn( "First pingall failed. Retrying..." )
546 time.sleep( main.pingSleep )
547 else:
548 break
GlennRC6ac11b12015-10-21 17:41:28 -0700549
Hari Krishnac195f3b2015-07-08 20:02:24 -0700550 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 Wangb6586542016-02-26 09:25:56 -0800557 if not pingResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -0700558 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -0800559 main.stop( email=main.emailOnStop )
560
GlennRC626ba132015-09-18 16:16:31 -0700561 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700562 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700563 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700564 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700565
Jon Hallef0e2a12017-05-24 16:57:53 -0700566 caseResult = appCheck and pingResult
GlennRCbddd58f2015-10-01 15:45:25 -0700567 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700568 onpass="Reactive Mode IPv4 Pingall test PASS",
569 onfail="Reactive Mode IPv4 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700570
571 def CASE42( self, main ):
572 """
Jon Hallef0e2a12017-05-24 16:57:53 -0700573 Verify Reactive forwarding ( Spine Topology )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700574 """
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 Hallef0e2a12017-05-24 16:57:53 -0700584 appResults = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700585
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 Hallef0e2a12017-05-24 16:57:53 -0700601 main.log.warn( main.CLIs[ 0 ].apps() )
602 main.log.warn( main.CLIs[ 0 ].appIDs() )
Jon Hall4ba53f02015-07-29 13:07:41 -0700603
Hari Krishnac195f3b2015-07-08 20:02:24 -0700604 time.sleep( 10 )
605
GlennRC6ac11b12015-10-21 17:41:28 -0700606 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700607 for i in range( main.numPings ):
GlennRC6ac11b12015-10-21 17:41:28 -0700608 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700609 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -0700610 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -0700611 main.log.warn( "First pingall failed. Retrying..." )
612 time.sleep( main.pingSleep )
613 else:
614 break
GlennRC6ac11b12015-10-21 17:41:28 -0700615
Hari Krishnac195f3b2015-07-08 20:02:24 -0700616 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 Wangb6586542016-02-26 09:25:56 -0800623 if not pingResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -0700624 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -0800625 main.stop( email=main.emailOnStop )
626
GlennRC626ba132015-09-18 16:16:31 -0700627 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700628 main.log.report( "IPv4 Pingall Test in Reactive mode successful" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700629 else:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700630 main.log.report( "IPv4 Pingall Test in Reactive mode failed" )
631
Jon Hallef0e2a12017-05-24 16:57:53 -0700632 caseResult = appCheck and pingResult
GlennRCbddd58f2015-10-01 15:45:25 -0700633 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700634 onpass="Reactive Mode IPv4 Pingall test PASS",
635 onfail="Reactive Mode IPv4 Pingall test FAIL" )
636
GlennRC026dba62016-01-07 18:42:33 -0800637 def CASE47( self, main ):
You Wang0779bac2016-01-27 16:32:33 -0800638 """
639 Verify reactive forwarding in ATT topology, use a different ping method than CASE40
640 """
GlennRC026dba62016-01-07 18:42:33 -0800641 import time
You Wang0779bac2016-01-27 16:32:33 -0800642 main.log.report( "Verify Reactive forwarding (ATT Topology) " )
GlennRC026dba62016-01-07 18:42:33 -0800643 main.log.report( "______________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -0800644 main.case( "Enable Reactive forwarding, verify ping, and disable reactive forwarding" )
GlennRC026dba62016-01-07 18:42:33 -0800645
646 main.step( "Enable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700647 appResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
GlennRC026dba62016-01-07 18:42:33 -0800648 utilities.assert_equals( expect=main.TRUE, actual=appResult,
649 onpass="Successfully install fwd app",
650 onfail="Failed to install fwd app" )
651
Jon Hallef0e2a12017-05-24 16:57:53 -0700652 numHosts = int( main.params[ 'TOPO1' ][ 'numHosts' ] )
GlennRC026dba62016-01-07 18:42:33 -0800653
Jon Hallef0e2a12017-05-24 16:57:53 -0700654 for i in range( numHosts ):
GlennRC026dba62016-01-07 18:42:33 -0800655 src = "h1"
Jon Hallef0e2a12017-05-24 16:57:53 -0700656 dest = "h" + str( i + 1 )
GlennRC026dba62016-01-07 18:42:33 -0800657 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 Hallef0e2a12017-05-24 16:57:53 -0700661 hosts = main.CLIs[ 0 ].hosts( jsonFormat=False )
GlennRC026dba62016-01-07 18:42:33 -0800662
663 main.log.info( hosts )
664
665 main.step( "Disable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700666 appResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
GlennRC026dba62016-01-07 18:42:33 -0800667 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 Wang0779bac2016-01-27 16:32:33 -0800672 """
673 Verify reactive forwarding in Chordal topology, use a different ping method than CASE41
674 """
GlennRC026dba62016-01-07 18:42:33 -0800675 import time
You Wang0779bac2016-01-27 16:32:33 -0800676 main.log.report( "Verify Reactive forwarding (Chordal Topology) " )
GlennRC026dba62016-01-07 18:42:33 -0800677 main.log.report( "______________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -0800678 main.case( "Enable Reactive forwarding, verify ping, and disable reactive forwarding" )
GlennRC026dba62016-01-07 18:42:33 -0800679
680 main.step( "Enable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700681 appResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
GlennRC026dba62016-01-07 18:42:33 -0800682 utilities.assert_equals( expect=main.TRUE, actual=appResult,
683 onpass="Successfully install fwd app",
684 onfail="Failed to install fwd app" )
685
Jon Hallef0e2a12017-05-24 16:57:53 -0700686 numHosts = int( main.params[ 'TOPO2' ][ 'numHosts' ] )
GlennRC026dba62016-01-07 18:42:33 -0800687
Jon Hallef0e2a12017-05-24 16:57:53 -0700688 for i in range( numHosts ):
GlennRC026dba62016-01-07 18:42:33 -0800689 src = "h1"
Jon Hallef0e2a12017-05-24 16:57:53 -0700690 dest = "h" + str( i + 1 )
GlennRC026dba62016-01-07 18:42:33 -0800691 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 Hallef0e2a12017-05-24 16:57:53 -0700695 hosts = main.CLIs[ 0 ].hosts( jsonFormat=False )
GlennRC026dba62016-01-07 18:42:33 -0800696
697 main.log.info( hosts )
698
699 main.step( "Disable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700700 appResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
GlennRC026dba62016-01-07 18:42:33 -0800701 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 Wang0779bac2016-01-27 16:32:33 -0800706 """
707 Verify reactive forwarding in Spine-leaf topology, use a different ping method than CASE42
708 """
GlennRC026dba62016-01-07 18:42:33 -0800709 import time
You Wang0779bac2016-01-27 16:32:33 -0800710 main.log.report( "Verify Reactive forwarding (Spine-leaf Topology) " )
GlennRC026dba62016-01-07 18:42:33 -0800711 main.log.report( "______________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -0800712 main.case( "Enable Reactive forwarding, verify ping, and disable reactive forwarding" )
GlennRC026dba62016-01-07 18:42:33 -0800713
714 main.step( "Enable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700715 appResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
GlennRC026dba62016-01-07 18:42:33 -0800716 utilities.assert_equals( expect=main.TRUE, actual=appResult,
717 onpass="Successfully install fwd app",
718 onfail="Failed to install fwd app" )
719
Jon Hallef0e2a12017-05-24 16:57:53 -0700720 numHosts = int( main.params[ 'TOPO3' ][ 'numHosts' ] )
GlennRC026dba62016-01-07 18:42:33 -0800721
Jon Hallef0e2a12017-05-24 16:57:53 -0700722 for i in range( 11, numHosts + 10 ):
GlennRC026dba62016-01-07 18:42:33 -0800723 src = "h11"
Jon Hallef0e2a12017-05-24 16:57:53 -0700724 dest = "h" + str( i + 1 )
GlennRC026dba62016-01-07 18:42:33 -0800725 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 Hallef0e2a12017-05-24 16:57:53 -0700729 hosts = main.CLIs[ 0 ].hosts( jsonFormat=False )
GlennRC026dba62016-01-07 18:42:33 -0800730
731 main.log.info( hosts )
732
733 main.step( "Disable Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700734 appResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
GlennRC026dba62016-01-07 18:42:33 -0800735 utilities.assert_equals( expect=main.TRUE, actual=appResult,
736 onpass="Successfully deactivated fwd app",
737 onfail="Failed to deactivate fwd app" )
738
Hari Krishna4223dbd2015-08-13 16:29:53 -0700739 def CASE140( self, main ):
740 """
Jon Hallef0e2a12017-05-24 16:57:53 -0700741 Verify IPv6 Reactive forwarding ( Att Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700742 """
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 Hallef0e2a12017-05-24 16:57:53 -0700749 hostList = [ ( 'h' + str( x + 1 ) ) for x in range( main.numMNhosts ) ]
Hari Krishna4223dbd2015-08-13 16:29:53 -0700750
751 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700752 cfgResult1 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
753 cfgResult2 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700754 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" )
GlennRC626ba132015-09-18 16:16:31 -0700760 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700761 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700762 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -0700763 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -0700764 main.log.warn( "First pingall failed. Trying again.." )
GlennRC626ba132015-09-18 16:16:31 -0700765 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700766 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
GlennRC626ba132015-09-18 16:16:31 -0700773 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700774 main.log.report( "IPv6 Pingall Test in Reactive mode successful" )
775 else:
776 main.log.report( "IPv6 Pingall Test in Reactive mode failed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700777
Jon Hallef0e2a12017-05-24 16:57:53 -0700778 caseResult = appCheck and pingResult
GlennRCbddd58f2015-10-01 15:45:25 -0700779 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700780 onpass="Reactive Mode IPv6 Pingall test PASS",
781 onfail="Reactive Mode IPv6 Pingall test FAIL" )
782
783 def CASE141( self, main ):
784 """
Jon Hallef0e2a12017-05-24 16:57:53 -0700785 Verify IPv6 Reactive forwarding ( Chordal Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700786 """
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 Hallef0e2a12017-05-24 16:57:53 -0700793 hostList = [ ( 'h' + str( x + 1 ) ) for x in range( main.numMNhosts ) ]
Hari Krishna4223dbd2015-08-13 16:29:53 -0700794
795 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700796 cfgResult1 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
797 cfgResult2 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700798 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" )
GlennRC626ba132015-09-18 16:16:31 -0700804 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700805 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700806 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC626ba132015-09-18 16:16:31 -0700807 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -0700808 main.log.warn( "First pingall failed. Trying again.." )
GlennRC626ba132015-09-18 16:16:31 -0700809 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700810 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
GlennRC626ba132015-09-18 16:16:31 -0700817 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700818 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 Hallef0e2a12017-05-24 16:57:53 -0700826 appResults = appResults and main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700827 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 Hallef0e2a12017-05-24 16:57:53 -0700842 main.log.warn( main.CLIs[ 0 ].apps() )
843 main.log.warn( main.CLIs[ 0 ].appIDs() )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700844
845 # Waiting for reative flows to be cleared.
846 time.sleep( 30 )
Jon Hallef0e2a12017-05-24 16:57:53 -0700847 caseResult = appCheck and cfgResult and pingResult
GlennRCbddd58f2015-10-01 15:45:25 -0700848 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700849 onpass="Reactive Mode IPv6 Pingall test PASS",
850 onfail="Reactive Mode IPv6 Pingall test FAIL" )
851
852 def CASE142( self, main ):
853 """
Jon Hallef0e2a12017-05-24 16:57:53 -0700854 Verify IPv6 Reactive forwarding ( Spine Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700855 """
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 Hallef0e2a12017-05-24 16:57:53 -0700863 hostList = [ ( 'h' + str( x + 11 ) ) for x in range( main.numMNhosts ) ]
Hari Krishna4223dbd2015-08-13 16:29:53 -0700864 main.step( "Set IPv6 cfg parameters for Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700865 cfgResult1 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
866 cfgResult2 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700867 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" )
GlennRC626ba132015-09-18 16:16:31 -0700873 pingResult = main.FALSE
Hari Krishna4223dbd2015-08-13 16:29:53 -0700874 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -0700875 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
GlennRC558cd862015-10-08 09:54:04 -0700876 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -0700877 main.log.warn( "First pingall failed. Trying again..." )
GlennRC558cd862015-10-08 09:54:04 -0700878 pingResult = main.Mininet1.pingall( protocol="IPv6", timeout=main.pingTimeout )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700879 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
GlennRC626ba132015-09-18 16:16:31 -0700886 if pingResult == main.TRUE:
Hari Krishna4223dbd2015-08-13 16:29:53 -0700887 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 Hallef0e2a12017-05-24 16:57:53 -0700895 appResults = appResults and main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700896 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 Hallef0e2a12017-05-24 16:57:53 -0700911 main.log.warn( main.CLIs[ 0 ].apps() )
912 main.log.warn( main.CLIs[ 0 ].appIDs() )
Hari Krishna4223dbd2015-08-13 16:29:53 -0700913
914 # Waiting for reative flows to be cleared.
915 time.sleep( 30 )
Jon Hallef0e2a12017-05-24 16:57:53 -0700916 caseResult = appCheck and cfgResult and pingResult
GlennRCbddd58f2015-10-01 15:45:25 -0700917 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -0700918 onpass="Reactive Mode IPv6 Pingall test PASS",
919 onfail="Reactive Mode IPv6 Pingall test FAIL" )
Hari Krishnac195f3b2015-07-08 20:02:24 -0700920
You Wang0779bac2016-01-27 16:32:33 -0800921 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 Hallef0e2a12017-05-24 16:57:53 -0700931 appResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -0800932 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 Hallef0e2a12017-05-24 16:57:53 -0700937 cfgResult1 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
938 cfgResult2 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
You Wang0779bac2016-01-27 16:32:33 -0800939 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 Wangb6586542016-02-26 09:25:56 -0800944 main.step( "Discover hosts using ping" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700945 numHosts = int( main.params[ 'TOPO1' ][ 'numHosts' ] )
946 for i in range( numHosts ):
You Wang0779bac2016-01-27 16:32:33 -0800947 src = "h1"
Jon Hallef0e2a12017-05-24 16:57:53 -0700948 dest = "1000::" + str( i + 1 )
949 main.Mininet1.handle.sendline( src + " ping6 " + dest + " -c 3 -i 1 -W 1" )
You Wang0779bac2016-01-27 16:32:33 -0800950 main.Mininet1.handle.expect( "mininet>" )
951 main.log.info( main.Mininet1.handle.before )
Jon Hallef0e2a12017-05-24 16:57:53 -0700952 hosts = main.CLIs[ 0 ].hosts( jsonFormat=False )
You Wang0779bac2016-01-27 16:32:33 -0800953 main.log.info( hosts )
954
955 main.step( "Disable Reactive forwarding" )
You Wang0779bac2016-01-27 16:32:33 -0800956 main.log.info( "Uninstall IPv6 reactive forwarding app" )
957 appCheck = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -0700958 appResults = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -0800959 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 Hallef0e2a12017-05-24 16:57:53 -0700975 main.log.warn( main.CLIs[ 0 ].apps() )
976 main.log.warn( main.CLIs[ 0 ].appIDs() )
You Wang0779bac2016-01-27 16:32:33 -0800977
978 # Waiting for reative flows to be cleared.
979 time.sleep( 30 )
980
981 main.step( "Disable IPv4 Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -0700982 appResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -0800983 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 Hallef0e2a12017-05-24 16:57:53 -0700997 appResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -0800998 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 Hallef0e2a12017-05-24 16:57:53 -07001003 cfgResult1 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
1004 cfgResult2 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
You Wang0779bac2016-01-27 16:32:33 -08001005 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 Wangb6586542016-02-26 09:25:56 -08001010 main.step( "Discover hosts using ping" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001011 numHosts = int( main.params[ 'TOPO2' ][ 'numHosts' ] )
1012 for i in range( numHosts ):
You Wang0779bac2016-01-27 16:32:33 -08001013 src = "h1"
Jon Hallef0e2a12017-05-24 16:57:53 -07001014 dest = "1000::" + str( i + 1 )
1015 main.Mininet1.handle.sendline( src + " ping6 " + dest + " -c 3 -i 1 -W 1" )
You Wang0779bac2016-01-27 16:32:33 -08001016 main.Mininet1.handle.expect( "mininet>" )
1017 main.log.info( main.Mininet1.handle.before )
Jon Hallef0e2a12017-05-24 16:57:53 -07001018 hosts = main.CLIs[ 0 ].hosts( jsonFormat=False )
You Wang0779bac2016-01-27 16:32:33 -08001019 main.log.info( hosts )
1020
1021 main.step( "Disable Reactive forwarding" )
You Wang0779bac2016-01-27 16:32:33 -08001022 main.log.info( "Uninstall IPv6 reactive forwarding app" )
1023 appCheck = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07001024 appResults = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -08001025 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 Hallef0e2a12017-05-24 16:57:53 -07001041 main.log.warn( main.CLIs[ 0 ].apps() )
1042 main.log.warn( main.CLIs[ 0 ].appIDs() )
You Wang0779bac2016-01-27 16:32:33 -08001043
1044 # Waiting for reative flows to be cleared.
1045 time.sleep( 30 )
1046
1047 main.step( "Disable IPv4 Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001048 appResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -08001049 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 Hallef0e2a12017-05-24 16:57:53 -07001063 appResult = main.CLIs[ 0 ].activateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -08001064 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 Hallef0e2a12017-05-24 16:57:53 -07001069 cfgResult1 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "ipv6Forwarding", "true" )
1070 cfgResult2 = main.CLIs[ 0 ].setCfg( "org.onosproject.fwd.ReactiveForwarding", "matchIpv6Address", "true" )
You Wang0779bac2016-01-27 16:32:33 -08001071 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 Wangb6586542016-02-26 09:25:56 -08001076 main.step( "Discover hosts using ping" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001077 numHosts = int( main.params[ 'TOPO3' ][ 'numHosts' ] )
1078 for i in range( 11, numHosts + 10 ):
You Wang0779bac2016-01-27 16:32:33 -08001079 src = "h11"
Jon Hallef0e2a12017-05-24 16:57:53 -07001080 dest = "1000::" + str( i + 1 )
1081 main.Mininet1.handle.sendline( src + " ping6 " + dest + " -c 3 -i 1 -W 1" )
You Wang0779bac2016-01-27 16:32:33 -08001082 main.Mininet1.handle.expect( "mininet>" )
1083 main.log.info( main.Mininet1.handle.before )
Jon Hallef0e2a12017-05-24 16:57:53 -07001084 hosts = main.CLIs[ 0 ].hosts( jsonFormat=False )
You Wang0779bac2016-01-27 16:32:33 -08001085 main.log.info( hosts )
1086
1087 main.step( "Disable Reactive forwarding" )
You Wang0779bac2016-01-27 16:32:33 -08001088 main.log.info( "Uninstall IPv6 reactive forwarding app" )
1089 appCheck = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07001090 appResults = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -08001091 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 Hallef0e2a12017-05-24 16:57:53 -07001107 main.log.warn( main.CLIs[ 0 ].apps() )
1108 main.log.warn( main.CLIs[ 0 ].appIDs() )
You Wang0779bac2016-01-27 16:32:33 -08001109
1110 # Waiting for reative flows to be cleared.
1111 time.sleep( 30 )
1112
1113 main.step( "Disable IPv4 Reactive forwarding" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001114 appResult = main.CLIs[ 0 ].deactivateApp( "org.onosproject.fwd" )
You Wang0779bac2016-01-27 16:32:33 -08001115 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 Krishnac195f3b2015-07-08 20:02:24 -07001119 def CASE5( self, main ):
1120 """
1121 Compare current ONOS topology with reference data
1122 """
1123 import re
Jon Hall4ba53f02015-07-29 13:07:41 -07001124
Hari Krishnac195f3b2015-07-08 20:02:24 -07001125 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 Krishnac195f3b2015-07-08 20:02:24 -07001137
Jon Hallef0e2a12017-05-24 16:57:53 -07001138 for check in range( main.topoCheck ):
GlennRC289c1b62015-12-12 10:45:43 -08001139 time1 = time.time()
Devin Lim58046fa2017-07-05 16:55:00 -07001140 for i in xrange( 1, ( main.numMNswitches + 1 ), main.numCtrls ):
GlennRC289c1b62015-12-12 10:45:43 -08001141 pool = []
1142 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -07001143 if i >= main.numMNswitches + 1:
GlennRC289c1b62015-12-12 10:45:43 -08001144 break
GlennRC20fc6522015-12-23 23:26:57 -08001145 dpid = "of:00000000000000" + format( i, "02x" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001146 t = main.Thread( target=cli.getDevicePortsEnabledCount,
1147 threadID=main.threadID,
1148 name="getDevicePortsEnabledCount",
1149 args=[ dpid ] )
GlennRC289c1b62015-12-12 10:45:43 -08001150 t.start()
Jon Hallef0e2a12017-05-24 16:57:53 -07001151 pool.append( t )
GlennRC289c1b62015-12-12 10:45:43 -08001152 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 Hall4ba53f02015-07-29 13:07:41 -07001160
GlennRC289c1b62015-12-12 10:45:43 -08001161 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07001162 main.log.info( "Time for counting enabled ports of the switches: %2f seconds" % ( time2 - time1 ) )
1163 main.log.info(
GlennRC289c1b62015-12-12 10:45:43 -08001164 "Device Enabled ports EXPECTED: %s" %
1165 str( main.devicePortsEnabledCount ) )
Jon Hallef0e2a12017-05-24 16:57:53 -07001166 main.log.info(
GlennRC289c1b62015-12-12 10:45:43 -08001167 "Device Enabled ports ACTUAL: %s" %
1168 str( devicePortsEnabledCountTemp ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001169
GlennRC289c1b62015-12-12 10:45:43 -08001170 if ( cmp( main.devicePortsEnabledCount,
1171 devicePortsEnabledCountTemp ) == 0 ):
1172 stepResult1 = main.TRUE
1173 else:
1174 stepResult1 = main.FALSE
Hari Krishnac195f3b2015-07-08 20:02:24 -07001175
GlennRC289c1b62015-12-12 10:45:43 -08001176 main.step( "Compare Device active links with reference" )
1177 time1 = time.time()
Devin Lim58046fa2017-07-05 16:55:00 -07001178 for i in xrange( 1, ( main.numMNswitches + 1 ), main.numCtrls ):
GlennRC289c1b62015-12-12 10:45:43 -08001179 pool = []
1180 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -07001181 if i >= main.numMNswitches + 1:
GlennRC289c1b62015-12-12 10:45:43 -08001182 break
GlennRC20fc6522015-12-23 23:26:57 -08001183 dpid = "of:00000000000000" + format( i, "02x" )
Jon Hallef0e2a12017-05-24 16:57:53 -07001184 t = main.Thread( target=cli.getDeviceLinksActiveCount,
1185 threadID=main.threadID,
1186 name="getDeviceLinksActiveCount",
1187 args=[ dpid ] )
GlennRC289c1b62015-12-12 10:45:43 -08001188 t.start()
Jon Hallef0e2a12017-05-24 16:57:53 -07001189 pool.append( t )
GlennRC289c1b62015-12-12 10:45:43 -08001190 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 Krishnac195f3b2015-07-08 20:02:24 -07001198
GlennRC289c1b62015-12-12 10:45:43 -08001199 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07001200 main.log.info( "Time for counting all enabled links of the switches: %2f seconds" % ( time2 - time1 ) )
1201 main.log.info(
GlennRC289c1b62015-12-12 10:45:43 -08001202 "Device Active links EXPECTED: %s" %
1203 str( main.deviceActiveLinksCount ) )
Jon Hallef0e2a12017-05-24 16:57:53 -07001204 main.log.info(
GlennRC289c1b62015-12-12 10:45:43 -08001205 "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
GlennRC289c1b62015-12-12 10:45:43 -08001223 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001224 onpass="Compare Topology test PASS",
1225 onfail="Compare Topology test FAIL" )
1226
Devin Lim58046fa2017-07-05 16:55:00 -07001227 def CASE60( self, main ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07001228 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001229 Install 300 host intents and verify ping all ( Att Topology )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001230 """
1231 main.log.report( "Add 300 host intents and verify pingall (Att Topology)" )
1232 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001233 main.case( "Install 300 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001234
Hari Krishnac195f3b2015-07-08 20:02:24 -07001235 main.step( "Add host Intents" )
You Wangb6586542016-02-26 09:25:56 -08001236 intentIdList = main.CHOtestFunctions.installHostIntents()
Jon Hallef0e2a12017-05-24 16:57:53 -07001237 main.intentIds = list( intentIdList )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001238
Jon Hallef0e2a12017-05-24 16:57:53 -07001239 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001240 intentState = main.CHOtestFunctions.checkIntents()
GlennRCa8d786a2015-09-23 17:40:11 -07001241 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1242 onpass="INTENTS INSTALLED",
1243 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001244
1245 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001246 pingResult = main.CHOtestFunctions.checkPingall()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001247 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1248 onpass="PING ALL PASS",
1249 onfail="PING ALL FAIL" )
1250
GlennRCbddd58f2015-10-01 15:45:25 -07001251 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001252 utilities.assert_equals(
1253 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001254 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001255 onpass="Install 300 Host Intents and Ping All test PASS",
1256 onfail="Install 300 Host Intents and Ping All test FAIL" )
1257
GlennRCfcfdc4f2015-09-30 16:01:57 -07001258 if not intentState:
1259 main.log.debug( "Intents failed to install completely" )
1260 if not pingResult:
1261 main.log.debug( "Pingall failed" )
1262
GlennRCbddd58f2015-10-01 15:45:25 -07001263 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001264 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001265 main.stop( email=main.emailOnStop )
1266
Devin Lim58046fa2017-07-05 16:55:00 -07001267 def CASE61( self, main ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07001268 """
You Wang0779bac2016-01-27 16:32:33 -08001269 Install 300 host intents and verify ping all for Chordal Topology
Hari Krishnac195f3b2015-07-08 20:02:24 -07001270 """
You Wang0779bac2016-01-27 16:32:33 -08001271 main.log.report( "Add 300 host intents and verify pingall (Chordal Topo)" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001272 main.log.report( "_______________________________________" )
You Wang0779bac2016-01-27 16:32:33 -08001273 main.case( "Install 300 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001274
Hari Krishnac195f3b2015-07-08 20:02:24 -07001275 main.step( "Add host Intents" )
You Wangb6586542016-02-26 09:25:56 -08001276 intentIdList = main.CHOtestFunctions.installHostIntents()
Jon Hallef0e2a12017-05-24 16:57:53 -07001277 main.intentIds = list( intentIdList )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001278
Jon Hallef0e2a12017-05-24 16:57:53 -07001279 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001280 intentState = main.CHOtestFunctions.checkIntents()
GlennRCa8d786a2015-09-23 17:40:11 -07001281 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1282 onpass="INTENTS INSTALLED",
1283 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001284
1285 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001286 pingResult = main.CHOtestFunctions.checkPingall()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001287 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1288 onpass="PING ALL PASS",
1289 onfail="PING ALL FAIL" )
1290
GlennRCbddd58f2015-10-01 15:45:25 -07001291 caseResult = ( intentState and pingResult )
You Wangb6586542016-02-26 09:25:56 -08001292 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 Krishnac195f3b2015-07-08 20:02:24 -07001296
GlennRCfcfdc4f2015-09-30 16:01:57 -07001297 if not intentState:
1298 main.log.debug( "Intents failed to install completely" )
1299 if not pingResult:
1300 main.log.debug( "Pingall failed" )
1301
GlennRCbddd58f2015-10-01 15:45:25 -07001302 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001303 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001304 main.stop( email=main.emailOnStop )
1305
Devin Lim58046fa2017-07-05 16:55:00 -07001306 def CASE62( self, main ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07001307 """
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 Krishnac195f3b2015-07-08 20:02:24 -07001312 main.case( "Install 2278 host intents" )
GlennRCa8d786a2015-09-23 17:40:11 -07001313
You Wangb6586542016-02-26 09:25:56 -08001314 main.step( "Add host Intents" )
1315 intentIdList = main.CHOtestFunctions.installHostIntents()
Jon Hallef0e2a12017-05-24 16:57:53 -07001316 main.intentIds = list( intentIdList )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001317
Jon Hallef0e2a12017-05-24 16:57:53 -07001318 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001319 intentState = main.CHOtestFunctions.checkIntents()
GlennRCa8d786a2015-09-23 17:40:11 -07001320 utilities.assert_equals( expect=main.TRUE, actual=intentState,
1321 onpass="INTENTS INSTALLED",
1322 onfail="SOME INTENTS NOT INSTALLED" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001323
1324 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001325 pingResult = main.CHOtestFunctions.checkPingall()
Hari Krishnac195f3b2015-07-08 20:02:24 -07001326 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1327 onpass="PING ALL PASS",
1328 onfail="PING ALL FAIL" )
1329
GlennRCbddd58f2015-10-01 15:45:25 -07001330 caseResult = ( intentState and pingResult )
You Wangb6586542016-02-26 09:25:56 -08001331 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 Krishnac195f3b2015-07-08 20:02:24 -07001335
GlennRCfcfdc4f2015-09-30 16:01:57 -07001336 if not intentState:
1337 main.log.debug( "Intents failed to install completely" )
1338 if not pingResult:
1339 main.log.debug( "Pingall failed" )
1340
GlennRCbddd58f2015-10-01 15:45:25 -07001341 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001342 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001343 main.stop( email=main.emailOnStop )
1344
Devin Lim58046fa2017-07-05 16:55:00 -07001345 def CASE160( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07001346 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001347 Verify IPv6 ping across 300 host intents ( Att Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001348 """
1349 main.log.report( "Verify IPv6 ping across 300 host intents (Att Topology)" )
1350 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001351 main.case( "IPv6 ping all 300 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001352
Hari Krishna4223dbd2015-08-13 16:29:53 -07001353 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001354 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
1355 utilities.assert_equals( expect=main.TRUE,
1356 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001357 onpass="PING ALL PASS",
1358 onfail="PING ALL FAIL" )
1359
GlennRCbddd58f2015-10-01 15:45:25 -07001360 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001361 utilities.assert_equals(
1362 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001363 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07001364 onpass="IPv6 Ping across 300 host intents test PASS",
1365 onfail="IPv6 Ping across 300 host intents test FAIL" )
1366
You Wangb6586542016-02-26 09:25:56 -08001367 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001368 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08001369 main.stop( email=main.emailOnStop )
1370
Devin Lim58046fa2017-07-05 16:55:00 -07001371 def CASE161( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07001372 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001373 Verify IPv6 ping across 300 host intents ( Chordal Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001374 """
You Wang0779bac2016-01-27 16:32:33 -08001375 main.log.report( "Verify IPv6 ping across 300 host intents (Chordal Topology)" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001376 main.log.report( "_________________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -08001377 main.case( "IPv6 ping all 300 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001378
Hari Krishna4223dbd2015-08-13 16:29:53 -07001379 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001380 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001381 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1382 onpass="PING ALL PASS",
1383 onfail="PING ALL FAIL" )
1384
GlennRCbddd58f2015-10-01 15:45:25 -07001385 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001386 utilities.assert_equals(
1387 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001388 actual=caseResult,
You Wang0779bac2016-01-27 16:32:33 -08001389 onpass="IPv6 Ping across 300 host intents test PASS",
1390 onfail="IPv6 Ping across 300 host intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001391
You Wangb6586542016-02-26 09:25:56 -08001392 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001393 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08001394 main.stop( email=main.emailOnStop )
1395
Devin Lim58046fa2017-07-05 16:55:00 -07001396 def CASE162( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07001397 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001398 Verify IPv6 ping across 2278 host intents ( Spine Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001399 """
1400 main.log.report( "Verify IPv6 ping across 2278 host intents (Spine Topology)" )
1401 main.log.report( "_________________________________________________" )
You Wang0779bac2016-01-27 16:32:33 -08001402 main.case( "IPv6 ping all 2278 host intents" )
You Wangb6586542016-02-26 09:25:56 -08001403
Hari Krishna4223dbd2015-08-13 16:29:53 -07001404 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001405 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001406 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
1407 onpass="PING ALL PASS",
1408 onfail="PING ALL FAIL" )
1409
GlennRCbddd58f2015-10-01 15:45:25 -07001410 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07001411 utilities.assert_equals(
1412 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07001413 actual=caseResult,
You Wang0779bac2016-01-27 16:32:33 -08001414 onpass="IPv6 Ping across 2278 host intents test PASS",
1415 onfail="IPv6 Ping across 2278 host intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07001416
You Wangb6586542016-02-26 09:25:56 -08001417 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001418 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08001419 main.stop( email=main.emailOnStop )
1420
Hari Krishnac195f3b2015-07-08 20:02:24 -07001421 def CASE70( self, main ):
1422 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001423 Randomly bring some core links down and verify ping all ( Host Intents-Att Topo )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001424 """
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 Krishnac195f3b2015-07-08 20:02:24 -07001436
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 Wangb6586542016-02-26 09:25:56 -08001458 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001459 main.Mininet1.link(
1460 END1=link2End1,
1461 END2=main.randomLink2[ i ],
1462 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001463 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001464 main.Mininet1.link(
1465 END1=link3End1,
1466 END2=main.randomLink3[ i ],
1467 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001468 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001469
Jon Hallef0e2a12017-05-24 16:57:53 -07001470 main.step( "Verify link down is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08001471 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 Krishnac195f3b2015-07-08 20:02:24 -07001480
Jon Hallef0e2a12017-05-24 16:57:53 -07001481 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001482 intentState = main.CHOtestFunctions.checkIntents()
1483 utilities.assert_equals( expect=main.TRUE,
1484 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001485 onpass="INTENTS INSTALLED",
1486 onfail="SOME INTENTS NOT INSTALLED" )
1487
Hari Krishnac195f3b2015-07-08 20:02:24 -07001488 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001489 pingResult = main.CHOtestFunctions.checkPingall()
1490 utilities.assert_equals( expect=main.TRUE,
1491 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001492 onpass="PING ALL PASS",
1493 onfail="PING ALL FAIL" )
1494
GlennRCbddd58f2015-10-01 15:45:25 -07001495 caseResult = linkDown and pingResult and intentState
You Wangb6586542016-02-26 09:25:56 -08001496 utilities.assert_equals( expect=main.TRUE,
1497 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001498 onpass="Random Link cut Test PASS",
1499 onfail="Random Link cut Test FAIL" )
1500
GlennRCfcfdc4f2015-09-30 16:01:57 -07001501 # 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
GlennRCbddd58f2015-10-01 15:45:25 -07001509 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001510 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001511 main.stop( email=main.emailOnStop )
1512
Hari Krishnac195f3b2015-07-08 20:02:24 -07001513 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 Wangb6586542016-02-26 09:25:56 -08001521 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001522 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 Wangb6586542016-02-26 09:25:56 -08001536 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001537 main.Mininet1.link(
1538 END1=link2End1,
1539 END2=main.randomLink2[ i ],
1540 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001541 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001542 main.Mininet1.link(
1543 END1=link3End1,
1544 END2=main.randomLink3[ i ],
1545 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001546 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001547
Jon Hallef0e2a12017-05-24 16:57:53 -07001548 main.step( "Verify link up is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08001549 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 Krishnac195f3b2015-07-08 20:02:24 -07001557
Jon Hallef0e2a12017-05-24 16:57:53 -07001558 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001559 intentState = main.CHOtestFunctions.checkIntents()
1560 utilities.assert_equals( expect=main.TRUE,
1561 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001562 onpass="INTENTS INSTALLED",
1563 onfail="SOME INTENTS NOT INSTALLED" )
1564
Hari Krishnac195f3b2015-07-08 20:02:24 -07001565 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001566 pingResult = main.CHOtestFunctions.checkPingall()
1567 utilities.assert_equals( expect=main.TRUE,
1568 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001569 onpass="PING ALL PASS",
1570 onfail="PING ALL FAIL" )
1571
GlennRCbddd58f2015-10-01 15:45:25 -07001572 caseResult = linkUp and pingResult
1573 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001574 onpass="Link Up Test PASS",
1575 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001576 # Printing what exactly failed
1577 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08001578 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001579 if not pingResult:
1580 main.log.debug( "Pingall failed" )
1581 if not intentState:
1582 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001583
GlennRCbddd58f2015-10-01 15:45:25 -07001584 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001585 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001586 main.stop( email=main.emailOnStop )
1587
Hari Krishnac195f3b2015-07-08 20:02:24 -07001588 def CASE71( self, main ):
1589 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001590 Randomly bring some core links down and verify ping all ( Point Intents-Att Topo )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001591 """
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 Wangb6586542016-02-26 09:25:56 -08001603 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001604
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 Wangb6586542016-02-26 09:25:56 -08001626 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001627 main.Mininet1.link(
1628 END1=link2End1,
1629 END2=main.randomLink2[ i ],
1630 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001631 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001632 main.Mininet1.link(
1633 END1=link3End1,
1634 END2=main.randomLink3[ i ],
1635 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001636 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001637
Jon Hallef0e2a12017-05-24 16:57:53 -07001638 main.step( "Verify link down is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08001639 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 Krishnac195f3b2015-07-08 20:02:24 -07001647
Jon Hallef0e2a12017-05-24 16:57:53 -07001648 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001649 intentState = main.CHOtestFunctions.checkIntents()
1650 utilities.assert_equals( expect=main.TRUE,
1651 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001652 onpass="INTENTS INSTALLED",
1653 onfail="SOME INTENTS NOT INSTALLED" )
1654
Hari Krishnac195f3b2015-07-08 20:02:24 -07001655 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001656 pingResult = main.CHOtestFunctions.checkPingall()
1657 utilities.assert_equals( expect=main.TRUE,
1658 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001659 onpass="PING ALL PASS",
1660 onfail="PING ALL FAIL" )
1661
GlennRCbddd58f2015-10-01 15:45:25 -07001662 caseResult = linkDown and pingResult and intentState
1663 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001664 onpass="Random Link cut Test PASS",
1665 onfail="Random Link cut Test FAIL" )
1666
GlennRCfcfdc4f2015-09-30 16:01:57 -07001667 # 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
GlennRCbddd58f2015-10-01 15:45:25 -07001675 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001676 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001677 main.stop( email=main.emailOnStop )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001678
Hari Krishnac195f3b2015-07-08 20:02:24 -07001679 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 Wangb6586542016-02-26 09:25:56 -08001687 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001688 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 Wangb6586542016-02-26 09:25:56 -08001702 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001703 main.Mininet1.link(
1704 END1=link2End1,
1705 END2=main.randomLink2[ i ],
1706 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001707 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001708 main.Mininet1.link(
1709 END1=link3End1,
1710 END2=main.randomLink3[ i ],
1711 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001712 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001713
Jon Hallef0e2a12017-05-24 16:57:53 -07001714 main.step( "Verify link up is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08001715 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 Krishnac195f3b2015-07-08 20:02:24 -07001722
Jon Hallef0e2a12017-05-24 16:57:53 -07001723 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001724 intentState = main.CHOtestFunctions.checkIntents()
1725 utilities.assert_equals( expect=main.TRUE,
1726 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001727 onpass="INTENTS INSTALLED",
1728 onfail="SOME INTENTS NOT INSTALLED" )
1729
Hari Krishnac195f3b2015-07-08 20:02:24 -07001730 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001731 pingResult = main.CHOtestFunctions.checkPingall()
1732 utilities.assert_equals( expect=main.TRUE,
1733 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001734 onpass="PING ALL PASS",
1735 onfail="PING ALL FAIL" )
1736
GlennRCbddd58f2015-10-01 15:45:25 -07001737 caseResult = linkUp and pingResult
1738 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001739 onpass="Link Up Test PASS",
1740 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001741 # Printing what exactly failed
1742 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08001743 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001744 if not pingResult:
1745 main.log.debug( "Pingall failed" )
1746 if not intentState:
1747 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001748
GlennRCbddd58f2015-10-01 15:45:25 -07001749 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001750 main.log.report( "Stopping test" )
GlennRC884dc9e2015-10-09 15:53:20 -07001751 main.stop( email=main.emailOnStop )
GlennRCbddd58f2015-10-01 15:45:25 -07001752
Hari Krishnac195f3b2015-07-08 20:02:24 -07001753 def CASE72( self, main ):
1754 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001755 Randomly bring some links down and verify ping all ( Host Intents-Chordal Topo )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001756 """
1757 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001758 import itertools
You Wangb6586542016-02-26 09:25:56 -08001759 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001760
Hari Krishnac195f3b2015-07-08 20:02:24 -07001761 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 Hallef0e2a12017-05-24 16:57:53 -07001767 switches.append( 's%d' % ( i + 1 ) )
1768 switchesLinksComb = list( itertools.combinations( switches, 2 ) )
1769 main.randomLinks = random.sample( switchesLinksComb, 5 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001770 print main.randomLinks
1771 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001772
Hari Krishnac195f3b2015-07-08 20:02:24 -07001773 for switch in main.randomLinks:
1774 main.Mininet1.link(
Jon Hallef0e2a12017-05-24 16:57:53 -07001775 END1=switch[ 0 ],
1776 END2=switch[ 1 ],
1777 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001778 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001779
Jon Hallef0e2a12017-05-24 16:57:53 -07001780 main.step( "Verify link down is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08001781 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 Krishnac195f3b2015-07-08 20:02:24 -07001788
Jon Hallef0e2a12017-05-24 16:57:53 -07001789 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001790 intentState = main.CHOtestFunctions.checkIntents()
1791 utilities.assert_equals( expect=main.TRUE,
1792 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001793 onpass="INTENTS INSTALLED",
1794 onfail="SOME INTENTS NOT INSTALLED" )
1795
Hari Krishnac195f3b2015-07-08 20:02:24 -07001796 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001797 pingResult = main.CHOtestFunctions.checkPingall()
1798 utilities.assert_equals( expect=main.TRUE,
1799 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001800 onpass="PING ALL PASS",
1801 onfail="PING ALL FAIL" )
1802
GlennRCbddd58f2015-10-01 15:45:25 -07001803 caseResult = linkDown and pingResult and intentState
1804 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001805 onpass="Random Link cut Test PASS",
1806 onfail="Random Link cut Test FAIL" )
1807
GlennRCfcfdc4f2015-09-30 16:01:57 -07001808 # 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
GlennRCbddd58f2015-10-01 15:45:25 -07001816 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001817 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001818 main.stop( email=main.emailOnStop )
1819
Hari Krishnac195f3b2015-07-08 20:02:24 -07001820 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 Wangb6586542016-02-26 09:25:56 -08001825 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001826
Hari Krishnac195f3b2015-07-08 20:02:24 -07001827 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 Hall4ba53f02015-07-29 13:07:41 -07001834
Hari Krishnac195f3b2015-07-08 20:02:24 -07001835 for switch in main.randomLinks:
1836 main.Mininet1.link(
Jon Hallef0e2a12017-05-24 16:57:53 -07001837 END1=switch[ 0 ],
1838 END2=switch[ 1 ],
1839 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001840 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001841
Jon Hallef0e2a12017-05-24 16:57:53 -07001842 main.step( "Verify link up is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08001843 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 Krishnac195f3b2015-07-08 20:02:24 -07001850
Jon Hallef0e2a12017-05-24 16:57:53 -07001851 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001852 intentState = main.CHOtestFunctions.checkIntents()
1853 utilities.assert_equals( expect=main.TRUE,
1854 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001855 onpass="INTENTS INSTALLED",
1856 onfail="SOME INTENTS NOT INSTALLED" )
1857
Hari Krishnac195f3b2015-07-08 20:02:24 -07001858 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001859 pingResult = main.CHOtestFunctions.checkPingall()
1860 utilities.assert_equals( expect=main.TRUE,
1861 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001862 onpass="PING ALL PASS",
1863 onfail="PING ALL FAIL" )
1864
GlennRCbddd58f2015-10-01 15:45:25 -07001865 caseResult = linkUp and pingResult
1866 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001867 onpass="Link Up Test PASS",
1868 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001869 # Printing what exactly failed
1870 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08001871 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001872 if not pingResult:
1873 main.log.debug( "Pingall failed" )
1874 if not intentState:
1875 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001876
GlennRCbddd58f2015-10-01 15:45:25 -07001877 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001878 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001879 main.stop( email=main.emailOnStop )
1880
Hari Krishnac195f3b2015-07-08 20:02:24 -07001881 def CASE73( self, main ):
1882 """
Jon Hallef0e2a12017-05-24 16:57:53 -07001883 Randomly bring some links down and verify ping all ( Point Intents-Chordal Topo )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001884 """
1885 import random
Jon Hall4ba53f02015-07-29 13:07:41 -07001886 import itertools
You Wangb6586542016-02-26 09:25:56 -08001887 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001888
Hari Krishnac195f3b2015-07-08 20:02:24 -07001889 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 Hallef0e2a12017-05-24 16:57:53 -07001895 switches.append( 's%d' % ( i + 1 ) )
1896 switchesLinksComb = list( itertools.combinations( switches, 2 ) )
1897 main.randomLinks = random.sample( switchesLinksComb, 5 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001898 print main.randomLinks
1899 main.step( "Cut links on random devices" )
Jon Hall4ba53f02015-07-29 13:07:41 -07001900
Hari Krishnac195f3b2015-07-08 20:02:24 -07001901 for switch in main.randomLinks:
1902 main.Mininet1.link(
Jon Hallef0e2a12017-05-24 16:57:53 -07001903 END1=switch[ 0 ],
1904 END2=switch[ 1 ],
1905 OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08001906 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001907
Jon Hallef0e2a12017-05-24 16:57:53 -07001908 main.step( "Verify link down is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08001909 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 Krishnac195f3b2015-07-08 20:02:24 -07001916
Jon Hallef0e2a12017-05-24 16:57:53 -07001917 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001918 intentState = main.CHOtestFunctions.checkIntents()
1919 utilities.assert_equals( expect=main.TRUE,
1920 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001921 onpass="INTENTS INSTALLED",
1922 onfail="SOME INTENTS NOT INSTALLED" )
1923
Hari Krishnac195f3b2015-07-08 20:02:24 -07001924 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001925 pingResult = main.CHOtestFunctions.checkPingall()
1926 utilities.assert_equals( expect=main.TRUE,
1927 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001928 onpass="PING ALL PASS",
1929 onfail="PING ALL FAIL" )
1930
GlennRCbddd58f2015-10-01 15:45:25 -07001931 caseResult = linkDown and pingResult and intentState
1932 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001933 onpass="Random Link cut Test PASS",
1934 onfail="Random Link cut Test FAIL" )
1935
GlennRCfcfdc4f2015-09-30 16:01:57 -07001936 # 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
GlennRCbddd58f2015-10-01 15:45:25 -07001944 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07001945 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07001946 main.stop( email=main.emailOnStop )
1947
Hari Krishnac195f3b2015-07-08 20:02:24 -07001948 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 Wangb6586542016-02-26 09:25:56 -08001953 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07001954
Hari Krishnac195f3b2015-07-08 20:02:24 -07001955 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 Hall4ba53f02015-07-29 13:07:41 -07001962
Hari Krishnac195f3b2015-07-08 20:02:24 -07001963 for switch in main.randomLinks:
1964 main.Mininet1.link(
Jon Hallef0e2a12017-05-24 16:57:53 -07001965 END1=switch[ 0 ],
1966 END2=switch[ 1 ],
1967 OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08001968 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07001969
Jon Hallef0e2a12017-05-24 16:57:53 -07001970 main.step( "Verify link up is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08001971 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 Krishnac195f3b2015-07-08 20:02:24 -07001978
Jon Hallef0e2a12017-05-24 16:57:53 -07001979 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08001980 intentState = main.CHOtestFunctions.checkIntents()
1981 utilities.assert_equals( expect=main.TRUE,
1982 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07001983 onpass="INTENTS INSTALLED",
1984 onfail="SOME INTENTS NOT INSTALLED" )
1985
Hari Krishnac195f3b2015-07-08 20:02:24 -07001986 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08001987 pingResult = main.CHOtestFunctions.checkPingall()
1988 utilities.assert_equals( expect=main.TRUE,
1989 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001990 onpass="PING ALL PASS",
1991 onfail="PING ALL FAIL" )
1992
GlennRCbddd58f2015-10-01 15:45:25 -07001993 caseResult = linkUp and pingResult
1994 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07001995 onpass="Link Up Test PASS",
1996 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07001997 # Printing what exactly failed
1998 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08001999 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002000 if not pingResult:
2001 main.log.debug( "Pingall failed" )
2002 if not intentState:
2003 main.log.debug( "Intents are not all installed" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002004
GlennRCbddd58f2015-10-01 15:45:25 -07002005 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002006 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002007 main.stop( email=main.emailOnStop )
2008
Hari Krishnac195f3b2015-07-08 20:02:24 -07002009 def CASE74( self, main ):
2010 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002011 Randomly bring some core links down and verify ping all ( Host Intents-Spine Topo )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002012 """
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 Wangb6586542016-02-26 09:25:56 -08002024 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -07002025
Hari Krishnac195f3b2015-07-08 20:02:24 -07002026 main.log.report( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
2027 main.log.report( "___________________________________________________________________________" )
Jon Hall6509dbf2016-06-21 17:01:17 -07002028 main.case( "Bring some core links down and verify ping all (Host Intents-Spine Topo)" )
You Wang0779bac2016-01-27 16:32:33 -08002029
2030 main.step( "Bring some core links down" )
Jon Hallef0e2a12017-05-24 16:57:53 -07002031 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 Krishna6185fc12015-07-13 15:42:31 -07002039
2040 # Work around for link state propagation delay. Added some sleep time.
Hari Krishnac195f3b2015-07-08 20:02:24 -07002041 # 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 Wangb6586542016-02-26 09:25:56 -08002044 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002045 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08002046 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002047
You Wangb6586542016-02-26 09:25:56 -08002048 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 Wang0779bac2016-01-27 16:32:33 -08002056
You Wangb6586542016-02-26 09:25:56 -08002057 main.step( "Verify intents are installed" )
2058 intentState = main.CHOtestFunctions.checkIntents()
2059 utilities.assert_equals( expect=main.TRUE,
2060 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002061 onpass="INTENTS INSTALLED",
2062 onfail="SOME INTENTS NOT INSTALLED" )
2063
Hari Krishnac195f3b2015-07-08 20:02:24 -07002064 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002065 pingResult = main.CHOtestFunctions.checkPingall()
2066 utilities.assert_equals( expect=main.TRUE,
2067 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002068 onpass="PING ALL PASS",
2069 onfail="PING ALL FAIL" )
2070
GlennRCbddd58f2015-10-01 15:45:25 -07002071 caseResult = linkDown and pingResult and intentState
2072 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002073 onpass="Random Link cut Test PASS",
2074 onfail="Random Link cut Test FAIL" )
2075
GlennRCfcfdc4f2015-09-30 16:01:57 -07002076 # 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
GlennRCbddd58f2015-10-01 15:45:25 -07002084 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002085 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002086 main.stop( email=main.emailOnStop )
2087
Hari Krishnac195f3b2015-07-08 20:02:24 -07002088 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 Wangb6586542016-02-26 09:25:56 -08002095 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002096 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 Krishna6185fc12015-07-13 15:42:31 -07002102
You Wang0779bac2016-01-27 16:32:33 -08002103 main.step( "Bring up the core links that are down" )
Hari Krishna6185fc12015-07-13 15:42:31 -07002104 # 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 Krishnac195f3b2015-07-08 20:02:24 -07002107 main.Mininet1.link( END1=link1End1, END2=main.randomLink3, OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08002108 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002109 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08002110 time.sleep( main.linkSleep )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002111
Jon Hallef0e2a12017-05-24 16:57:53 -07002112 main.step( "Verify link up is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08002113 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 Krishnac195f3b2015-07-08 20:02:24 -07002120
Jon Hallef0e2a12017-05-24 16:57:53 -07002121 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08002122 intentState = main.CHOtestFunctions.checkIntents()
2123 utilities.assert_equals( expect=main.TRUE,
2124 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002125 onpass="INTENTS INSTALLED",
2126 onfail="SOME INTENTS NOT INSTALLED" )
2127
Hari Krishnac195f3b2015-07-08 20:02:24 -07002128 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002129 pingResult = main.CHOtestFunctions.checkPingall()
2130 utilities.assert_equals( expect=main.TRUE,
2131 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002132 onpass="PING ALL PASS",
2133 onfail="PING ALL FAIL" )
2134
GlennRCbddd58f2015-10-01 15:45:25 -07002135 caseResult = linkUp and pingResult
2136 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002137 onpass="Link Up Test PASS",
2138 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002139 # Printing what exactly failed
2140 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08002141 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002142 if not pingResult:
2143 main.log.debug( "Pingall failed" )
2144 if not intentState:
2145 main.log.debug( "Intents are not all installed" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002146
GlennRCbddd58f2015-10-01 15:45:25 -07002147 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002148 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002149 main.stop( email=main.emailOnStop )
2150
Hari Krishnab79d0822015-08-20 09:48:43 -07002151 def CASE75( self, main ):
2152 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002153 Randomly bring some core links down and verify ping all ( Point Intents-Spine Topo )
Hari Krishnab79d0822015-08-20 09:48:43 -07002154 """
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 Wangb6586542016-02-26 09:25:56 -08002166 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnab79d0822015-08-20 09:48:43 -07002167
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 Wang0779bac2016-01-27 16:32:33 -08002171
2172 main.step( "Bring some core links down" )
Jon Hallef0e2a12017-05-24 16:57:53 -07002173 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 Krishnab79d0822015-08-20 09:48:43 -07002181
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 Wangb6586542016-02-26 09:25:56 -08002186 time.sleep( main.linkSleep )
Hari Krishnab79d0822015-08-20 09:48:43 -07002187 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="down" )
You Wangb6586542016-02-26 09:25:56 -08002188 time.sleep( main.linkSleep )
Hari Krishnab79d0822015-08-20 09:48:43 -07002189
Jon Hallef0e2a12017-05-24 16:57:53 -07002190 main.step( "Verify link down is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08002191 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 Krishnab79d0822015-08-20 09:48:43 -07002198
Jon Hallef0e2a12017-05-24 16:57:53 -07002199 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08002200 intentState = main.CHOtestFunctions.checkIntents()
2201 utilities.assert_equals( expect=main.TRUE,
2202 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002203 onpass="INTENTS INSTALLED",
2204 onfail="SOME INTENTS NOT INSTALLED" )
2205
Hari Krishnab79d0822015-08-20 09:48:43 -07002206 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002207 pingResult = main.CHOtestFunctions.checkPingall()
2208 utilities.assert_equals( expect=main.TRUE,
2209 actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002210 onpass="PING ALL PASS",
2211 onfail="PING ALL FAIL" )
2212
GlennRCbddd58f2015-10-01 15:45:25 -07002213 caseResult = linkDown and pingResult and intentState
2214 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002215 onpass="Random Link cut Test PASS",
2216 onfail="Random Link cut Test FAIL" )
2217
GlennRCfcfdc4f2015-09-30 16:01:57 -07002218 # 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
GlennRCbddd58f2015-10-01 15:45:25 -07002226 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002227 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002228 main.stop( email=main.emailOnStop )
2229
Hari Krishnab79d0822015-08-20 09:48:43 -07002230 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 Wangb6586542016-02-26 09:25:56 -08002237 main.linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
Hari Krishnab79d0822015-08-20 09:48:43 -07002238 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 Wang0779bac2016-01-27 16:32:33 -08002245 main.step( "Bring up the core links that are down" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002246 # 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 Wangb6586542016-02-26 09:25:56 -08002250 time.sleep( main.linkSleep )
Hari Krishnab79d0822015-08-20 09:48:43 -07002251 main.Mininet1.link( END1=link2End1, END2=main.randomLink4, OPTION="up" )
You Wangb6586542016-02-26 09:25:56 -08002252 time.sleep( main.linkSleep )
Hari Krishnab79d0822015-08-20 09:48:43 -07002253
Jon Hallef0e2a12017-05-24 16:57:53 -07002254 main.step( "Verify link up is discoverd by onos" )
You Wangb6586542016-02-26 09:25:56 -08002255 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 Krishnab79d0822015-08-20 09:48:43 -07002262
Jon Hallef0e2a12017-05-24 16:57:53 -07002263 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08002264 intentState = main.CHOtestFunctions.checkIntents()
2265 utilities.assert_equals( expect=main.TRUE,
2266 actual=intentState,
GlennRCfcfdc4f2015-09-30 16:01:57 -07002267 onpass="INTENTS INSTALLED",
2268 onfail="SOME INTENTS NOT INSTALLED" )
2269
Hari Krishnab79d0822015-08-20 09:48:43 -07002270 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002271 pingResult = main.CHOtestFunctions.checkPingall()
2272 utilities.assert_equals( expect=main.TRUE,
2273 actual=pingResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002274 onpass="PING ALL PASS",
2275 onfail="PING ALL FAIL" )
2276
GlennRCbddd58f2015-10-01 15:45:25 -07002277 caseResult = linkUp and pingResult
2278 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnab79d0822015-08-20 09:48:43 -07002279 onpass="Link Up Test PASS",
2280 onfail="Link Up Test FAIL" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002281 # Printing what exactly failed
2282 if not linkUp:
You Wang0779bac2016-01-27 16:32:33 -08002283 main.log.debug( "Link up was not discovered correctly" )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002284 if not pingResult:
2285 main.log.debug( "Pingall failed" )
2286 if not intentState:
2287 main.log.debug( "Intents are not all installed" )
Hari Krishnab79d0822015-08-20 09:48:43 -07002288
GlennRCbddd58f2015-10-01 15:45:25 -07002289 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002290 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002291 main.stop( email=main.emailOnStop )
2292
Devin Lim58046fa2017-07-05 16:55:00 -07002293 def CASE170( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07002294 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002295 IPv6 ping all with some core links down( Host Intents-Att Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002296 """
2297 main.log.report( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
2298 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002299 main.case( "IPv6 ping all with some core links down( Host Intents-Att Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002300
Hari Krishna4223dbd2015-08-13 16:29:53 -07002301 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002302 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2303 utilities.assert_equals( expect=main.TRUE,
2304 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002305 onpass="PING ALL PASS",
2306 onfail="PING ALL FAIL" )
2307
GlennRCbddd58f2015-10-01 15:45:25 -07002308 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002309 utilities.assert_equals(
2310 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002311 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002312 onpass="IPv6 Ping across 300 host intents test PASS",
2313 onfail="IPv6 Ping across 300 host intents test FAIL" )
2314
You Wangb6586542016-02-26 09:25:56 -08002315 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002316 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002317 main.stop( email=main.emailOnStop )
2318
Devin Lim58046fa2017-07-05 16:55:00 -07002319 def CASE180( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07002320 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002321 IPv6 ping all with after core links back up( Host Intents-Att Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002322 """
2323 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
2324 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002325 main.case( "IPv6 ping all with after core links back up( Host Intents-Att Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002326
Hari Krishna4223dbd2015-08-13 16:29:53 -07002327 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002328 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2329 utilities.assert_equals( expect=main.TRUE,
2330 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002331 onpass="PING ALL PASS",
2332 onfail="PING ALL FAIL" )
2333
GlennRCbddd58f2015-10-01 15:45:25 -07002334 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002335 utilities.assert_equals(
2336 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002337 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002338 onpass="IPv6 Ping across 300 host intents test PASS",
2339 onfail="IPv6 Ping across 300 host intents test FAIL" )
2340
You Wangb6586542016-02-26 09:25:56 -08002341 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002342 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002343 main.stop( email=main.emailOnStop )
2344
Devin Lim58046fa2017-07-05 16:55:00 -07002345 def CASE171( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07002346 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002347 IPv6 ping all with some core links down( Point Intents-Att Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002348 """
2349 main.log.report( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
2350 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002351 main.case( "IPv6 ping all with some core links down( Point Intents-Att Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002352
Hari Krishna4223dbd2015-08-13 16:29:53 -07002353 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002354 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2355 utilities.assert_equals( expect=main.TRUE,
2356 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002357 onpass="PING ALL PASS",
2358 onfail="PING ALL FAIL" )
2359
GlennRCbddd58f2015-10-01 15:45:25 -07002360 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002361 utilities.assert_equals(
2362 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002363 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002364 onpass="IPv6 Ping across 600 point intents test PASS",
2365 onfail="IPv6 Ping across 600 point intents test FAIL" )
2366
You Wangb6586542016-02-26 09:25:56 -08002367 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002368 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002369 main.stop( email=main.emailOnStop )
2370
Devin Lim58046fa2017-07-05 16:55:00 -07002371 def CASE181( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07002372 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002373 IPv6 ping all with after core links back up( Point Intents-Att Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002374 """
2375 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
2376 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002377 main.case( "IPv6 ping all with after core links back up( Point Intents-Att Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002378
Hari Krishna4223dbd2015-08-13 16:29:53 -07002379 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002380 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2381 utilities.assert_equals( expect=main.TRUE,
2382 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002383 onpass="PING ALL PASS",
2384 onfail="PING ALL FAIL" )
2385
GlennRCbddd58f2015-10-01 15:45:25 -07002386 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002387 utilities.assert_equals(
2388 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002389 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002390 onpass="IPv6 Ping across 600 Point intents test PASS",
2391 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2392
You Wangb6586542016-02-26 09:25:56 -08002393 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002394 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002395 main.stop( email=main.emailOnStop )
2396
Devin Lim58046fa2017-07-05 16:55:00 -07002397 def CASE172( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07002398 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002399 IPv6 ping all with some core links down( Host Intents-Chordal Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002400 """
2401 main.log.report( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
2402 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002403 main.case( "IPv6 ping all with some core links down( Host Intents-Chordal Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002404
Hari Krishna4223dbd2015-08-13 16:29:53 -07002405 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002406 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2407 utilities.assert_equals( expect=main.TRUE,
2408 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002409 onpass="PING ALL PASS",
2410 onfail="PING ALL FAIL" )
2411
GlennRCbddd58f2015-10-01 15:45:25 -07002412 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002413 utilities.assert_equals(
2414 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002415 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002416 onpass="IPv6 Ping across 300 host intents test PASS",
2417 onfail="IPv6 Ping across 300 host intents test FAIL" )
2418
Devin Lim58046fa2017-07-05 16:55:00 -07002419 def CASE182( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07002420 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002421 IPv6 ping all with after core links back up( Host Intents-Chordal Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002422 """
2423 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
2424 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002425 main.case( "IPv6 ping all with after core links back up( Host Intents-Chordal Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002426
Hari Krishna4223dbd2015-08-13 16:29:53 -07002427 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002428 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2429 utilities.assert_equals( expect=main.TRUE,
2430 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002431 onpass="PING ALL PASS",
2432 onfail="PING ALL FAIL" )
2433
GlennRCbddd58f2015-10-01 15:45:25 -07002434 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002435 utilities.assert_equals(
2436 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002437 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002438 onpass="IPv6 Ping across 300 host intents test PASS",
2439 onfail="IPv6 Ping across 300 host intents test FAIL" )
2440
You Wangb6586542016-02-26 09:25:56 -08002441 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002442 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002443 main.stop( email=main.emailOnStop )
2444
Devin Lim58046fa2017-07-05 16:55:00 -07002445 def CASE173( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07002446 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002447 IPv6 ping all with some core links down( Point Intents-Chordal Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002448 """
2449 main.log.report( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
2450 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002451 main.case( "IPv6 ping all with some core links down( Point Intents-Chordal Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002452
Hari Krishna4223dbd2015-08-13 16:29:53 -07002453 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002454 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2455 utilities.assert_equals( expect=main.TRUE,
2456 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002457 onpass="PING ALL PASS",
2458 onfail="PING ALL FAIL" )
2459
GlennRCbddd58f2015-10-01 15:45:25 -07002460 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002461 utilities.assert_equals(
2462 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002463 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002464 onpass="IPv6 Ping across 600 point intents test PASS",
2465 onfail="IPv6 Ping across 600 point intents test FAIL" )
2466
You Wangb6586542016-02-26 09:25:56 -08002467 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002468 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002469 main.stop( email=main.emailOnStop )
2470
Devin Lim58046fa2017-07-05 16:55:00 -07002471 def CASE183( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07002472 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002473 IPv6 ping all with after core links back up( Point Intents-Chordal Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002474 """
2475 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
2476 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002477 main.case( "IPv6 ping all with after core links back up( Point Intents-Chordal Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002478
Hari Krishna4223dbd2015-08-13 16:29:53 -07002479 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002480 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2481 utilities.assert_equals( expect=main.TRUE,
2482 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002483 onpass="PING ALL PASS",
2484 onfail="PING ALL FAIL" )
2485
GlennRCbddd58f2015-10-01 15:45:25 -07002486 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002487 utilities.assert_equals(
2488 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002489 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002490 onpass="IPv6 Ping across 600 Point intents test PASS",
2491 onfail="IPv6 Ping across 600 Point intents test FAIL" )
2492
You Wangb6586542016-02-26 09:25:56 -08002493 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002494 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002495 main.stop( email=main.emailOnStop )
2496
Devin Lim58046fa2017-07-05 16:55:00 -07002497 def CASE174( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07002498 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002499 IPv6 ping all with some core links down( Host Intents-Spine Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002500 """
2501 main.log.report( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
2502 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002503 main.case( "IPv6 ping all with some core links down( Host Intents-Spine Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002504
Hari Krishna4223dbd2015-08-13 16:29:53 -07002505 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002506 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2507 utilities.assert_equals( expect=main.TRUE,
2508 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002509 onpass="PING ALL PASS",
2510 onfail="PING ALL FAIL" )
2511
GlennRCbddd58f2015-10-01 15:45:25 -07002512 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002513 utilities.assert_equals(
2514 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002515 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002516 onpass="IPv6 Ping across 2278 host intents test PASS",
2517 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2518
You Wangb6586542016-02-26 09:25:56 -08002519 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002520 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002521 main.stop( email=main.emailOnStop )
2522
Devin Lim58046fa2017-07-05 16:55:00 -07002523 def CASE184( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07002524 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002525 IPv6 ping all with after core links back up( Host Intents-Spine Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002526 """
2527 main.log.report( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
2528 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002529 main.case( "IPv6 ping all with after core links back up( Host Intents-Spine Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002530
Hari Krishna4223dbd2015-08-13 16:29:53 -07002531 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002532 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2533 utilities.assert_equals( expect=main.TRUE,
2534 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002535 onpass="PING ALL PASS",
2536 onfail="PING ALL FAIL" )
2537
GlennRCbddd58f2015-10-01 15:45:25 -07002538 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002539 utilities.assert_equals(
2540 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002541 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002542 onpass="IPv6 Ping across 2278 host intents test PASS",
2543 onfail="IPv6 Ping across 2278 host intents test FAIL" )
2544
You Wangb6586542016-02-26 09:25:56 -08002545 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002546 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002547 main.stop( email=main.emailOnStop )
2548
Devin Lim58046fa2017-07-05 16:55:00 -07002549 def CASE175( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07002550 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002551 IPv6 ping all with some core links down( Point Intents-Spine Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002552 """
2553 main.log.report( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
2554 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002555 main.case( "IPv6 ping all with some core links down( Point Intents-Spine Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002556
Hari Krishna4223dbd2015-08-13 16:29:53 -07002557 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002558 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2559 utilities.assert_equals( expect=main.TRUE,
2560 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002561 onpass="PING ALL PASS",
2562 onfail="PING ALL FAIL" )
2563
GlennRCbddd58f2015-10-01 15:45:25 -07002564 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002565 utilities.assert_equals(
2566 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002567 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002568 onpass="IPv6 Ping across 4556 point intents test PASS",
2569 onfail="IPv6 Ping across 4556 point intents test FAIL" )
2570
You Wangb6586542016-02-26 09:25:56 -08002571 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002572 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002573 main.stop( email=main.emailOnStop )
2574
Devin Lim58046fa2017-07-05 16:55:00 -07002575 def CASE185( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07002576 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002577 IPv6 ping all with after core links back up( Point Intents-Spine Topo )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002578 """
2579 main.log.report( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
2580 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07002581 main.case( "IPv6 ping all with after core links back up( Point Intents-Spine Topo )" )
You Wangb6586542016-02-26 09:25:56 -08002582
Hari Krishna4223dbd2015-08-13 16:29:53 -07002583 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002584 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
2585 utilities.assert_equals( expect=main.TRUE,
2586 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002587 onpass="PING ALL PASS",
2588 onfail="PING ALL FAIL" )
2589
GlennRCbddd58f2015-10-01 15:45:25 -07002590 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07002591 utilities.assert_equals(
2592 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002593 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07002594 onpass="IPv6 Ping across 4556 Point intents test PASS",
2595 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
2596
You Wangb6586542016-02-26 09:25:56 -08002597 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07002598 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08002599 main.stop( email=main.emailOnStop )
2600
Devin Lim58046fa2017-07-05 16:55:00 -07002601 def CASE90( self, main ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07002602 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002603 Install 600 point intents and verify ping all ( Att Topology )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002604 """
2605 main.log.report( "Add 600 point intents and verify pingall (Att Topology)" )
2606 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002607 main.case( "Install 600 point intents" )
You Wangb6586542016-02-26 09:25:56 -08002608
Hari Krishnac195f3b2015-07-08 20:02:24 -07002609 main.step( "Add point Intents" )
You Wangb6586542016-02-26 09:25:56 -08002610 intentIdList = main.CHOtestFunctions.installPointIntents()
Jon Hallef0e2a12017-05-24 16:57:53 -07002611 main.intentIds = list( intentIdList )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002612
Jon Hallef0e2a12017-05-24 16:57:53 -07002613 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08002614 intentState = main.CHOtestFunctions.checkIntents()
2615 utilities.assert_equals( expect=main.TRUE,
2616 actual=intentState,
GlennRCa8d786a2015-09-23 17:40:11 -07002617 onpass="INTENTS INSTALLED",
2618 onfail="SOME INTENTS NOT INSTALLED" )
2619
Hari Krishnac195f3b2015-07-08 20:02:24 -07002620 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002621 pingResult = main.CHOtestFunctions.checkPingall()
2622 utilities.assert_equals( expect=main.TRUE,
2623 actual=pingResult,
GlennRC6ac11b12015-10-21 17:41:28 -07002624 onpass="PING ALL PASS",
Hari Krishnac195f3b2015-07-08 20:02:24 -07002625 onfail="PING ALL FAIL" )
2626
GlennRCbddd58f2015-10-01 15:45:25 -07002627 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002628 utilities.assert_equals(
2629 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002630 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002631 onpass="Install 600 point Intents and Ping All test PASS",
2632 onfail="Install 600 point Intents and Ping All test FAIL" )
2633
GlennRCbddd58f2015-10-01 15:45:25 -07002634 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 Hallef0e2a12017-05-24 16:57:53 -07002640 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002641 main.stop( email=main.emailOnStop )
2642
Devin Lim58046fa2017-07-05 16:55:00 -07002643 def CASE91( self, main ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07002644 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002645 Install 600 point intents and verify ping all ( Chordal Topology )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002646 """
2647 main.log.report( "Add 600 point intents and verify pingall (Chordal Topology)" )
2648 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002649 main.case( "Install 600 point intents" )
You Wangb6586542016-02-26 09:25:56 -08002650
Hari Krishnac195f3b2015-07-08 20:02:24 -07002651 main.step( "Add point Intents" )
You Wangb6586542016-02-26 09:25:56 -08002652 intentIdList = main.CHOtestFunctions.installPointIntents()
Jon Hallef0e2a12017-05-24 16:57:53 -07002653 main.intentIds = list( intentIdList )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002654
Jon Hallef0e2a12017-05-24 16:57:53 -07002655 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08002656 intentState = main.CHOtestFunctions.checkIntents()
2657 utilities.assert_equals( expect=main.TRUE,
2658 actual=intentState,
GlennRCa8d786a2015-09-23 17:40:11 -07002659 onpass="INTENTS INSTALLED",
2660 onfail="SOME INTENTS NOT INSTALLED" )
2661
Hari Krishnac195f3b2015-07-08 20:02:24 -07002662 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002663 pingResult = main.CHOtestFunctions.checkPingall()
2664 utilities.assert_equals( expect=main.TRUE,
2665 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002666 onpass="PING ALL PASS",
2667 onfail="PING ALL FAIL" )
2668
GlennRCbddd58f2015-10-01 15:45:25 -07002669 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002670 utilities.assert_equals(
2671 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002672 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002673 onpass="Install 600 point Intents and Ping All test PASS",
2674 onfail="Install 600 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002675
GlennRCbddd58f2015-10-01 15:45:25 -07002676 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 Hallef0e2a12017-05-24 16:57:53 -07002682 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002683 main.stop( email=main.emailOnStop )
2684
Devin Lim58046fa2017-07-05 16:55:00 -07002685 def CASE92( self, main ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07002686 """
Jon Hallef0e2a12017-05-24 16:57:53 -07002687 Install 4556 point intents and verify ping all ( Spine Topology )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002688 """
2689 main.log.report( "Add 4556 point intents and verify pingall (Spine Topology)" )
2690 main.log.report( "_______________________________________" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002691 main.case( "Install 4556 point intents" )
GlennRCa8d786a2015-09-23 17:40:11 -07002692
You Wangb6586542016-02-26 09:25:56 -08002693 main.step( "Add point Intents" )
2694 intentIdList = main.CHOtestFunctions.installPointIntents()
Jon Hallef0e2a12017-05-24 16:57:53 -07002695 main.intentIds = list( intentIdList )
GlennRCfcfdc4f2015-09-30 16:01:57 -07002696
Jon Hallef0e2a12017-05-24 16:57:53 -07002697 main.step( "Verify intents are installed" )
You Wangb6586542016-02-26 09:25:56 -08002698 intentState = main.CHOtestFunctions.checkIntents()
2699 utilities.assert_equals( expect=main.TRUE,
2700 actual=intentState,
GlennRCa8d786a2015-09-23 17:40:11 -07002701 onpass="INTENTS INSTALLED",
2702 onfail="SOME INTENTS NOT INSTALLED" )
2703
Hari Krishnac195f3b2015-07-08 20:02:24 -07002704 main.step( "Verify Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08002705 pingResult = main.CHOtestFunctions.checkPingall()
2706 utilities.assert_equals( expect=main.TRUE,
2707 actual=pingResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002708 onpass="PING ALL PASS",
2709 onfail="PING ALL FAIL" )
2710
GlennRCbddd58f2015-10-01 15:45:25 -07002711 caseResult = ( intentState and pingResult )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002712 utilities.assert_equals(
2713 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002714 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002715 onpass="Install 4556 point Intents and Ping All test PASS",
2716 onfail="Install 4556 point Intents and Ping All test FAIL" )
Jon Hall4ba53f02015-07-29 13:07:41 -07002717
GlennRCbddd58f2015-10-01 15:45:25 -07002718 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 Hallef0e2a12017-05-24 16:57:53 -07002724 main.log.report( "Stopping test" )
GlennRCbddd58f2015-10-01 15:45:25 -07002725 main.stop( email=main.emailOnStop )
2726
Devin Lim58046fa2017-07-05 16:55:00 -07002727 def CASE93( self, main ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07002728 """
2729 Install multi-single point intents and verify Ping all works
2730 for att topology
2731 """
2732 import copy
2733 import time
GlennRCdb2c8422015-09-29 12:21:59 -07002734 from collections import Counter
Hari Krishnac195f3b2015-07-08 20:02:24 -07002735 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 Hallef0e2a12017-05-24 16:57:53 -07002738 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
2739 portIngressList = [ '1' ] * ( len( deviceDPIDsCopy ) - 1 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002740 intentIdList = []
Jon Hallef0e2a12017-05-24 16:57:53 -07002741 main.log.info( "MACsDict" + str( main.MACsDict ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002742 time1 = time.time()
Devin Lim58046fa2017-07-05 16:55:00 -07002743 for i in xrange( 0, len( deviceDPIDsCopy ), main.numCtrls ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07002744 pool = []
2745 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -07002746 egressDevice = deviceDPIDsCopy[ i ]
2747 ingressDeviceList = copy.copy( deviceDPIDsCopy )
2748 ingressDeviceList.remove( egressDevice )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002749 if i >= len( deviceDPIDsCopy ):
2750 break
2751 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
Jon Hallef0e2a12017-05-24 16:57:53 -07002752 threadID=main.threadID,
2753 name="addMultipointToSinglepointIntent",
2754 args=[ ingressDeviceList, egressDevice, portIngressList, '1', '', '', main.MACsDict.get( egressDevice ) ] )
2755 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002756 t.start()
2757 i = i + 1
2758 main.threadID = main.threadID + 1
2759 for thread in pool:
2760 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07002761 intentIdList.append( thread.result )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002762 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07002763 main.log.info( "Time for adding point intents: %2f seconds" % ( time2 - time1 ) )
Jon Hall4ba53f02015-07-29 13:07:41 -07002764
Jon Hallef0e2a12017-05-24 16:57:53 -07002765 main.step( "Verify intents are installed" )
GlennRC1dde1712015-10-02 11:03:08 -07002766 # Giving onos multiple chances to install intents
2767 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07002768 if i != 0:
2769 main.log.warn( "Verification failed. Retrying..." )
Jon Hallef0e2a12017-05-24 16:57:53 -07002770 main.log.info( "Waiting for onos to install intents..." )
GlennRCdb2c8422015-09-29 12:21:59 -07002771 time.sleep( main.checkIntentsDelay )
2772
2773 intentState = main.TRUE
Devin Lim58046fa2017-07-05 16:55:00 -07002774 for e in range( main.numCtrls ):
Jon Hallef0e2a12017-05-24 16:57:53 -07002775 main.log.info( "Checking intents on CLI %s" % ( e + 1 ) )
2776 IntentStateIndividual = main.CLIs[ e ].checkIntentState( intentsId=intentIdList )
You Wangb6586542016-02-26 09:25:56 -08002777 if not IntentStateIndividual:
Jon Hallef0e2a12017-05-24 16:57:53 -07002778 main.log.warn( "Not all intents installed on ONOS%s" % ( e + 1 ) )
You Wangb6586542016-02-26 09:25:56 -08002779 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07002780 if intentState:
2781 break
You Wangb6586542016-02-26 09:25:56 -08002782 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07002783 #Dumping intent summary
Jon Hallef0e2a12017-05-24 16:57:53 -07002784 main.log.info( "**** Intent Summary ****\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCdb2c8422015-09-29 12:21:59 -07002785
2786 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2787 onpass="INTENTS INSTALLED",
2788 onfail="SOME INTENTS NOT INSTALLED" )
2789
Jon Hallef0e2a12017-05-24 16:57:53 -07002790 main.step( "Verify flows are all added" )
GlennRCfa69a2a2015-10-02 15:54:06 -07002791
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 Hallef0e2a12017-05-24 16:57:53 -07002807 main.log.info( "Summary:\n" + str( main.ONOScli1.summary( jsonFormat=False ) ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07002808
2809 utilities.assert_equals( expect=main.TRUE, actual=flowState,
2810 onpass="FLOWS INSTALLED",
2811 onfail="SOME FLOWS NOT ADDED" )
GlennRCdb2c8422015-09-29 12:21:59 -07002812
Hari Krishnac195f3b2015-07-08 20:02:24 -07002813 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -07002814 for i in range( main.numPings ):
GlennRCdb2c8422015-09-29 12:21:59 -07002815 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07002816 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -07002817 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -07002818 main.log.warn( "First pingall failed. Retrying..." )
2819 time.sleep( main.pingSleep )
2820 else:
2821 break
GlennRCdb2c8422015-09-29 12:21:59 -07002822
Hari Krishnac195f3b2015-07-08 20:02:24 -07002823 time2 = time.time()
2824 timeDiff = round( ( time2 - time1 ), 2 )
2825 main.log.report(
2826 "Time taken for Ping All: " +
2827 str( timeDiff ) +
2828 " seconds" )
GlennRCdb2c8422015-09-29 12:21:59 -07002829
GlennRCbddd58f2015-10-01 15:45:25 -07002830 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002831 utilities.assert_equals(
2832 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002833 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002834 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 Hall4ba53f02015-07-29 13:07:41 -07002836
GlennRCfa69a2a2015-10-02 15:54:06 -07002837 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 Hallef0e2a12017-05-24 16:57:53 -07002845 main.log.report( "Stopping test" )
GlennRCfa69a2a2015-10-02 15:54:06 -07002846 main.stop( email=main.emailOnStop )
2847
Devin Lim58046fa2017-07-05 16:55:00 -07002848 def CASE94( self, main ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07002849 """
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 Hallef0e2a12017-05-24 16:57:53 -07002858 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
2859 portIngressList = [ '1' ] * ( len( deviceDPIDsCopy ) - 1 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002860 intentIdList = []
Jon Hallef0e2a12017-05-24 16:57:53 -07002861 main.log.info( "MACsDict" + str( main.MACsDict ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002862 time1 = time.time()
Devin Lim58046fa2017-07-05 16:55:00 -07002863 for i in xrange( 0, len( deviceDPIDsCopy ), main.numCtrls ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07002864 pool = []
2865 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -07002866 egressDevice = deviceDPIDsCopy[ i ]
2867 ingressDeviceList = copy.copy( deviceDPIDsCopy )
2868 ingressDeviceList.remove( egressDevice )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002869 if i >= len( deviceDPIDsCopy ):
2870 break
2871 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
Jon Hallef0e2a12017-05-24 16:57:53 -07002872 threadID=main.threadID,
2873 name="addMultipointToSinglepointIntent",
2874 args=[ ingressDeviceList, egressDevice, portIngressList, '1', '', '', main.MACsDict.get( egressDevice ) ] )
2875 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002876 t.start()
2877 i = i + 1
2878 main.threadID = main.threadID + 1
2879 for thread in pool:
2880 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07002881 intentIdList.append( thread.result )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002882 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07002883 main.log.info( "Time for adding point intents: %2f seconds" % ( time2 - time1 ) )
GlennRCdb2c8422015-09-29 12:21:59 -07002884
Jon Hallef0e2a12017-05-24 16:57:53 -07002885 main.step( "Verify intents are installed" )
GlennRC1dde1712015-10-02 11:03:08 -07002886 # Giving onos multiple chances to install intents
2887 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07002888 if i != 0:
2889 main.log.warn( "Verification failed. Retrying..." )
Jon Hallef0e2a12017-05-24 16:57:53 -07002890 main.log.info( "Waiting for onos to install intents..." )
GlennRCdb2c8422015-09-29 12:21:59 -07002891 time.sleep( main.checkIntentsDelay )
2892
2893 intentState = main.TRUE
Devin Lim58046fa2017-07-05 16:55:00 -07002894 for e in range( main.numCtrls ):
Jon Hallef0e2a12017-05-24 16:57:53 -07002895 main.log.info( "Checking intents on CLI %s" % ( e + 1 ) )
2896 IntentStateIndividual = main.CLIs[ e ].checkIntentState( intentsId=intentIdList )
You Wangb6586542016-02-26 09:25:56 -08002897 if not IntentStateIndividual:
Jon Hallef0e2a12017-05-24 16:57:53 -07002898 main.log.warn( "Not all intents installed on ONOS%s" % ( e + 1 ) )
You Wangb6586542016-02-26 09:25:56 -08002899 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07002900 if intentState:
2901 break
You Wangb6586542016-02-26 09:25:56 -08002902 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07002903 #Dumping intent summary
Jon Hallef0e2a12017-05-24 16:57:53 -07002904 main.log.info( "**** Intent Summary ****\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCdb2c8422015-09-29 12:21:59 -07002905
GlennRCdb2c8422015-09-29 12:21:59 -07002906 utilities.assert_equals( expect=main.TRUE, actual=intentState,
2907 onpass="INTENTS INSTALLED",
2908 onfail="SOME INTENTS NOT INSTALLED" )
2909
Jon Hallef0e2a12017-05-24 16:57:53 -07002910 main.step( "Verify flows are all added" )
GlennRCfa69a2a2015-10-02 15:54:06 -07002911
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 Hallef0e2a12017-05-24 16:57:53 -07002927 main.log.info( "Summary:\n" + str( main.ONOScli1.summary( jsonFormat=False ) ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07002928
2929 utilities.assert_equals( expect=main.TRUE, actual=flowState,
2930 onpass="FLOWS INSTALLED",
2931 onfail="SOME FLOWS NOT ADDED" )
2932
Hari Krishnac195f3b2015-07-08 20:02:24 -07002933 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -07002934 for i in range( main.numPings ):
GlennRCdb2c8422015-09-29 12:21:59 -07002935 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07002936 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -07002937 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -07002938 main.log.warn( "First pingall failed. Retrying..." )
2939 time.sleep( main.pingSleep )
2940 else:
2941 break
GlennRCfa69a2a2015-10-02 15:54:06 -07002942
Hari Krishnac195f3b2015-07-08 20:02:24 -07002943 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
GlennRCfa69a2a2015-10-02 15:54:06 -07002950 caseResult = ( checkFlowsState and pingResult and intentState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07002951 utilities.assert_equals(
2952 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07002953 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07002954 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 Hall4ba53f02015-07-29 13:07:41 -07002956
GlennRCfa69a2a2015-10-02 15:54:06 -07002957 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 Hallef0e2a12017-05-24 16:57:53 -07002965 main.log.report( "Stopping test" )
GlennRCfa69a2a2015-10-02 15:54:06 -07002966 main.stop( email=main.emailOnStop )
2967
Devin Lim58046fa2017-07-05 16:55:00 -07002968 def CASE95( self, main ):
GlennRCfa69a2a2015-10-02 15:54:06 -07002969 """
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 Hallef0e2a12017-05-24 16:57:53 -07002978 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
2979 portIngressList = [ '1' ] * ( len( deviceDPIDsCopy ) - 1 )
GlennRCfa69a2a2015-10-02 15:54:06 -07002980 intentIdList = []
Jon Hallef0e2a12017-05-24 16:57:53 -07002981 main.log.info( "MACsDict" + str( main.MACsDict ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07002982 time1 = time.time()
Devin Lim58046fa2017-07-05 16:55:00 -07002983 for i in xrange( 0, len( deviceDPIDsCopy ), main.numCtrls ):
GlennRCfa69a2a2015-10-02 15:54:06 -07002984 pool = []
2985 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -07002986 egressDevice = deviceDPIDsCopy[ i ]
2987 ingressDeviceList = copy.copy( deviceDPIDsCopy )
2988 ingressDeviceList.remove( egressDevice )
GlennRCfa69a2a2015-10-02 15:54:06 -07002989 if i >= len( deviceDPIDsCopy ):
2990 break
2991 t = main.Thread( target=cli.addMultipointToSinglepointIntent,
Jon Hallef0e2a12017-05-24 16:57:53 -07002992 threadID=main.threadID,
2993 name="addMultipointToSinglepointIntent",
2994 args=[ ingressDeviceList, egressDevice, portIngressList, '1', '', '', main.MACsDict.get( egressDevice ) ] )
2995 pool.append( t )
GlennRCfa69a2a2015-10-02 15:54:06 -07002996 t.start()
2997 i = i + 1
2998 main.threadID = main.threadID + 1
2999 for thread in pool:
3000 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07003001 intentIdList.append( thread.result )
GlennRCfa69a2a2015-10-02 15:54:06 -07003002 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003003 main.log.info( "Time for adding point intents: %2f seconds" % ( time2 - time1 ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003004
Jon Hallef0e2a12017-05-24 16:57:53 -07003005 main.step( "Verify intents are installed" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003006 # 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 Hallef0e2a12017-05-24 16:57:53 -07003010 main.log.info( "Waiting for onos to install intents..." )
GlennRCfa69a2a2015-10-02 15:54:06 -07003011 time.sleep( main.checkIntentsDelay )
3012
3013 intentState = main.TRUE
Devin Lim58046fa2017-07-05 16:55:00 -07003014 for e in range( main.numCtrls ):
Jon Hallef0e2a12017-05-24 16:57:53 -07003015 main.log.info( "Checking intents on CLI %s" % ( e + 1 ) )
3016 IntentStateIndividual = main.CLIs[ e ].checkIntentState( intentsId=intentIdList )
You Wangb6586542016-02-26 09:25:56 -08003017 if not IntentStateIndividual:
Jon Hallef0e2a12017-05-24 16:57:53 -07003018 main.log.warn( "Not all intents installed on ONOS%s" % ( e + 1 ) )
You Wangb6586542016-02-26 09:25:56 -08003019 intentState = intentState and IntentStateIndividual
GlennRCfa69a2a2015-10-02 15:54:06 -07003020 if intentState:
3021 break
You Wangb6586542016-02-26 09:25:56 -08003022 if not intentState:
GlennRCfa69a2a2015-10-02 15:54:06 -07003023 #Dumping intent summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003024 main.log.info( "**** Intent Summary ****\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003025
3026 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3027 onpass="INTENTS INSTALLED",
3028 onfail="SOME INTENTS NOT INSTALLED" )
3029
Jon Hallef0e2a12017-05-24 16:57:53 -07003030 main.step( "Verify flows are all added" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003031
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 Hallef0e2a12017-05-24 16:57:53 -07003047 main.log.info( "Summary:\n" + str( main.ONOScli1.summary( jsonFormat=False ) ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003048
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 Hallef0e2a12017-05-24 16:57:53 -07003054 for i in range( main.numPings ):
GlennRCfa69a2a2015-10-02 15:54:06 -07003055 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003056 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -07003057 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -07003058 main.log.warn( "First pingall failed. Retrying..." )
3059 time.sleep( main.pingSleep )
3060 else:
3061 break
GlennRCfa69a2a2015-10-02 15:54:06 -07003062
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 Hallef0e2a12017-05-24 16:57:53 -07003085 main.log.report( "Stopping test" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003086 main.stop( email=main.emailOnStop )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003087
Devin Lim58046fa2017-07-05 16:55:00 -07003088 def CASE96( self, main ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07003089 """
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 Hallef0e2a12017-05-24 16:57:53 -07003097 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3098 portEgressList = [ '1' ] * ( len( deviceDPIDsCopy ) - 1 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003099 intentIdList = []
Jon Hallef0e2a12017-05-24 16:57:53 -07003100 main.log.info( "MACsDict" + str( main.MACsDict ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003101 time1 = time.time()
Devin Lim58046fa2017-07-05 16:55:00 -07003102 for i in xrange( 0, len( deviceDPIDsCopy ), main.numCtrls ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07003103 pool = []
3104 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -07003105 ingressDevice = deviceDPIDsCopy[ i ]
3106 egressDeviceList = copy.copy( deviceDPIDsCopy )
3107 egressDeviceList.remove( ingressDevice )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003108 if i >= len( deviceDPIDsCopy ):
3109 break
3110 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
Jon Hallef0e2a12017-05-24 16:57:53 -07003111 threadID=main.threadID,
3112 name="addSinglepointToMultipointIntent",
3113 args=[ ingressDevice, egressDeviceList, '1', portEgressList, '', main.MACsDict.get( ingressDevice ) ] )
3114 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003115 t.start()
3116 i = i + 1
3117 main.threadID = main.threadID + 1
3118 for thread in pool:
3119 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07003120 intentIdList.append( thread.result )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003121 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003122 main.log.info( "Time for adding point intents: %2f seconds" % ( time2 - time1 ) )
GlennRCdb2c8422015-09-29 12:21:59 -07003123
Jon Hallef0e2a12017-05-24 16:57:53 -07003124 main.step( "Verify intents are installed" )
GlennRC1dde1712015-10-02 11:03:08 -07003125 # Giving onos multiple chances to install intents
3126 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003127 if i != 0:
3128 main.log.warn( "Verification failed. Retrying..." )
Jon Hallef0e2a12017-05-24 16:57:53 -07003129 main.log.info( "Waiting for onos to install intents..." )
GlennRCdb2c8422015-09-29 12:21:59 -07003130 time.sleep( main.checkIntentsDelay )
3131
3132 intentState = main.TRUE
Devin Lim58046fa2017-07-05 16:55:00 -07003133 for e in range( main.numCtrls ):
Jon Hallef0e2a12017-05-24 16:57:53 -07003134 main.log.info( "Checking intents on CLI %s" % ( e + 1 ) )
3135 IntentStateIndividual = main.CLIs[ e ].checkIntentState( intentsId=intentIdList )
You Wangb6586542016-02-26 09:25:56 -08003136 if not IntentStateIndividual:
Jon Hallef0e2a12017-05-24 16:57:53 -07003137 main.log.warn( "Not all intents installed on ONOS%s" % ( e + 1 ) )
You Wangb6586542016-02-26 09:25:56 -08003138 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07003139 if intentState:
3140 break
You Wangb6586542016-02-26 09:25:56 -08003141 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07003142 #Dumping intent summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003143 main.log.info( "**** Intent Summary ****\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCdb2c8422015-09-29 12:21:59 -07003144
GlennRCdb2c8422015-09-29 12:21:59 -07003145 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3146 onpass="INTENTS INSTALLED",
3147 onfail="SOME INTENTS NOT INSTALLED" )
3148
Jon Hallef0e2a12017-05-24 16:57:53 -07003149 main.step( "Verify flows are all added" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003150
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 Hallef0e2a12017-05-24 16:57:53 -07003166 main.log.info( "Summary:\n" + str( main.ONOScli1.summary( jsonFormat=False ) ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003167
3168 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3169 onpass="FLOWS INSTALLED",
3170 onfail="SOME FLOWS NOT ADDED" )
3171
Hari Krishnac195f3b2015-07-08 20:02:24 -07003172 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -07003173 for i in range( main.numPings ):
GlennRCdb2c8422015-09-29 12:21:59 -07003174 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003175 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -07003176 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -07003177 main.log.warn( "First pingall failed. Retrying..." )
3178 time.sleep( main.pingSleep )
3179 else:
3180 break
GlennRCfa69a2a2015-10-02 15:54:06 -07003181
Hari Krishnac195f3b2015-07-08 20:02:24 -07003182 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 Hallef0e2a12017-05-24 16:57:53 -07003189 caseResult = ( pingResult and intentState and flowState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003190 utilities.assert_equals(
3191 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003192 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003193 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
GlennRCfa69a2a2015-10-02 15:54:06 -07003196 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 Hallef0e2a12017-05-24 16:57:53 -07003204 main.log.report( "Stopping test" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003205 main.stop( email=main.emailOnStop )
3206
Devin Lim58046fa2017-07-05 16:55:00 -07003207 def CASE97( self, main ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07003208 """
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 Hallef0e2a12017-05-24 16:57:53 -07003216 deviceDPIDsCopy = copy.copy( main.deviceDPIDs )
3217 portEgressList = [ '1' ] * ( len( deviceDPIDsCopy ) - 1 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003218 intentIdList = []
Jon Hallef0e2a12017-05-24 16:57:53 -07003219 main.log.info( "MACsDict" + str( main.MACsDict ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003220 time1 = time.time()
Devin Lim58046fa2017-07-05 16:55:00 -07003221 for i in xrange( 0, len( deviceDPIDsCopy ), main.numCtrls ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07003222 pool = []
3223 for cli in main.CLIs:
Jon Hallef0e2a12017-05-24 16:57:53 -07003224 ingressDevice = deviceDPIDsCopy[ i ]
3225 egressDeviceList = copy.copy( deviceDPIDsCopy )
3226 egressDeviceList.remove( ingressDevice )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003227 if i >= len( deviceDPIDsCopy ):
3228 break
3229 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
Jon Hallef0e2a12017-05-24 16:57:53 -07003230 threadID=main.threadID,
3231 name="addSinglepointToMultipointIntent",
3232 args=[ ingressDevice, egressDeviceList, '1', portEgressList, '', main.MACsDict.get( ingressDevice ), '' ] )
3233 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003234 t.start()
3235 i = i + 1
3236 main.threadID = main.threadID + 1
3237 for thread in pool:
3238 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07003239 intentIdList.append( thread.result )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003240 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003241 main.log.info( "Time for adding point intents: %2f seconds" % ( time2 - time1 ) )
GlennRCdb2c8422015-09-29 12:21:59 -07003242
Jon Hallef0e2a12017-05-24 16:57:53 -07003243 main.step( "Verify intents are installed" )
GlennRC1dde1712015-10-02 11:03:08 -07003244 # Giving onos multiple chances to install intents
3245 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003246 if i != 0:
3247 main.log.warn( "Verification failed. Retrying..." )
Jon Hallef0e2a12017-05-24 16:57:53 -07003248 main.log.info( "Waiting for onos to install intents..." )
GlennRCdb2c8422015-09-29 12:21:59 -07003249 time.sleep( main.checkIntentsDelay )
3250
3251 intentState = main.TRUE
Devin Lim58046fa2017-07-05 16:55:00 -07003252 for e in range( main.numCtrls ):
Jon Hallef0e2a12017-05-24 16:57:53 -07003253 main.log.info( "Checking intents on CLI %s" % ( e + 1 ) )
3254 IntentStateIndividual = main.CLIs[ e ].checkIntentState( intentsId=intentIdList )
You Wangb6586542016-02-26 09:25:56 -08003255 if not IntentStateIndividual:
Jon Hallef0e2a12017-05-24 16:57:53 -07003256 main.log.warn( "Not all intents installed on ONOS%s" % ( e + 1 ) )
You Wangb6586542016-02-26 09:25:56 -08003257 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07003258 if intentState:
3259 break
You Wangb6586542016-02-26 09:25:56 -08003260 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07003261 #Dumping intent summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003262 main.log.info( "**** Intent Summary ****\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCdb2c8422015-09-29 12:21:59 -07003263
GlennRCdb2c8422015-09-29 12:21:59 -07003264 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3265 onpass="INTENTS INSTALLED",
3266 onfail="SOME INTENTS NOT INSTALLED" )
3267
Jon Hallef0e2a12017-05-24 16:57:53 -07003268 main.step( "Verify flows are all added" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003269
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 Hallef0e2a12017-05-24 16:57:53 -07003285 main.log.info( "Summary:\n" + str( main.ONOScli1.summary( jsonFormat=False ) ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003286
3287 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3288 onpass="FLOWS INSTALLED",
3289 onfail="SOME FLOWS NOT ADDED" )
3290
Hari Krishnac195f3b2015-07-08 20:02:24 -07003291 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -07003292 for i in range( main.numPings ):
GlennRCdb2c8422015-09-29 12:21:59 -07003293 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003294 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -07003295 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -07003296 main.log.warn( "First pingall failed. Retrying..." )
3297 time.sleep( main.pingSleep )
3298 else:
3299 break
GlennRCfa69a2a2015-10-02 15:54:06 -07003300
Hari Krishnac195f3b2015-07-08 20:02:24 -07003301 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 Hallef0e2a12017-05-24 16:57:53 -07003308 caseResult = ( pingResult and intentState and flowState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003309 utilities.assert_equals(
3310 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003311 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003312 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
GlennRCfa69a2a2015-10-02 15:54:06 -07003315 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 Hallef0e2a12017-05-24 16:57:53 -07003323 main.log.report( "Stopping test" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003324 main.stop( email=main.emailOnStop )
3325
Devin Lim58046fa2017-07-05 16:55:00 -07003326 def CASE98( self, main ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07003327 """
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 Hallef0e2a12017-05-24 16:57:53 -07003337 portEgressList = [ '1' ] * ( len( deviceDPIDsCopy ) - 1 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003338 intentIdList = []
3339 MACsDictCopy = {}
3340 for i in range( len( deviceDPIDsCopy ) ):
Jon Hallef0e2a12017-05-24 16:57:53 -07003341 MACsDictCopy[ deviceDPIDsCopy[ i ] ] = main.hostMACs[ i ].split( '/' )[ 0 ]
Hari Krishnac195f3b2015-07-08 20:02:24 -07003342
Jon Hallef0e2a12017-05-24 16:57:53 -07003343 main.log.info( "deviceDPIDsCopy" + str( deviceDPIDsCopy ) )
3344 main.log.info( "MACsDictCopy" + str( MACsDictCopy ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003345 time1 = time.time()
Devin Lim58046fa2017-07-05 16:55:00 -07003346 for i in xrange( 0, len( deviceDPIDsCopy ), main.numCtrls ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07003347 pool = []
3348 for cli in main.CLIs:
3349 if i >= len( deviceDPIDsCopy ):
3350 break
Jon Hallef0e2a12017-05-24 16:57:53 -07003351 ingressDevice = deviceDPIDsCopy[ i ]
3352 egressDeviceList = copy.copy( deviceDPIDsCopy )
3353 egressDeviceList.remove( ingressDevice )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003354 t = main.Thread( target=cli.addSinglepointToMultipointIntent,
Jon Hallef0e2a12017-05-24 16:57:53 -07003355 threadID=main.threadID,
3356 name="addSinglepointToMultipointIntent",
3357 args=[ ingressDevice, egressDeviceList, '1', portEgressList, '', MACsDictCopy.get( ingressDevice ), '' ] )
3358 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003359 t.start()
3360 i = i + 1
3361 main.threadID = main.threadID + 1
3362 for thread in pool:
3363 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07003364 intentIdList.append( thread.result )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003365 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003366 main.log.info( "Time for adding point intents: %2f seconds" % ( time2 - time1 ) )
GlennRCdb2c8422015-09-29 12:21:59 -07003367
Jon Hallef0e2a12017-05-24 16:57:53 -07003368 main.step( "Verify intents are installed" )
GlennRC1dde1712015-10-02 11:03:08 -07003369 # Giving onos multiple chances to install intents
3370 for i in range( main.intentCheck ):
GlennRCdb2c8422015-09-29 12:21:59 -07003371 if i != 0:
3372 main.log.warn( "Verification failed. Retrying..." )
Jon Hallef0e2a12017-05-24 16:57:53 -07003373 main.log.info( "Waiting for onos to install intents..." )
GlennRCdb2c8422015-09-29 12:21:59 -07003374 time.sleep( main.checkIntentsDelay )
3375
3376 intentState = main.TRUE
Devin Lim58046fa2017-07-05 16:55:00 -07003377 for e in range( main.numCtrls ):
Jon Hallef0e2a12017-05-24 16:57:53 -07003378 main.log.info( "Checking intents on CLI %s" % ( e + 1 ) )
3379 IntentStateIndividual = main.CLIs[ e ].checkIntentState( intentsId=intentIdList )
You Wangb6586542016-02-26 09:25:56 -08003380 if not IntentStateIndividual:
Jon Hallef0e2a12017-05-24 16:57:53 -07003381 main.log.warn( "Not all intents installed on ONOS%s" % ( e + 1 ) )
You Wangb6586542016-02-26 09:25:56 -08003382 intentState = intentState and IntentStateIndividual
GlennRCdb2c8422015-09-29 12:21:59 -07003383 if intentState:
3384 break
You Wangb6586542016-02-26 09:25:56 -08003385 if not intentState:
GlennRCdb2c8422015-09-29 12:21:59 -07003386 #Dumping intent summary
Jon Hallef0e2a12017-05-24 16:57:53 -07003387 main.log.info( "**** Intent Summary ****\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
GlennRCdb2c8422015-09-29 12:21:59 -07003388
GlennRCdb2c8422015-09-29 12:21:59 -07003389 utilities.assert_equals( expect=main.TRUE, actual=intentState,
3390 onpass="INTENTS INSTALLED",
3391 onfail="SOME INTENTS NOT INSTALLED" )
3392
Jon Hallef0e2a12017-05-24 16:57:53 -07003393 main.step( "Verify flows are all added" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003394
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 Hallef0e2a12017-05-24 16:57:53 -07003410 main.log.info( "Summary:\n" + str( main.ONOScli1.summary( jsonFormat=False ) ) )
GlennRCfa69a2a2015-10-02 15:54:06 -07003411
3412 utilities.assert_equals( expect=main.TRUE, actual=flowState,
3413 onpass="FLOWS INSTALLED",
3414 onfail="SOME FLOWS NOT ADDED" )
3415
Hari Krishnac195f3b2015-07-08 20:02:24 -07003416 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -07003417 for i in range( main.numPings ):
GlennRCdb2c8422015-09-29 12:21:59 -07003418 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003419 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -07003420 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -07003421 main.log.warn( "First pingall failed. Retrying..." )
3422 time.sleep( main.pingSleep )
3423 else:
3424 break
GlennRCfa69a2a2015-10-02 15:54:06 -07003425
Hari Krishnac195f3b2015-07-08 20:02:24 -07003426 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 Hallef0e2a12017-05-24 16:57:53 -07003433 caseResult = ( pingResult and intentState and flowState )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003434 utilities.assert_equals(
3435 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003436 actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003437 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
GlennRCfa69a2a2015-10-02 15:54:06 -07003440 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 Hallef0e2a12017-05-24 16:57:53 -07003448 main.log.report( "Stopping test" )
GlennRCfa69a2a2015-10-02 15:54:06 -07003449 main.stop( email=main.emailOnStop )
3450
Devin Lim58046fa2017-07-05 16:55:00 -07003451 def CASE190( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07003452 """
Jon Hallef0e2a12017-05-24 16:57:53 -07003453 Verify IPv6 ping across 600 Point intents ( Att Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003454 """
3455 main.log.report( "Verify IPv6 ping across 600 Point intents (Att Topology)" )
3456 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003457 main.case( "IPv6 ping all 600 Point intents" )
You Wangb6586542016-02-26 09:25:56 -08003458
Hari Krishna4223dbd2015-08-13 16:29:53 -07003459 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08003460 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
3461 utilities.assert_equals( expect=main.TRUE,
3462 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003463 onpass="PING ALL PASS",
3464 onfail="PING ALL FAIL" )
3465
GlennRCbddd58f2015-10-01 15:45:25 -07003466 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003467 utilities.assert_equals(
3468 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003469 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003470 onpass="IPv6 Ping across 600 Point intents test PASS",
3471 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3472
You Wangb6586542016-02-26 09:25:56 -08003473 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07003474 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08003475 main.stop( email=main.emailOnStop )
3476
Devin Lim58046fa2017-07-05 16:55:00 -07003477 def CASE191( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07003478 """
Jon Hallef0e2a12017-05-24 16:57:53 -07003479 Verify IPv6 ping across 600 Point intents ( Chordal Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003480 """
3481 main.log.report( "Verify IPv6 ping across 600 Point intents (Chordal Topology)" )
3482 main.log.report( "_________________________________________________" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003483 main.case( "IPv6 ping all 600 Point intents" )
You Wangb6586542016-02-26 09:25:56 -08003484
Hari Krishna4223dbd2015-08-13 16:29:53 -07003485 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08003486 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
3487 utilities.assert_equals( expect=main.TRUE,
3488 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003489 onpass="PING ALL PASS",
3490 onfail="PING ALL FAIL" )
3491
GlennRCbddd58f2015-10-01 15:45:25 -07003492 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003493 utilities.assert_equals(
3494 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003495 actual=caseResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003496 onpass="IPv6 Ping across 600 Point intents test PASS",
3497 onfail="IPv6 Ping across 600 Point intents test FAIL" )
3498
You Wangb6586542016-02-26 09:25:56 -08003499 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07003500 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08003501 main.stop( email=main.emailOnStop )
3502
Devin Lim58046fa2017-07-05 16:55:00 -07003503 def CASE192( self, main ):
Hari Krishna4223dbd2015-08-13 16:29:53 -07003504 """
Jon Hallef0e2a12017-05-24 16:57:53 -07003505 Verify IPv6 ping across 4556 Point intents ( Spine Topology )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003506 """
3507 main.log.report( "Verify IPv6 ping across 4556 Point intents (Spine Topology)" )
3508 main.log.report( "_________________________________________________" )
Hari Krishna310efca2015-09-03 09:43:16 -07003509 main.case( "IPv6 ping all 4556 Point intents" )
You Wangb6586542016-02-26 09:25:56 -08003510
Hari Krishna4223dbd2015-08-13 16:29:53 -07003511 main.step( "Verify IPv6 Ping across all hosts" )
You Wangb6586542016-02-26 09:25:56 -08003512 pingResult = main.CHOtestFunctions.checkPingall( protocol="IPv6" )
3513 utilities.assert_equals( expect=main.TRUE,
3514 actual=pingResult,
Hari Krishna4223dbd2015-08-13 16:29:53 -07003515 onpass="PING ALL PASS",
3516 onfail="PING ALL FAIL" )
3517
GlennRCbddd58f2015-10-01 15:45:25 -07003518 caseResult = pingResult
Hari Krishna4223dbd2015-08-13 16:29:53 -07003519 utilities.assert_equals(
3520 expect=main.TRUE,
GlennRCbddd58f2015-10-01 15:45:25 -07003521 actual=caseResult,
Hari Krishna310efca2015-09-03 09:43:16 -07003522 onpass="IPv6 Ping across 4556 Point intents test PASS",
3523 onfail="IPv6 Ping across 4556 Point intents test FAIL" )
Hari Krishna4223dbd2015-08-13 16:29:53 -07003524
You Wangb6586542016-02-26 09:25:56 -08003525 if not caseResult and main.failSwitch:
Jon Hallef0e2a12017-05-24 16:57:53 -07003526 main.log.report( "Stopping test" )
You Wangb6586542016-02-26 09:25:56 -08003527 main.stop( email=main.emailOnStop )
3528
Devin Lim58046fa2017-07-05 16:55:00 -07003529 def CASE10( self, main ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07003530 import time
GlennRCc6cd2a62015-08-10 16:08:22 -07003531 import re
Hari Krishnac195f3b2015-07-08 20:02:24 -07003532 """
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 Krishnaad0c5202015-09-01 14:26:49 -07003539 purgeDelay = int( main.params[ "timers" ][ "IntentPurgeDelay" ] )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003540 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 Krishnac195f3b2015-07-08 20:02:24 -07003552 intentIdList = []
3553 step1Result = main.TRUE
3554 moreIntents = main.TRUE
3555 removeIntentCount = 0
Jon Hallef0e2a12017-05-24 16:57:53 -07003556 intentsCount = len( intentsList )
3557 main.log.info( "Current number of intents: " + str( intentsCount ) )
You Wangb6586542016-02-26 09:25:56 -08003558
3559 main.step( "Remove all installed intents" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003560 if ( len( intentsList ) > 1 ):
3561 results = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07003562 main.log.info( "Removing intent..." )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003563 while moreIntents:
Jon Hallef0e2a12017-05-24 16:57:53 -07003564 # This is a work around only: cycle through intents removal for up to 5 times.
Hari Krishnac195f3b2015-07-08 20:02:24 -07003565 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 Hallef0e2a12017-05-24 16:57:53 -07003581 main.log.info( "Round %d intents to remove: " % ( removeIntentCount ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003582 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 Hallef0e2a12017-05-24 16:57:53 -07003588 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 Krishnac195f3b2015-07-08 20:02:24 -07003591 time1 = time.time()
Devin Lim58046fa2017-07-05 16:55:00 -07003592 for i in xrange( 0, len( intentIdList1 ), main.numCtrls ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07003593 pool = []
3594 for cli in main.CLIs:
3595 if i >= len( intentIdList1 ):
3596 break
3597 t = main.Thread( target=cli.removeIntent,
Jon Hallef0e2a12017-05-24 16:57:53 -07003598 threadID=main.threadID,
3599 name="removeIntent",
3600 args=[ intentIdList1[ i ], 'org.onosproject.cli', False, False ] )
3601 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003602 t.start()
3603 i = i + 1
3604 main.threadID = main.threadID + 1
3605 for thread in pool:
3606 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07003607 intentIdList.append( thread.result )
3608 #time.sleep( 2 )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003609 time2 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003610 main.log.info( "Time for removing host intents: %2f seconds" % ( time2 - time1 ) )
Hari Krishnaad0c5202015-09-01 14:26:49 -07003611 time.sleep( purgeDelay )
Jon Hallef0e2a12017-05-24 16:57:53 -07003612 main.log.info( "Purging WITHDRAWN Intents" )
3613 purgeResult = main.ONOScli1.purgeWithdrawnIntents()
Hari Krishnac195f3b2015-07-08 20:02:24 -07003614 else:
Jon Hallef0e2a12017-05-24 16:57:53 -07003615 time.sleep( 10 )
3616 if len( main.ONOScli1.intents() ):
Hari Krishnac195f3b2015-07-08 20:02:24 -07003617 continue
3618 break
Hari Krishnaad0c5202015-09-01 14:26:49 -07003619 time.sleep( purgeDelay )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003620 else:
Jon Hallef0e2a12017-05-24 16:57:53 -07003621 print "Removed %d intents" % ( intentsCount )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003622 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 Wangb6586542016-02-26 09:25:56 -08003628
3629 main.log.info( main.ONOScli1.summary( jsonFormat=False ) )
GlennRCbddd58f2015-10-01 15:45:25 -07003630 caseResult = step1Result
3631 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003632 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 Krishnac195f3b2015-07-08 20:02:24 -07003643 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 Krishna6185fc12015-07-13 15:42:31 -07003651
Hari Krishnac195f3b2015-07-08 20:02:24 -07003652 pool = []
3653 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003654 for cli, feature in main.CLIs:
3655 t = main.Thread( target=cli, threadID=threadID,
3656 name="featureInstall", args=[ feature ] )
3657 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003658 t.start()
3659 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07003660
Hari Krishnac195f3b2015-07-08 20:02:24 -07003661 results = []
3662 for thread in pool:
3663 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07003664 results.append( thread.result )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003665 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003666
Jon Hallef0e2a12017-05-24 16:57:53 -07003667 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 Krishnac195f3b2015-07-08 20:02:24 -07003671 else:
Jon Hallef0e2a12017-05-24 16:57:53 -07003672 main.log.info( "Successful feature:install onos-app-ifwd" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003673 installResult = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07003674 main.log.info( "Time for feature:install onos-app-ifwd: %2f seconds" % ( time2 - time1 ) )
Jon Hall4ba53f02015-07-29 13:07:41 -07003675
GlennRC6ac11b12015-10-21 17:41:28 -07003676 main.step( "Verify Ping across all hosts" )
Jon Hallef0e2a12017-05-24 16:57:53 -07003677 for i in range( main.numPings ):
GlennRC6ac11b12015-10-21 17:41:28 -07003678 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003679 pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
GlennRC6ac11b12015-10-21 17:41:28 -07003680 if not pingResult:
Jon Hallef0e2a12017-05-24 16:57:53 -07003681 main.log.warn( "First pingall failed. Retrying..." )
3682 time.sleep( main.pingSleep )
3683 else:
3684 break
GlennRC6ac11b12015-10-21 17:41:28 -07003685
Hari Krishnac195f3b2015-07-08 20:02:24 -07003686 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 Hall4ba53f02015-07-29 13:07:41 -07003692
GlennRC626ba132015-09-18 16:16:31 -07003693 if pingResult == main.TRUE:
Hari Krishnac195f3b2015-07-08 20:02:24 -07003694 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 Hall4ba53f02015-07-29 13:07:41 -07003700
Hari Krishnac195f3b2015-07-08 20:02:24 -07003701 pool = []
3702 time1 = time.time()
Jon Hallef0e2a12017-05-24 16:57:53 -07003703 for cli, feature in main.CLIs:
3704 t = main.Thread( target=cli, threadID=threadID,
3705 name="featureUninstall", args=[ feature ] )
3706 pool.append( t )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003707 t.start()
3708 threadID = threadID + 1
Jon Hall4ba53f02015-07-29 13:07:41 -07003709
Hari Krishnac195f3b2015-07-08 20:02:24 -07003710 results = []
3711 for thread in pool:
3712 thread.join()
Jon Hallef0e2a12017-05-24 16:57:53 -07003713 results.append( thread.result )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003714 time2 = time.time()
Jon Hall4ba53f02015-07-29 13:07:41 -07003715
Jon Hallef0e2a12017-05-24 16:57:53 -07003716 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 Krishnac195f3b2015-07-08 20:02:24 -07003721 else:
Jon Hallef0e2a12017-05-24 16:57:53 -07003722 main.log.info( "Successful feature:uninstall onos-app-ifwd" )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003723 uninstallResult = main.TRUE
Jon Hallef0e2a12017-05-24 16:57:53 -07003724 main.log.info( "Time for feature:uninstall onos-app-ifwd: %2f seconds" % ( time2 - time1 ) )
Hari Krishnac195f3b2015-07-08 20:02:24 -07003725
3726 # Waiting for reative flows to be cleared.
3727 time.sleep( 10 )
3728
GlennRCbddd58f2015-10-01 15:45:25 -07003729 caseResult = installResult and pingResult and uninstallResult
3730 utilities.assert_equals( expect=main.TRUE, actual=caseResult,
Hari Krishnac195f3b2015-07-08 20:02:24 -07003731 onpass="Intent based Reactive forwarding Pingall test PASS",
3732 onfail="Intent based Reactive forwarding Pingall test FAIL" )