blob: 4861e0557095592370101ca6dc5f4e757c770e9e [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
admine0ae8202013-08-28 11:51:43 -070079
80 def start_embedded(self):
81 self.handle.sendline("")
82 self.handle.expect("\$")
83 self.handle.sendline("~/ONOS/start-onos-embedded.sh start")
84 try:
85 self.handle.expect("start...")
86 main.log.info("Embedded ONOS started")
87 except:
88 main.log.info("Embedded ONOS failed to start")
89
adminbae64d82013-08-01 10:50:15 -070090 def link_down(self, **linkParams):
91 '''
92 Specifically used for the ONOS demo on the HW.
93 Should be replaced by actual switch drivers in the future.
94 '''
95 args = utilities.parse_args(["SDPID","SPORT","DDPID","DPORT"], **linkParams)
96 sdpid = args["SDPID"] if args["SDPID"] != None else "00:00:00:00:ba:5e:ba:13"
97 sport = args["SPORT"] if args["SPORT"] != None else "22"
98 ddpid = args["DDPID"] if args["DDPID"] != None else "00:00:20:4e:7f:51:8a:35"
99 dport = args["DPORT"] if args["DPORT"] != None else "22"
100
101 cmd = "curl -s 10.128.4.11:9000/gui/link/down/" + sdpid + "/" + sport + "/" + ddpid + "/" + dport + " > /tmp/log &"
102 os.popen( cmd )
103
104 def link_up(self, **linkParams):
105 '''
106 Specifically used for the ONOS demo on the HW.
107 Should be replaced by actual switch drivers in the future.
108 '''
109 args = utilities.parse_args(["SDPID","SPORT","DDPID","DPORT"], **linkParams)
110 sdpid = args["SDPID"] if args["SDPID"] != None else "00:00:00:00:ba:5e:ba:13"
111 sport = args["SPORT"] if args["SPORT"] != None else "22"
112 ddpid = args["DDPID"] if args["DDPID"] != None else "00:00:20:4e:7f:51:8a:35"
113 dport = args["DPORT"] if args["DPORT"] != None else "22"
114
115 cmd = "curl -s 10.128.4.11:9000/gui/link/up/" + sdpid + "/" + sport + "/" + ddpid + "/" + dport + " > /tmp/log &"
116 os.popen( cmd )
117
118 def start_rest(self):
119 '''
120 Starts the rest server on ONOS.
121 '''
admin530b4c92013-08-14 16:54:35 -0700122 response = self.execute(cmd="~/ONOS/start-rest.sh start",prompt="\$",timeout=10)
adminbae64d82013-08-01 10:50:15 -0700123 if re.search("admin",response):
124 main.log.info("Rest Server Started Successfully")
125 time.sleep(5)
126 return main.TRUE
127 else :
128 main.log.warn("Failed to start Rest Server")
129 return main.FALSE
130
131 def status(self):
132 '''
133 Called start-onos.sh status and returns TRUE/FALSE accordingly
134 '''
135 self.execute(cmd="\r",prompt="\$",timeout=10)
136 response = self.execute(cmd="~/ONOS/start-onos.sh status ",prompt="\d+\sinstance\sof\sonos\srunning",timeout=10)
137 self.execute(cmd="\r",prompt="\$",timeout=10)
138 if re.search("1\sinstance\sof\sonos\srunning",response):
139 return main.TRUE
140 elif re.search("0\sinstance\sof\sonos\srunning",response):
141 return main.FALSE
142 else :
143 return main.FALSE
144
145 def isup(self):
146 '''
147 A more complete check to see if ONOS is up and running properly.
148 First, it checks if the process is up.
149 Second, it reads the logs for "Exception: Connection refused"
150 Third, it makes sure the logs are actually moving.
151 returns TRUE/FALSE accordingly.
152 '''
153 self.execute(cmd="\r",prompt="\$",timeout=10)
154 response = self.execute(cmd="~/ONOS/start-onos.sh status ",prompt="running",timeout=10)
155 self.execute(cmd="\r",prompt="\$",timeout=10)
156 tail1 = self.execute(cmd="tail ~/ONOS/onos-logs/onos.*.log",prompt="\$",timeout=10)
157 time.sleep(2)
158 self.execute(cmd="\r",prompt="\$",timeout=10)
159 tail2 = self.execute(cmd="tail ~/ONOS/onos-logs/onos.*.log",prompt="\$",timeout=10)
160 pattern = '(.*)1 instance(.*)'
161 pattern2 = '(.*)Exception: Connection refused(.*)'
162 if utilities.assert_matches(expect=pattern,actual=response,onpass="ONOS process is running...",onfail="ONOS process not running..."):
163 if tail1 == tail2:
164 main.log.error("ONOS is frozen...")
165 return main.FALSE
166 elif re.search( pattern2,tail1 ):
167 main.log.info("Connection Refused found in onos log")
168 return main.FALSE
169 elif re.search( pattern2,tail2 ):
170 main.log.info("Connection Refused found in onos log")
171 return main.FALSE
172 else:
173 main.log.info("Onos log is moving! It's looking good!")
174 return main.TRUE
175 else:
176 return main.FALSE
177
178
179 def rest_status(self):
180 '''
181 Checks if the rest server is running.
182 '''
183 response = self.execute(cmd="~/ONOS/start-rest.sh status ",prompt="running",timeout=10)
184 if re.search("rest\sserver\sis\srunning",response):
185 main.log.info("Rest Server is running")
186 elif re.search("rest\sserver\sis\snot\srunning",response):
187 main.log.warn("Rest Server is not Running")
188 else :
189 main.log.error("No response" +response)
190 self.execute(cmd="\r",prompt="\$",timeout=10)
191
192 return response
193
194 def stop(self):
195 '''
196 Runs ./start-onos.sh stop to stop ONOS
197 '''
198 self.handle.sendline("")
199 self.handle.expect("\$")
admin530b4c92013-08-14 16:54:35 -0700200 self.handle.sendline("~/ONOS/start-onos.sh stop")
adminbae64d82013-08-01 10:50:15 -0700201 self.handle.expect("stop", 2)
adminaeedddd2013-08-02 15:14:15 -0700202 result = self.handle.before
admin530b4c92013-08-14 16:54:35 -0700203 self.handle.expect("\$", 60)
adminaeedddd2013-08-02 15:14:15 -0700204 if re.search("Killed", result):
adminbae64d82013-08-01 10:50:15 -0700205 main.log.info("ONOS Killed Successfully")
206 return main.TRUE
207 else :
208 main.log.warn("ONOS wasn't running")
209 return main.FALSE
210
211 def rest_stop(self):
212 '''
213 Runs ./start-rest.sh stop to stop ONOS rest server
214 '''
215 response = self.execute(cmd="~/ONOS/start-rest.sh stop ",prompt="killing",timeout=10)
216 self.execute(cmd="\r",prompt="\$",timeout=10)
217 if re.search("killing", response):
218 main.log.info("Rest Server Stopped")
219 return main.TRUE
220 else :
221 main.log.error("Failed to Stop, Rest Server is not Running")
222 return main.FALSE
223
224 def disconnect(self):
225 '''
adminaeedddd2013-08-02 15:14:15 -0700226 Called when Test is complete to disconnect the ONOS handle.
adminbae64d82013-08-01 10:50:15 -0700227 '''
adminaeedddd2013-08-02 15:14:15 -0700228 response = ''
229 try:
adminbae64d82013-08-01 10:50:15 -0700230 self.handle.sendline("exit")
adminaeedddd2013-08-02 15:14:15 -0700231 self.handle.expect("closed")
232 except:
adminbae64d82013-08-01 10:50:15 -0700233 main.log.error("Connection failed to the host")
234 response = main.FALSE
adminaeedddd2013-08-02 15:14:15 -0700235 return response
236
adminbae64d82013-08-01 10:50:15 -0700237 def get_version(self):
238 '''
239 Writes the COMMIT number to the report to be parsed by Jenkins data collecter.
240 '''
241 self.handle.sendline("cat /home/admin/ONOS/.git/ORIG_HEAD")
242 self.handle.expect("ORIG_HEAD")
243 self.handle.expect("\$")
244 main.log.report( "COMMIT: " + str(self.handle.before + self.handle.after))
245
246 def add_flow(self, path):
247 '''
248 Copies the flowdef file from TestStation -> ONOS machine
249 Then runs ./add_flow.py to add the flows to ONOS
250 '''
251 main.log.info("Adding Flows...")
252 self.handle.sendline("scp admin@10.128.7.7:%s /tmp/flowtmp" % path)
253 self.handle.expect("100%")
254 self.handle.expect("\$", 30)
255 self.handle.sendline("~/ONOS/web/add_flow.py -m onos -f /tmp/flowtmp")
256 self.handle.expect("add_flow")
257 self.handle.expect("\$", 1000)
258 main.log.info("Flows added")
259
260 def delete_flow(self, *delParams):
261 '''
262 Deletes a specific flow, a range of flows, or all flows.
263 '''
264 if len(delParams)==1:
265 if str(delParams[0])=="all":
266 main.log.info("Deleting ALL flows...")
267 #self.execute(cmd="~/ONOS/scripts/TestON_delete_flow.sh all",prompt="done",timeout=150)
268 self.handle.sendline("~/ONOS/web/delete_flow.py all")
269 self.handle.expect("delete_flow")
270 self.handle.expect("\$",1000)
271 self.handle.sendline("~/ONOS/web/clear_flow.py all")
272 self.handle.expect("clear_flow")
273 self.handle.expect("\$",1000)
274 main.log.info("Flows deleted")
275 else:
276 main.log.info("Deleting flow "+str(delParams[0])+"...")
277 #self.execute(cmd="~/ONOS/scripts/TestON_delete_flow.sh "+str(delParams[0]),prompt="done",timeout=150)
278 #self.execute(cmd="\n",prompt="\$",timeout=60)
279 self.handle.sendline("~/ONOS/web/delete_flow.py %d" % int(delParams[0]))
280 self.handle.expect("delete_flow")
281 self.handle.expect("\$",60)
282 self.handle.sendline("~/ONOS/web/clear_flow.py %d" % int(delParams[0]))
283 self.handle.expect("clear_flow")
284 self.handle.expect("\$",60)
285 main.log.info("Flow deleted")
286 elif len(delParams)==2:
287 main.log.info("Deleting flows "+str(delParams[0])+" through "+str(delParams[1])+"...")
288 #self.execute(cmd="~/ONOS/scripts/TestON_delete_flow.sh "+str(delParams[0])+" "+str(delParams[1]),prompt="done",timeout=150)
289 #self.execute(cmd="\n",prompt="\$",timeout=60)
290 self.handle.sendline("~/ONOS/web/delete_flow.py %d %d" % (int(delParams[0]), int(delParams[1])))
291 self.handle.expect("delete_flow")
292 self.handle.expect("\$",600)
293 self.handle.sendline("~/ONOS/web/clear_flow.py %d %d" % (int(delParams[0]), int(delParams[1])))
294 self.handle.expect("clear_flow")
295 self.handle.expect("\$",600)
296 main.log.info("Flows deleted")
297
298 def check_flow(self):
299 '''
300 Calls the ./get_flow.py all and checks:
301 - If each FlowPath has at least one FlowEntry
302 - That there are no "NOT"s found
303 returns TRUE/FALSE
304 '''
305 flowEntryDetect = 1
306 count = 0
307 self.handle.sendline("clear")
308 time.sleep(1)
309 self.handle.sendline("~/ONOS/web/get_flow.py all")
310 self.handle.expect("get_flow")
311 while 1:
312 i=self.handle.expect(['FlowPath','FlowEntry','NOT','\$',pexpect.TIMEOUT],timeout=180)
313 if i==0:
314 count = count + 1
315 if flowEntryDetect == 0:
316 main.log.info("FlowPath without FlowEntry")
317 return main.FALSE
318 else:
319 flowEntryDetect = 0
320 elif i==1:
321 flowEntryDetect = 1
322 elif i==2:
323 main.log.error("Found a NOT")
324 return main.FALSE
325 elif i==3:
326 if count == 0:
327 main.log.info("There don't seem to be any flows here...")
328 return main.FALSE
329 else:
330 main.log.info("All flows pass")
331 main.log.info("Number of FlowPaths: "+str(count))
332 return main.TRUE
333 elif i==4:
334 main.log.error("Command Timeout!")
335 return main.FALSE
336
337 def get_flow(self, *flowParams):
338 '''
339 Returns verbose output of ./get_flow.py
340 '''
341 if len(flowParams)==1:
342 if str(flowParams[0])=="all":
343 self.execute(cmd="\n",prompt="\$",timeout=60)
344 main.log.info("Getting all flow data...")
345 data = self.execute(cmd="~/ONOS/scripts/TestON_get_flow.sh all",prompt="done",timeout=150)
346 self.execute(cmd="\n",prompt="\$",timeout=60)
347 return data
348 else:
349 main.log.info("Retrieving flow "+str(flowParams[0])+" data...")
350 data = self.execute(cmd="~/ONOS/scripts/TestON_get_flow.sh "+str(flowParams[0]),prompt="done",timeout=150)
351 self.execute(cmd="\n",prompt="\$",timeout=60)
352 return data
353 elif len(flowParams)==5:
354 main.log.info("Retrieving flow installer data...")
355 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)
356 self.execute(cmd="\n",prompt="\$",timeout=60)
357 return data
358 elif len(flowParams)==4:
359 main.log.info("Retrieving flow endpoints...")
360 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)
361 self.execute(cmd="\n",prompt="\$",timeout=60)
362 return data
363
364
365# http://localhost:8080/wm/core/topology/switches/all/json
366# http://localhost:8080/wm/core/topology/links/json
367# http://localhost:8080/wm/registry/controllers/json
368# http://localhost:8080/wm/registry/switches/json"
369
370 def get_json(self, url):
371 '''
372 Helper functions used to parse the json output of a rest call
373 '''
374 try:
375 command = "curl -s %s" % (url)
376 result = os.popen(command).read()
377 parsedResult = json.loads(result)
378 except:
379 print "REST IF %s has issue" % command
380 parsedResult = ""
381
382 if type(parsedResult) == 'dict' and parsedResult.has_key('code'):
383 print "REST %s returned code %s" % (command, parsedResult['code'])
384 parsedResult = ""
385 return parsedResult
386
387 def check_switch(self,RestIP,correct_nr_switch ):
388 '''
389 Used by check_status
390 '''
391 buf = ""
392 retcode = 0
393 RestPort="8080"
394 url="http://%s:%s/wm/core/topology/switches/all/json" % (RestIP, RestPort)
395 parsedResult = self.get_json(url)
396 if parsedResult == "":
397 retcode = 1
398 return (retcode, "Rest API has an issue")
399 url = "http://%s:%s/wm/registry/switches/json" % (RestIP, RestPort)
400 registry = self.get_json(url)
401
402 if registry == "":
403 retcode = 1
404 return (retcode, "Rest API has an issue")
405
406 cnt = 0
407 active = 0
408
409 for s in parsedResult:
410 cnt += 1
411 if s['state'] == "ACTIVE":
412 active += 1
413
414 buf += "switch: network %d : %d switches %d active\n" % (0+1, cnt, active)
415 if correct_nr_switch != cnt:
416 buf += "switch fail: network %d should have %d switches but has %d\n" % (1, correct_nr_switch, cnt)
417 retcode = 1
418
419 if correct_nr_switch != active:
420 buf += "switch fail: network %d should have %d active switches but has %d\n" % (1, correct_nr_switch, active)
421 retcode = 1
422
423 return (retcode, buf)
424
425 def check_link(self,RestIP, nr_links):
426 '''
427 Used by check_status
428 '''
429 RestPort = "8080"
430 buf = ""
431 retcode = 0
432
433 url = "http://%s:%s/wm/core/topology/links/json" % (RestIP, RestPort)
434 parsedResult = self.get_json(url)
435
436 if parsedResult == "":
437 retcode = 1
438 return (retcode, "Rest API has an issue")
439
440 buf += "link: total %d links (correct : %d)\n" % (len(parsedResult), nr_links)
441 intra = 0
442 interlink=0
443
444 for s in parsedResult:
445 intra = intra + 1
446
447 if intra != nr_links:
448 buf += "link fail\n"
449 retcode = 1
450
451 return (retcode, buf)
452
453 def check_status_report(self, ip, numoswitch, numolink):
454 '''
455 Checks the number of swithes & links that ONOS sees against the supplied values.
456 Writes to the report log.
457 '''
458 main.log.info("Making some rest calls...")
459 switch = self.check_switch(ip, int(numoswitch))
460 link = self.check_link(ip, int(numolink))
461 value = switch[0]
462 value += link[0]
463 main.log.report( "\n-----\n%s%s-----\n" % ( switch[1], link[1]) )
464 if value != 0:
465 return 0
466 else:
467 # "PASS"
468 return 1
469
470 def check_status(self, ip, numoswitch, numolink):
471 '''
472 Checks the number of swithes & links that ONOS sees against the supplied values.
473 Writes to the main log.
474 '''
475 main.log.info("Making some rest calls...")
476 switch = self.check_switch(ip, int(numoswitch))
477 link = self.check_link(ip, int(numolink))
478 value = switch[0]
479 value += link[0]
480 main.log.info( "\n-----\n%s%s-----\n" % ( switch[1], link[1]) )
481 if value != 0:
482 return 0
483 else:
484 # "PASS"
485 return 1
486
487 def drop_keyspace(self):
488 '''
489 Drops the ONOS keyspace
490 '''
491 self.handle.sendline("~/ONOS/scripts/test-drop-keyspace.sh")
492 self.handle.expect("keyspace")
493 self.handle.sendline("")
494 self.handle.expect("\$")
495 self.handle.expect("\$")
496
497 def ctrl_none(self):
498 '''
499 Points all the mininet swithces to no controllers
500 *NOTE will only work if CLUSTER is set up on ONOS nodes
501 '''
502 self.execute(cmd="switch none", prompt="\$",timeout=10)
503
504 def ctrl_one(self, ip):
505 '''
506 Points all the mininet swithces to all controllers
507 *NOTE will only work if CLUSTER is set up on ONOS nodes
508 '''
509 self.execute(cmd="switch one", prompt="\$",timeout=10)
510
511 def check_for_no_exceptions(self):
512 '''
513 Used by CassndraCheck.py to scan ONOS logs for Exceptions
514 '''
admin530b4c92013-08-14 16:54:35 -0700515 self.handle.sendline("dsh 'grep Exception ~/ONOS/onos-logs/onos.*.log'")
adminbae64d82013-08-01 10:50:15 -0700516 self.handle.expect("\$ dsh")
517 self.handle.expect("\$")
518 output = self.handle.before
519 main.log.info( output )
520 if re.search("Exception",output):
521 return main.FALSE
522 else :
523 return main.TRUE
524
525 def git_pull(self):
526 '''
527 Stops the ONOS, pulls the latest code, and builds with mvn.
528 Assumes that "git pull" works without login
529 '''
530 main.log.info("Stopping onos")
531 self.stop()
532 self.handle.sendline("cd ~/ONOS")
533 self.handle.expect("ONOS\$")
534 self.handle.sendline("git pull")
admin530b4c92013-08-14 16:54:35 -0700535
536 uptodate = 0
adminbae64d82013-08-01 10:50:15 -0700537 i=self.handle.expect(['fatal','Username\sfor\s(.*):\s','Unpacking\sobjects',pexpect.TIMEOUT,'Already up-to-date','Aborting'],timeout=180)
538 if i==0:
539 main.log.error("Git pull had some issue...")
540 return main.FALSE
541 elif i==1:
542 main.log.error("Asking for username!!! BADD!")
543 return false
544
545 self.handle.expect('Password\sfor\s(.*):\s')
546 j = self.handle.expect(['Unpacking\sobjects','Already up-to-date'])
547 if j == 0:
548 main.log.info("pulling repository now")
549 elif j == 1:
550 main.log.info("Up to date!")
551 else:
552 main.log.error("something went wrong")
553 return main.FALSE
554 self.handle.expect("ONOS\$", 30)
555 elif i==2:
556 main.log.info("pulling repository now")
557 self.handle.expect("ONOS\$", 30)
558 elif i==3:
559 main.log.error("TIMEOUT")
560 return main.FALSE
561 elif i==4:
admin530b4c92013-08-14 16:54:35 -0700562 main.log.info("Already up to date")
563 uptodate = 1
adminbae64d82013-08-01 10:50:15 -0700564 elif i==5:
565 main.log.info("Aborting... Are there conflicting git files?")
566 return main.FALSE
567
admin530b4c92013-08-14 16:54:35 -0700568 '''
adminbae64d82013-08-01 10:50:15 -0700569 main.log.info("./setup-local-maven.sh")
570 self.handle.sendline("./setup-local-maven.sh")
571 self.handle.expect("local-maven.sh")
572 while 1:
573 i=self.handle.expect(['BUILD\sFAILURE','BUILD\sSUCCESS','ONOS\$',pexpect.TIMEOUT],timeout=90)
574 if i == 0:
575 main.log.error("Build failure!")
576 return main.FALSE
577 elif i == 1:
578 main.log.info("Build success!")
579 elif i == 2:
580 main.log.info("Build complete")
581 break;
582 elif i == 3:
583 main.log.error("TIMEOUT!")
584 return main.FALSE
admin530b4c92013-08-14 16:54:35 -0700585 '''
586 if uptodate == 0:
587 main.log.info("mvn clean")
588 self.handle.sendline("mvn clean")
589 while 1:
590 i=self.handle.expect(['BUILD\sFAILURE','BUILD\sSUCCESS','ONOS\$',pexpect.TIMEOUT],timeout=30)
591 if i == 0:
592 main.log.error("Build failure!")
593 return main.FALSE
594 elif i == 1:
595 main.log.info("Build success!")
596 elif i == 2:
597 main.log.info("Build complete")
598 break;
599 elif i == 3:
600 main.log.error("TIMEOUT!")
601 return main.FALSE
adminbae64d82013-08-01 10:50:15 -0700602
admin530b4c92013-08-14 16:54:35 -0700603 main.log.info("mvn compile")
604 self.handle.sendline("mvn compile")
605 while 1:
606 i=self.handle.expect(['BUILD\sFAILURE','BUILD\sSUCCESS','ONOS\$',pexpect.TIMEOUT],timeout=30)
607 if i == 0:
608 main.log.error("Build failure!")
609 return main.FALSE
610 elif i == 1:
611 main.log.info("Build success!")
612 elif i == 2:
613 main.log.info("Build complete")
614 break;
615 elif i == 3:
616 main.log.error("TIMEOUT!")
617 return main.FALSE
adminbae64d82013-08-01 10:50:15 -0700618