blob: 4fbdb01a54ef6753c1a5215ec851c487ebe00e66 [file] [log] [blame]
Jon Hall85794ff2015-07-08 14:12:30 -07001"""
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -07002Copyright 2015 Open Networking Foundation ( ONF )
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -07003
4Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
5the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
6or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
7
8 TestON is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 2 of the License, or
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070011 ( at your option ) any later version.
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -070012
13 TestON is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with TestON. If not, see <http://www.gnu.org/licenses/>.
20"""
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -070021"""
Jon Hall85794ff2015-07-08 14:12:30 -070022Description: This test is to determine if a single
23 instance ONOS 'cluster' can handle a restart
24
25List of test cases:
26CASE1: Compile ONOS and push it to the test machines
27CASE2: Assign devices to controllers
28CASE21: Assign mastership to controllers
29CASE3: Assign intents
30CASE4: Ping across added host intents
31CASE5: Reading state of ONOS
32CASE6: The Failure case.
33CASE7: Check state after control plane failure
34CASE8: Compare topo
35CASE9: Link s3-s28 down
36CASE10: Link s3-s28 up
37CASE11: Switch down
38CASE12: Switch up
39CASE13: Clean up
40CASE14: start election app on all onos nodes
41CASE15: Check that Leadership Election is still functional
42CASE16: Install Distributed Primitives app
43CASE17: Check for basic functionality with distributed primitives
44"""
Jon Hall85794ff2015-07-08 14:12:30 -070045class HAsingleInstanceRestart:
46
47 def __init__( self ):
48 self.default = ''
49
50 def CASE1( self, main ):
51 """
52 CASE1 is to compile ONOS and push it to the test machines
53
54 Startup sequence:
55 cell <name>
56 onos-verify-cell
57 NOTE: temporary - onos-remove-raft-logs
58 onos-uninstall
59 start mininet
60 git pull
61 mvn clean install
62 onos-package
63 onos-install -f
64 onos-wait-for-start
65 start cli sessions
66 start tcpdump
67 """
68 main.log.info( "ONOS Single node cluster restart " +
69 "HA test - initialization" )
Jon Hall85794ff2015-07-08 14:12:30 -070070
Devin Lim142b5342017-07-20 15:22:39 -070071 # set global variables
Devin Lim58046fa2017-07-05 16:55:00 -070072 # These are for csv plotting in jenkins
73 main.HAlabels = []
74 main.HAdata = []
Jon Halle1a3b752015-07-22 13:02:46 -070075 try:
Devin Lim142b5342017-07-20 15:22:39 -070076 from tests.dependencies.ONOSSetup import ONOSSetup
77 main.testSetUp = ONOSSetup()
78 except ImportError:
79 main.log.error( "ONOSSetup not found. exiting the test" )
Devin Lim44075962017-08-11 10:56:37 -070080 main.cleanAndExit()
Devin Lim142b5342017-07-20 15:22:39 -070081 main.testSetUp.envSetupDescription()
82 try:
Jon Hall53c5e662016-04-13 16:06:56 -070083 from tests.HA.dependencies.HA import HA
Jon Hall41d39f12016-04-11 22:54:35 -070084 main.HA = HA()
Devin Lim142b5342017-07-20 15:22:39 -070085 # load some variables from the params file
86 cellName = main.params[ 'ENV' ][ 'cellName' ]
87 main.apps = main.params[ 'ENV' ][ 'appString' ]
88 main.numCtrls = int( main.params[ 'num_controllers' ] )
Jon Hallab611372018-02-21 15:26:05 -080089 stepResult = main.testSetUp.envSetup( includeCaseDesc=False )
Devin Lim142b5342017-07-20 15:22:39 -070090 except Exception as e:
91 main.testSetUp.envSetupException( e )
92 main.testSetUp.evnSetupConclusion( stepResult )
Jon Hallab611372018-02-21 15:26:05 -080093
Jon Hall3e6edb32018-08-21 16:20:30 -070094 cellApps = str( main.params["ENV"]["appString"] )
95 cellNAme = str( main.params["ENV"]["appString"] )
Jon Hallab611372018-02-21 15:26:05 -080096 applyFuncs = [ main.testSetUp.createApplyCell ]
Jon Hall3e6edb32018-08-21 16:20:30 -070097 applyArgs = [ [ main.Cluster, True, cellName , cellApps, "", True, main.Cluster.runningNodes[ 0 ].ipAddress ] ]
Jon Hallab611372018-02-21 15:26:05 -080098 try:
99 if main.params[ 'topology' ][ 'topoFile' ]:
100 main.log.info( 'Skipping start of Mininet in this case, make sure you start it elsewhere' )
101 else:
102 applyFuncs.append( main.HA.startingMininet )
103 applyArgs.append( None )
104 except (KeyError, IndexError):
105 applyFuncs.append( main.HA.startingMininet )
106 applyArgs.append( None )
107
Devin Lim142b5342017-07-20 15:22:39 -0700108 main.Cluster.setRunningNode( int( main.params[ 'num_controllers' ] ) )
109 ip = main.Cluster.getIps( allNode=True )
Jon Hall3e6edb32018-08-21 16:20:30 -0700110 main.testSetUp.ONOSSetUp( main.Cluster, cellName="SingleHA",
Jon Hallab611372018-02-21 15:26:05 -0800111 extraApply=applyFuncs,
112 applyArgs=applyArgs,
113 includeCaseDesc=False )
Devin Lim58046fa2017-07-05 16:55:00 -0700114 main.HA.initialSetUp()
Jon Hall9d2dcad2016-04-08 10:15:20 -0700115
Jon Hallab611372018-02-21 15:26:05 -0800116 main.step( 'Set logging levels' )
117 logging = True
118 try:
119 logs = main.params.get( 'ONOS_Logging', False )
120 if logs:
121 for namespace, level in logs.items():
122 for ctrl in main.Cluster.active():
123 ctrl.CLI.logSet( level, namespace )
124 except AttributeError:
125 logging = False
126 utilities.assert_equals( expect=True, actual=logging,
127 onpass="Set log levels",
128 onfail="Failed to set log levels" )
129
Jon Hall85794ff2015-07-08 14:12:30 -0700130 def CASE2( self, main ):
131 """
132 Assign devices to controllers
133 """
Devin Lim58046fa2017-07-05 16:55:00 -0700134 main.HA.assignDevices( main )
Jon Hall85794ff2015-07-08 14:12:30 -0700135
Jon Hallab611372018-02-21 15:26:05 -0800136 def CASE102( self, main ):
137 """
138 Set up Spine-Leaf fabric topology in Mininet
139 """
140 main.HA.startTopology( main )
141
Jon Hall85794ff2015-07-08 14:12:30 -0700142 def CASE21( self, main ):
143 """
144 Assign mastership to controllers
145 """
Devin Lim58046fa2017-07-05 16:55:00 -0700146 main.HA.assignMastership( main )
Jon Hall85794ff2015-07-08 14:12:30 -0700147
148 def CASE3( self, main ):
149 """
150 Assign intents
151 """
Devin Lim58046fa2017-07-05 16:55:00 -0700152 main.HA.assignIntents( main )
Jon Hall85794ff2015-07-08 14:12:30 -0700153
154 def CASE4( self, main ):
155 """
156 Ping across added host intents
157 """
Jon Hallca319892017-06-15 15:25:22 -0700158 main.HA.pingAcrossHostIntent( main )
Jon Hall85794ff2015-07-08 14:12:30 -0700159
Jon Hallab611372018-02-21 15:26:05 -0800160 def CASE104( self, main ):
161 """
162 Ping Hosts
163 """
164 main.case( "Check connectivity" )
165 main.step( "Ping between all hosts" )
166 pingResult = main.Mininet1.pingall()
167 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
168 onpass="All Pings Passed",
169 onfail="Failed to ping between all hosts" )
170
Jon Hall85794ff2015-07-08 14:12:30 -0700171 def CASE5( self, main ):
172 """
173 Reading state of ONOS
174 """
Jon Hallab611372018-02-21 15:26:05 -0800175 main.HA.readingState( main )
Jon Hall8bafdc02017-09-05 11:36:26 -0700176
Jon Hall85794ff2015-07-08 14:12:30 -0700177 def CASE6( self, main ):
178 """
179 The Failure case.
180 """
181 import time
Jon Hall85794ff2015-07-08 14:12:30 -0700182 assert main, "main not defined"
183 assert utilities.assert_equals, "utilities.assert_equals not defined"
184
Jon Hall85794ff2015-07-08 14:12:30 -0700185 main.case( "Restart ONOS node" )
Jon Hall783bbf92015-07-23 14:33:19 -0700186 main.caseExplanation = "Killing ONOS process and restart cli " +\
Jon Hall85794ff2015-07-08 14:12:30 -0700187 "sessions once onos is up."
Jon Hall96091e62015-09-21 17:34:17 -0700188
189 main.step( "Checking ONOS Logs for errors" )
Devin Lim142b5342017-07-20 15:22:39 -0700190 for ctrl in main.Cluster.active():
191 main.log.debug( "Checking logs for errors on " + ctrl.name + ":" )
192 main.log.warn( main.ONOSbench.checkLogs( ctrl.ip_address ) )
193 ctrl = main.Cluster.runningNodes[ 0 ]
Jon Hall85794ff2015-07-08 14:12:30 -0700194 main.step( "Killing ONOS processes" )
Devin Lim142b5342017-07-20 15:22:39 -0700195 killResult = main.ONOSbench.onosKill( ctrl.ipAddress )
Jon Hall85794ff2015-07-08 14:12:30 -0700196 start = time.time()
197 utilities.assert_equals( expect=main.TRUE, actual=killResult,
198 onpass="ONOS Killed",
199 onfail="Error killing ONOS" )
200
201 main.step( "Checking if ONOS is up yet" )
202 count = 0
203 while count < 10:
Devin Lim142b5342017-07-20 15:22:39 -0700204 onos1Isup = main.ONOSbench.isup( ctrl.ipAddress )
Jon Hall85794ff2015-07-08 14:12:30 -0700205 if onos1Isup == main.TRUE:
206 elapsed = time.time() - start
207 break
208 else:
209 count = count + 1
210 utilities.assert_equals( expect=main.TRUE, actual=onos1Isup,
211 onpass="ONOS is back up",
212 onfail="ONOS failed to start" )
213
Jon Hall6509dbf2016-06-21 17:01:17 -0700214 main.step( "Starting ONOS CLI sessions" )
Devin Lim142b5342017-07-20 15:22:39 -0700215 cliResults = ctrl.CLI.startOnosCli( ctrl.ipAddress )
Jon Hall85794ff2015-07-08 14:12:30 -0700216 utilities.assert_equals( expect=main.TRUE, actual=cliResults,
217 onpass="ONOS cli startup successful",
218 onfail="ONOS cli startup failed" )
219
220 if elapsed:
221 main.log.info( "ESTIMATE: ONOS took %s seconds to restart" %
222 str( elapsed ) )
223 main.restartTime = elapsed
224 else:
225 main.restartTime = -1
226 time.sleep( 5 )
227 # rerun on election apps
Devin Lim142b5342017-07-20 15:22:39 -0700228 ctrl.CLI.electionTestRun()
Jon Hall85794ff2015-07-08 14:12:30 -0700229
230 def CASE7( self, main ):
231 """
232 Check state after ONOS failure
233 """
Jon Hallab611372018-02-21 15:26:05 -0800234 main.HA.checkStateAfterEvent( main, afterWhich=0, compareSwitch=True, isRestart=True )
Jon Hall85794ff2015-07-08 14:12:30 -0700235
236 def CASE8( self, main ):
237 """
238 Compare topo
239 """
240 import json
241 import time
Jon Hall85794ff2015-07-08 14:12:30 -0700242 assert main, "main not defined"
243 assert utilities.assert_equals, "utilities.assert_equals not defined"
244
245 main.case( "Compare ONOS Topology view to Mininet topology" )
Jon Hall783bbf92015-07-23 14:33:19 -0700246 main.caseExplanation = "Compare topology objects between Mininet" +\
Jon Hall85794ff2015-07-08 14:12:30 -0700247 " and ONOS"
Jon Hall85794ff2015-07-08 14:12:30 -0700248 topoResult = main.FALSE
249 elapsed = 0
250 count = 0
Jon Halle9b1fa32015-12-08 15:32:21 -0800251 main.step( "Comparing ONOS topology to MN topology" )
Jon Hall85794ff2015-07-08 14:12:30 -0700252 startTime = time.time()
Devin Lim142b5342017-07-20 15:22:39 -0700253 ctrl = main.Cluster.active( 0 )
Jon Hall85794ff2015-07-08 14:12:30 -0700254 # Give time for Gossip to work
Jon Halle9b1fa32015-12-08 15:32:21 -0800255 while topoResult == main.FALSE and ( elapsed < 60 or count < 3 ):
Jon Hall96091e62015-09-21 17:34:17 -0700256 devicesResults = main.TRUE
257 linksResults = main.TRUE
258 hostsResults = main.TRUE
259 hostAttachmentResults = True
Jon Hall85794ff2015-07-08 14:12:30 -0700260 count += 1
261 cliStart = time.time()
262 devices = []
Devin Lim142b5342017-07-20 15:22:39 -0700263 devices.append( ctrl.CLI.devices() )
Jon Hall85794ff2015-07-08 14:12:30 -0700264 hosts = []
Devin Lim142b5342017-07-20 15:22:39 -0700265 hosts.append( json.loads( ctrl.CLI.hosts() ) )
Jon Hall85794ff2015-07-08 14:12:30 -0700266 ipResult = main.TRUE
267 for controller in range( 0, len( hosts ) ):
268 controllerStr = str( controller + 1 )
269 for host in hosts[ controller ]:
270 if host is None or host.get( 'ipAddresses', [] ) == []:
271 main.log.error(
272 "DEBUG:Error with host ips on controller" +
273 controllerStr + ": " + str( host ) )
274 ipResult = main.FALSE
275 ports = []
Devin Lim142b5342017-07-20 15:22:39 -0700276 ports.append( ctrl.CLI.ports() )
Jon Hall85794ff2015-07-08 14:12:30 -0700277 links = []
Devin Lim142b5342017-07-20 15:22:39 -0700278 links.append( ctrl.CLI.links() )
Jon Hall85794ff2015-07-08 14:12:30 -0700279 clusters = []
Devin Lim142b5342017-07-20 15:22:39 -0700280 clusters.append( ctrl.CLI.clusters() )
Jon Hall85794ff2015-07-08 14:12:30 -0700281
282 elapsed = time.time() - startTime
283 cliTime = time.time() - cliStart
284 print "CLI time: " + str( cliTime )
285
286 mnSwitches = main.Mininet1.getSwitches()
287 mnLinks = main.Mininet1.getLinks()
288 mnHosts = main.Mininet1.getHosts()
Devin Lim142b5342017-07-20 15:22:39 -0700289 for controller in main.Cluster.getRunningPos():
290 controllerStr = str( controller )
Jon Hall85794ff2015-07-08 14:12:30 -0700291 if devices[ controller ] and ports[ controller ] and\
Jon Hallf37d44d2017-05-24 10:37:30 -0700292 "Error" not in devices[ controller ] and\
293 "Error" not in ports[ controller ]:
Jon Hall85794ff2015-07-08 14:12:30 -0700294
Jon Hallc6793552016-01-19 14:18:37 -0800295 try:
296 currentDevicesResult = main.Mininet1.compareSwitches(
297 mnSwitches,
298 json.loads( devices[ controller ] ),
299 json.loads( ports[ controller ] ) )
Jon Halla478b852017-12-04 15:00:15 -0800300 except ( TypeError, ValueError ):
Jon Hallc6793552016-01-19 14:18:37 -0800301 main.log.exception( "Object not as expected; devices={!r}\nports={!r}".format(
302 devices[ controller ], ports[ controller ] ) )
Jon Hall85794ff2015-07-08 14:12:30 -0700303 else:
304 currentDevicesResult = main.FALSE
305 utilities.assert_equals( expect=main.TRUE,
306 actual=currentDevicesResult,
307 onpass="ONOS" + controllerStr +
308 " Switches view is correct",
309 onfail="ONOS" + controllerStr +
310 " Switches view is incorrect" )
311
312 if links[ controller ] and "Error" not in links[ controller ]:
313 currentLinksResult = main.Mininet1.compareLinks(
314 mnSwitches, mnLinks,
315 json.loads( links[ controller ] ) )
316 else:
317 currentLinksResult = main.FALSE
318 utilities.assert_equals( expect=main.TRUE,
319 actual=currentLinksResult,
320 onpass="ONOS" + controllerStr +
321 " links view is correct",
322 onfail="ONOS" + controllerStr +
323 " links view is incorrect" )
324
325 if hosts[ controller ] or "Error" not in hosts[ controller ]:
326 currentHostsResult = main.Mininet1.compareHosts(
327 mnHosts,
328 hosts[ controller ] )
329 else:
330 currentHostsResult = main.FALSE
331 utilities.assert_equals( expect=main.TRUE,
332 actual=currentHostsResult,
333 onpass="ONOS" + controllerStr +
334 " hosts exist in Mininet",
335 onfail="ONOS" + controllerStr +
336 " hosts don't match Mininet" )
337 # CHECKING HOST ATTACHMENT POINTS
338 hostAttachment = True
Jon Hallab611372018-02-21 15:26:05 -0800339 if main.topoMappings:
340 zeroHosts = False
341 if hosts[ controller ] or "Error" not in hosts[ controller ]:
342 if hosts[ controller ] == []:
343 main.log.warn( "There are no hosts discovered" )
344 zeroHosts = True
345 else:
346 for host in hosts[ controller ]:
347 mac = None
348 location = None
349 device = None
350 port = None
351 try:
352 mac = host.get( 'mac' )
353 assert mac, "mac field could not be found for this host object"
Jon Hall85794ff2015-07-08 14:12:30 -0700354
Jon Hallab611372018-02-21 15:26:05 -0800355 location = host.get( 'locations' )[ 0 ]
356 assert location, "location field could not be found for this host object"
Jon Hall85794ff2015-07-08 14:12:30 -0700357
Jon Hallab611372018-02-21 15:26:05 -0800358 # Trim the protocol identifier off deviceId
359 device = str( location.get( 'elementId' ) ).split( ':' )[ 1 ]
360 assert device, "elementId field could not be found for this host location object"
Jon Hall85794ff2015-07-08 14:12:30 -0700361
Jon Hallab611372018-02-21 15:26:05 -0800362 port = location.get( 'port' )
363 assert port, "port field could not be found for this host location object"
Jon Hall85794ff2015-07-08 14:12:30 -0700364
Jon Hallab611372018-02-21 15:26:05 -0800365 # Now check if this matches where they should be
366 if mac and device and port:
367 if str( port ) != "1":
368 main.log.error( "The attachment port is incorrect for " +
369 "host " + str( mac ) +
370 ". Expected: 1 Actual: " + str( port ) )
371 hostAttachment = False
372 if device != main.topoMappings[ str( mac ) ]:
373 main.log.error( "The attachment device is incorrect for " +
374 "host " + str( mac ) +
375 ". Expected: " + main.topoMappings[ str( mac ) ] +
376 " Actual: " + device )
377 hostAttachment = False
378 else:
Jon Hall85794ff2015-07-08 14:12:30 -0700379 hostAttachment = False
Jon Hallab611372018-02-21 15:26:05 -0800380 except AssertionError:
381 main.log.exception( "Json object not as expected" )
382 main.log.error( repr( host ) )
Jon Hall85794ff2015-07-08 14:12:30 -0700383 hostAttachment = False
Jon Hallab611372018-02-21 15:26:05 -0800384 else:
385 main.log.error( "No hosts json output or \"Error\"" +
386 " in output. hosts = " +
387 repr( hosts[ controller ] ) )
388 if zeroHosts is False:
389 hostAttachment = True
Jon Hall85794ff2015-07-08 14:12:30 -0700390
Jon Hall85794ff2015-07-08 14:12:30 -0700391 devicesResults = devicesResults and currentDevicesResult
392 linksResults = linksResults and currentLinksResult
393 hostsResults = hostsResults and currentHostsResult
394 hostAttachmentResults = hostAttachmentResults and\
395 hostAttachment
396
Jon Halla440e872016-03-31 15:15:50 -0700397 # "consistent" results don't make sense for single instance
Jon Hall85794ff2015-07-08 14:12:30 -0700398 # there should always only be one cluster
Jon Hall85794ff2015-07-08 14:12:30 -0700399 clusterResults = main.FALSE
Jon Halla440e872016-03-31 15:15:50 -0700400 try:
401 numClusters = len( json.loads( clusters[ 0 ] ) )
402 except ( ValueError, TypeError ):
403 main.log.exception( "Error parsing clusters[0]: " +
Jon Hallf37d44d2017-05-24 10:37:30 -0700404 repr( clusters[ 0 ] ) )
Jon Halla440e872016-03-31 15:15:50 -0700405 numClusters = "ERROR"
406 clusterResults = main.FALSE
Jon Hall85794ff2015-07-08 14:12:30 -0700407 if numClusters == 1:
408 clusterResults = main.TRUE
409 utilities.assert_equals(
410 expect=1,
411 actual=numClusters,
412 onpass="ONOS shows 1 SCC",
413 onfail="ONOS shows " + str( numClusters ) + " SCCs" )
414
415 topoResult = ( devicesResults and linksResults
416 and hostsResults and ipResult and clusterResults and
417 hostAttachmentResults )
418
419 topoResult = topoResult and int( count <= 2 )
420 note = "note it takes about " + str( int( cliTime ) ) + \
421 " seconds for the test to make all the cli calls to fetch " +\
422 "the topology from each ONOS instance"
423 main.log.info(
424 "Very crass estimate for topology discovery/convergence( " +
425 str( note ) + " ): " + str( elapsed ) + " seconds, " +
426 str( count ) + " tries" )
427 utilities.assert_equals( expect=main.TRUE, actual=topoResult,
428 onpass="Topology Check Test successful",
429 onfail="Topology Check Test NOT successful" )
Jon Hall41d39f12016-04-11 22:54:35 -0700430 main.step( "Checking ONOS nodes" )
Devin Lim3ebd5e72017-11-14 10:38:00 -0800431 nodeResults = utilities.retry( main.Cluster.nodesCheck,
Jon Hall41d39f12016-04-11 22:54:35 -0700432 False,
Jon Hall41d39f12016-04-11 22:54:35 -0700433 attempts=5 )
434
435 utilities.assert_equals( expect=True, actual=nodeResults,
436 onpass="Nodes check successful",
437 onfail="Nodes check NOT successful" )
438 if not nodeResults:
Devin Lim142b5342017-07-20 15:22:39 -0700439 for ctrl in main.Cluster.active():
Jon Hall41d39f12016-04-11 22:54:35 -0700440 main.log.debug( "{} components not ACTIVE: \n{}".format(
Devin Lim142b5342017-07-20 15:22:39 -0700441 ctrl.name,
442 ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
Jon Hall85794ff2015-07-08 14:12:30 -0700443
Jon Halld2871c22016-07-26 11:01:14 -0700444 if not topoResult:
Devin Lim44075962017-08-11 10:56:37 -0700445 main.cleanAndExit()
Jon Halld2871c22016-07-26 11:01:14 -0700446
Jon Hall85794ff2015-07-08 14:12:30 -0700447 def CASE9( self, main ):
448 """
Jon Hallab611372018-02-21 15:26:05 -0800449 Link down
Jon Hall85794ff2015-07-08 14:12:30 -0700450 """
Jon Hallab611372018-02-21 15:26:05 -0800451 src = main.params['kill']['linkSrc']
452 dst = main.params['kill']['linkDst']
453 main.HA.linkDown( main, src, dst )
Jon Hall85794ff2015-07-08 14:12:30 -0700454
455 def CASE10( self, main ):
456 """
Jon Hallab611372018-02-21 15:26:05 -0800457 Link up
Jon Hall85794ff2015-07-08 14:12:30 -0700458 """
Jon Hallab611372018-02-21 15:26:05 -0800459 src = main.params['kill']['linkSrc']
460 dst = main.params['kill']['linkDst']
461 main.HA.linkUp( main, src, dst )
Jon Hall85794ff2015-07-08 14:12:30 -0700462
463 def CASE11( self, main ):
464 """
465 Switch Down
466 """
467 # NOTE: You should probably run a topology check after this
Devin Lim58046fa2017-07-05 16:55:00 -0700468 main.HA.switchDown( main )
Jon Hall85794ff2015-07-08 14:12:30 -0700469
470 def CASE12( self, main ):
471 """
472 Switch Up
473 """
474 # NOTE: You should probably run a topology check after this
Devin Lim58046fa2017-07-05 16:55:00 -0700475 main.HA.switchUp( main )
Jon Hall85794ff2015-07-08 14:12:30 -0700476
477 def CASE13( self, main ):
478 """
479 Clean up
480 """
Devin Lim58046fa2017-07-05 16:55:00 -0700481 main.HAlabels.append( "Restart" )
482 main.HAdata.append( str( main.restartTime ) )
483 main.HA.cleanUp( main )
Jon Hall85794ff2015-07-08 14:12:30 -0700484
485 def CASE14( self, main ):
486 """
Jon Hallab611372018-02-21 15:26:05 -0800487 Start election app on all onos nodes
Jon Hall85794ff2015-07-08 14:12:30 -0700488 """
Devin Lim58046fa2017-07-05 16:55:00 -0700489 main.HA.startElectionApp( main )
Jon Hall85794ff2015-07-08 14:12:30 -0700490
491 def CASE15( self, main ):
492 """
493 Check that Leadership Election is still functional
acsmars71adceb2015-08-31 15:09:26 -0700494 15.1 Run election on each node
495 15.2 Check that each node has the same leaders and candidates
496 15.3 Find current leader and withdraw
497 15.4 Check that a new node was elected leader
498 15.5 Check that that new leader was the candidate of old leader
499 15.6 Run for election on old leader
500 15.7 Check that oldLeader is a candidate, and leader if only 1 node
501 15.8 Make sure that the old leader was added to the candidate list
502
503 old and new variable prefixes refer to data from before vs after
504 withdrawl and later before withdrawl vs after re-election
Jon Hall85794ff2015-07-08 14:12:30 -0700505 """
Devin Lim58046fa2017-07-05 16:55:00 -0700506 main.HA.isElectionFunctional( main )
Jon Hall85794ff2015-07-08 14:12:30 -0700507
508 def CASE16( self, main ):
509 """
510 Install Distributed Primitives app
511 """
Devin Lim58046fa2017-07-05 16:55:00 -0700512 main.HA.installDistributedPrimitiveApp( main )
Jon Hall85794ff2015-07-08 14:12:30 -0700513
514 def CASE17( self, main ):
515 """
516 Check for basic functionality with distributed primitives
517 """
Devin Lim58046fa2017-07-05 16:55:00 -0700518 main.HA.checkDistPrimitivesFunc( main )