Jeremy Ronquillo | b27ce4c | 2017-07-17 12:41:28 -0700 | [diff] [blame] | 1 | """ |
| 2 | Copyright 2015 Open Networking Foundation (ONF) |
| 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 |
| 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 | |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 22 | ''' |
| 23 | SCPFintentEventTp |
| 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.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 27 | |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 28 | yunpeng@onlab.us |
| 29 | ''' |
| 30 | |
cameron@onlab.us | aaecfd7 | 2015-07-08 12:27:26 -0700 | [diff] [blame] | 31 | import time |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 32 | |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 33 | |
suibin | 7f2c9cd | 2015-07-08 17:34:59 -0700 | [diff] [blame] | 34 | class SCPFintentEventTp: |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 35 | def __init__( self ): |
| 36 | self.default = '' |
| 37 | |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 38 | 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 Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 48 | 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.us | c10e22c | 2015-05-13 13:07:28 -0700 | [diff] [blame] | 83 | |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 84 | 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.us | aaecfd7 | 2015-07-08 12:27:26 -0700 | [diff] [blame] | 89 | |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 90 | # 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.us | 412e956 | 2015-05-13 16:04:34 -0700 | [diff] [blame] | 96 | |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 97 | def CASE1( self, main ): |
| 98 | # Clean up test environment and set up |
| 99 | import time |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 100 | main.maxNumBatch = 0 |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 101 | 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.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 106 | |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 107 | # config apps |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 108 | main.CLIs[0].setCfg( "org.onosproject.net.intent.impl.IntentManager", |
| 109 | "skipReleaseResourcesOnWithdrawal " + main.skipRelRsrc ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 110 | main.CLIs[0].setCfg( "org.onosproject.provider.nil.NullProviders", "deviceCount " + str(int( main.numCtrls*10)) ) |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 111 | main.CLIs[0].setCfg( "org.onosproject.provider.nil.NullProviders", "topoShape linear" ) |
| 112 | main.CLIs[0].setCfg( "org.onosproject.provider.nil.NullProviders", "enabled true" ) |
YPZhang | e6ef82a | 2016-07-05 16:48:15 -0700 | [diff] [blame] | 113 | if main.flowObj: |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 114 | main.CLIs[0].setCfg("org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator", |
| 115 | "useFlowObjectives", value="true") |
You Wang | 106d0fa | 2017-05-15 17:22:15 -0700 | [diff] [blame] | 116 | main.CLIs[0].setCfg("org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator", |
| 117 | "defaultFlowObjectiveCompiler", |
| 118 | value='org.onosproject.net.intent.impl.compiler.LinkCollectionIntentObjectiveCompiler') |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 119 | time.sleep( main.startUpSleep ) |
cameron@onlab.us | eae03dc | 2015-07-29 11:51:28 -0700 | [diff] [blame] | 120 | |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 121 | # balanceMasters |
| 122 | main.CLIs[0].balanceMasters() |
| 123 | time.sleep( main.startUpSleep ) |
cameron@onlab.us | aaecfd7 | 2015-07-08 12:27:26 -0700 | [diff] [blame] | 124 | |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 125 | def CASE2(self, main): |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 126 | import numpy |
cameron@onlab.us | c10e22c | 2015-05-13 13:07:28 -0700 | [diff] [blame] | 127 | |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 128 | 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.us | c10e22c | 2015-05-13 13:07:28 -0700 | [diff] [blame] | 139 | |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 140 | 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.us | c10e22c | 2015-05-13 13:07:28 -0700 | [diff] [blame] | 144 | |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 145 | main.log.info( "Starting intent-perf test for " + str( main.testDuration) + " seconds..." ) |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 146 | main.CLIs[0].sendline( "intent-perf-start" ) |
| 147 | stop = time.time() + float( main.testDuration ) |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 148 | |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 149 | while time.time() < stop: |
| 150 | time.sleep(15) |
| 151 | result = main.CLIs[0].getIntentPerfSummary() |
| 152 | if result: |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 153 | for i in range( main.numCtrls ): |
| 154 | main.log.info( "Node {} Overall Rate: {}".format( main.ONOSip[ i ], result[ main.ONOSip[ i ] ] ) ) |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 155 | main.log.info( "Stop intent-perf" ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 156 | for i in range( main.numCtrls ): |
| 157 | main.CLIs[i].sendline( "intent-perf-stop" ) |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 158 | if result: |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 159 | for i in range( main.numCtrls ): |
| 160 | main.log.info( "Node {} final Overall Rate: {}".format( main.ONOSip[ i ], result[ main.ONOSip[ i ] ] ) ) |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 161 | |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 162 | with open( main.dbFileName, "a" ) as resultDB: |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 163 | for nodes in range( main.numCtrls ): |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 164 | resultString = "'" + main.commit + "'," |
| 165 | resultString += "'1gig'," |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 166 | resultString += str( main.numCtrls) + "," |
YPZhang | cbc2a06 | 2016-07-11 10:55:44 -0700 | [diff] [blame] | 167 | 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() |