blob: 4f1ec829fbc92b50b441ef2f1b7e5b4f673f500d [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
94 applyFuncs = [ main.testSetUp.createApplyCell ]
95 applyArgs = [ [ main.Cluster, True, "SingleHA", "", "", True, main.Cluster.runningNodes[ 0 ].ipAddress ] ]
96 try:
97 if main.params[ 'topology' ][ 'topoFile' ]:
98 main.log.info( 'Skipping start of Mininet in this case, make sure you start it elsewhere' )
99 else:
100 applyFuncs.append( main.HA.startingMininet )
101 applyArgs.append( None )
102 except (KeyError, IndexError):
103 applyFuncs.append( main.HA.startingMininet )
104 applyArgs.append( None )
105
Devin Lim142b5342017-07-20 15:22:39 -0700106 main.Cluster.setRunningNode( int( main.params[ 'num_controllers' ] ) )
107 ip = main.Cluster.getIps( allNode=True )
You Wanga0f6ff62018-01-11 15:46:30 -0800108 main.testSetUp.ONOSSetUp( main.Cluster, cellName="SingleHA", removeLog=True,
Jon Hallab611372018-02-21 15:26:05 -0800109 extraApply=applyFuncs,
110 applyArgs=applyArgs,
111 includeCaseDesc=False )
Devin Lim58046fa2017-07-05 16:55:00 -0700112 main.HA.initialSetUp()
Jon Hall9d2dcad2016-04-08 10:15:20 -0700113
Jon Hallab611372018-02-21 15:26:05 -0800114 main.step( 'Set logging levels' )
115 logging = True
116 try:
117 logs = main.params.get( 'ONOS_Logging', False )
118 if logs:
119 for namespace, level in logs.items():
120 for ctrl in main.Cluster.active():
121 ctrl.CLI.logSet( level, namespace )
122 except AttributeError:
123 logging = False
124 utilities.assert_equals( expect=True, actual=logging,
125 onpass="Set log levels",
126 onfail="Failed to set log levels" )
127
Jon Hall85794ff2015-07-08 14:12:30 -0700128 def CASE2( self, main ):
129 """
130 Assign devices to controllers
131 """
Devin Lim58046fa2017-07-05 16:55:00 -0700132 main.HA.assignDevices( main )
Jon Hall85794ff2015-07-08 14:12:30 -0700133
Jon Hallab611372018-02-21 15:26:05 -0800134 def CASE102( self, main ):
135 """
136 Set up Spine-Leaf fabric topology in Mininet
137 """
138 main.HA.startTopology( main )
139
Jon Hall85794ff2015-07-08 14:12:30 -0700140 def CASE21( self, main ):
141 """
142 Assign mastership to controllers
143 """
Devin Lim58046fa2017-07-05 16:55:00 -0700144 main.HA.assignMastership( main )
Jon Hall85794ff2015-07-08 14:12:30 -0700145
146 def CASE3( self, main ):
147 """
148 Assign intents
149 """
Devin Lim58046fa2017-07-05 16:55:00 -0700150 main.HA.assignIntents( main )
Jon Hall85794ff2015-07-08 14:12:30 -0700151
152 def CASE4( self, main ):
153 """
154 Ping across added host intents
155 """
Jon Hallca319892017-06-15 15:25:22 -0700156 main.HA.pingAcrossHostIntent( main )
Jon Hall85794ff2015-07-08 14:12:30 -0700157
Jon Hallab611372018-02-21 15:26:05 -0800158 def CASE104( self, main ):
159 """
160 Ping Hosts
161 """
162 main.case( "Check connectivity" )
163 main.step( "Ping between all hosts" )
164 pingResult = main.Mininet1.pingall()
165 utilities.assert_equals( expect=main.TRUE, actual=pingResult,
166 onpass="All Pings Passed",
167 onfail="Failed to ping between all hosts" )
168
Jon Hall85794ff2015-07-08 14:12:30 -0700169 def CASE5( self, main ):
170 """
171 Reading state of ONOS
172 """
Jon Hallab611372018-02-21 15:26:05 -0800173 main.HA.readingState( main )
Jon Hall8bafdc02017-09-05 11:36:26 -0700174
Jon Hall85794ff2015-07-08 14:12:30 -0700175 def CASE6( self, main ):
176 """
177 The Failure case.
178 """
179 import time
Jon Hall85794ff2015-07-08 14:12:30 -0700180 assert main, "main not defined"
181 assert utilities.assert_equals, "utilities.assert_equals not defined"
182
Jon Hall85794ff2015-07-08 14:12:30 -0700183 main.case( "Restart ONOS node" )
Jon Hall783bbf92015-07-23 14:33:19 -0700184 main.caseExplanation = "Killing ONOS process and restart cli " +\
Jon Hall85794ff2015-07-08 14:12:30 -0700185 "sessions once onos is up."
Jon Hall96091e62015-09-21 17:34:17 -0700186
187 main.step( "Checking ONOS Logs for errors" )
Devin Lim142b5342017-07-20 15:22:39 -0700188 for ctrl in main.Cluster.active():
189 main.log.debug( "Checking logs for errors on " + ctrl.name + ":" )
190 main.log.warn( main.ONOSbench.checkLogs( ctrl.ip_address ) )
191 ctrl = main.Cluster.runningNodes[ 0 ]
Jon Hall85794ff2015-07-08 14:12:30 -0700192 main.step( "Killing ONOS processes" )
Devin Lim142b5342017-07-20 15:22:39 -0700193 killResult = main.ONOSbench.onosKill( ctrl.ipAddress )
Jon Hall85794ff2015-07-08 14:12:30 -0700194 start = time.time()
195 utilities.assert_equals( expect=main.TRUE, actual=killResult,
196 onpass="ONOS Killed",
197 onfail="Error killing ONOS" )
198
199 main.step( "Checking if ONOS is up yet" )
200 count = 0
201 while count < 10:
Devin Lim142b5342017-07-20 15:22:39 -0700202 onos1Isup = main.ONOSbench.isup( ctrl.ipAddress )
Jon Hall85794ff2015-07-08 14:12:30 -0700203 if onos1Isup == main.TRUE:
204 elapsed = time.time() - start
205 break
206 else:
207 count = count + 1
208 utilities.assert_equals( expect=main.TRUE, actual=onos1Isup,
209 onpass="ONOS is back up",
210 onfail="ONOS failed to start" )
211
Jon Hall6509dbf2016-06-21 17:01:17 -0700212 main.step( "Starting ONOS CLI sessions" )
Devin Lim142b5342017-07-20 15:22:39 -0700213 cliResults = ctrl.CLI.startOnosCli( ctrl.ipAddress )
Jon Hall85794ff2015-07-08 14:12:30 -0700214 utilities.assert_equals( expect=main.TRUE, actual=cliResults,
215 onpass="ONOS cli startup successful",
216 onfail="ONOS cli startup failed" )
217
218 if elapsed:
219 main.log.info( "ESTIMATE: ONOS took %s seconds to restart" %
220 str( elapsed ) )
221 main.restartTime = elapsed
222 else:
223 main.restartTime = -1
224 time.sleep( 5 )
225 # rerun on election apps
Devin Lim142b5342017-07-20 15:22:39 -0700226 ctrl.CLI.electionTestRun()
Jon Hall85794ff2015-07-08 14:12:30 -0700227
228 def CASE7( self, main ):
229 """
230 Check state after ONOS failure
231 """
Jon Hallab611372018-02-21 15:26:05 -0800232 main.HA.checkStateAfterEvent( main, afterWhich=0, compareSwitch=True, isRestart=True )
Jon Hall85794ff2015-07-08 14:12:30 -0700233
234 def CASE8( self, main ):
235 """
236 Compare topo
237 """
238 import json
239 import time
Jon Hall85794ff2015-07-08 14:12:30 -0700240 assert main, "main not defined"
241 assert utilities.assert_equals, "utilities.assert_equals not defined"
242
243 main.case( "Compare ONOS Topology view to Mininet topology" )
Jon Hall783bbf92015-07-23 14:33:19 -0700244 main.caseExplanation = "Compare topology objects between Mininet" +\
Jon Hall85794ff2015-07-08 14:12:30 -0700245 " and ONOS"
Jon Hall85794ff2015-07-08 14:12:30 -0700246 topoResult = main.FALSE
247 elapsed = 0
248 count = 0
Jon Halle9b1fa32015-12-08 15:32:21 -0800249 main.step( "Comparing ONOS topology to MN topology" )
Jon Hall85794ff2015-07-08 14:12:30 -0700250 startTime = time.time()
Devin Lim142b5342017-07-20 15:22:39 -0700251 ctrl = main.Cluster.active( 0 )
Jon Hall85794ff2015-07-08 14:12:30 -0700252 # Give time for Gossip to work
Jon Halle9b1fa32015-12-08 15:32:21 -0800253 while topoResult == main.FALSE and ( elapsed < 60 or count < 3 ):
Jon Hall96091e62015-09-21 17:34:17 -0700254 devicesResults = main.TRUE
255 linksResults = main.TRUE
256 hostsResults = main.TRUE
257 hostAttachmentResults = True
Jon Hall85794ff2015-07-08 14:12:30 -0700258 count += 1
259 cliStart = time.time()
260 devices = []
Devin Lim142b5342017-07-20 15:22:39 -0700261 devices.append( ctrl.CLI.devices() )
Jon Hall85794ff2015-07-08 14:12:30 -0700262 hosts = []
Devin Lim142b5342017-07-20 15:22:39 -0700263 hosts.append( json.loads( ctrl.CLI.hosts() ) )
Jon Hall85794ff2015-07-08 14:12:30 -0700264 ipResult = main.TRUE
265 for controller in range( 0, len( hosts ) ):
266 controllerStr = str( controller + 1 )
267 for host in hosts[ controller ]:
268 if host is None or host.get( 'ipAddresses', [] ) == []:
269 main.log.error(
270 "DEBUG:Error with host ips on controller" +
271 controllerStr + ": " + str( host ) )
272 ipResult = main.FALSE
273 ports = []
Devin Lim142b5342017-07-20 15:22:39 -0700274 ports.append( ctrl.CLI.ports() )
Jon Hall85794ff2015-07-08 14:12:30 -0700275 links = []
Devin Lim142b5342017-07-20 15:22:39 -0700276 links.append( ctrl.CLI.links() )
Jon Hall85794ff2015-07-08 14:12:30 -0700277 clusters = []
Devin Lim142b5342017-07-20 15:22:39 -0700278 clusters.append( ctrl.CLI.clusters() )
Jon Hall85794ff2015-07-08 14:12:30 -0700279
280 elapsed = time.time() - startTime
281 cliTime = time.time() - cliStart
282 print "CLI time: " + str( cliTime )
283
284 mnSwitches = main.Mininet1.getSwitches()
285 mnLinks = main.Mininet1.getLinks()
286 mnHosts = main.Mininet1.getHosts()
Devin Lim142b5342017-07-20 15:22:39 -0700287 for controller in main.Cluster.getRunningPos():
288 controllerStr = str( controller )
Jon Hall85794ff2015-07-08 14:12:30 -0700289 if devices[ controller ] and ports[ controller ] and\
Jon Hallf37d44d2017-05-24 10:37:30 -0700290 "Error" not in devices[ controller ] and\
291 "Error" not in ports[ controller ]:
Jon Hall85794ff2015-07-08 14:12:30 -0700292
Jon Hallc6793552016-01-19 14:18:37 -0800293 try:
294 currentDevicesResult = main.Mininet1.compareSwitches(
295 mnSwitches,
296 json.loads( devices[ controller ] ),
297 json.loads( ports[ controller ] ) )
Jon Halla478b852017-12-04 15:00:15 -0800298 except ( TypeError, ValueError ):
Jon Hallc6793552016-01-19 14:18:37 -0800299 main.log.exception( "Object not as expected; devices={!r}\nports={!r}".format(
300 devices[ controller ], ports[ controller ] ) )
Jon Hall85794ff2015-07-08 14:12:30 -0700301 else:
302 currentDevicesResult = main.FALSE
303 utilities.assert_equals( expect=main.TRUE,
304 actual=currentDevicesResult,
305 onpass="ONOS" + controllerStr +
306 " Switches view is correct",
307 onfail="ONOS" + controllerStr +
308 " Switches view is incorrect" )
309
310 if links[ controller ] and "Error" not in links[ controller ]:
311 currentLinksResult = main.Mininet1.compareLinks(
312 mnSwitches, mnLinks,
313 json.loads( links[ controller ] ) )
314 else:
315 currentLinksResult = main.FALSE
316 utilities.assert_equals( expect=main.TRUE,
317 actual=currentLinksResult,
318 onpass="ONOS" + controllerStr +
319 " links view is correct",
320 onfail="ONOS" + controllerStr +
321 " links view is incorrect" )
322
323 if hosts[ controller ] or "Error" not in hosts[ controller ]:
324 currentHostsResult = main.Mininet1.compareHosts(
325 mnHosts,
326 hosts[ controller ] )
327 else:
328 currentHostsResult = main.FALSE
329 utilities.assert_equals( expect=main.TRUE,
330 actual=currentHostsResult,
331 onpass="ONOS" + controllerStr +
332 " hosts exist in Mininet",
333 onfail="ONOS" + controllerStr +
334 " hosts don't match Mininet" )
335 # CHECKING HOST ATTACHMENT POINTS
336 hostAttachment = True
Jon Hallab611372018-02-21 15:26:05 -0800337 if main.topoMappings:
338 zeroHosts = False
339 if hosts[ controller ] or "Error" not in hosts[ controller ]:
340 if hosts[ controller ] == []:
341 main.log.warn( "There are no hosts discovered" )
342 zeroHosts = True
343 else:
344 for host in hosts[ controller ]:
345 mac = None
346 location = None
347 device = None
348 port = None
349 try:
350 mac = host.get( 'mac' )
351 assert mac, "mac field could not be found for this host object"
Jon Hall85794ff2015-07-08 14:12:30 -0700352
Jon Hallab611372018-02-21 15:26:05 -0800353 location = host.get( 'locations' )[ 0 ]
354 assert location, "location field could not be found for this host object"
Jon Hall85794ff2015-07-08 14:12:30 -0700355
Jon Hallab611372018-02-21 15:26:05 -0800356 # Trim the protocol identifier off deviceId
357 device = str( location.get( 'elementId' ) ).split( ':' )[ 1 ]
358 assert device, "elementId field could not be found for this host location object"
Jon Hall85794ff2015-07-08 14:12:30 -0700359
Jon Hallab611372018-02-21 15:26:05 -0800360 port = location.get( 'port' )
361 assert port, "port field could not be found for this host location object"
Jon Hall85794ff2015-07-08 14:12:30 -0700362
Jon Hallab611372018-02-21 15:26:05 -0800363 # Now check if this matches where they should be
364 if mac and device and port:
365 if str( port ) != "1":
366 main.log.error( "The attachment port is incorrect for " +
367 "host " + str( mac ) +
368 ". Expected: 1 Actual: " + str( port ) )
369 hostAttachment = False
370 if device != main.topoMappings[ str( mac ) ]:
371 main.log.error( "The attachment device is incorrect for " +
372 "host " + str( mac ) +
373 ". Expected: " + main.topoMappings[ str( mac ) ] +
374 " Actual: " + device )
375 hostAttachment = False
376 else:
Jon Hall85794ff2015-07-08 14:12:30 -0700377 hostAttachment = False
Jon Hallab611372018-02-21 15:26:05 -0800378 except AssertionError:
379 main.log.exception( "Json object not as expected" )
380 main.log.error( repr( host ) )
Jon Hall85794ff2015-07-08 14:12:30 -0700381 hostAttachment = False
Jon Hallab611372018-02-21 15:26:05 -0800382 else:
383 main.log.error( "No hosts json output or \"Error\"" +
384 " in output. hosts = " +
385 repr( hosts[ controller ] ) )
386 if zeroHosts is False:
387 hostAttachment = True
Jon Hall85794ff2015-07-08 14:12:30 -0700388
Jon Hall85794ff2015-07-08 14:12:30 -0700389 devicesResults = devicesResults and currentDevicesResult
390 linksResults = linksResults and currentLinksResult
391 hostsResults = hostsResults and currentHostsResult
392 hostAttachmentResults = hostAttachmentResults and\
393 hostAttachment
394
Jon Halla440e872016-03-31 15:15:50 -0700395 # "consistent" results don't make sense for single instance
Jon Hall85794ff2015-07-08 14:12:30 -0700396 # there should always only be one cluster
Jon Hall85794ff2015-07-08 14:12:30 -0700397 clusterResults = main.FALSE
Jon Halla440e872016-03-31 15:15:50 -0700398 try:
399 numClusters = len( json.loads( clusters[ 0 ] ) )
400 except ( ValueError, TypeError ):
401 main.log.exception( "Error parsing clusters[0]: " +
Jon Hallf37d44d2017-05-24 10:37:30 -0700402 repr( clusters[ 0 ] ) )
Jon Halla440e872016-03-31 15:15:50 -0700403 numClusters = "ERROR"
404 clusterResults = main.FALSE
Jon Hall85794ff2015-07-08 14:12:30 -0700405 if numClusters == 1:
406 clusterResults = main.TRUE
407 utilities.assert_equals(
408 expect=1,
409 actual=numClusters,
410 onpass="ONOS shows 1 SCC",
411 onfail="ONOS shows " + str( numClusters ) + " SCCs" )
412
413 topoResult = ( devicesResults and linksResults
414 and hostsResults and ipResult and clusterResults and
415 hostAttachmentResults )
416
417 topoResult = topoResult and int( count <= 2 )
418 note = "note it takes about " + str( int( cliTime ) ) + \
419 " seconds for the test to make all the cli calls to fetch " +\
420 "the topology from each ONOS instance"
421 main.log.info(
422 "Very crass estimate for topology discovery/convergence( " +
423 str( note ) + " ): " + str( elapsed ) + " seconds, " +
424 str( count ) + " tries" )
425 utilities.assert_equals( expect=main.TRUE, actual=topoResult,
426 onpass="Topology Check Test successful",
427 onfail="Topology Check Test NOT successful" )
Jon Hall41d39f12016-04-11 22:54:35 -0700428 main.step( "Checking ONOS nodes" )
Devin Lim3ebd5e72017-11-14 10:38:00 -0800429 nodeResults = utilities.retry( main.Cluster.nodesCheck,
Jon Hall41d39f12016-04-11 22:54:35 -0700430 False,
Jon Hall41d39f12016-04-11 22:54:35 -0700431 attempts=5 )
432
433 utilities.assert_equals( expect=True, actual=nodeResults,
434 onpass="Nodes check successful",
435 onfail="Nodes check NOT successful" )
436 if not nodeResults:
Devin Lim142b5342017-07-20 15:22:39 -0700437 for ctrl in main.Cluster.active():
Jon Hall41d39f12016-04-11 22:54:35 -0700438 main.log.debug( "{} components not ACTIVE: \n{}".format(
Devin Lim142b5342017-07-20 15:22:39 -0700439 ctrl.name,
440 ctrl.CLI.sendline( "scr:list | grep -v ACTIVE" ) ) )
Jon Hall85794ff2015-07-08 14:12:30 -0700441
Jon Halld2871c22016-07-26 11:01:14 -0700442 if not topoResult:
Devin Lim44075962017-08-11 10:56:37 -0700443 main.cleanAndExit()
Jon Halld2871c22016-07-26 11:01:14 -0700444
Jon Hall85794ff2015-07-08 14:12:30 -0700445 def CASE9( self, main ):
446 """
Jon Hallab611372018-02-21 15:26:05 -0800447 Link down
Jon Hall85794ff2015-07-08 14:12:30 -0700448 """
Jon Hallab611372018-02-21 15:26:05 -0800449 src = main.params['kill']['linkSrc']
450 dst = main.params['kill']['linkDst']
451 main.HA.linkDown( main, src, dst )
Jon Hall85794ff2015-07-08 14:12:30 -0700452
453 def CASE10( self, main ):
454 """
Jon Hallab611372018-02-21 15:26:05 -0800455 Link up
Jon Hall85794ff2015-07-08 14:12:30 -0700456 """
Jon Hallab611372018-02-21 15:26:05 -0800457 src = main.params['kill']['linkSrc']
458 dst = main.params['kill']['linkDst']
459 main.HA.linkUp( main, src, dst )
Jon Hall85794ff2015-07-08 14:12:30 -0700460
461 def CASE11( self, main ):
462 """
463 Switch Down
464 """
465 # NOTE: You should probably run a topology check after this
Devin Lim58046fa2017-07-05 16:55:00 -0700466 main.HA.switchDown( main )
Jon Hall85794ff2015-07-08 14:12:30 -0700467
468 def CASE12( self, main ):
469 """
470 Switch Up
471 """
472 # NOTE: You should probably run a topology check after this
Devin Lim58046fa2017-07-05 16:55:00 -0700473 main.HA.switchUp( main )
Jon Hall85794ff2015-07-08 14:12:30 -0700474
475 def CASE13( self, main ):
476 """
477 Clean up
478 """
Devin Lim58046fa2017-07-05 16:55:00 -0700479 main.HAlabels.append( "Restart" )
480 main.HAdata.append( str( main.restartTime ) )
481 main.HA.cleanUp( main )
Jon Hall85794ff2015-07-08 14:12:30 -0700482
483 def CASE14( self, main ):
484 """
Jon Hallab611372018-02-21 15:26:05 -0800485 Start election app on all onos nodes
Jon Hall85794ff2015-07-08 14:12:30 -0700486 """
Devin Lim58046fa2017-07-05 16:55:00 -0700487 main.HA.startElectionApp( main )
Jon Hall85794ff2015-07-08 14:12:30 -0700488
489 def CASE15( self, main ):
490 """
491 Check that Leadership Election is still functional
acsmars71adceb2015-08-31 15:09:26 -0700492 15.1 Run election on each node
493 15.2 Check that each node has the same leaders and candidates
494 15.3 Find current leader and withdraw
495 15.4 Check that a new node was elected leader
496 15.5 Check that that new leader was the candidate of old leader
497 15.6 Run for election on old leader
498 15.7 Check that oldLeader is a candidate, and leader if only 1 node
499 15.8 Make sure that the old leader was added to the candidate list
500
501 old and new variable prefixes refer to data from before vs after
502 withdrawl and later before withdrawl vs after re-election
Jon Hall85794ff2015-07-08 14:12:30 -0700503 """
Devin Lim58046fa2017-07-05 16:55:00 -0700504 main.HA.isElectionFunctional( main )
Jon Hall85794ff2015-07-08 14:12:30 -0700505
506 def CASE16( self, main ):
507 """
508 Install Distributed Primitives app
509 """
Devin Lim58046fa2017-07-05 16:55:00 -0700510 main.HA.installDistributedPrimitiveApp( main )
Jon Hall85794ff2015-07-08 14:12:30 -0700511
512 def CASE17( self, main ):
513 """
514 Check for basic functionality with distributed primitives
515 """
Devin Lim58046fa2017-07-05 16:55:00 -0700516 main.HA.checkDistPrimitivesFunc( main )