Jeremy Ronquillo | b27ce4c | 2017-07-17 12:41:28 -0700 | [diff] [blame] | 1 | """ |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 2 | Copyright 2015 Open Networking Foundation ( ONF ) |
Jeremy Ronquillo | b27ce4c | 2017-07-17 12:41:28 -0700 | [diff] [blame] | 3 | |
| 4 | Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>, |
| 5 | the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>, |
| 6 | or 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 Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 11 | ( at your option ) any later version. |
Jeremy Ronquillo | b27ce4c | 2017-07-17 12:41:28 -0700 | [diff] [blame] | 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 | """ |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 21 | """ |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 22 | SCPFintentEventTp |
| 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.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 26 | |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 27 | yunpeng@onlab.us |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 28 | """ |
cameron@onlab.us | aaecfd7 | 2015-07-08 12:27:26 -0700 | [diff] [blame] | 29 | import time |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 30 | |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 31 | |
suibin | 7f2c9cd | 2015-07-08 17:34:59 -0700 | [diff] [blame] | 32 | class SCPFintentEventTp: |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 33 | |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 34 | def __init__( self ): |
| 35 | self.default = '' |
| 36 | |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 37 | def CASE0( self, main ): |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 38 | """ |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 39 | - 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 Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 46 | """ |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 47 | 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 Lim | 4407596 | 2017-08-11 10:56:37 -0700 | [diff] [blame] | 52 | main.cleanAndExit() |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 53 | main.testSetUp.envSetupDescription() |
| 54 | stepResult = main.FALSE |
| 55 | try: |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 56 | main.cellName = main.params[ 'ENV' ][ 'cellName' ] |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 57 | 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 Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 61 | main.skipRelRsrc = main.params[ 'TEST' ][ 'skipReleaseResourcesOnWithdrawal' ] |
| 62 | main.flowObj = main.params[ 'TEST' ][ 'flowObj' ] |
| 63 | main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] ) |
| 64 | main.installSleep = int( main.params[ 'SLEEP' ][ 'install' ] ) |
| 65 | main.verifySleep = int( main.params[ 'SLEEP' ][ 'verify' ] ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 66 | main.scale = ( main.params[ 'SCALE' ] ).split( "," ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 67 | main.testDuration = main.params[ 'TEST' ][ 'duration' ] |
| 68 | main.logInterval = main.params[ 'TEST' ][ 'log_interval' ] |
| 69 | main.debug = main.params[ 'debugMode' ] |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 70 | main.intentManagerCfg = main.params[ 'CFG' ][ 'intentManager' ] |
| 71 | main.intentConfigRegiCfg = main.params[ 'CFG' ][ 'intentConfigRegi' ] |
| 72 | main.nullProviderCfg = main.params[ 'CFG' ][ 'nullProvider' ] |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 73 | main.intentPerfInstallerCfg = main.params[ 'CFG' ][ 'intentPerfInstaller' ] |
Devin Lim | 9ef93e1 | 2017-08-07 17:01:46 -0700 | [diff] [blame] | 74 | main.neighbor = ( main.params[ 'TEST' ][ 'neighbors' ] ).split( "," ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 75 | main.timeout = int( main.params[ 'SLEEP' ][ 'timeout' ] ) |
| 76 | main.cyclePeriod = main.params[ 'TEST' ][ 'cyclePeriod' ] |
| 77 | if main.flowObj == "True": |
| 78 | main.flowObj = True |
| 79 | main.dbFileName = main.params[ 'DATABASE' ][ 'dbFlowObj' ] |
| 80 | main.numKeys = main.params[ 'TEST' ][ 'numKeysFlowObj' ] |
| 81 | else: |
| 82 | main.flowObj = False |
| 83 | main.dbFileName = main.params[ 'DATABASE' ][ 'dbName' ] |
| 84 | main.numKeys = main.params[ 'TEST' ][ 'numKeys' ] |
cameron@onlab.us | c10e22c | 2015-05-13 13:07:28 -0700 | [diff] [blame] | 85 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 86 | stepResult = main.testSetUp.envSetup() |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 87 | # Create DataBase file |
| 88 | main.log.info( "Create Database file " + main.dbFileName ) |
| 89 | resultsDB = open( main.dbFileName, "w+" ) |
| 90 | resultsDB.close() |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 91 | except Exception as e: |
| 92 | main.testSetUp.envSetupException( e ) |
Jon Hall | aa1d9b8 | 2020-07-30 13:49:42 -0700 | [diff] [blame] | 93 | main.testSetUp.envSetupConclusion( stepResult ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 94 | main.commit = main.commit.split( " " )[ 1 ] |
cameron@onlab.us | 412e956 | 2015-05-13 16:04:34 -0700 | [diff] [blame] | 95 | |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 96 | def CASE1( self, main ): |
| 97 | # Clean up test environment and set up |
| 98 | import time |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 99 | main.maxNumBatch = 0 |
You Wang | a0f6ff6 | 2018-01-11 15:46:30 -0800 | [diff] [blame] | 100 | main.testSetUp.ONOSSetUp( main.Cluster, True, |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 101 | cellName=main.cellName, killRemoveMax=False ) |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 102 | # config apps |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 103 | main.Cluster.active( 0 ).CLI.setCfg( main.intentManagerCfg, |
| 104 | "skipReleaseResourcesOnWithdrawal " + main.skipRelRsrc ) |
| 105 | main.Cluster.active( 0 ).CLI.setCfg( main.nullProviderCfg, |
| 106 | "deviceCount " + str( int( main.Cluster.numCtrls * 10 ) ) ) |
| 107 | main.Cluster.active( 0 ).CLI.setCfg( main.nullProviderCfg, "topoShape linear" ) |
| 108 | main.Cluster.active( 0 ).CLI.setCfg( main.nullProviderCfg, "enabled true" ) |
YPZhang | e6ef82a | 2016-07-05 16:48:15 -0700 | [diff] [blame] | 109 | if main.flowObj: |
Devin Lim | 6301b74 | 2017-08-07 11:00:21 -0700 | [diff] [blame] | 110 | main.Cluster.active( 0 ).CLI.setCfg( main.intentConfigRegiCfg, |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 111 | "useFlowObjectives", value="true" ) |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 112 | time.sleep( main.startUpSleep ) |
cameron@onlab.us | eae03dc | 2015-07-29 11:51:28 -0700 | [diff] [blame] | 113 | |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 114 | # balanceMasters |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 115 | main.Cluster.active( 0 ).CLI.balanceMasters() |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 116 | time.sleep( main.startUpSleep ) |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 117 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 118 | def CASE2( self, main ): |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 119 | import numpy |
You Wang | f085421 | 2018-08-22 14:31:54 -0700 | [diff] [blame] | 120 | # If we activate intentperf from the cell, there's chance that it doesn't get all cluster |
| 121 | # nodes when some of the nodes have a large startup delay |
| 122 | main.log.info( "Activate intentperf app" ) |
| 123 | main.Cluster.active( 0 ).CLI.app( "intentperf", "activate" ) |
| 124 | time.sleep( 5 ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 125 | main.log.info( "Cluster Count = " + str( main.Cluster.numCtrls ) ) |
Devin Lim | 9ef93e1 | 2017-08-07 17:01:46 -0700 | [diff] [blame] | 126 | neighbors = '0' if main.neighbor.pop( 0 ) == '0' else str( main.Cluster.numCtrls - 1 ) |
| 127 | main.log.info( "Neighbors: " + neighbors ) |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 128 | main.log.info( "Config intent-perf app" ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 129 | main.Cluster.active( 0 ).CLI.setCfg( main.intentPerfInstallerCfg, |
| 130 | "numKeys " + main.numKeys ) |
| 131 | main.Cluster.active( 0 ).CLI.setCfg( main.intentPerfInstallerCfg, |
Devin Lim | 9ef93e1 | 2017-08-07 17:01:46 -0700 | [diff] [blame] | 132 | "numNeighbors " + neighbors ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 133 | main.Cluster.active( 0 ).CLI.setCfg( main.intentPerfInstallerCfg, |
| 134 | "cyclePeriod " + main.cyclePeriod ) |
cameron@onlab.us | c10e22c | 2015-05-13 13:07:28 -0700 | [diff] [blame] | 135 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 136 | main.log.info( "Starting intent-perf test for " + str( main.testDuration ) + " seconds..." ) |
| 137 | main.Cluster.active( 0 ).CLI.sendline( "intent-perf-start" ) |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 138 | stop = time.time() + float( main.testDuration ) |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 139 | |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 140 | while time.time() < stop: |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 141 | time.sleep( 15 ) |
| 142 | result = main.Cluster.active( 0 ).CLI.getIntentPerfSummary() |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 143 | if result: |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 144 | for ctrl in main.Cluster.active(): |
| 145 | main.log.info( "Node {} Overall Rate: {}".format( ctrl.ipAddress, |
| 146 | result[ ctrl.ipAddress ] ) ) |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 147 | main.log.info( "Stop intent-perf" ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 148 | for ctrl in main.Cluster.active(): |
| 149 | ctrl.CLI.sendline( "intent-perf-stop" ) |
You Wang | aa7bc72 | 2019-02-21 17:55:39 -0800 | [diff] [blame] | 150 | tp = 0.0 |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 151 | if result: |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 152 | for ctrl in main.Cluster.active(): |
| 153 | main.log.info( "Node {} final Overall Rate: {}".format( ctrl.ipAddress, |
| 154 | result[ ctrl.ipAddress ] ) ) |
You Wang | aa7bc72 | 2019-02-21 17:55:39 -0800 | [diff] [blame] | 155 | tp += float( result[ ctrl.ipAddress ] ) |
| 156 | |
| 157 | # Check if throughput result is abnormal |
| 158 | if main.flowObj: |
| 159 | threshold = float( main.params[ 'ALARM' ][ 'minTpFlowObj' ].split( ',' )[ main.cycle - 1 ] ) |
| 160 | else: |
| 161 | threshold = float( main.params[ 'ALARM' ][ 'minTp' ].split( ',' )[ main.cycle - 1 ] ) |
| 162 | if tp < threshold: |
| 163 | main.log.alarm( "{}-node with {} neighbor: {}/s < {}/s".format( main.Cluster.numCtrls, |
| 164 | neighbors, tp, threshold ) ) |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 165 | |
You Wang | 025ddcd | 2019-03-21 12:16:56 -0700 | [diff] [blame] | 166 | if result: |
| 167 | with open( main.dbFileName, "a" ) as resultDB: |
| 168 | for nodes in range( main.Cluster.numCtrls ): |
| 169 | resultString = "'" + main.commit + "'," |
| 170 | resultString += "'1gig'," |
| 171 | resultString += str( main.Cluster.numCtrls ) + "," |
| 172 | resultString += "'baremetal" + str(nodes + 1) + "'," |
| 173 | resultString += neighbors + "," |
| 174 | resultString += result[ main.Cluster.active( nodes ).ipAddress ] + "," |
| 175 | resultString += str( 0 ) + "\n" # no stddev |
| 176 | resultDB.write( resultString ) |
| 177 | resultDB.close() |