blob: 3b9e86b0b94d479b40434d819dc4e5984b2abb9c [file] [log] [blame]
adminbae64d82013-08-01 10:50:15 -07001#!/usr/bin/env python
2'''
3Created on 31-May-2013
4
5@author: Anil Kumar (anilkumar.s@paxterrasolutions.com)
6
7 TestON is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 2 of the License, or
10 (at your option) any later version.
11
12 TestON is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with TestON. If not, see <http://www.gnu.org/licenses/>.
19
20
21'''
22import time
23import pexpect
24import struct, fcntl, os, sys, signal
25import sys
26import re
27import json
28sys.path.append("../")
29from drivers.common.clidriver import CLI
30
31class OnosCliDriver(CLI):
32
33 def __init__(self):
34 super(CLI, self).__init__()
35
36 def connect(self,**connectargs):
37 '''
38 Creates ssh handle for ONOS.
39 '''
40 for key in connectargs:
41 vars(self)[key] = connectargs[key]
42
43
44 self.name = self.options['name']
45 self.handle = super(OnosCliDriver,self).connect(user_name = self.user_name, ip_address = self.ip_address,port = self.port, pwd = self.pwd)
46
47 if self.handle:
48 #self.start()
49 #self.start_rest()
50 return self.handle
51 else :
52 main.log.info("NO HANDLE")
53 return main.FALSE
54
55 def start(self):
56 '''
57 Starts ONOS on remote machine.
58 Returns false if any errors were encountered.
59 '''
60 self.handle.sendline("")
61 self.handle.expect("\$")
admin530b4c92013-08-14 16:54:35 -070062 self.handle.sendline("~/ONOS/start-onos.sh start")
adminaeedddd2013-08-02 15:14:15 -070063 self.handle.expect("onos.sh start")
adminbae64d82013-08-01 10:50:15 -070064 i=self.handle.expect(["Starting\sONOS\scontroller","Cassandra\sis\snot\srunning"])
65 if i==0:
adminaeedddd2013-08-02 15:14:15 -070066 try:
admin530b4c92013-08-14 16:54:35 -070067 self.handle.expect("\$", timeout=60)
adminbae64d82013-08-01 10:50:15 -070068 main.log.info("ONOS Started ")
adminaeedddd2013-08-02 15:14:15 -070069 except:
adminbae64d82013-08-01 10:50:15 -070070 main.log.info("ONOS NOT Started, stuck while waiting for it to start ")
71 return main.FALSE
adminaeedddd2013-08-02 15:14:15 -070072 return main.TRUE
adminbae64d82013-08-01 10:50:15 -070073 elif i==1:
74 main.log.error("ONOS didn't start because cassandra wasn't running.")
75 return main.FALSE
76
77 main.log.error("ONOS expect script missed something... ")
78 return main.FALSE
79
80 def link_down(self, **linkParams):
81 '''
82 Specifically used for the ONOS demo on the HW.
83 Should be replaced by actual switch drivers in the future.
84 '''
85 args = utilities.parse_args(["SDPID","SPORT","DDPID","DPORT"], **linkParams)
86 sdpid = args["SDPID"] if args["SDPID"] != None else "00:00:00:00:ba:5e:ba:13"
87 sport = args["SPORT"] if args["SPORT"] != None else "22"
88 ddpid = args["DDPID"] if args["DDPID"] != None else "00:00:20:4e:7f:51:8a:35"
89 dport = args["DPORT"] if args["DPORT"] != None else "22"
90
91 cmd = "curl -s 10.128.4.11:9000/gui/link/down/" + sdpid + "/" + sport + "/" + ddpid + "/" + dport + " > /tmp/log &"
92 os.popen( cmd )
93
94 def link_up(self, **linkParams):
95 '''
96 Specifically used for the ONOS demo on the HW.
97 Should be replaced by actual switch drivers in the future.
98 '''
99 args = utilities.parse_args(["SDPID","SPORT","DDPID","DPORT"], **linkParams)
100 sdpid = args["SDPID"] if args["SDPID"] != None else "00:00:00:00:ba:5e:ba:13"
101 sport = args["SPORT"] if args["SPORT"] != None else "22"
102 ddpid = args["DDPID"] if args["DDPID"] != None else "00:00:20:4e:7f:51:8a:35"
103 dport = args["DPORT"] if args["DPORT"] != None else "22"
104
105 cmd = "curl -s 10.128.4.11:9000/gui/link/up/" + sdpid + "/" + sport + "/" + ddpid + "/" + dport + " > /tmp/log &"
106 os.popen( cmd )
107
108 def start_rest(self):
109 '''
110 Starts the rest server on ONOS.
111 '''
admin530b4c92013-08-14 16:54:35 -0700112 response = self.execute(cmd="~/ONOS/start-rest.sh start",prompt="\$",timeout=10)
adminbae64d82013-08-01 10:50:15 -0700113 if re.search("admin",response):
114 main.log.info("Rest Server Started Successfully")
115 time.sleep(5)
116 return main.TRUE
117 else :
118 main.log.warn("Failed to start Rest Server")
119 return main.FALSE
120
121 def status(self):
122 '''
123 Called start-onos.sh status and returns TRUE/FALSE accordingly
124 '''
125 self.execute(cmd="\r",prompt="\$",timeout=10)
126 response = self.execute(cmd="~/ONOS/start-onos.sh status ",prompt="\d+\sinstance\sof\sonos\srunning",timeout=10)
127 self.execute(cmd="\r",prompt="\$",timeout=10)
128 if re.search("1\sinstance\sof\sonos\srunning",response):
129 return main.TRUE
130 elif re.search("0\sinstance\sof\sonos\srunning",response):
131 return main.FALSE
132 else :
133 return main.FALSE
134
135 def isup(self):
136 '''
137 A more complete check to see if ONOS is up and running properly.
138 First, it checks if the process is up.
139 Second, it reads the logs for "Exception: Connection refused"
140 Third, it makes sure the logs are actually moving.
141 returns TRUE/FALSE accordingly.
142 '''
143 self.execute(cmd="\r",prompt="\$",timeout=10)
144 response = self.execute(cmd="~/ONOS/start-onos.sh status ",prompt="running",timeout=10)
145 self.execute(cmd="\r",prompt="\$",timeout=10)
146 tail1 = self.execute(cmd="tail ~/ONOS/onos-logs/onos.*.log",prompt="\$",timeout=10)
147 time.sleep(2)
148 self.execute(cmd="\r",prompt="\$",timeout=10)
149 tail2 = self.execute(cmd="tail ~/ONOS/onos-logs/onos.*.log",prompt="\$",timeout=10)
150 pattern = '(.*)1 instance(.*)'
151 pattern2 = '(.*)Exception: Connection refused(.*)'
152 if utilities.assert_matches(expect=pattern,actual=response,onpass="ONOS process is running...",onfail="ONOS process not running..."):
153 if tail1 == tail2:
154 main.log.error("ONOS is frozen...")
155 return main.FALSE
156 elif re.search( pattern2,tail1 ):
157 main.log.info("Connection Refused found in onos log")
158 return main.FALSE
159 elif re.search( pattern2,tail2 ):
160 main.log.info("Connection Refused found in onos log")
161 return main.FALSE
162 else:
163 main.log.info("Onos log is moving! It's looking good!")
164 return main.TRUE
165 else:
166 return main.FALSE
167
168
169 def rest_status(self):
170 '''
171 Checks if the rest server is running.
172 '''
173 response = self.execute(cmd="~/ONOS/start-rest.sh status ",prompt="running",timeout=10)
174 if re.search("rest\sserver\sis\srunning",response):
175 main.log.info("Rest Server is running")
176 elif re.search("rest\sserver\sis\snot\srunning",response):
177 main.log.warn("Rest Server is not Running")
178 else :
179 main.log.error("No response" +response)
180 self.execute(cmd="\r",prompt="\$",timeout=10)
181
182 return response
183
184 def stop(self):
185 '''
186 Runs ./start-onos.sh stop to stop ONOS
187 '''
188 self.handle.sendline("")
189 self.handle.expect("\$")
admin530b4c92013-08-14 16:54:35 -0700190 self.handle.sendline("~/ONOS/start-onos.sh stop")
adminbae64d82013-08-01 10:50:15 -0700191 self.handle.expect("stop", 2)
adminaeedddd2013-08-02 15:14:15 -0700192 result = self.handle.before
admin530b4c92013-08-14 16:54:35 -0700193 self.handle.expect("\$", 60)
adminaeedddd2013-08-02 15:14:15 -0700194 if re.search("Killed", result):
adminbae64d82013-08-01 10:50:15 -0700195 main.log.info("ONOS Killed Successfully")
196 return main.TRUE
197 else :
198 main.log.warn("ONOS wasn't running")
199 return main.FALSE
200
201 def rest_stop(self):
202 '''
203 Runs ./start-rest.sh stop to stop ONOS rest server
204 '''
205 response = self.execute(cmd="~/ONOS/start-rest.sh stop ",prompt="killing",timeout=10)
206 self.execute(cmd="\r",prompt="\$",timeout=10)
207 if re.search("killing", response):
208 main.log.info("Rest Server Stopped")
209 return main.TRUE
210 else :
211 main.log.error("Failed to Stop, Rest Server is not Running")
212 return main.FALSE
213
214 def disconnect(self):
215 '''
adminaeedddd2013-08-02 15:14:15 -0700216 Called when Test is complete to disconnect the ONOS handle.
adminbae64d82013-08-01 10:50:15 -0700217 '''
adminaeedddd2013-08-02 15:14:15 -0700218 response = ''
219 try:
adminbae64d82013-08-01 10:50:15 -0700220 self.handle.sendline("exit")
adminaeedddd2013-08-02 15:14:15 -0700221 self.handle.expect("closed")
222 except:
adminbae64d82013-08-01 10:50:15 -0700223 main.log.error("Connection failed to the host")
224 response = main.FALSE
adminaeedddd2013-08-02 15:14:15 -0700225 return response
226
adminbae64d82013-08-01 10:50:15 -0700227 def get_version(self):
228 '''
229 Writes the COMMIT number to the report to be parsed by Jenkins data collecter.
230 '''
231 self.handle.sendline("cat /home/admin/ONOS/.git/ORIG_HEAD")
232 self.handle.expect("ORIG_HEAD")
233 self.handle.expect("\$")
234 main.log.report( "COMMIT: " + str(self.handle.before + self.handle.after))
235
236 def add_flow(self, path):
237 '''
238 Copies the flowdef file from TestStation -> ONOS machine
239 Then runs ./add_flow.py to add the flows to ONOS
240 '''
241 main.log.info("Adding Flows...")
242 self.handle.sendline("scp admin@10.128.7.7:%s /tmp/flowtmp" % path)
243 self.handle.expect("100%")
244 self.handle.expect("\$", 30)
245 self.handle.sendline("~/ONOS/web/add_flow.py -m onos -f /tmp/flowtmp")
246 self.handle.expect("add_flow")
247 self.handle.expect("\$", 1000)
248 main.log.info("Flows added")
249
250 def delete_flow(self, *delParams):
251 '''
252 Deletes a specific flow, a range of flows, or all flows.
253 '''
254 if len(delParams)==1:
255 if str(delParams[0])=="all":
256 main.log.info("Deleting ALL flows...")
257 #self.execute(cmd="~/ONOS/scripts/TestON_delete_flow.sh all",prompt="done",timeout=150)
258 self.handle.sendline("~/ONOS/web/delete_flow.py all")
259 self.handle.expect("delete_flow")
260 self.handle.expect("\$",1000)
261 self.handle.sendline("~/ONOS/web/clear_flow.py all")
262 self.handle.expect("clear_flow")
263 self.handle.expect("\$",1000)
264 main.log.info("Flows deleted")
265 else:
266 main.log.info("Deleting flow "+str(delParams[0])+"...")
267 #self.execute(cmd="~/ONOS/scripts/TestON_delete_flow.sh "+str(delParams[0]),prompt="done",timeout=150)
268 #self.execute(cmd="\n",prompt="\$",timeout=60)
269 self.handle.sendline("~/ONOS/web/delete_flow.py %d" % int(delParams[0]))
270 self.handle.expect("delete_flow")
271 self.handle.expect("\$",60)
272 self.handle.sendline("~/ONOS/web/clear_flow.py %d" % int(delParams[0]))
273 self.handle.expect("clear_flow")
274 self.handle.expect("\$",60)
275 main.log.info("Flow deleted")
276 elif len(delParams)==2:
277 main.log.info("Deleting flows "+str(delParams[0])+" through "+str(delParams[1])+"...")
278 #self.execute(cmd="~/ONOS/scripts/TestON_delete_flow.sh "+str(delParams[0])+" "+str(delParams[1]),prompt="done",timeout=150)
279 #self.execute(cmd="\n",prompt="\$",timeout=60)
280 self.handle.sendline("~/ONOS/web/delete_flow.py %d %d" % (int(delParams[0]), int(delParams[1])))
281 self.handle.expect("delete_flow")
282 self.handle.expect("\$",600)
283 self.handle.sendline("~/ONOS/web/clear_flow.py %d %d" % (int(delParams[0]), int(delParams[1])))
284 self.handle.expect("clear_flow")
285 self.handle.expect("\$",600)
286 main.log.info("Flows deleted")
287
288 def check_flow(self):
289 '''
290 Calls the ./get_flow.py all and checks:
291 - If each FlowPath has at least one FlowEntry
292 - That there are no "NOT"s found
293 returns TRUE/FALSE
294 '''
295 flowEntryDetect = 1
296 count = 0
297 self.handle.sendline("clear")
298 time.sleep(1)
299 self.handle.sendline("~/ONOS/web/get_flow.py all")
300 self.handle.expect("get_flow")
301 while 1:
302 i=self.handle.expect(['FlowPath','FlowEntry','NOT','\$',pexpect.TIMEOUT],timeout=180)
303 if i==0:
304 count = count + 1
305 if flowEntryDetect == 0:
306 main.log.info("FlowPath without FlowEntry")
307 return main.FALSE
308 else:
309 flowEntryDetect = 0
310 elif i==1:
311 flowEntryDetect = 1
312 elif i==2:
313 main.log.error("Found a NOT")
314 return main.FALSE
315 elif i==3:
316 if count == 0:
317 main.log.info("There don't seem to be any flows here...")
318 return main.FALSE
319 else:
320 main.log.info("All flows pass")
321 main.log.info("Number of FlowPaths: "+str(count))
322 return main.TRUE
323 elif i==4:
324 main.log.error("Command Timeout!")
325 return main.FALSE
326
327 def get_flow(self, *flowParams):
328 '''
329 Returns verbose output of ./get_flow.py
330 '''
331 if len(flowParams)==1:
332 if str(flowParams[0])=="all":
333 self.execute(cmd="\n",prompt="\$",timeout=60)
334 main.log.info("Getting all flow data...")
335 data = self.execute(cmd="~/ONOS/scripts/TestON_get_flow.sh all",prompt="done",timeout=150)
336 self.execute(cmd="\n",prompt="\$",timeout=60)
337 return data
338 else:
339 main.log.info("Retrieving flow "+str(flowParams[0])+" data...")
340 data = self.execute(cmd="~/ONOS/scripts/TestON_get_flow.sh "+str(flowParams[0]),prompt="done",timeout=150)
341 self.execute(cmd="\n",prompt="\$",timeout=60)
342 return data
343 elif len(flowParams)==5:
344 main.log.info("Retrieving flow installer data...")
345 data = self.execute(cmd="~/ONOS/scripts/TestON_get_flow.sh "+str(flowParams[0])+" "+str(flowParams[1])+" "+str(flowParams[2])+" "+str(flowParams[3])+" "+str(flowParams[4]),prompt="done",timeout=150)
346 self.execute(cmd="\n",prompt="\$",timeout=60)
347 return data
348 elif len(flowParams)==4:
349 main.log.info("Retrieving flow endpoints...")
350 data = self.execute(cmd="~/ONOS/scripts/TestON_get_flow.sh "+str(flowParams[0])+" "+str(flowParams[1])+" "+str(flowParams[2])+" "+str(flowParams[3]),prompt="done",timeout=150)
351 self.execute(cmd="\n",prompt="\$",timeout=60)
352 return data
353
354
355# http://localhost:8080/wm/core/topology/switches/all/json
356# http://localhost:8080/wm/core/topology/links/json
357# http://localhost:8080/wm/registry/controllers/json
358# http://localhost:8080/wm/registry/switches/json"
359
360 def get_json(self, url):
361 '''
362 Helper functions used to parse the json output of a rest call
363 '''
364 try:
365 command = "curl -s %s" % (url)
366 result = os.popen(command).read()
367 parsedResult = json.loads(result)
368 except:
369 print "REST IF %s has issue" % command
370 parsedResult = ""
371
372 if type(parsedResult) == 'dict' and parsedResult.has_key('code'):
373 print "REST %s returned code %s" % (command, parsedResult['code'])
374 parsedResult = ""
375 return parsedResult
376
377 def check_switch(self,RestIP,correct_nr_switch ):
378 '''
379 Used by check_status
380 '''
381 buf = ""
382 retcode = 0
383 RestPort="8080"
384 url="http://%s:%s/wm/core/topology/switches/all/json" % (RestIP, RestPort)
385 parsedResult = self.get_json(url)
386 if parsedResult == "":
387 retcode = 1
388 return (retcode, "Rest API has an issue")
389 url = "http://%s:%s/wm/registry/switches/json" % (RestIP, RestPort)
390 registry = self.get_json(url)
391
392 if registry == "":
393 retcode = 1
394 return (retcode, "Rest API has an issue")
395
396 cnt = 0
397 active = 0
398
399 for s in parsedResult:
400 cnt += 1
401 if s['state'] == "ACTIVE":
402 active += 1
403
404 buf += "switch: network %d : %d switches %d active\n" % (0+1, cnt, active)
405 if correct_nr_switch != cnt:
406 buf += "switch fail: network %d should have %d switches but has %d\n" % (1, correct_nr_switch, cnt)
407 retcode = 1
408
409 if correct_nr_switch != active:
410 buf += "switch fail: network %d should have %d active switches but has %d\n" % (1, correct_nr_switch, active)
411 retcode = 1
412
413 return (retcode, buf)
414
415 def check_link(self,RestIP, nr_links):
416 '''
417 Used by check_status
418 '''
419 RestPort = "8080"
420 buf = ""
421 retcode = 0
422
423 url = "http://%s:%s/wm/core/topology/links/json" % (RestIP, RestPort)
424 parsedResult = self.get_json(url)
425
426 if parsedResult == "":
427 retcode = 1
428 return (retcode, "Rest API has an issue")
429
430 buf += "link: total %d links (correct : %d)\n" % (len(parsedResult), nr_links)
431 intra = 0
432 interlink=0
433
434 for s in parsedResult:
435 intra = intra + 1
436
437 if intra != nr_links:
438 buf += "link fail\n"
439 retcode = 1
440
441 return (retcode, buf)
442
443 def check_status_report(self, ip, numoswitch, numolink):
444 '''
445 Checks the number of swithes & links that ONOS sees against the supplied values.
446 Writes to the report log.
447 '''
448 main.log.info("Making some rest calls...")
449 switch = self.check_switch(ip, int(numoswitch))
450 link = self.check_link(ip, int(numolink))
451 value = switch[0]
452 value += link[0]
453 main.log.report( "\n-----\n%s%s-----\n" % ( switch[1], link[1]) )
454 if value != 0:
455 return 0
456 else:
457 # "PASS"
458 return 1
459
460 def check_status(self, ip, numoswitch, numolink):
461 '''
462 Checks the number of swithes & links that ONOS sees against the supplied values.
463 Writes to the main log.
464 '''
465 main.log.info("Making some rest calls...")
466 switch = self.check_switch(ip, int(numoswitch))
467 link = self.check_link(ip, int(numolink))
468 value = switch[0]
469 value += link[0]
470 main.log.info( "\n-----\n%s%s-----\n" % ( switch[1], link[1]) )
471 if value != 0:
472 return 0
473 else:
474 # "PASS"
475 return 1
476
477 def drop_keyspace(self):
478 '''
479 Drops the ONOS keyspace
480 '''
481 self.handle.sendline("~/ONOS/scripts/test-drop-keyspace.sh")
482 self.handle.expect("keyspace")
483 self.handle.sendline("")
484 self.handle.expect("\$")
485 self.handle.expect("\$")
486
487 def ctrl_none(self):
488 '''
489 Points all the mininet swithces to no controllers
490 *NOTE will only work if CLUSTER is set up on ONOS nodes
491 '''
492 self.execute(cmd="switch none", prompt="\$",timeout=10)
493
494 def ctrl_one(self, ip):
495 '''
496 Points all the mininet swithces to all controllers
497 *NOTE will only work if CLUSTER is set up on ONOS nodes
498 '''
499 self.execute(cmd="switch one", prompt="\$",timeout=10)
500
501 def check_for_no_exceptions(self):
502 '''
503 Used by CassndraCheck.py to scan ONOS logs for Exceptions
504 '''
admin530b4c92013-08-14 16:54:35 -0700505 self.handle.sendline("dsh 'grep Exception ~/ONOS/onos-logs/onos.*.log'")
adminbae64d82013-08-01 10:50:15 -0700506 self.handle.expect("\$ dsh")
507 self.handle.expect("\$")
508 output = self.handle.before
509 main.log.info( output )
510 if re.search("Exception",output):
511 return main.FALSE
512 else :
513 return main.TRUE
514
515 def git_pull(self):
516 '''
517 Stops the ONOS, pulls the latest code, and builds with mvn.
518 Assumes that "git pull" works without login
519 '''
520 main.log.info("Stopping onos")
521 self.stop()
522 self.handle.sendline("cd ~/ONOS")
523 self.handle.expect("ONOS\$")
524 self.handle.sendline("git pull")
admin530b4c92013-08-14 16:54:35 -0700525
526 uptodate = 0
adminbae64d82013-08-01 10:50:15 -0700527 i=self.handle.expect(['fatal','Username\sfor\s(.*):\s','Unpacking\sobjects',pexpect.TIMEOUT,'Already up-to-date','Aborting'],timeout=180)
528 if i==0:
529 main.log.error("Git pull had some issue...")
530 return main.FALSE
531 elif i==1:
532 main.log.error("Asking for username!!! BADD!")
533 return false
534
535 self.handle.expect('Password\sfor\s(.*):\s')
536 j = self.handle.expect(['Unpacking\sobjects','Already up-to-date'])
537 if j == 0:
538 main.log.info("pulling repository now")
539 elif j == 1:
540 main.log.info("Up to date!")
541 else:
542 main.log.error("something went wrong")
543 return main.FALSE
544 self.handle.expect("ONOS\$", 30)
545 elif i==2:
546 main.log.info("pulling repository now")
547 self.handle.expect("ONOS\$", 30)
548 elif i==3:
549 main.log.error("TIMEOUT")
550 return main.FALSE
551 elif i==4:
admin530b4c92013-08-14 16:54:35 -0700552 main.log.info("Already up to date")
553 uptodate = 1
adminbae64d82013-08-01 10:50:15 -0700554 elif i==5:
555 main.log.info("Aborting... Are there conflicting git files?")
556 return main.FALSE
557
admin530b4c92013-08-14 16:54:35 -0700558 '''
adminbae64d82013-08-01 10:50:15 -0700559 main.log.info("./setup-local-maven.sh")
560 self.handle.sendline("./setup-local-maven.sh")
561 self.handle.expect("local-maven.sh")
562 while 1:
563 i=self.handle.expect(['BUILD\sFAILURE','BUILD\sSUCCESS','ONOS\$',pexpect.TIMEOUT],timeout=90)
564 if i == 0:
565 main.log.error("Build failure!")
566 return main.FALSE
567 elif i == 1:
568 main.log.info("Build success!")
569 elif i == 2:
570 main.log.info("Build complete")
571 break;
572 elif i == 3:
573 main.log.error("TIMEOUT!")
574 return main.FALSE
admin530b4c92013-08-14 16:54:35 -0700575 '''
576 if uptodate == 0:
577 main.log.info("mvn clean")
578 self.handle.sendline("mvn clean")
579 while 1:
580 i=self.handle.expect(['BUILD\sFAILURE','BUILD\sSUCCESS','ONOS\$',pexpect.TIMEOUT],timeout=30)
581 if i == 0:
582 main.log.error("Build failure!")
583 return main.FALSE
584 elif i == 1:
585 main.log.info("Build success!")
586 elif i == 2:
587 main.log.info("Build complete")
588 break;
589 elif i == 3:
590 main.log.error("TIMEOUT!")
591 return main.FALSE
adminbae64d82013-08-01 10:50:15 -0700592
admin530b4c92013-08-14 16:54:35 -0700593 main.log.info("mvn compile")
594 self.handle.sendline("mvn compile")
595 while 1:
596 i=self.handle.expect(['BUILD\sFAILURE','BUILD\sSUCCESS','ONOS\$',pexpect.TIMEOUT],timeout=30)
597 if i == 0:
598 main.log.error("Build failure!")
599 return main.FALSE
600 elif i == 1:
601 main.log.info("Build success!")
602 elif i == 2:
603 main.log.info("Build complete")
604 break;
605 elif i == 3:
606 main.log.error("TIMEOUT!")
607 return main.FALSE
adminbae64d82013-08-01 10:50:15 -0700608