blob: adc6ac2127ee6b61a02482703181ed6e18eb5297 [file] [log] [blame]
YPZhangcbc2a062016-07-11 10:55:44 -07001'''
2SCPFintentEventTp
3 - Use intentperf app to generate a lot of intent install and withdraw events
4 - Test will run with 1,3,5,7 nodes, and with all neighbors
5 - Test will run 400 seconds and grep the overall rate from intent-perf summary
andrew@onlab.us2ae3a112015-02-02 11:24:32 -08006
YPZhangcbc2a062016-07-11 10:55:44 -07007 yunpeng@onlab.us
8'''
9
cameron@onlab.usaaecfd72015-07-08 12:27:26 -070010import time
andrew@onlab.us10332202015-03-11 15:04:43 -070011
andrew@onlab.us2ae3a112015-02-02 11:24:32 -080012
suibin7f2c9cd2015-07-08 17:34:59 -070013class SCPFintentEventTp:
andrew@onlab.us2ae3a112015-02-02 11:24:32 -080014 def __init__( self ):
15 self.default = ''
16
YPZhangcbc2a062016-07-11 10:55:44 -070017 def CASE0( self, main ):
18 '''
19 - GIT
20 - BUILDING ONOS
21 Pull specific ONOS branch, then Build ONOS ono ONOS Bench.
22 This step is usually skipped. Because in a Jenkins driven automated
23 test env. We want Jenkins jobs to pull&build for flexibility to handle
24 different versions of ONOS.
25 - Construct tests variables
26 '''
Devin Lim58046fa2017-07-05 16:55:00 -070027 try:
28 from tests.dependencies.ONOSSetup import ONOSSetup
29 main.testSetUp = ONOSSetup()
30 except ImportError:
31 main.log.error( "ONOSSetup not found. exiting the test" )
32 main.exit()
33 main.testSetUp.envSetupDescription()
34 stepResult = main.FALSE
35 try:
36 main.cellName = main.params[ 'ENV'][ 'cellName']
37 main.apps = main.params[ 'ENV' ][ 'cellApps' ]
38 main.BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
39 main.BENCHUser = main.params[ 'BENCH' ][ 'user' ]
40 main.MN1Ip = main.params[ 'MN' ][ 'ip1' ]
41 main.maxNodes = int( main.params[ 'max' ] )
42 main.numSwitches = ( main.params[ 'TEST' ][ 'numSwitches' ] ).split(",")
43 main.skipRelRsrc = main.params[ 'TEST' ][ 'skipReleaseResourcesOnWithdrawal' ]
44 main.flowObj = main.params[ 'TEST' ][ 'flowObj' ]
45 main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
46 main.installSleep = int( main.params[ 'SLEEP' ][ 'install' ] )
47 main.verifySleep = int( main.params[ 'SLEEP' ][ 'verify' ] )
48 main.scale = ( main.params[ 'SCALE' ] ).split(",")
49 main.testDuration = main.params[ 'TEST' ][ 'duration' ]
50 main.logInterval = main.params[ 'TEST' ][ 'log_interval' ]
51 main.debug = main.params[ 'debugMode' ]
52 main.timeout = int( main.params[ 'SLEEP' ][ 'timeout' ] )
53 main.cyclePeriod = main.params[ 'TEST' ][ 'cyclePeriod' ]
54 if main.flowObj == "True":
55 main.flowObj = True
56 main.dbFileName = main.params[ 'DATABASE' ][ 'dbFlowObj' ]
57 main.numKeys = main.params[ 'TEST' ][ 'numKeysFlowObj' ]
58 else:
59 main.flowObj = False
60 main.dbFileName = main.params[ 'DATABASE' ][ 'dbName' ]
61 main.numKeys = main.params[ 'TEST' ][ 'numKeys' ]
cameron@onlab.usc10e22c2015-05-13 13:07:28 -070062
Devin Lim58046fa2017-07-05 16:55:00 -070063 stepResult = main.testSetUp.gitPulling()
64 # Create DataBase file
65 main.log.info( "Create Database file " + main.dbFileName )
66 resultsDB = open( main.dbFileName, "w+" )
67 resultsDB.close()
cameron@onlab.usaaecfd72015-07-08 12:27:26 -070068
Devin Lim58046fa2017-07-05 16:55:00 -070069 # set neighbors
70 main.neighbors = "1"
71 except Exception as e:
72 main.testSetUp.envSetupException( e )
73 main.testSetUp.evnSetupConclusion( stepResult )
74 main.commit = main.commit.split( " " )[ 1 ]
cameron@onlab.us412e9562015-05-13 16:04:34 -070075
YPZhangcbc2a062016-07-11 10:55:44 -070076 def CASE1( self, main ):
77 # Clean up test environment and set up
78 import time
YPZhangcbc2a062016-07-11 10:55:44 -070079 main.maxNumBatch = 0
Devin Lim58046fa2017-07-05 16:55:00 -070080 main.testSetUp.getNumCtrls( True )
81 main.testSetUp.envSetup( includeGitPull=False, makeMaxNodes=False )
82 main.testSetUp.ONOSSetUp( main.MN1Ip, True,
83 cellName=main.cellName, killRemoveMax=False,
84 CtrlsSet=False )
cameron@onlab.us059c2562015-04-02 14:12:51 -070085
YPZhangcbc2a062016-07-11 10:55:44 -070086 # config apps
YPZhangcbc2a062016-07-11 10:55:44 -070087 main.CLIs[0].setCfg( "org.onosproject.net.intent.impl.IntentManager",
88 "skipReleaseResourcesOnWithdrawal " + main.skipRelRsrc )
Devin Lim58046fa2017-07-05 16:55:00 -070089 main.CLIs[0].setCfg( "org.onosproject.provider.nil.NullProviders", "deviceCount " + str(int( main.numCtrls*10)) )
YPZhangcbc2a062016-07-11 10:55:44 -070090 main.CLIs[0].setCfg( "org.onosproject.provider.nil.NullProviders", "topoShape linear" )
91 main.CLIs[0].setCfg( "org.onosproject.provider.nil.NullProviders", "enabled true" )
YPZhange6ef82a2016-07-05 16:48:15 -070092 if main.flowObj:
YPZhangcbc2a062016-07-11 10:55:44 -070093 main.CLIs[0].setCfg("org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator",
94 "useFlowObjectives", value="true")
You Wang106d0fa2017-05-15 17:22:15 -070095 main.CLIs[0].setCfg("org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator",
96 "defaultFlowObjectiveCompiler",
97 value='org.onosproject.net.intent.impl.compiler.LinkCollectionIntentObjectiveCompiler')
YPZhangcbc2a062016-07-11 10:55:44 -070098 time.sleep( main.startUpSleep )
cameron@onlab.useae03dc2015-07-29 11:51:28 -070099
YPZhangcbc2a062016-07-11 10:55:44 -0700100 # balanceMasters
101 main.CLIs[0].balanceMasters()
102 time.sleep( main.startUpSleep )
cameron@onlab.usaaecfd72015-07-08 12:27:26 -0700103
YPZhangcbc2a062016-07-11 10:55:44 -0700104 def CASE2(self, main):
jenkins3af0cd82015-03-24 10:27:16 -0700105 import numpy
cameron@onlab.usc10e22c2015-05-13 13:07:28 -0700106
YPZhangcbc2a062016-07-11 10:55:44 -0700107 main.log.info( "Cluster Count = " + str( main.numCtrls ) )
108 # adjust neighbors
109 if main.numCtrls == 1:
110 main.neighbors = "0"
111 main.log.info( "Neighbors: 0" )
112 elif main.neighbors != "0":
113 main.neighbors = "0"
114 main.log.info( "Neighbors: 0" )
115 elif main.neighbors == "0":
116 main.neighbors = str( main.numCtrls - 1 )
117 main.log.info( "Neighbors: " + main.neighbors )
cameron@onlab.usc10e22c2015-05-13 13:07:28 -0700118
YPZhangcbc2a062016-07-11 10:55:44 -0700119 main.log.info( "Config intent-perf app" )
120 main.CLIs[0].setCfg( "org.onosproject.intentperf.IntentPerfInstaller", "numKeys " + main.numKeys )
121 main.CLIs[0].setCfg( "org.onosproject.intentperf.IntentPerfInstaller", "numNeighbors " + str( main.neighbors ) )
122 main.CLIs[0].setCfg( "org.onosproject.intentperf.IntentPerfInstaller", "cyclePeriod " + main.cyclePeriod )
cameron@onlab.usc10e22c2015-05-13 13:07:28 -0700123
Devin Lim58046fa2017-07-05 16:55:00 -0700124 main.log.info( "Starting intent-perf test for " + str( main.testDuration) + " seconds..." )
YPZhangcbc2a062016-07-11 10:55:44 -0700125 main.CLIs[0].sendline( "intent-perf-start" )
126 stop = time.time() + float( main.testDuration )
andrew@onlab.us10332202015-03-11 15:04:43 -0700127
YPZhangcbc2a062016-07-11 10:55:44 -0700128 while time.time() < stop:
129 time.sleep(15)
130 result = main.CLIs[0].getIntentPerfSummary()
131 if result:
Devin Lim58046fa2017-07-05 16:55:00 -0700132 for i in range( main.numCtrls ):
133 main.log.info( "Node {} Overall Rate: {}".format( main.ONOSip[ i ], result[ main.ONOSip[ i ] ] ) )
YPZhangcbc2a062016-07-11 10:55:44 -0700134 main.log.info( "Stop intent-perf" )
Devin Lim58046fa2017-07-05 16:55:00 -0700135 for i in range( main.numCtrls ):
136 main.CLIs[i].sendline( "intent-perf-stop" )
YPZhangcbc2a062016-07-11 10:55:44 -0700137 if result:
Devin Lim58046fa2017-07-05 16:55:00 -0700138 for i in range( main.numCtrls ):
139 main.log.info( "Node {} final Overall Rate: {}".format( main.ONOSip[ i ], result[ main.ONOSip[ i ] ] ) )
andrew@onlab.us2ae3a112015-02-02 11:24:32 -0800140
YPZhangcbc2a062016-07-11 10:55:44 -0700141 with open( main.dbFileName, "a" ) as resultDB:
Devin Lim58046fa2017-07-05 16:55:00 -0700142 for nodes in range( main.numCtrls ):
YPZhangcbc2a062016-07-11 10:55:44 -0700143 resultString = "'" + main.commit + "',"
144 resultString += "'1gig',"
Devin Lim58046fa2017-07-05 16:55:00 -0700145 resultString += str( main.numCtrls) + ","
YPZhangcbc2a062016-07-11 10:55:44 -0700146 resultString += "'baremetal" + str( nodes+1 ) + "',"
147 resultString += main.neighbors + ","
148 resultString += result[ main.ONOSip[ nodes ] ]+","
149 resultString += str(0) + "\n" # no stddev
150 resultDB.write( resultString )
151 resultDB.close()