blob: 1b55d54e5791803a2c63010bd11c7c21e8eac299 [file] [log] [blame]
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -07001"""
2Copyright 2015 Open Networking Foundation (ONF)
3
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
11 (at your option) any later version.
12
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"""
21
YPZhangcbc2a062016-07-11 10:55:44 -070022'''
23SCPFintentEventTp
24 - Use intentperf app to generate a lot of intent install and withdraw events
25 - Test will run with 1,3,5,7 nodes, and with all neighbors
26 - Test will run 400 seconds and grep the overall rate from intent-perf summary
andrew@onlab.us2ae3a112015-02-02 11:24:32 -080027
YPZhangcbc2a062016-07-11 10:55:44 -070028 yunpeng@onlab.us
29'''
30
cameron@onlab.usaaecfd72015-07-08 12:27:26 -070031import time
andrew@onlab.us10332202015-03-11 15:04:43 -070032
andrew@onlab.us2ae3a112015-02-02 11:24:32 -080033
suibin7f2c9cd2015-07-08 17:34:59 -070034class SCPFintentEventTp:
andrew@onlab.us2ae3a112015-02-02 11:24:32 -080035 def __init__( self ):
36 self.default = ''
37
YPZhangcbc2a062016-07-11 10:55:44 -070038 def CASE0( self, main ):
39 '''
40 - GIT
41 - BUILDING ONOS
42 Pull specific ONOS branch, then Build ONOS ono ONOS Bench.
43 This step is usually skipped. Because in a Jenkins driven automated
44 test env. We want Jenkins jobs to pull&build for flexibility to handle
45 different versions of ONOS.
46 - Construct tests variables
47 '''
Devin Lim58046fa2017-07-05 16:55:00 -070048 try:
49 from tests.dependencies.ONOSSetup import ONOSSetup
50 main.testSetUp = ONOSSetup()
51 except ImportError:
52 main.log.error( "ONOSSetup not found. exiting the test" )
53 main.exit()
54 main.testSetUp.envSetupDescription()
55 stepResult = main.FALSE
56 try:
57 main.cellName = main.params[ 'ENV'][ 'cellName']
58 main.apps = main.params[ 'ENV' ][ 'cellApps' ]
59 main.BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
60 main.BENCHUser = main.params[ 'BENCH' ][ 'user' ]
61 main.MN1Ip = main.params[ 'MN' ][ 'ip1' ]
62 main.maxNodes = int( main.params[ 'max' ] )
63 main.numSwitches = ( main.params[ 'TEST' ][ 'numSwitches' ] ).split(",")
64 main.skipRelRsrc = main.params[ 'TEST' ][ 'skipReleaseResourcesOnWithdrawal' ]
65 main.flowObj = main.params[ 'TEST' ][ 'flowObj' ]
66 main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
67 main.installSleep = int( main.params[ 'SLEEP' ][ 'install' ] )
68 main.verifySleep = int( main.params[ 'SLEEP' ][ 'verify' ] )
69 main.scale = ( main.params[ 'SCALE' ] ).split(",")
70 main.testDuration = main.params[ 'TEST' ][ 'duration' ]
71 main.logInterval = main.params[ 'TEST' ][ 'log_interval' ]
72 main.debug = main.params[ 'debugMode' ]
73 main.timeout = int( main.params[ 'SLEEP' ][ 'timeout' ] )
74 main.cyclePeriod = main.params[ 'TEST' ][ 'cyclePeriod' ]
75 if main.flowObj == "True":
76 main.flowObj = True
77 main.dbFileName = main.params[ 'DATABASE' ][ 'dbFlowObj' ]
78 main.numKeys = main.params[ 'TEST' ][ 'numKeysFlowObj' ]
79 else:
80 main.flowObj = False
81 main.dbFileName = main.params[ 'DATABASE' ][ 'dbName' ]
82 main.numKeys = main.params[ 'TEST' ][ 'numKeys' ]
cameron@onlab.usc10e22c2015-05-13 13:07:28 -070083
Devin Lim58046fa2017-07-05 16:55:00 -070084 stepResult = main.testSetUp.gitPulling()
85 # Create DataBase file
86 main.log.info( "Create Database file " + main.dbFileName )
87 resultsDB = open( main.dbFileName, "w+" )
88 resultsDB.close()
cameron@onlab.usaaecfd72015-07-08 12:27:26 -070089
Devin Lim58046fa2017-07-05 16:55:00 -070090 # set neighbors
91 main.neighbors = "1"
92 except Exception as e:
93 main.testSetUp.envSetupException( e )
94 main.testSetUp.evnSetupConclusion( stepResult )
95 main.commit = main.commit.split( " " )[ 1 ]
cameron@onlab.us412e9562015-05-13 16:04:34 -070096
YPZhangcbc2a062016-07-11 10:55:44 -070097 def CASE1( self, main ):
98 # Clean up test environment and set up
99 import time
YPZhangcbc2a062016-07-11 10:55:44 -0700100 main.maxNumBatch = 0
Devin Lim58046fa2017-07-05 16:55:00 -0700101 main.testSetUp.getNumCtrls( True )
102 main.testSetUp.envSetup( includeGitPull=False, makeMaxNodes=False )
103 main.testSetUp.ONOSSetUp( main.MN1Ip, True,
104 cellName=main.cellName, killRemoveMax=False,
105 CtrlsSet=False )
cameron@onlab.us059c2562015-04-02 14:12:51 -0700106
YPZhangcbc2a062016-07-11 10:55:44 -0700107 # config apps
YPZhangcbc2a062016-07-11 10:55:44 -0700108 main.CLIs[0].setCfg( "org.onosproject.net.intent.impl.IntentManager",
109 "skipReleaseResourcesOnWithdrawal " + main.skipRelRsrc )
Devin Lim58046fa2017-07-05 16:55:00 -0700110 main.CLIs[0].setCfg( "org.onosproject.provider.nil.NullProviders", "deviceCount " + str(int( main.numCtrls*10)) )
YPZhangcbc2a062016-07-11 10:55:44 -0700111 main.CLIs[0].setCfg( "org.onosproject.provider.nil.NullProviders", "topoShape linear" )
112 main.CLIs[0].setCfg( "org.onosproject.provider.nil.NullProviders", "enabled true" )
YPZhange6ef82a2016-07-05 16:48:15 -0700113 if main.flowObj:
YPZhangcbc2a062016-07-11 10:55:44 -0700114 main.CLIs[0].setCfg("org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator",
115 "useFlowObjectives", value="true")
You Wang106d0fa2017-05-15 17:22:15 -0700116 main.CLIs[0].setCfg("org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator",
117 "defaultFlowObjectiveCompiler",
118 value='org.onosproject.net.intent.impl.compiler.LinkCollectionIntentObjectiveCompiler')
YPZhangcbc2a062016-07-11 10:55:44 -0700119 time.sleep( main.startUpSleep )
cameron@onlab.useae03dc2015-07-29 11:51:28 -0700120
YPZhangcbc2a062016-07-11 10:55:44 -0700121 # balanceMasters
122 main.CLIs[0].balanceMasters()
123 time.sleep( main.startUpSleep )
cameron@onlab.usaaecfd72015-07-08 12:27:26 -0700124
YPZhangcbc2a062016-07-11 10:55:44 -0700125 def CASE2(self, main):
jenkins3af0cd82015-03-24 10:27:16 -0700126 import numpy
cameron@onlab.usc10e22c2015-05-13 13:07:28 -0700127
YPZhangcbc2a062016-07-11 10:55:44 -0700128 main.log.info( "Cluster Count = " + str( main.numCtrls ) )
129 # adjust neighbors
130 if main.numCtrls == 1:
131 main.neighbors = "0"
132 main.log.info( "Neighbors: 0" )
133 elif main.neighbors != "0":
134 main.neighbors = "0"
135 main.log.info( "Neighbors: 0" )
136 elif main.neighbors == "0":
137 main.neighbors = str( main.numCtrls - 1 )
138 main.log.info( "Neighbors: " + main.neighbors )
cameron@onlab.usc10e22c2015-05-13 13:07:28 -0700139
YPZhangcbc2a062016-07-11 10:55:44 -0700140 main.log.info( "Config intent-perf app" )
141 main.CLIs[0].setCfg( "org.onosproject.intentperf.IntentPerfInstaller", "numKeys " + main.numKeys )
142 main.CLIs[0].setCfg( "org.onosproject.intentperf.IntentPerfInstaller", "numNeighbors " + str( main.neighbors ) )
143 main.CLIs[0].setCfg( "org.onosproject.intentperf.IntentPerfInstaller", "cyclePeriod " + main.cyclePeriod )
cameron@onlab.usc10e22c2015-05-13 13:07:28 -0700144
Devin Lim58046fa2017-07-05 16:55:00 -0700145 main.log.info( "Starting intent-perf test for " + str( main.testDuration) + " seconds..." )
YPZhangcbc2a062016-07-11 10:55:44 -0700146 main.CLIs[0].sendline( "intent-perf-start" )
147 stop = time.time() + float( main.testDuration )
andrew@onlab.us10332202015-03-11 15:04:43 -0700148
YPZhangcbc2a062016-07-11 10:55:44 -0700149 while time.time() < stop:
150 time.sleep(15)
151 result = main.CLIs[0].getIntentPerfSummary()
152 if result:
Devin Lim58046fa2017-07-05 16:55:00 -0700153 for i in range( main.numCtrls ):
154 main.log.info( "Node {} Overall Rate: {}".format( main.ONOSip[ i ], result[ main.ONOSip[ i ] ] ) )
YPZhangcbc2a062016-07-11 10:55:44 -0700155 main.log.info( "Stop intent-perf" )
Devin Lim58046fa2017-07-05 16:55:00 -0700156 for i in range( main.numCtrls ):
157 main.CLIs[i].sendline( "intent-perf-stop" )
YPZhangcbc2a062016-07-11 10:55:44 -0700158 if result:
Devin Lim58046fa2017-07-05 16:55:00 -0700159 for i in range( main.numCtrls ):
160 main.log.info( "Node {} final Overall Rate: {}".format( main.ONOSip[ i ], result[ main.ONOSip[ i ] ] ) )
andrew@onlab.us2ae3a112015-02-02 11:24:32 -0800161
YPZhangcbc2a062016-07-11 10:55:44 -0700162 with open( main.dbFileName, "a" ) as resultDB:
Devin Lim58046fa2017-07-05 16:55:00 -0700163 for nodes in range( main.numCtrls ):
YPZhangcbc2a062016-07-11 10:55:44 -0700164 resultString = "'" + main.commit + "',"
165 resultString += "'1gig',"
Devin Lim58046fa2017-07-05 16:55:00 -0700166 resultString += str( main.numCtrls) + ","
YPZhangcbc2a062016-07-11 10:55:44 -0700167 resultString += "'baremetal" + str( nodes+1 ) + "',"
168 resultString += main.neighbors + ","
169 resultString += result[ main.ONOSip[ nodes ] ]+","
170 resultString += str(0) + "\n" # no stddev
171 resultDB.write( resultString )
172 resultDB.close()