blob: 1594345de453ebef25278e492115622c52333e7b [file] [log] [blame]
andrew@onlab.us2ae3a112015-02-02 11:24:32 -08001# ScaleOutTemplate
2#
3# CASE1 starts number of nodes specified in param file
4#
5# cameron@onlab.us
6
7import sys
andrew@onlab.us24e2f002015-03-11 15:06:12 -07008import os.path
andrew@onlab.us2ae3a112015-02-02 11:24:32 -08009
10
11class pushTestIntents:
12
13 def __init__( self ):
14 self.default = ''
15
andrew@onlab.us24e2f002015-03-11 15:06:12 -070016 def CASE1( self, main ): #This is the initialization case
17 #this case will clean up all nodes
18 import time #but only node 1 is started in this case
19
20 global clusterCount #number of nodes running
21 global ONOSIp #list of ONOS IP addresses
andrew@onlab.us2ae3a112015-02-02 11:24:32 -080022 clusterCount = 1
andrew@onlab.us24e2f002015-03-11 15:06:12 -070023 ONOSIp = [ 0 ]
andrew@onlab.us2ae3a112015-02-02 11:24:32 -080024
andrew@onlab.us24e2f002015-03-11 15:06:12 -070025
26 #Load values from params file
andrew@onlab.us2ae3a112015-02-02 11:24:32 -080027 checkoutBranch = main.params[ 'GIT' ][ 'checkout' ]
28 gitPull = main.params[ 'GIT' ][ 'autopull' ]
29 cellName = main.params[ 'ENV' ][ 'cellName' ]
andrew@onlab.us24e2f002015-03-11 15:06:12 -070030 Features= main.params[ 'ENV' ][ 'cellFeatures' ]
andrew@onlab.us2ae3a112015-02-02 11:24:32 -080031 BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
32 BENCHUser = main.params[ 'BENCH' ][ 'user' ]
andrew@onlab.us2ae3a112015-02-02 11:24:32 -080033 MN1Ip = main.params[ 'MN' ][ 'ip1' ]
andrew@onlab.us24e2f002015-03-11 15:06:12 -070034 maxNodes = int(main.params[ 'availableNodes' ])
35 Features = main.params[ 'ENV' ][ 'cellFeatures' ]
36 skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ]
37 switchCount = main.params[ 'TEST' ][ 'switchCount' ]
andrew@onlab.us2ae3a112015-02-02 11:24:32 -080038
andrew@onlab.us24e2f002015-03-11 15:06:12 -070039 #Populate ONOSIp with ips from params
40 for i in range(1, maxNodes + 1):
41 ipString = 'ip' + str(i)
42 ONOSIp.append(main.params[ 'CTRL' ][ ipString ])
43
44 tempIp = []
45 for node in range( 1, clusterCount + 1):
46 tempIp.append(ONOSIp[node])
andrew@onlab.us2ae3a112015-02-02 11:24:32 -080047
andrew@onlab.us24e2f002015-03-11 15:06:12 -070048 #kill off all onos processes
49 main.log.step("Safety check, killing all ONOS processes")
50 main.log.step("before initiating enviornment setup")
51 for node in range(1, maxNodes + 1):
52 main.ONOSbench.onosDie(ONOSIp[node])
53
54 #construct the cell file
55 main.log.info("Creating cell file")
56 exec "a = main.ONOSbench.createCellFile"
57 cellIp = []
58 for node in range (1, clusterCount + 1):
59 cellIp.append(ONOSIp[node])
60 a(BENCHIp,cellName,MN1Ip,str(Features), *cellIp)
61
62 main.step( "Applying cell file to environment" )
63 cellApplyResult = main.ONOSbench.setCell( cellName )
64
65 #Uninstall everywhere
andrew@onlab.us2ae3a112015-02-02 11:24:32 -080066 main.log.step( "Cleaning Enviornment..." )
andrew@onlab.us24e2f002015-03-11 15:06:12 -070067 for i in range(1, maxNodes + 1):
68 main.log.info(" Uninstalling ONOS " + str(i) )
69 main.ONOSbench.onosUninstall( ONOSIp[i] )
70
71 #mvn clean install, for debugging set param 'skipCleanInstall' to yes to speed up test
72 if skipMvn != "yes":
73 mvnResult = main.ONOSbench.cleanInstall()
74
75 #git
76 main.step( "Git checkout and pull " + checkoutBranch )
77 if gitPull == 'on':
78 checkoutResult = main.ONOSbench.gitCheckout( checkoutBranch )
79 pullResult = main.ONOSbench.gitPull()
andrew@onlab.us2ae3a112015-02-02 11:24:32 -080080
andrew@onlab.us24e2f002015-03-11 15:06:12 -070081 else:
82 checkoutResult = main.TRUE
83 pullResult = main.TRUE
84 main.log.info( "Skipped git checkout and pull" )
andrew@onlab.us2ae3a112015-02-02 11:24:32 -080085
andrew@onlab.us24e2f002015-03-11 15:06:12 -070086 main.ONOSbench.createLinkGraphFile(BENCHIp, tempIp, switchCount)
87 main.ONOSbench.createNullDevProviderFile(BENCHIp, tempIp, switchCount)
88 main.ONOSbench.createNullLinkProviderFile(BENCHIp)
89
andrew@onlab.us2ae3a112015-02-02 11:24:32 -080090 main.step( "Creating ONOS package" )
91 packageResult = main.ONOSbench.onosPackage()
92
93 main.step( "Installing ONOS package" )
andrew@onlab.us24e2f002015-03-11 15:06:12 -070094 install1Result = main.ONOSbench.onosInstall( node=ONOSIp[1] )
andrew@onlab.us2ae3a112015-02-02 11:24:32 -080095
andrew@onlab.us2ae3a112015-02-02 11:24:32 -080096 main.step( "verify cells" )
97 verifyCellResult = main.ONOSbench.verifyCell()
98
99 main.step( "Set cell for ONOS cli env" )
andrew@onlab.us24e2f002015-03-11 15:06:12 -0700100 cli1 = main.ONOS1cli.startOnosCli( ONOSIp[1] )
andrew@onlab.us2ae3a112015-02-02 11:24:32 -0800101
andrew@onlab.us24e2f002015-03-11 15:06:12 -0700102
andrew@onlab.us2ae3a112015-02-02 11:24:32 -0800103 def CASE2( self, main ):
andrew@onlab.us24e2f002015-03-11 15:06:12 -0700104 # This case increases the cluster size by whatever scale is
105 # Note: 'scale' is the size of the step
106 # if scaling is not a part of your test, simply run this case
107 # once after CASE1 to set up your enviornment for your desired
108 # cluster size. If scaling is a part of you test call this case each time
109 # you want to increase cluster size
110
111 ''
andrew@onlab.us2ae3a112015-02-02 11:24:32 -0800112 'Increase number of nodes and initiate CLI'
113 ''
114 import time
andrew@onlab.us2ae3a112015-02-02 11:24:32 -0800115 global clusterCount
andrew@onlab.us2ae3a112015-02-02 11:24:32 -0800116
andrew@onlab.us24e2f002015-03-11 15:06:12 -0700117 BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
118 scale = int( main.params[ 'SCALE' ] )
119 clusterCount += scale
120 switchCount = main.params[ 'TEST' ][ 'switchCount' ]
andrew@onlab.us2ae3a112015-02-02 11:24:32 -0800121
andrew@onlab.us24e2f002015-03-11 15:06:12 -0700122 main.log.info("Creating cell file")
123 exec "a = main.ONOSbench.createCellFile"
124 cellIp = []
125 for node in range (1, clusterCount + 1):
126 cellIp.append(ONOSIp[node])
127 a(BENCHIp,cellName,MN1Ip,str(Features), *cellIp)
128
129 main.step( "Applying cell file to environment" )
130 cellApplyResult = main.ONOSbench.setCell( cellName )
131
132 #Uninstall everywhere
133 main.log.step( "Cleaning Enviornment..." )
134 for node in range(1, maxNodes + 1):
135 main.ONOSbench.onosDie(ONOSIp[node])
136 main.log.info(" Uninstalling ONOS " + str(node) )
137 main.ONOSbench.onosUninstall( ONOSIp[node] )
138
139 tempIp = []
140 for node in range( 1, clusterCount + 1):
141 tempIp.append(ONOSIp[node])
142
143 main.ONOSbench.createLinkGraphFile(BENCHIp, tempIp, switchCount)
144 main.ONOSbench.createNullDevProviderFile(BENCHIp, tempIp, switchCount)
145 main.ONOSbench.createNullLinkProviderFile(BENCHIp)
146
147 main.ONOSbench.onosPackage()
148
149 main.log.report( "Increasing cluster size to " + str( clusterCount ) )
150 for node in range(1, clusterCount + 1):
151 main.log.info("Starting ONOS " + str(node) + " at IP: " + ONOSIp[node])
152 main.ONOSbench.onosInstall( node=ONOSIp[node])
153 if node == 1:
154 main.ONOS1cli.startOnosCli( ONOSIp[1] )
155
156 for node in range(1, clusterCount + 1):
157 for i in range( 2 ):
158 isup = main.ONOSbench.isup( ONOSIp[node] )
159 if isup:
160 main.log.info("ONOS " + str(node) + " is up\n")
161 break
162 if not isup:
163 main.log.report( "ONOS " + str(node) + " didn't start!" )
164
165 def CASE3( self, main ):
166
167 import time
168 import numpy
169
170
171 sampleSize = int(main.params[ 'TEST' ][ 'sampleSize' ])
172 warmUp = int(main.params[ 'TEST' ][ 'warmUp' ])
173 intentsList = (main.params[ 'TEST' ][ 'intents' ]).split(",")
174 switchCount = int(main.params[ 'TEST' ][ 'switchCount' ])
175 debug = main.params[ 'TEST' ][ 'switchCount' ]
176 for i in range(0,len(intentsList)):
177 intentsList[i] = int(intentsList[i])
jenkins375cfac2015-03-24 10:32:14 -0700178
179 if debug == "True":
180 debug = True
181 else:
182 debug = False
andrew@onlab.us24e2f002015-03-11 15:06:12 -0700183
184 linkCount = 0
jenkins375cfac2015-03-24 10:32:14 -0700185 for i in range(0,10):
andrew@onlab.us24e2f002015-03-11 15:06:12 -0700186 main.ONOSbench.handle.sendline("onos $OC1 links|wc -l")
187 main.ONOSbench.handle.expect(":~")
188 linkCount = main.ONOSbench.handle.before
189 if debug: main.log.info("Link Count check: " + linkCount)
190 if str((switchCount*2)-2) in linkCount:
191 break
jenkins375cfac2015-03-24 10:32:14 -0700192 time.sleep(2)
andrew@onlab.us24e2f002015-03-11 15:06:12 -0700193
194 links = "--"
195 while "=null:" not in links:
196 if debug: main.log.info("top of loop")
197 main.ONOSbench.handle.sendline("onos $OC1 links")
198 main.ONOSbench.handle.expect(":~")
199 links = main.ONOSbench.handle.before
200 if debug: main.log.info(str(links))
201 time.sleep(1)
202 links = links.splitlines()
203 templinks = links
204
205 tempDevices = []
206 for line in links:
207 temp = line.split(" ")
208 temp[0].replace("src=","")
209 temp[0] = (temp[0].split("/"))[0]
210 tempDevices.append(temp[0])
211
212 tempDevices.sort()
213 devices = []
214 for i in tempDevices:
215 if "src=null" in i:
216 devices.append(i.replace("src=", ""))
217 if debug: main.log.info(str(devices))
218
219 ingress = devices[0]
220 egress = devices.pop()
221 if debug: main.log.info(ingress)
222 if debug: main.log.info(egress)
223
224 for intentSize in intentsList:
225 cmd = "onos $OC1 push-test-intents "
226 cmd += ingress + "/6 "
227 cmd += egress + "/5 "
228 cmd += str(intentSize) + " 1"
229 installed = []
230 withdrawn = []
231
232 for run in range(0, (warmUp + sampleSize)):
jenkins375cfac2015-03-24 10:32:14 -0700233 if run > warmUp:
234 time.sleep(5)
andrew@onlab.us24e2f002015-03-11 15:06:12 -0700235
236 myRawResult = "--"
237 while "ms" not in myRawResult:
238 main.ONOSbench.handle.sendline(cmd)
239 main.ONOSbench.handle.expect(":~")
240 myRawResult = main.ONOSbench.handle.before
241 if debug: main.log.info(myRawResult)
242
jenkins375cfac2015-03-24 10:32:14 -0700243 if debug: main.log.info(myRawResult)
andrew@onlab.us24e2f002015-03-11 15:06:12 -0700244
245 if run >= warmUp:
246 myRawResult = myRawResult.splitlines()
247 for line in myRawResult:
248 if "install" in line:
jenkins375cfac2015-03-24 10:32:14 -0700249 installed.append(int(line.split(" ")[5]))
250
251 for line in myRawResult:
252 if "withdraw" in line:
253 withdrawn.append(int(line.split(" ")[5]))
254
255 print("installed: " + str(installed))
256 print("withraw: " + str(withdrawn) + "\n")
257
258 main.log.report("----------------------------------------------------")
259 main.log.report("Scale: " + str(clusterCount) + "\tIntent batch size: " + str(intentSize))
260 main.log.report("Installed average: " + str(numpy.mean(installed)))
261 main.log.report("Installed standard deviation: " + str(numpy.std(installed)))
262 main.log.report("Withdraw average: " + str(numpy.mean(withdrawn)))
263 main.log.report("Withdraw standard deviation: " + str(numpy.std(withdrawn)))
264 main.log.report(" ")
265
266
andrew@onlab.us24e2f002015-03-11 15:06:12 -0700267
jenkins375cfac2015-03-24 10:32:14 -0700268
andrew@onlab.us2ae3a112015-02-02 11:24:32 -0800269
270
271
272
273
274
275
276
277