Add logging to onos rest driver
Change-Id: Idf3a384b8f7f6e625b9265bef7b0146eab00afec
diff --git a/TestON/drivers/common/api/controller/onosrestdriver.py b/TestON/drivers/common/api/controller/onosrestdriver.py
index 5ab27a7..c2ce59e 100755
--- a/TestON/drivers/common/api/controller/onosrestdriver.py
+++ b/TestON/drivers/common/api/controller/onosrestdriver.py
@@ -118,11 +118,16 @@
method.upper() + " method." )
if debug:
main.log.debug( self.name + ": request data: " + str( data ) )
+ self.log( "Sending %s to %s with %s\n" % ( method.upper(),
+ path,
+ self.pprint( data ) ) )
response = requests.request( method.upper(),
path,
params=query,
data=data,
auth=auth )
+ self.log( "Received %s code with body: %s\n" % ( response.status_code,
+ self.pprint( response.text.encode( 'utf8' ) ) ) )
if debug:
main.log.debug( response )
return ( response.status_code, response.text.encode( 'utf8' ) )
@@ -1913,7 +1918,6 @@
The ip and port option are for the requests input's ip and port
of the ONOS node
"""
- # from pprint import pprint
flowJsonList = []
flowJsonBatch = { "flows": flowJsonList }
@@ -2008,12 +2012,10 @@
flowJson[ 'selector' ][ 'criteria' ].append( {
"type": "IP_PROTO",
"protocol": ipProto } )
- # pprint(flowJson)
flowJsonList.append( flowJson )
main.log.info( self.name + ": Number of flows in batch: " + str( len( flowJsonList ) ) )
flowJsonBatch[ 'flows' ] = flowJsonList
- # pprint(flowJsonBatch)
return flowJsonBatch