cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 1 | # ScaleOutTemplate |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 2 | # |
| 3 | # CASE1 starts number of nodes specified in param file |
| 4 | # |
| 5 | # cameron@onlab.us |
| 6 | |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 7 | import sys |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 8 | import os.path |
cameron@onlab.us | aaecfd7 | 2015-07-08 12:27:26 -0700 | [diff] [blame] | 9 | import time |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 10 | |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 11 | |
suibin | 7f2c9cd | 2015-07-08 17:34:59 -0700 | [diff] [blame] | 12 | class SCPFintentEventTp: |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 13 | |
| 14 | def __init__( self ): |
| 15 | self.default = '' |
| 16 | |
cameron@onlab.us | aaecfd7 | 2015-07-08 12:27:26 -0700 | [diff] [blame] | 17 | def CASE1( self, main ): |
| 18 | import sys |
cameron@onlab.us | c10e22c | 2015-05-13 13:07:28 -0700 | [diff] [blame] | 19 | import os.path |
cameron@onlab.us | aaecfd7 | 2015-07-08 12:27:26 -0700 | [diff] [blame] | 20 | import time |
cameron@onlab.us | c10e22c | 2015-05-13 13:07:28 -0700 | [diff] [blame] | 21 | |
cameron@onlab.us | aaecfd7 | 2015-07-08 12:27:26 -0700 | [diff] [blame] | 22 | global init |
| 23 | try: |
| 24 | if type(init) is not bool: |
GlennRC | f9ef27d | 2015-09-16 12:08:38 -0700 | [diff] [blame] | 25 | init = False |
cameron@onlab.us | aaecfd7 | 2015-07-08 12:27:26 -0700 | [diff] [blame] | 26 | except NameError: |
| 27 | init = False |
| 28 | |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 29 | #Load values from params file |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 30 | checkoutBranch = main.params[ 'GIT' ][ 'checkout' ] |
| 31 | gitPull = main.params[ 'GIT' ][ 'autopull' ] |
| 32 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 33 | Apps = main.params[ 'ENV' ][ 'cellApps' ] |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 34 | BENCHIp = main.params[ 'BENCH' ][ 'ip1' ] |
| 35 | BENCHUser = main.params[ 'BENCH' ][ 'user' ] |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 36 | MN1Ip = main.params[ 'MN' ][ 'ip1' ] |
cameron@onlab.us | c5bf819 | 2015-07-13 13:36:05 -0700 | [diff] [blame] | 37 | maxNodes = int(main.params[ 'max' ]) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 38 | main.maxNodes = maxNodes |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 39 | skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ] |
cameron@onlab.us | aaecfd7 | 2015-07-08 12:27:26 -0700 | [diff] [blame] | 40 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 41 | numSwitches = (main.params[ 'TEST' ][ 'numSwitches' ]).split(",") |
cameron@onlab.us | cd4e8a2 | 2015-05-11 10:58:43 -0700 | [diff] [blame] | 42 | flowRuleBU = main.params[ 'TEST' ][ 'flowRuleBUEnabled' ] |
suibin zhang | d1f0380 | 2016-02-25 11:48:58 -0800 | [diff] [blame] | 43 | skipRelRsrc = main.params[ 'TEST'][ 'skipReleaseResourcesOnWithdrawal'] |
cameron@onlab.us | c10e22c | 2015-05-13 13:07:28 -0700 | [diff] [blame] | 44 | homeDir = os.path.expanduser('~') |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 45 | |
cameron@onlab.us | 412e956 | 2015-05-13 16:04:34 -0700 | [diff] [blame] | 46 | main.exceptions = [0]*11 |
| 47 | main.warnings = [0]*11 |
| 48 | main.errors = [0]*11 |
| 49 | |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 50 | # -- INIT SECTION, ONLY RUNS ONCE -- # |
| 51 | if init == False: |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 52 | init = True |
| 53 | global clusterCount #number of nodes running |
| 54 | global ONOSIp #list of ONOS IP addresses |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 55 | global scale |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 56 | global commit |
cameron@onlab.us | c10e22c | 2015-05-13 13:07:28 -0700 | [diff] [blame] | 57 | |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 58 | clusterCount = 0 |
cameron@onlab.us | c5bf819 | 2015-07-13 13:36:05 -0700 | [diff] [blame] | 59 | ONOSIp = main.ONOSbench.getOnosIps() |
| 60 | print ONOSIp |
| 61 | print main.ONOSbench.onosIps.values() |
| 62 | |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 63 | scale = (main.params[ 'SCALE' ]).split(",") |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 64 | clusterCount = int(scale[0]) |
| 65 | |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 66 | #Populate ONOSIp with ips from params |
jenkins | 15b2b13 | 2015-06-23 14:04:09 -0700 | [diff] [blame] | 67 | ONOSIp.extend(main.ONOSbench.getOnosIps()) |
jenkins | 15b2b13 | 2015-06-23 14:04:09 -0700 | [diff] [blame] | 68 | |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 69 | #mvn clean install, for debugging set param 'skipCleanInstall' to yes to speed up test |
| 70 | if skipMvn != "yes": |
| 71 | mvnResult = main.ONOSbench.cleanInstall() |
| 72 | |
| 73 | #git |
| 74 | main.step( "Git checkout and pull " + checkoutBranch ) |
| 75 | if gitPull == 'on': |
| 76 | checkoutResult = main.ONOSbench.gitCheckout( checkoutBranch ) |
| 77 | pullResult = main.ONOSbench.gitPull() |
| 78 | |
| 79 | else: |
| 80 | checkoutResult = main.TRUE |
| 81 | pullResult = main.TRUE |
| 82 | main.log.info( "Skipped git checkout and pull" ) |
cameron@onlab.us | c5bf819 | 2015-07-13 13:36:05 -0700 | [diff] [blame] | 83 | |
Jon Hall | 6509dbf | 2016-06-21 17:01:17 -0700 | [diff] [blame] | 84 | main.step("Grabbing commit number") |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 85 | commit = main.ONOSbench.getVersion() |
| 86 | commit = (commit.split(" "))[1] |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 87 | |
Jon Hall | 6509dbf | 2016-06-21 17:01:17 -0700 | [diff] [blame] | 88 | main.step("Creating results file") |
suibin | 584c070 | 2015-07-14 15:57:27 -0700 | [diff] [blame] | 89 | resultsDB = open("/tmp/IntentEventTPDB", "w+") |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 90 | resultsDB.close() |
| 91 | |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 92 | # -- END OF INIT SECTION --# |
cameron@onlab.us | c5bf819 | 2015-07-13 13:36:05 -0700 | [diff] [blame] | 93 | |
Jon Hall | 6509dbf | 2016-06-21 17:01:17 -0700 | [diff] [blame] | 94 | main.step("Adjusting scale") |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 95 | print str(scale) |
cameron@onlab.us | c5bf819 | 2015-07-13 13:36:05 -0700 | [diff] [blame] | 96 | print str(ONOSIp) |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 97 | clusterCount = int(scale[0]) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 98 | scale.remove(scale[0]) |
| 99 | |
jenkins | 5a77199 | 2015-06-24 13:53:27 -0700 | [diff] [blame] | 100 | MN1Ip = ONOSIp[len(ONOSIp) -1] |
| 101 | BENCHIp = ONOSIp[len(ONOSIp) -2] |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 102 | |
| 103 | #kill off all onos processes |
Jon Hall | 6509dbf | 2016-06-21 17:01:17 -0700 | [diff] [blame] | 104 | main.step("Safety check, killing all ONOS processes") |
| 105 | main.step("before initiating environment setup") |
cameron@onlab.us | aaecfd7 | 2015-07-08 12:27:26 -0700 | [diff] [blame] | 106 | for node in range(maxNodes): |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 107 | main.ONOSbench.onosDie(ONOSIp[node]) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 108 | |
jenkins | 8f8f4f3 | 2015-06-24 14:05:04 -0700 | [diff] [blame] | 109 | MN1Ip = ONOSIp[len(ONOSIp) -1] |
| 110 | BENCHIp = ONOSIp[len(ONOSIp) -2] |
| 111 | |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 112 | #Uninstall everywhere |
Jon Hall | 6509dbf | 2016-06-21 17:01:17 -0700 | [diff] [blame] | 113 | main.step( "Cleaning Enviornment..." ) |
cameron@onlab.us | aaecfd7 | 2015-07-08 12:27:26 -0700 | [diff] [blame] | 114 | for i in range(maxNodes): |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 115 | main.log.info(" Uninstalling ONOS " + str(i) ) |
| 116 | main.ONOSbench.onosUninstall( ONOSIp[i] ) |
suibin | e1a104d | 2015-07-08 15:58:29 -0700 | [diff] [blame] | 117 | main.log.info("Sleep 10 second for uninstall to settle...") |
| 118 | time.sleep(10) |
| 119 | main.ONOSbench.handle.sendline(" ") |
| 120 | main.ONOSbench.handle.expect(":~") |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 121 | |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 122 | #construct the cell file |
| 123 | main.log.info("Creating cell file") |
| 124 | cellIp = [] |
cameron@onlab.us | aaecfd7 | 2015-07-08 12:27:26 -0700 | [diff] [blame] | 125 | for node in range (clusterCount): |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 126 | cellIp.append(ONOSIp[node]) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 127 | |
cameron@onlab.us | c5bf819 | 2015-07-13 13:36:05 -0700 | [diff] [blame] | 128 | main.ONOSbench.createCellFile("localhost",cellName,MN1Ip,str(Apps), cellIp) |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 129 | |
| 130 | main.step( "Set Cell" ) |
| 131 | main.ONOSbench.setCell(cellName) |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 132 | |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 133 | myDistribution = [] |
cameron@onlab.us | aaecfd7 | 2015-07-08 12:27:26 -0700 | [diff] [blame] | 134 | for node in range (clusterCount): |
| 135 | myDistribution.append(numSwitches[node]) |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 136 | |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 137 | main.step( "Creating ONOS package" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 138 | packageResult = main.ONOSbench.onosPackage() |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 139 | |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 140 | main.step( "verify cells" ) |
| 141 | verifyCellResult = main.ONOSbench.verifyCell() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 142 | |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 143 | main.log.report( "Initializeing " + str( clusterCount ) + " node cluster." ) |
cameron@onlab.us | aaecfd7 | 2015-07-08 12:27:26 -0700 | [diff] [blame] | 144 | for node in range(clusterCount): |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 145 | main.log.info("Starting ONOS " + str(node) + " at IP: " + ONOSIp[node]) |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 146 | main.ONOSbench.onosInstall( ONOSIp[node]) |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 147 | |
cameron@onlab.us | aaecfd7 | 2015-07-08 12:27:26 -0700 | [diff] [blame] | 148 | for node in range(clusterCount): |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 149 | for i in range( 2 ): |
| 150 | isup = main.ONOSbench.isup( ONOSIp[node] ) |
| 151 | if isup: |
| 152 | main.log.info("ONOS " + str(node) + " is up\n") |
| 153 | break |
| 154 | if not isup: |
| 155 | main.log.report( "ONOS " + str(node) + " didn't start!" ) |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 156 | main.log.info("Startup sequence complete") |
| 157 | |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 158 | time.sleep(20) |
| 159 | |
YPZhang | f1153fb | 2016-04-26 10:58:56 -0700 | [diff] [blame] | 160 | main.ONOSbench.onosCfgSet( ONOSIp[0], "org.onosproject.store.flow.impl.DistributedFlowRuleStore", "backupEnabled " + str(flowRuleBU)) |
suibin zhang | d1f0380 | 2016-02-25 11:48:58 -0800 | [diff] [blame] | 161 | main.ONOSbench.onosCfgSet( ONOSIp[0], "org.onosproject.net.intent.impl.IntentManager", "skipReleaseResourcesOnWithdrawal " + skipRelRsrc) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 162 | devices = int(clusterCount)*10 |
cameron@onlab.us | eae03dc | 2015-07-29 11:51:28 -0700 | [diff] [blame] | 163 | |
Jon Hall | 6509dbf | 2016-06-21 17:01:17 -0700 | [diff] [blame] | 164 | main.step("Setting up null provider") |
cameron@onlab.us | aaecfd7 | 2015-07-08 12:27:26 -0700 | [diff] [blame] | 165 | for i in range(3): |
cameron@onlab.us | eae03dc | 2015-07-29 11:51:28 -0700 | [diff] [blame] | 166 | main.ONOSbench.onosCfgSet( ONOSIp[0], "org.onosproject.provider.nil.NullProviders", "deviceCount " + str(devices)) |
cameron@onlab.us | aaecfd7 | 2015-07-08 12:27:26 -0700 | [diff] [blame] | 167 | main.ONOSbench.onosCfgSet( ONOSIp[0], "org.onosproject.provider.nil.NullProviders", "topoShape linear") |
| 168 | main.ONOSbench.onosCfgSet( ONOSIp[0], "org.onosproject.provider.nil.NullProviders", "enabled true") |
| 169 | time.sleep(5) |
| 170 | |
| 171 | main.ONOSbench.handle.sendline("onos $OC1 summary") |
cameron@onlab.us | f33b45c | 2015-05-06 13:54:46 -0700 | [diff] [blame] | 172 | main.ONOSbench.handle.expect(":~") |
cameron@onlab.us | aaecfd7 | 2015-07-08 12:27:26 -0700 | [diff] [blame] | 173 | |
| 174 | before = main.ONOSbench.handle.before |
cameron@onlab.us | eae03dc | 2015-07-29 11:51:28 -0700 | [diff] [blame] | 175 | if ("devices=" + str(devices)) in before: |
cameron@onlab.us | f33b45c | 2015-05-06 13:54:46 -0700 | [diff] [blame] | 176 | break |
cameron@onlab.us | cd4e8a2 | 2015-05-11 10:58:43 -0700 | [diff] [blame] | 177 | |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 178 | main.ONOSbench.handle.sendline("""onos $OC1 "balance-masters" """) |
| 179 | main.ONOSbench.handle.expect(":~") |
| 180 | print main.ONOSbench.handle.before |
You Wang | 3b148ea | 2016-06-20 20:33:42 -0700 | [diff] [blame] | 181 | time.sleep(5) |
cameron@onlab.us | aaecfd7 | 2015-07-08 12:27:26 -0700 | [diff] [blame] | 182 | |
GlennRC | f9ef27d | 2015-09-16 12:08:38 -0700 | [diff] [blame] | 183 | for i in range(3): |
| 184 | passed = main.ONOSbench.verifySummary( ONOSIp[0] ) |
| 185 | if passed: |
| 186 | main.log.info("Clusters have converged") |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 187 | break |
GlennRC | f9ef27d | 2015-09-16 12:08:38 -0700 | [diff] [blame] | 188 | else: |
| 189 | main.log.error("Clusters have not converged, retying...") |
| 190 | time.sleep(3) |
| 191 | |
jenkins | 5037994 | 2015-06-19 13:36:43 -0700 | [diff] [blame] | 192 | main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"]) |
GlennRC | f9ef27d | 2015-09-16 12:08:38 -0700 | [diff] [blame] | 193 | |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 194 | def CASE2( self, main ): |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 195 | import time |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 196 | import json |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 197 | import string |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 198 | import csv |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 199 | import numpy |
cameron@onlab.us | c10e22c | 2015-05-13 13:07:28 -0700 | [diff] [blame] | 200 | import os.path |
| 201 | |
| 202 | global currentNeighbors |
| 203 | neighbors = [] |
| 204 | |
| 205 | try: |
| 206 | currentNeighbors |
| 207 | except: |
| 208 | currentNeighbors = "0" |
| 209 | neighbors = ['0'] |
| 210 | else: |
| 211 | if currentNeighbors == "r": #reset |
| 212 | currentNeighbors = "a" |
| 213 | neighbors = ['0'] |
| 214 | else: |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 215 | currentNeighbors = "r" |
cameron@onlab.us | c10e22c | 2015-05-13 13:07:28 -0700 | [diff] [blame] | 216 | neighbors = ['a'] |
| 217 | |
| 218 | if clusterCount == 1: |
| 219 | currentNeighbors = "r" |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 220 | |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 221 | main.log.info("Cluster Count = " + str(clusterCount)) |
| 222 | |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 223 | intentsRate = main.params['METRICS']['intents_rate'] |
| 224 | intentsWithdrawn = main.params[ 'METRICS' ][ 'intents_withdrawn' ] |
| 225 | intentsFailed = main.params[ 'METRICS' ][ 'intents_failed' ] |
| 226 | testDuration = main.params[ 'TEST' ][ 'duration' ] |
| 227 | logInterval = main.params[ 'TEST' ][ 'log_interval' ] |
| 228 | debug = main.params[ 'debugMode' ] |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 229 | numKeys = main.params[ 'TEST' ][ 'numKeys' ] |
| 230 | cyclePeriod = main.params[ 'TEST' ][ 'cyclePeriod' ] |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 231 | #neighbors = (main.params[ 'TEST' ][ 'neighbors' ]).split(",") |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 232 | metricList = [intentsRate, intentsWithdrawn, intentsFailed] |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 233 | |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 234 | for n in range(0, len(neighbors)): |
| 235 | if neighbors[n] == 'a': |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 236 | neighbors[n] = str(clusterCount -1) |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 237 | if int(clusterCount) == 1: |
| 238 | neighbors = neighbors.pop() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 239 | |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 240 | for n in neighbors: |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 241 | main.log.info("Run with " + n + " neighbors") |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 242 | time.sleep(5) |
cameron@onlab.us | cd4e8a2 | 2015-05-11 10:58:43 -0700 | [diff] [blame] | 243 | main.ONOSbench.handle.sendline("onos $OC1 cfg set org.onosproject.intentperf.IntentPerfInstaller numKeys " + numKeys ) |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 244 | main.ONOSbench.handle.expect(":~") |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 245 | main.ONOSbench.handle.sendline("onos $OC1 cfg set org.onosproject.intentperf.IntentPerfInstaller numNeighbors " + n ) |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 246 | main.ONOSbench.handle.expect(":~") |
| 247 | main.ONOSbench.handle.sendline("onos $OC1 cfg set org.onosproject.intentperf.IntentPerfInstaller cyclePeriod " + cyclePeriod ) |
| 248 | main.ONOSbench.handle.expect(":~") |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 249 | |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 250 | cmd = "onos $OC1 intent-perf-start" |
| 251 | main.ONOSbench.handle.sendline(cmd) |
| 252 | main.ONOSbench.handle.expect(":~") |
| 253 | main.log.info("Starting ONOS (all nodes) intent-perf from $OC1" ) |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 254 | |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 255 | main.log.info( "Starting test loop for " + str(testDuration) + " seconds...\n" ) |
| 256 | stop = time.time() + float( testDuration ) |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 257 | |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 258 | while time.time() < stop: |
| 259 | time.sleep( float( logInterval ) ) |
| 260 | groupResult = [] |
| 261 | for node in range (1, clusterCount + 1): |
| 262 | groupResult.append(0) |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 263 | |
GlennRC | b077315 | 2015-09-13 21:02:11 -0700 | [diff] [blame] | 264 | cmd = " onos-ssh $OC" + str(node) + """ cat /opt/onos/log/karaf.log | grep "Throughput:" | tail -1 """ |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 265 | main.log.info("COMMAND: " + str(cmd)) |
| 266 | |
| 267 | x = 0 |
| 268 | while True: |
| 269 | main.ONOSbench.handle.sendline(cmd) |
jenkins | 5037994 | 2015-06-19 13:36:43 -0700 | [diff] [blame] | 270 | time.sleep(6) |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 271 | main.ONOSbench.handle.expect(":~") |
| 272 | raw = main.ONOSbench.handle.before |
| 273 | if "OVERALL=" in raw: |
| 274 | break |
| 275 | x += 1 |
| 276 | if x > 10: |
| 277 | main.log.error("Expected output not being recieved... continuing") |
| 278 | break |
| 279 | time.sleep(2) |
| 280 | |
| 281 | raw = raw.splitlines() |
| 282 | splitResults = [] |
| 283 | for line in raw: |
| 284 | splitResults.extend(line.split(" ")) |
| 285 | |
| 286 | myResult = "--" |
| 287 | for field in splitResults: |
| 288 | if "OVERALL" in field: |
| 289 | myResult = field |
| 290 | |
| 291 | if myResult == "--": |
| 292 | main.log.error("Parsing/Pexpect error\n" + str(splitResults)) |
| 293 | |
| 294 | myResult = myResult.replace(";", "") |
| 295 | myResult = myResult.replace("OVERALL=","") |
| 296 | myResult = float(myResult) |
| 297 | groupResult[len(groupResult) -1] = myResult |
| 298 | |
| 299 | main.log.info("Node " + str(node) + " overall rate: " + str(myResult)) |
| 300 | |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 301 | clusterTotal = str(numpy.sum(groupResult)) |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 302 | main.log.report("Results from this round of polling: " + str(groupResult)) |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 303 | main.log.report("Cluster Total: " + clusterTotal + "\n") |
cameron@onlab.us | c10e22c | 2015-05-13 13:07:28 -0700 | [diff] [blame] | 304 | |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 305 | cmd = "onos $OC1 intent-perf-stop" |
| 306 | main.ONOSbench.handle.sendline(cmd) |
| 307 | main.ONOSbench.handle.expect(":~") |
| 308 | main.log.info("Stopping intentperf" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 309 | |
GlennRC | 47736b8 | 2015-09-16 14:27:51 -0700 | [diff] [blame] | 310 | with open("/tmp/IntentEventTPDB", "a") as resultsDB: |
| 311 | for node in groupResult: |
| 312 | resultString = "'" + commit + "'," |
| 313 | resultString += "'1gig'," |
| 314 | resultString += str(clusterCount) + "," |
| 315 | resultString += "'baremetal" + str(int(groupResult.index(node)) + 1) + "'," |
| 316 | resultString += n + "," |
| 317 | resultString += str(node) + "," |
| 318 | resultString += str(0) + "\n" #no stddev |
| 319 | resultsDB.write(resultString) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 320 | |
| 321 | resultsDB.close() |
| 322 | |
| 323 | main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"]) |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 324 | |