Jon Hall | 669bc86 | 2021-03-09 12:24:44 -0800 | [diff] [blame] | 1 | class SRrollingRestart: |
| 2 | def __init__( self ): |
| 3 | self.default = '' |
| 4 | |
| 5 | def CASE1( self, main ): |
| 6 | main.case("Testing connections") |
| 7 | main.persistentSetup = True |
| 8 | |
| 9 | def CASE2( self, main ): |
| 10 | """ |
| 11 | Connect to Pod |
| 12 | Perform rolling ONOS failure/recovery test |
| 13 | Collect logs and analyze results |
| 14 | """ |
Jon Hall | a16b4db | 2021-10-20 14:11:59 -0700 | [diff] [blame] | 15 | try: |
| 16 | from tests.USECASE.SegmentRouting.SRStaging.dependencies.SRStagingTest import SRStagingTest |
| 17 | import json |
| 18 | except ImportError: |
| 19 | main.log.error( "SRStagingTest not found. Exiting the test" ) |
| 20 | main.cleanAndExit() |
| 21 | try: |
| 22 | main.funcs |
| 23 | except ( NameError, AttributeError ): |
| 24 | main.funcs = SRStagingTest() |
| 25 | |
| 26 | descPrefix = "Rolling ONOS Restart" |
| 27 | pod = main.params['GRAPH'].get( 'nodeCluster', "hardware" ) |
| 28 | main.funcs.setupTest( main, |
| 29 | topology='0x2', |
| 30 | onosNodes=3, |
| 31 | description="%s tests on the %s pod" % ( descPrefix, pod ) ) |
| 32 | switches = int( main.params[ 'TOPO' ][ 'switchNum' ] ) |
| 33 | links = int( main.params[ 'TOPO' ][ 'linkNum' ] ) |
Tseng, Yi | f3aecbb | 2022-06-02 16:53:03 -0700 | [diff] [blame^] | 34 | hosts = [ 'h1', 'h2', 'h3' ] |
Jon Hall | a16b4db | 2021-10-20 14:11:59 -0700 | [diff] [blame] | 35 | |
| 36 | clusterSize = main.Cluster.numCtrls |
| 37 | restartRounds = int( main.params.get( 'restartRounds', 1 ) ) |
| 38 | |
| 39 | def verifications( main, switches, links, hosts ): |
| 40 | """ |
| 41 | Checks to perform before and after each ONOS node event |
| 42 | All asserts should happen within this function |
| 43 | """ |
| 44 | from tests.USECASE.SegmentRouting.dependencies.Testcaselib import Testcaselib as run |
| 45 | run.verifyTopology( main, switches, links, main.Cluster.numCtrls ) |
| 46 | run.pingAllFabricIntfs( main, hosts, dumpFlows=False ) |
| 47 | run.verifyPing( main, hosts, hosts ) |
| 48 | verifications( main, switches, links, hosts ) |
| 49 | # TODO ADD control plane checks: nodes, flows, ... |
| 50 | # TODO: Mastership check? look at HA Test |
| 51 | # TODO: Any specific fabric checks? APP commands? |
| 52 | |
| 53 | for i in range( 0, clusterSize * restartRounds ): |
| 54 | n = i % clusterSize |
| 55 | ctrl = main.Cluster.getControllers( n ) |
| 56 | |
| 57 | longDesc = "%s - kill %s" % ( descPrefix, ctrl.name ) |
| 58 | # TODO: verify flow isn't interrupted |
| 59 | node = main.funcs.onosDown( main, ctrl, preventRestart=True ) |
| 60 | verifications( main, switches, links, hosts ) |
| 61 | main.funcs.onosUp( main, node, ctrl ) |
| 62 | verifications( main, switches, links, hosts ) |
| 63 | # Cleanup |
| 64 | main.log.warn( json.dumps( main.downtimeResults, indent=4, sort_keys=True ) ) |
| 65 | main.funcs.cleanup( main ) |
| 66 | |
| 67 | |