Fix a bug in onos rest driver
Change-Id: I6c3622ea0042ef44014efd33099b5bda8aac9a9b
diff --git a/TestON/drivers/common/api/controller/onosrestdriver.py b/TestON/drivers/common/api/controller/onosrestdriver.py
index 082ab17..15e1e88 100755
--- a/TestON/drivers/common/api/controller/onosrestdriver.py
+++ b/TestON/drivers/common/api/controller/onosrestdriver.py
@@ -1842,12 +1842,12 @@
else:
main.log.error( "Error with REST request, response was: " +
str( response ) )
- return main.FALSE
+ return main.FALSE, response
except NotImplementedError as e:
raise e # Inform the caller
except ( AttributeError, TypeError ):
main.log.exception( self.name + ": Object not as expected" )
- return None
+ return None, None
except Exception:
main.log.exception( self.name + ": Uncaught exception!" )
main.cleanup()
diff --git a/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py b/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py
index f1ffb9b..183a3e6 100755
--- a/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py
+++ b/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py
@@ -344,15 +344,20 @@
main.addedBatchList = []
q = Queue()
tAllAdded = 0
+ main.postFailed = False
def postWorker(id):
while True:
item = q.get()
#print json.dumps(item)
status,response = main.ONOSrest.sendFlowBatch(batch = item)
- main.log.info("Thread {} is working on posting. ".format(id))
- #print json.dumps(response)
- main.addedBatchList.append(response[1])
+ if status == main.TRUE:
+ main.log.info("Thread {} is working on posting. ".format(id))
+ #print json.dumps(response)
+ main.addedBatchList.append(response[1])
+ else:
+ main.log.error( "Thread {} failed to post.".format(id) )
+ main.postFailed = True
q.task_done()
for i in range( int( main.params['CASE2100']['numThreads'])):
@@ -367,6 +372,10 @@
q.join()
tLastPostEnd = time.time()
+ if main.postFailed:
+ main.log.error( "Flow batch posting failed, exit test" )
+ main.cleanup()
+ main.exit()
main.step("Check to ensure all flows are in added state.")
#pprint(main.addedBatchList)