blob: 327a60f0e00aee63dd45b1817154e1535830b986 [file] [log] [blame]
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -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 Ronquillo23fb2162017-09-15 14:59:57 -070021"""
YPZhangcbc2a062016-07-11 10:55:44 -070022SCPFintentEventTp
23 - Use intentperf app to generate a lot of intent install and withdraw events
24 - Test will run with 1,3,5,7 nodes, and with all neighbors
25 - Test will run 400 seconds and grep the overall rate from intent-perf summary
andrew@onlab.us2ae3a112015-02-02 11:24:32 -080026
YPZhangcbc2a062016-07-11 10:55:44 -070027 yunpeng@onlab.us
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070028"""
cameron@onlab.usaaecfd72015-07-08 12:27:26 -070029import time
andrew@onlab.us10332202015-03-11 15:04:43 -070030
andrew@onlab.us2ae3a112015-02-02 11:24:32 -080031
suibin7f2c9cd2015-07-08 17:34:59 -070032class SCPFintentEventTp:
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070033
andrew@onlab.us2ae3a112015-02-02 11:24:32 -080034 def __init__( self ):
35 self.default = ''
36
YPZhangcbc2a062016-07-11 10:55:44 -070037 def CASE0( self, main ):
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070038 """
YPZhangcbc2a062016-07-11 10:55:44 -070039 - GIT
40 - BUILDING ONOS
41 Pull specific ONOS branch, then Build ONOS ono ONOS Bench.
42 This step is usually skipped. Because in a Jenkins driven automated
43 test env. We want Jenkins jobs to pull&build for flexibility to handle
44 different versions of ONOS.
45 - Construct tests variables
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070046 """
Devin Lim58046fa2017-07-05 16:55:00 -070047 try:
48 from tests.dependencies.ONOSSetup import ONOSSetup
49 main.testSetUp = ONOSSetup()
50 except ImportError:
51 main.log.error( "ONOSSetup not found. exiting the test" )
Devin Lim44075962017-08-11 10:56:37 -070052 main.cleanAndExit()
Devin Lim58046fa2017-07-05 16:55:00 -070053 main.testSetUp.envSetupDescription()
54 stepResult = main.FALSE
55 try:
Devin Lim142b5342017-07-20 15:22:39 -070056 main.cellName = main.params[ 'ENV' ][ 'cellName' ]
Devin Lim58046fa2017-07-05 16:55:00 -070057 main.apps = main.params[ 'ENV' ][ 'cellApps' ]
58 main.BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
59 main.BENCHUser = main.params[ 'BENCH' ][ 'user' ]
60 main.MN1Ip = main.params[ 'MN' ][ 'ip1' ]
Devin Lim142b5342017-07-20 15:22:39 -070061 main.numSwitches = ( main.params[ 'TEST' ][ 'numSwitches' ] ).split( "," )
Devin Lim58046fa2017-07-05 16:55:00 -070062 main.skipRelRsrc = main.params[ 'TEST' ][ 'skipReleaseResourcesOnWithdrawal' ]
63 main.flowObj = main.params[ 'TEST' ][ 'flowObj' ]
64 main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
65 main.installSleep = int( main.params[ 'SLEEP' ][ 'install' ] )
66 main.verifySleep = int( main.params[ 'SLEEP' ][ 'verify' ] )
Devin Lim142b5342017-07-20 15:22:39 -070067 main.scale = ( main.params[ 'SCALE' ] ).split( "," )
Devin Lim58046fa2017-07-05 16:55:00 -070068 main.testDuration = main.params[ 'TEST' ][ 'duration' ]
69 main.logInterval = main.params[ 'TEST' ][ 'log_interval' ]
70 main.debug = main.params[ 'debugMode' ]
Devin Lim142b5342017-07-20 15:22:39 -070071 main.intentManagerCfg = main.params[ 'CFG' ][ 'intentManager' ]
72 main.intentConfigRegiCfg = main.params[ 'CFG' ][ 'intentConfigRegi' ]
73 main.nullProviderCfg = main.params[ 'CFG' ][ 'nullProvider' ]
Devin Lim142b5342017-07-20 15:22:39 -070074 main.intentPerfInstallerCfg = main.params[ 'CFG' ][ 'intentPerfInstaller' ]
Devin Lim9ef93e12017-08-07 17:01:46 -070075 main.neighbor = ( main.params[ 'TEST' ][ 'neighbors' ] ).split( "," )
Devin Lim58046fa2017-07-05 16:55:00 -070076 main.timeout = int( main.params[ 'SLEEP' ][ 'timeout' ] )
77 main.cyclePeriod = main.params[ 'TEST' ][ 'cyclePeriod' ]
78 if main.flowObj == "True":
79 main.flowObj = True
80 main.dbFileName = main.params[ 'DATABASE' ][ 'dbFlowObj' ]
81 main.numKeys = main.params[ 'TEST' ][ 'numKeysFlowObj' ]
82 else:
83 main.flowObj = False
84 main.dbFileName = main.params[ 'DATABASE' ][ 'dbName' ]
85 main.numKeys = main.params[ 'TEST' ][ 'numKeys' ]
cameron@onlab.usc10e22c2015-05-13 13:07:28 -070086
Devin Lim142b5342017-07-20 15:22:39 -070087 stepResult = main.testSetUp.envSetup()
Devin Lim58046fa2017-07-05 16:55:00 -070088 # Create DataBase file
89 main.log.info( "Create Database file " + main.dbFileName )
90 resultsDB = open( main.dbFileName, "w+" )
91 resultsDB.close()
Devin Lim58046fa2017-07-05 16:55:00 -070092 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
You Wanga0f6ff62018-01-11 15:46:30 -0800101 main.testSetUp.ONOSSetUp( main.Cluster, True,
Devin Lim142b5342017-07-20 15:22:39 -0700102 cellName=main.cellName, killRemoveMax=False )
YPZhangcbc2a062016-07-11 10:55:44 -0700103 # config apps
Devin Lim142b5342017-07-20 15:22:39 -0700104 main.Cluster.active( 0 ).CLI.setCfg( main.intentManagerCfg,
105 "skipReleaseResourcesOnWithdrawal " + main.skipRelRsrc )
106 main.Cluster.active( 0 ).CLI.setCfg( main.nullProviderCfg,
107 "deviceCount " + str( int( main.Cluster.numCtrls * 10 ) ) )
108 main.Cluster.active( 0 ).CLI.setCfg( main.nullProviderCfg, "topoShape linear" )
109 main.Cluster.active( 0 ).CLI.setCfg( main.nullProviderCfg, "enabled true" )
YPZhange6ef82a2016-07-05 16:48:15 -0700110 if main.flowObj:
Devin Lim6301b742017-08-07 11:00:21 -0700111 main.Cluster.active( 0 ).CLI.setCfg( main.intentConfigRegiCfg,
Devin Lim142b5342017-07-20 15:22:39 -0700112 "useFlowObjectives", value="true" )
YPZhangcbc2a062016-07-11 10:55:44 -0700113 time.sleep( main.startUpSleep )
cameron@onlab.useae03dc2015-07-29 11:51:28 -0700114
YPZhangcbc2a062016-07-11 10:55:44 -0700115 # balanceMasters
Devin Lim142b5342017-07-20 15:22:39 -0700116 main.Cluster.active( 0 ).CLI.balanceMasters()
YPZhangcbc2a062016-07-11 10:55:44 -0700117 time.sleep( main.startUpSleep )
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700118
Devin Lim142b5342017-07-20 15:22:39 -0700119 def CASE2( self, main ):
jenkins3af0cd82015-03-24 10:27:16 -0700120 import numpy
You Wangf0854212018-08-22 14:31:54 -0700121 # If we activate intentperf from the cell, there's chance that it doesn't get all cluster
122 # nodes when some of the nodes have a large startup delay
123 main.log.info( "Activate intentperf app" )
124 main.Cluster.active( 0 ).CLI.app( "intentperf", "activate" )
125 time.sleep( 5 )
Devin Lim142b5342017-07-20 15:22:39 -0700126 main.log.info( "Cluster Count = " + str( main.Cluster.numCtrls ) )
Devin Lim9ef93e12017-08-07 17:01:46 -0700127 neighbors = '0' if main.neighbor.pop( 0 ) == '0' else str( main.Cluster.numCtrls - 1 )
128 main.log.info( "Neighbors: " + neighbors )
YPZhangcbc2a062016-07-11 10:55:44 -0700129 main.log.info( "Config intent-perf app" )
Devin Lim142b5342017-07-20 15:22:39 -0700130 main.Cluster.active( 0 ).CLI.setCfg( main.intentPerfInstallerCfg,
131 "numKeys " + main.numKeys )
132 main.Cluster.active( 0 ).CLI.setCfg( main.intentPerfInstallerCfg,
Devin Lim9ef93e12017-08-07 17:01:46 -0700133 "numNeighbors " + neighbors )
Devin Lim142b5342017-07-20 15:22:39 -0700134 main.Cluster.active( 0 ).CLI.setCfg( main.intentPerfInstallerCfg,
135 "cyclePeriod " + main.cyclePeriod )
cameron@onlab.usc10e22c2015-05-13 13:07:28 -0700136
Devin Lim142b5342017-07-20 15:22:39 -0700137 main.log.info( "Starting intent-perf test for " + str( main.testDuration ) + " seconds..." )
138 main.Cluster.active( 0 ).CLI.sendline( "intent-perf-start" )
YPZhangcbc2a062016-07-11 10:55:44 -0700139 stop = time.time() + float( main.testDuration )
andrew@onlab.us10332202015-03-11 15:04:43 -0700140
YPZhangcbc2a062016-07-11 10:55:44 -0700141 while time.time() < stop:
Devin Lim142b5342017-07-20 15:22:39 -0700142 time.sleep( 15 )
143 result = main.Cluster.active( 0 ).CLI.getIntentPerfSummary()
YPZhangcbc2a062016-07-11 10:55:44 -0700144 if result:
Devin Lim142b5342017-07-20 15:22:39 -0700145 for ctrl in main.Cluster.active():
146 main.log.info( "Node {} Overall Rate: {}".format( ctrl.ipAddress,
147 result[ ctrl.ipAddress ] ) )
YPZhangcbc2a062016-07-11 10:55:44 -0700148 main.log.info( "Stop intent-perf" )
Devin Lim142b5342017-07-20 15:22:39 -0700149 for ctrl in main.Cluster.active():
150 ctrl.CLI.sendline( "intent-perf-stop" )
YPZhangcbc2a062016-07-11 10:55:44 -0700151 if result:
Devin Lim142b5342017-07-20 15:22:39 -0700152 for ctrl in main.Cluster.active():
153 main.log.info( "Node {} final Overall Rate: {}".format( ctrl.ipAddress,
154 result[ ctrl.ipAddress ] ) )
andrew@onlab.us2ae3a112015-02-02 11:24:32 -0800155
YPZhangcbc2a062016-07-11 10:55:44 -0700156 with open( main.dbFileName, "a" ) as resultDB:
Devin Lim142b5342017-07-20 15:22:39 -0700157 for nodes in range( main.Cluster.numCtrls ):
YPZhangcbc2a062016-07-11 10:55:44 -0700158 resultString = "'" + main.commit + "',"
159 resultString += "'1gig',"
Devin Lim142b5342017-07-20 15:22:39 -0700160 resultString += str( main.Cluster.numCtrls ) + ","
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700161 resultString += "'baremetal" + str(nodes + 1) + "',"
Devin Lim9ef93e12017-08-07 17:01:46 -0700162 resultString += neighbors + ","
Devin Lim142b5342017-07-20 15:22:39 -0700163 resultString += result[ main.Cluster.active( nodes ).ipAddress ] + ","
164 resultString += str( 0 ) + "\n" # no stddev
YPZhangcbc2a062016-07-11 10:55:44 -0700165 resultDB.write( resultString )
166 resultDB.close()