Jon Hall | 669bc86 | 2021-03-09 12:24:44 -0800 | [diff] [blame] | 1 | class SRstratumRestart: |
| 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 Stratum agent failure/recovery test |
| 13 | Collect logs and analyze results |
| 14 | """ |
Jon Hall | be3a2ac | 2021-03-15 12:28:06 -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 = "Stratum_Reboot" |
| 27 | main.funcs.setupTest( main, |
| 28 | topology='2x2staging', |
| 29 | onosNodes=3, |
| 30 | description="%s tests on the staging pod" % descPrefix ) |
| 31 | srcComponentNames = main.params[ 'PERF' ][ 'traffic_host' ].split() |
| 32 | srcComponentList = [] |
| 33 | for name in srcComponentNames: |
| 34 | srcComponentList.append( getattr( main, name ) ) |
| 35 | dstComponent = getattr( main, main.params[ 'PERF' ][ 'pcap_host' ] ) |
| 36 | |
| 37 | main.downtimeResults = {} |
| 38 | |
| 39 | switchComponentList = [ getattr( main, "Spine%s" % n ) for n in range( 1, 2+1 ) ] |
| 40 | iterations = int( main.params[ 'PERF' ][ 'iterations' ] ) |
| 41 | |
| 42 | for i in range( 1, iterations + 1 ): |
| 43 | ## Spine Stratum agent Reboot |
| 44 | shortDescFailure = descPrefix + "-Failure%s" % i |
| 45 | longDescFailure = "%s Failure%s: Kill Stratum on switch" % ( descPrefix, i ) |
| 46 | shortDescRecovery = descPrefix + "-Recovery%s" % i |
| 47 | longDescRecovery = "%s Recovery%s: Restart Stratum on switch" % ( descPrefix, i ) |
| 48 | main.funcs.killSwitchAgent( switchComponentList, srcComponentList, dstComponent, |
| 49 | shortDescFailure, longDescFailure, |
| 50 | shortDescRecovery, longDescRecovery ) |
| 51 | |
| 52 | main.case( "Cleanup" ) |
| 53 | main.log.warn( json.dumps( main.downtimeResults, indent=4, sort_keys=True ) ) |
| 54 | main.funcs.cleanup( main ) |