blob: ecfd64a7f3b82934992835be49fe0a4fd6a2f27c [file] [log] [blame]
Devin Lim90803a82017-08-29 13:41:44 -07001#!groovy
2// This is a Jenkinsfile for a scripted pipeline for the SCPF tests
3// Define sets of tests
Devin Lim61657e42017-10-09 17:24:40 -07004AllTheTests=
5[
6 "FUNC":[
7 "FUNCipv6Intent" : ["basic":true, "extra_A":false, "extra_B":false, "day":""],
8 "FUNCoptical" : ["basic":true, "extra_A":false, "extra_B":false, "day":""],
9 "FUNCflow" : ["basic":true, "extra_A":false, "extra_B":false, "day":""],
10 "FUNCnetCfg": ["basic":true, "extra_A":false, "extra_B":false, "day":""],
11 "FUNCovsdbtest" : ["basic":true, "extra_A":false, "extra_B":false, "day":""],
12 "FUNCnetconf" : ["basic":true, "extra_A":false, "extra_B":false, "day":""],
13 "FUNCgroup" : ["basic":true, "extra_A":false, "extra_B":false, "day":""],
14 "FUNCintent" : ["basic":false, "extra_A":true, "extra_B":false, "day":""],
15 "FUNCintentRest" : ["basic":false, "extra_A":false, "extra_B":true, "day":""]
16 ],
17 "HA":[
18 "HAsanity" : ["basic":true, "extra_A":false, "extra_B":false, "day":""],
19 "HAclusterRestart" : ["basic":true, "extra_A":false, "extra_B":false, "day":""],
20 "HAsingleInstanceRestart" : ["basic":true, "extra_A":false, "extra_B":false, "day":""],
21 "HAstopNodes" : ["basic":false, "extra_A":true, "extra_B":false, "day":""],
22 "HAfullNetPartition" : ["basic":false, "extra_A":true, "extra_B":false, "day":""],
23 "HAswapNodes" : ["basic":false, "extra_A":false, "extra_B":true, "day":""],
24 "HAscaling" : ["basic":false, "extra_A":false, "extra_B":true, "day":""],
25 "HAkillNodes" : ["basic":false, "extra_A":false, "extra_B":true, "day":""]
26 ],
27 "SCPF":[
28 "SCPFswitchLat": ["basic":true, "extra_A":false, "extra_B":false, "extra_C":false, "extra_D":false, "new_Test":false, day:""],
29 "SCPFcbench": ["basic":true, "extra_A":false, "extra_B":false, "extra_C":false, "extra_D":false, "new_Test":false, day:""],
30 "SCPFportLat": ["basic":true, "extra_A":false, "extra_B":false, "extra_C":false, "extra_D":false, "new_Test":false, day:""],
31 "SCPFflowTp1g": ["basic":true, "extra_A":false, "extra_B":false, "extra_C":false, "extra_D":false, "new_Test":false, day:""],
32 "SCPFintentEventTp": ["basic":true, "extra_A":false, "extra_B":false, "extra_C":false, "extra_D":false, "new_Test":false, day:""],
33 "SCPFhostLat": ["basic":false, "extra_A":true, "extra_B":false, "extra_C":false, "extra_D":false, "new_Test":false, day:""],
34 // batch will be on extra_A after fixing from the ONOS side.
35 "SCPFbatchFlowResp": ["basic":false, "extra_A":false, "extra_B":false, "extra_C":false, "extra_D":false, "new_Test":false, day:""],
36 "SCPFintentRerouteLat": ["basic":false, "extra_A":true, "extra_B":false, "extra_C":false, "extra_D":false, "new_Test":false, day:""],
37 "SCPFintentInstallWithdrawLat": ["basic":false, "extra_A":true, "extra_B":false, "extra_C":false, "extra_D":false, "new_Test":false, day:""],
38 "SCPFflowTp1gWithFlowObj": ["basic":false, "extra_A":false, "extra_B":true, "extra_C":false, "extra_D":false, "new_Test":false, day:""],
39 "SCPFintentEventTpWithFlowObj": ["basic":false, "extra_A":false, "extra_B":true, "extra_C":false, "extra_D":false, "new_Test":false, day:""],
40 "SCPFintentRerouteLatWithFlowObj": ["basic":false, "extra_A":false, "extra_B":true, "extra_C":false, "extra_D":false, "new_Test":false, day:""],
41 "SCPFscalingMaxIntentsWithFlowObj": ["basic":false, "extra_A":false, "extra_B":true, "extra_C":false, "extra_D":false, "new_Test":false, day:""],
42 "SCPFintentInstallWithdrawLatWithFlowObj": ["basic":false, "extra_A":false, "extra_B":true, "extra_C":false, "extra_D":false, "new_Test":false, day:""],
43 "SCPFscaleTopo": ["basic":false, "extra_A":false, "extra_B":false, "extra_C":true, "extra_D":false, "new_Test":false, day:""],
44 "SCPFscalingMaxIntents": ["basic":false, "extra_A":false, "extra_B":false, "extra_C":false, "extra_D":true, "new_Test":false, day:""],
45 "SCPFmastershipFailoverLat": ["basic":false, "extra_A":false, "extra_B":false, "extra_C":false, "extra_D":false, "new_Test":true, day:""]
46 ],
47 "USECASE":[
48 "FUNCvirNetNB" : ["basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":""],
49 "FUNCbgpls" : ["basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":""],
50 "VPLSBasic" : ["basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":""],
51 "USECASE_SdnipFunction": ["basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":""],
52 "USECASE_SdnipFunctionCluster": ["basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":""],
53 "PLATdockertest": ["basic":false, "extra_A":true, "extra_B":false, "new_Test":false, "day":""],
54 "SRSanity": ["basic":false, "extra_A":false, "extra_B":true, "new_Test":false, "day":""],
55 "SRSwitchFailure": ["basic":false, "extra_A":false, "extra_B":true, "new_Test":false, "day":""],
56 "SRLinkFailure": ["basic":false, "extra_A":false, "extra_B":true, "new_Test":false, "day":""],
57 "SROnosFailure": ["basic":false, "extra_A":false, "extra_B":true, "new_Test":false, "day":""],
58 "SRClusterRestart": ["basic":false, "extra_A":false, "extra_B":true, "new_Test":false, "day":""],
59 "SRDynamic": ["basic":false, "extra_A":false, "extra_B":true, "new_Test":false, "day":""],
60 "SRHighAvailability": ["basic":false, "extra_A":false, "extra_B":true, "new_Test":false, "day":""],
61 "VPLSfailsafe" : ["basic":false, "extra_A":false, "extra_B":false, "new_Test":true, "day":""]
62 ]
63]
Devin Lim90803a82017-08-29 13:41:44 -070064testcases = [
65 "FUNC" : [ tests : "" , nodeName : "VM"],
66 "HA" : [ tests : "" , nodeName : "VM"],
67 "SCPF" : [ tests : "" , nodeName : "BM"],
68 "USECASE" : [ tests : "" , nodeName : "BM"]
69]
70Prefix_organizer = [
71 "FU" : "FUNC",
72 "HA" : "HA",
73 "PL" : "USECASE",
74 "SA" : "USECASE",
75 "SC" : "SCPF",
76 "SR" : "USECASE",
77 "US" : "USECASE",
78 "VP" : "USECASE"
79]
80
Devin Lima0e52eb2017-09-13 18:35:12 -070081onos_branch = "master"
82onos_tag = params.ONOSTag
Devin Lim37a83792017-10-26 16:38:21 -070083isOldFlow = false
Devin Lim90803a82017-08-29 13:41:44 -070084// Set tests based on day of week
85def now = new Date()
86echo(now.toString())
87today = now[Calendar.DAY_OF_WEEK]
88day = ""
Devin Lim61657e42017-10-09 17:24:40 -070089SCPF_choices = ""
Devin Lim90803a82017-08-29 13:41:44 -070090USECASE_choices = ""
Devin Lim61657e42017-10-09 17:24:40 -070091FUNC_choices = ""
92HA_choices = ""
Devin Lim90803a82017-08-29 13:41:44 -070093
94manually_run = params.manual_run
95post_result = params.PostResult
Devin Lim61657e42017-10-09 17:24:40 -070096if( !manually_run ){
97 sendToSlack( '#03CD9F', ":sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles:\n"
98 + "Starting tests on : " + now.toString()
99 + "\n:sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles:" )
100 testDivider( today )
101 FUNC_choices = lastCommaRemover( FUNC_choices )
102 HA_choices = lastCommaRemover( HA_choices )
103 SCPF_choices = lastCommaRemover( SCPF_choices )
104 USECASE_choices = lastCommaRemover( USECASE_choices )
105}
106
Devin Lim90803a82017-08-29 13:41:44 -0700107if ( manually_run ){
108 organize_tests( params.Tests )
109 onos_branch = params.ONOSVersion
110 test_branch = params.TestONBranch
111 println "Tests to be run manually : "
112}else{
113 testcases["SCPF"]["tests"] = SCPF_choices
114 testcases["USECASE"]["tests"] = USECASE_choices
115 testcases["FUNC"]["tests"] = FUNC_choices
116 testcases["HA"]["tests"] = HA_choices
117 println "Defaulting to " + day + " tests:"
118}
119print_tests( testcases )
Devin Lim37a83792017-10-26 16:38:21 -0700120def runTest = [
121 "VM" : [:],
122 "BM" : [:]
123]
124for( String test in testcases.keySet() ){
125 println test
126 if (testcases[test]["tests"] != ""){
127 runTest[testcases[test]["nodeName"]][test] = trigger_pipeline( onos_branch, testcases[test]["tests"], testcases[test]["nodeName"], test, manually_run, onos_tag )
128 }
129}
130def finalList = [:]
131finalList["VM"] = runTestSeq( runTest["VM"] )
132finalList["BM"] = runTestSeq( runTest["BM"] )
133parallel finalList
Devin Lim90803a82017-08-29 13:41:44 -0700134
Devin Lim61657e42017-10-09 17:24:40 -0700135def testDivider( today ){
136 switch (today) {
137 case Calendar.MONDAY:
138 monday( true )
139 tuesday( true, false )
140 wednesday( true, false )
141 thursday( true, false )
142 friday( true, false )
143 day = "Monday"
144 sendToSlack( '#FFD988', "Tests to be run this weekdays : \n" + printDaysForTest() )
145 break
146 case Calendar.TUESDAY:
147 tuesday( true, true )
148 day = "Tuesday"
149 break
150 case Calendar.WEDNESDAY:
151 wednesday( true, true )
152 day = "Wednesday"
153 break
154 case Calendar.THURSDAY:
155 thursday( true, true)
156 day = "Thursday"
157 break
158 case Calendar.FRIDAY:
159 friday( true, true)
160 day = "Friday"
161 break
162 case Calendar.SATURDAY:
163 saturday()
164 onos_branch= "1.11"
165 day = "Saturday"
166 break
167 case Calendar.SUNDAY:
168 sunday()
169 onos_branch= "1.10"
170 day = "Sunday"
171 break
172 }
173}
174def printDaysForTest(){
175 result = ""
176 for ( String test in AllTheTests.keySet() ){
177 result += test + " : \n"
178 for( String each in AllTheTests[ test ].keySet() ){
179 AllTheTests[ test ][ each ][ "day" ] = lastCommaRemover( AllTheTests[ test ][ each ][ "day" ] )
180 result += " " + each + ":[" + AllTheTests[ test ][ each ][ "day" ] + "]\n"
181 }
182 result += "\n"
183 }
184 return result
185}
186def lastCommaRemover( str ){
187 if ( str.size() > 0 && str[ str.size() - 1 ] == ',' ){
188 str = str.substring( 0,str.size() - 1 )
189 }
190 return str
191}
192def monday( getResult ){
193 FUNC_choices += adder( "FUNC", "basic", true, "M", getResult )
194 FUNC_choices += adder( "FUNC", "extra_A", true, "M", getResult )
195 HA_choices += adder( "HA", "basic", true, "M", getResult )
196 HA_choices += adder( "HA", "extra_A", true, "M", getResult )
197 SCPF_choices += adder( "SCPF", "basic", true, "M", getResult )
198 SCPF_choices += adder( "SCPF", "extra_B", true, "M", getResult )
199}
200def tuesday( getDay, getResult ){
201 FUNC_choices += adder( "FUNC", "basic", getDay, "T", getResult )
202 FUNC_choices += adder( "FUNC", "extra_B", getDay, "T", getResult )
203 HA_choices += adder( "HA", "basic", getDay, "T", getResult )
204 HA_choices += adder( "HA", "extra_B", getDay, "T", getResult )
205 SCPF_choices += adder( "SCPF", "basic", getDay, "T", getResult )
206 SCPF_choices += adder( "SCPF", "extra_C", getDay, "T", getResult )
207 USECASE_choices += adder( "USECASE", "basic", getDay, "T", getResult )
208 USECASE_choices += adder( "USECASE", "extra_A", getDay, "T", getResult )
209 USECASE_choices += adder( "USECASE", "new_Test", getDay, "T", getResult )
210}
211def wednesday( getDay, getResult ){
212 FUNC_choices += adder( "FUNC", "basic", getDay, "W", getResult )
213 FUNC_choices += adder( "FUNC", "extra_A", getDay, "W", getResult )
214 HA_choices += adder( "HA", "basic", getDay, "W", getResult )
215 HA_choices += adder( "HA", "extra_A", getDay, "W", getResult )
216 SCPF_choices += adder( "SCPF", "basic", getDay, "W", getResult )
217 SCPF_choices += adder( "SCPF", "extra_A", getDay, "W", getResult )
218 SCPF_choices += adder( "SCPF", "new_Test", getDay, "W", getResult )
Devin Lim37a83792017-10-26 16:38:21 -0700219 isOldFlow = true
Devin Lim61657e42017-10-09 17:24:40 -0700220}
221def thursday( getDay, getResult ){
222 FUNC_choices += adder( "FUNC", "basic", getDay, "Th", getResult )
223 FUNC_choices += adder( "FUNC", "extra_B", getDay, "Th", getResult )
224 HA_choices += adder( "HA", "basic", getDay, "Th", getResult )
225 HA_choices += adder( "HA", "extra_B", getDay, "Th", getResult )
226 SCPF_choices += adder( "SCPF", "basic", getDay, "Th", getResult )
227 SCPF_choices += adder( "SCPF", "extra_B", getDay, "Th", getResult )
Devin Lim37a83792017-10-26 16:38:21 -0700228 isOldFlow = true
Devin Lim61657e42017-10-09 17:24:40 -0700229}
230def friday( getDay, getResult ){
231 FUNC_choices += adder( "FUNC", "basic", getDay, "F", getResult )
232 FUNC_choices += adder( "FUNC", "extra_A", getDay, "F", getResult )
233 HA_choices += adder( "HA", "basic", getDay, "F", getResult )
234 HA_choices += adder( "HA", "extra_A", getDay, "F", getResult )
235 SCPF_choices += adder( "SCPF", "basic", getDay, "F", getResult )
236 SCPF_choices += adder( "SCPF", "extra_A", getDay, "F", getResult )
237 SCPF_choices += adder( "SCPF", "extra_D", getDay, "F", getResult )
238}
239def saturday(){
240 FUNC_choices += adder( "FUNC", "basic", false, "Sa", true )
241 FUNC_choices += adder( "FUNC", "extra_A", false, "Sa", true )
242 FUNC_choices += adder( "FUNC", "extra_B", false, "Sa", true )
243 HA_choices += adder( "HA", "basic", false, "Sa", true )
244 HA_choices += adder( "HA", "extra_A", false, "Sa", true )
245 HA_choices += adder( "HA", "extra_B", false, "Sa", true )
246 SCPF_choices += adder( "SCPF", "basic", false, "Sa", true )
247 SCPF_choices += adder( "SCPF", "extra_A", false, "Sa", true )
248 SCPF_choices += adder( "SCPF", "extra_B", false, "Sa", true )
249 SCPF_choices += adder( "SCPF", "extra_C", false, "Sa", true )
250 SCPF_choices += adder( "SCPF", "extra_D", false, "Sa", true )
251 SCPF_choices += adder( "SCPF", "new_Test", false, "Sa", true )
252 USECASE_choices += adder( "USECASE", "basic", false, "Sa", true )
253 USECASE_choices += adder( "USECASE", "new_Test", false, "Sa", true )
254}
255def sunday(){
256 FUNC_choices += adder( "FUNC", "basic", false, "S", true )
257 FUNC_choices += adder( "FUNC", "extra_A", false, "S", true )
258 FUNC_choices += adder( "FUNC", "extra_B", false, "S", true )
259 HA_choices += adder( "HA", "basic", false, "S", true )
260 HA_choices += adder( "HA", "extra_A", false, "S", true )
261 HA_choices += adder( "HA", "extra_B", false, "S", true )
262 SCPF_choices += adder( "SCPF", "basic", false, "S", true )
263 USECASE_choices += adder( "USECASE", "basic", false, "S", true )
264}
265def adder( testCat, set, dayAdding, day, getResult ){
266 result = ""
267 for( String test in AllTheTests[ testCat ].keySet() ){
268 if( AllTheTests[ testCat ][ test ][ set ] ){
269 if( getResult )
270 result += test + ","
271 if( dayAdding )
272 dayAdder( testCat, test, day )
273 }
274 }
275 return result
276}
277def dayAdder( testCat, testName, dayOfWeek ){
278 AllTheTests[ testCat ][ testName ][ "day" ] += dayOfWeek + ","
279}
Devin Lim90803a82017-08-29 13:41:44 -0700280def runTestSeq( testList ){
281 return{
282 for ( test in testList.keySet() ){
283 testList[test].call()
284 }
285 }
286}
287
288def print_tests( tests ){
289 for( String test in tests.keySet() ){
290 if( tests[test]["tests"] != "" ){
291 println test + ":"
292 println tests[test]["tests"]
293 }
294 }
295}
296def organize_tests( tests ){
297 testList = tests.tokenize("\n;, ")
298 for( String test in testList )
299 testcases [ Prefix_organizer[ ( test == "FUNCbgpls" || test == "FUNCvirNetNB" ? "US" : ( test[ 0 ] + test[ 1 ] ) ) ] ][ "tests" ] += test + ","
300}
Devin Lima0e52eb2017-09-13 18:35:12 -0700301def trigger_pipeline( branch, tests, nodeName, jobOn, manuallyRun, onosTag ){
Devin Lim90803a82017-08-29 13:41:44 -0700302// nodeName : "BM" or "VM"
303// jobOn : "SCPF" or "USECASE" or "FUNC" or "HA"
304 return{
305 if (branch == "master"){
306 onos_branch = branch
307 }else{
308 onos_branch = "onos-" + branch
309 }
310 wiki = branch
311 if ( !manuallyRun )
312 test_branch = onos_branch
313 if (onos_branch == "onos-1.11")
314 test_branch = "master"
315 println jobOn + "_Pipeline_" + manuallyRun ? "manually" : branch
316 node("TestStation-" + nodeName + "s"){
317 if (!manuallyRun)
Devin Lima0e52eb2017-09-13 18:35:12 -0700318 envSetup(onos_branch, test_branch, onosTag)
Devin Lim90803a82017-08-29 13:41:44 -0700319
Devin Lima0e52eb2017-09-13 18:35:12 -0700320 exportEnvProperty( onos_branch, test_branch, wiki, tests, post_result, manuallyRun, onosTag )
Devin Lim90803a82017-08-29 13:41:44 -0700321 }
322
323 jobToRun = jobOn + "_Pipeline_" + ( manuallyRun ? "manually" : branch )
324 build job: jobToRun, propagate: false
325 }
326}
327
328// export Environment properties.
Devin Lima0e52eb2017-09-13 18:35:12 -0700329def exportEnvProperty( onos_branch, test_branch, wiki, tests, postResult, manually_run, onosTag ){
Devin Lim90803a82017-08-29 13:41:44 -0700330 stage("export Property"){
331 sh '''
332 echo "ONOSBranch=''' + onos_branch +'''" > /var/jenkins/TestONOS.property
333 echo "TestONBranch=''' + test_branch +'''" >> /var/jenkins/TestONOS.property
Devin Lima0e52eb2017-09-13 18:35:12 -0700334 echo "ONOSTag='''+ onosTag +'''" >> /var/jenkins/TestONOS.property
Devin Lim90803a82017-08-29 13:41:44 -0700335 echo "WikiPrefix=''' + wiki +'''" >> /var/jenkins/TestONOS.property
336 echo "ONOSJVMHeap='''+ env.ONOSJVMHeap +'''" >> /var/jenkins/TestONOS.property
337 echo "Tests=''' + tests +'''" >> /var/jenkins/TestONOS.property
338 echo "postResult=''' + postResult +'''" >> /var/jenkins/TestONOS.property
339 echo "manualRun=''' + manually_run +'''" >> /var/jenkins/TestONOS.property
340 '''
341 }
342}
Devin Lim61657e42017-10-09 17:24:40 -0700343def sendToSlack( color, message ){
344 slackSend(color:color, message: message)
345}
Devin Lim90803a82017-08-29 13:41:44 -0700346// Initialize the environment Setup for the onos and OnosSystemTest
Devin Lima0e52eb2017-09-13 18:35:12 -0700347def envSetup( onos_branch, test_branch, onos_tag ){
Devin Lim90803a82017-08-29 13:41:44 -0700348 stage("envSetup") {
Devin Lima0e52eb2017-09-13 18:35:12 -0700349 sh '''#!/bin/bash -l
Devin Lim90803a82017-08-29 13:41:44 -0700350 set +e
351 . ~/.bashrc
352 env
353
354 echo -e "\n##### Set TestON Branch #####"
Devin Lima0e52eb2017-09-13 18:35:12 -0700355 echo "TestON Branch is set on: ''' + test_branch + '''"
Devin Lim90803a82017-08-29 13:41:44 -0700356
357 cd ~/OnosSystemTest/
358 git checkout HEAD~1 # Make sure you aren't pn a branch
359 git branch | grep -v "detached from" | xargs git branch -d # delete all local branches merged with remote
Devin Lima0e52eb2017-09-13 18:35:12 -0700360 git branch -D ''' + test_branch + ''' # just incase there are local changes. This will normally result in a branch not found error
Devin Lim90803a82017-08-29 13:41:44 -0700361 git clean -df # clean any local files
362 git fetch --all # update all caches from remotes
Devin Lima0e52eb2017-09-13 18:35:12 -0700363 git reset --hard origin/''' + test_branch +''' # force local index to match remote branch
Devin Lim90803a82017-08-29 13:41:44 -0700364 git clean -df # clean any local files
Devin Lima0e52eb2017-09-13 18:35:12 -0700365 git checkout ''' + test_branch + ''' #create new local branch
Devin Lim90803a82017-08-29 13:41:44 -0700366 git branch
367 git log -1 --decorate
368
369
370 echo -e "\n##### Set ONOS Branch #####"
Devin Lima0e52eb2017-09-13 18:35:12 -0700371 echo "ONOS Branch is set on: ''' + onos_branch + '''"
Devin Lim90803a82017-08-29 13:41:44 -0700372
373 echo -e "\n #### check karaf version ######"
374 env |grep karaf
375
376 cd ~/onos
377 rm -rf buck-out/*
378 ~/onos/tools/build/onos-buck clean
379 git checkout HEAD~1 # Make sure you aren't pn a branch
380 git branch | grep -v "detached from" | xargs git branch -d # delete all local branches merged with remote
Devin Lima0e52eb2017-09-13 18:35:12 -0700381 git branch -D ''' + onos_branch + ''' # just incase there are local changes. This will normally result in a branch not found error
Devin Lim90803a82017-08-29 13:41:44 -0700382 git clean -df # clean any local files
383 git fetch --all # update all caches from remotes
Devin Lima0e52eb2017-09-13 18:35:12 -0700384 git reset --hard origin/''' + onos_branch + ''' # force local index to match remote branch
Devin Lim90803a82017-08-29 13:41:44 -0700385 git clean -df # clean any local files
Devin Lima0e52eb2017-09-13 18:35:12 -0700386 ''' + tagCheck(onos_tag, onos_branch) + '''
Devin Lim90803a82017-08-29 13:41:44 -0700387 git branch
388 git log -1 --decorate
389
390
391 echo -e "\n##### set jvm heap size to 8G #####"
392 echo ${ONOSJVMHeap}
393
Devin Lima0e52eb2017-09-13 18:35:12 -0700394 inserted_line="export JAVA_OPTS=\"\${ONOSJVMHeap}\""
395 sed -i "s/bash/bash\\n$inserted_line/" ~/onos/tools/package/bin/onos-service
Devin Lim90803a82017-08-29 13:41:44 -0700396
397 echo "##### Check onos-service setting..... #####"
398 cat ~/onos/tools/package/bin/onos-service
399
400 export JAVA_HOME=/usr/lib/jvm/java-8-oracle
Devin Lim37a83792017-10-26 16:38:21 -0700401 ''' + oldFlowCheck() + '''
Devin Lim90803a82017-08-29 13:41:44 -0700402 echo -e "\n##### build ONOS skip unit tests ######"
403 #mvn clean install -DskipTests
404 # Force buck update
405 rm -f ~/onos/bin/buck
406 ~/onos/tools/build/onos-buck build onos
407
Devin Lima0e52eb2017-09-13 18:35:12 -0700408 sleep 30
409 echo -e "\n##### Stop all running instances of Karaf #####"
410 kill $(ps -efw | grep karaf | grep -v grep | awk '{print $2}')
411 sleep 30
412
Devin Lim90803a82017-08-29 13:41:44 -0700413 git branch'''
414 }
Devin Lima0e52eb2017-09-13 18:35:12 -0700415}
416def tagCheck(onos_tag, onos_branch){
417 result = "git checkout "
418 if (onos_tag == "" )
419 result += onos_branch //create new local branch
420 else
421 result += onos_tag //checkout the tag
422 return result
Devin Lim37a83792017-10-26 16:38:21 -0700423}
424def oldFlowCheck(){
425 result = ""
426 if( isOldFlow )
427 result = '''sed -i -e 's/@Component(immediate = true)/@Component(enabled = false)/g' ~/onos/core/store/dist/src/main/java/org/onosproject/store/flow/impl/DistributedFlowRuleStore.java
428 sed -i -e 's/@Component(enabled = false)/@Component(immediate = true)/g' ~/onos/core/store/dist/src/main/java/org/onosproject/store/flow/impl/ECFlowRuleStore.java'''
429 return result
Devin Lim90803a82017-08-29 13:41:44 -0700430}