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