[ONOS-7104]: Style fixes to the drivers directory in TestON

Change-Id: Ie151a956c15f1b1cc6ebc09a2e7474f8e4066459
diff --git a/TestON/drivers/common/api/controller/onosrestdriver.py b/TestON/drivers/common/api/controller/onosrestdriver.py
index 312f1f1..cf3eec6 100755
--- a/TestON/drivers/common/api/controller/onosrestdriver.py
+++ b/TestON/drivers/common/api/controller/onosrestdriver.py
@@ -48,7 +48,7 @@
         except Exception as e:
             main.log.exception( e )
         try:
-            if os.getenv( str( self.ip_address ) ) != None:
+            if os.getenv( str( self.ip_address ) ) is not None:
                 self.ip_address = os.getenv( str( self.ip_address ) )
             else:
                 main.log.info( self.name + ": ip set to " + self.ip_address )
@@ -74,7 +74,7 @@
             if isinstance( jsonObject, str ):
                 jsonObject = json.loads( jsonObject )
             return json.dumps( jsonObject, sort_keys=True,
-                               indent=4, separators=(',', ': '))
+                               indent=4, separators=( ',', ': ' ) )
         except ( TypeError, ValueError ):
             main.log.exception( "Error parsing jsonObject" )
             return None
@@ -99,20 +99,20 @@
         # TODO: Do we need to allow for other protocols besides http?
         # ANSWER: Not yet, but potentially https with certificates
         if ip == "DEFAULT":
-                main.log.warn( "No ip given, reverting to ip from topo file" )
-                ip = self.ip_address
+            main.log.warn( "No ip given, reverting to ip from topo file" )
+            ip = self.ip_address
         if port == "DEFAULT":
-                main.log.warn( "No port given, reverting to port " +
-                               "from topo file" )
-                port = self.port
+            main.log.warn( "No port given, reverting to port " +
+                           "from topo file" )
+            port = self.port
 
         try:
             path = "http://" + str( ip ) + ":" + str( port ) + base + url
             if self.user_name and self.pwd:
-                main.log.info("user/passwd is: " + self.user_name + "/" + self.pwd)
-                auth = (self.user_name, self.pwd)
+                main.log.info( "user/passwd is: " + self.user_name + "/" + self.pwd )
+                auth = ( self.user_name, self.pwd )
             else:
-                auth=None
+                auth = None
             main.log.info( "Sending request " + path + " using " +
                            method.upper() + " method." )
             response = requests.request( method.upper(),
@@ -273,7 +273,7 @@
             query = "/" + str( appName ) + "/active"
             response = self.send( method="POST",
                                   url="/applications" + query,
-                                  ip = ip, port = port)
+                                  ip = ip, port = port )
             if response:
                 output = response[ 1 ]
                 app = json.loads( output )
@@ -414,17 +414,17 @@
             error on requests; Returns None for exceptions
         """
         try:
-            intentJson = {"two": str( hostIdTwo ),
-                          "selector": {"criteria": []}, "priority": 7,
-                          "treatment": {"deferred": [], "instructions": []},
-                          "appId": appId, "one": str( hostIdOne ),
-                          "type": "HostToHostIntent",
-                          "constraints": [{"type": "LinkTypeConstraint",
-                                           "types": ["OPTICAL"],
-                                           "inclusive": 'false' }]}
+            intentJson = { "two": str( hostIdTwo ),
+                           "selector": { "criteria": [] }, "priority": 7,
+                           "treatment": { "deferred": [], "instructions": [] },
+                           "appId": appId, "one": str( hostIdOne ),
+                           "type": "HostToHostIntent",
+                           "constraints": [ { "type": "LinkTypeConstraint",
+                                              "types": [ "OPTICAL" ],
+                                              "inclusive": 'false' } ] }
             if vlanId:
-                intentJson[ 'selector' ][ 'criteria' ].append( { "type":"VLAN_VID",
-                                                                 "vlanId":vlanId } )
+                intentJson[ 'selector' ][ 'criteria' ].append( { "type": "VLAN_VID",
+                                                                 "vlanId": vlanId } )
             output = None
             if ip == "DEFAULT":
                 main.log.warn( "No ip given, reverting to ip from topo file" )
@@ -520,63 +520,63 @@
                     main.log.debug( self.name + ": Egress port not specified" )
                     return main.FALSE
 
-            intentJson ={ "ingressPoint": { "device": ingressDevice,
-                                           "port": ingressPort },
-                          "selector": { "criteria": [] },
-                          "priority": 55,
-                          "treatment": { "deferred": [],
-                                         "instructions": [] },
-                          "egressPoint": { "device": egressDevice,
-                                           "port": egressPort },
-                          "appId": appId,
-                          "type": "PointToPointIntent",
-                          "constraints": [ { "type": "LinkTypeConstraint",
-                                             "types": [ "OPTICAL" ],
-                                             "inclusive": "false" } ] }
+            intentJson = { "ingressPoint": { "device": ingressDevice,
+                                             "port": ingressPort },
+                           "selector": { "criteria": [] },
+                           "priority": 55,
+                           "treatment": { "deferred": [],
+                                          "instructions": [] },
+                           "egressPoint": { "device": egressDevice,
+                                            "port": egressPort },
+                           "appId": appId,
+                           "type": "PointToPointIntent",
+                           "constraints": [ { "type": "LinkTypeConstraint",
+                                              "types": [ "OPTICAL" ],
+                                              "inclusive": "false" } ] }
 
             # if protected:
             #     intentJson['constraints'].append( { "type": "Protection", "types": ["Protection"], "inclusive": "true" } )
 
             if ethType == "IPV4":
                 intentJson[ 'selector' ][ 'criteria' ].append( {
-                                                         "type":"ETH_TYPE",
-                                                         "ethType":2048 } )
+                                                         "type": "ETH_TYPE",
+                                                         "ethType": 2048 } )
             elif ethType:
                 intentJson[ 'selector' ][ 'criteria' ].append( {
-                                                         "type":"ETH_TYPE",
-                                                         "ethType":ethType } )
+                                                         "type": "ETH_TYPE",
+                                                         "ethType": ethType } )
 
             if ethSrc:
                 intentJson[ 'selector' ][ 'criteria' ].append(
-                                                       { "type":"ETH_SRC",
-                                                         "mac":ethSrc } )
+                                                       { "type": "ETH_SRC",
+                                                         "mac": ethSrc } )
             if ethDst:
                 intentJson[ 'selector' ][ 'criteria' ].append(
-                                                       { "type":"ETH_DST",
-                                                         "mac":ethDst } )
+                                                       { "type": "ETH_DST",
+                                                         "mac": ethDst } )
             if ipSrc:
                 intentJson[ 'selector' ][ 'criteria' ].append(
-                                                       { "type":"IPV4_SRC",
-                                                         "ip":ipSrc } )
+                                                       { "type": "IPV4_SRC",
+                                                         "ip": ipSrc } )
             if ipDst:
                 intentJson[ 'selector' ][ 'criteria' ].append(
-                                                       { "type":"IPV4_DST",
-                                                         "ip":ipDst } )
+                                                       { "type": "IPV4_DST",
+                                                         "ip": ipDst } )
             if tcpSrc:
                 intentJson[ 'selector' ][ 'criteria' ].append(
-                                                       { "type":"TCP_SRC",
+                                                       { "type": "TCP_SRC",
                                                          "tcpPort": tcpSrc } )
             if tcpDst:
                 intentJson[ 'selector' ][ 'criteria' ].append(
-                                                       { "type":"TCP_DST",
+                                                       { "type": "TCP_DST",
                                                          "tcpPort": tcpDst } )
             if ipProto:
                 intentJson[ 'selector' ][ 'criteria' ].append(
-                                                       { "type":"IP_PROTO",
+                                                       { "type": "IP_PROTO",
                                                          "protocol": ipProto } )
             if vlanId:
                 intentJson[ 'selector' ][ 'criteria' ].append(
-                                                       { "type":"VLAN_VID",
+                                                       { "type": "VLAN_VID",
                                                          "vlanId": vlanId } )
 
             # TODO: Bandwidth and Lambda will be implemented if needed
@@ -613,26 +613,26 @@
             main.log.exception( self.name + ": Uncaught exception!" )
             main.cleanAndExit()
 
-    def addSinglepointToMultipointIntent(self,
-                       ingressDevice,
-                       egressDeviceList,
-                       portEgressList,
-                       appId='org.onosproject.cli',
-                       portIngress="",
-                       ethType="",
-                       ethSrc="",
-                       ethDst="",
-                       bandwidth="",
-                       lambdaAlloc=False,
-                       ipProto="",
-                       ipSrc="",
-                       ipDst="",
-                       tcpSrc="",
-                       tcpDst="",
-                       partial=False,
-                       ip="DEFAULT",
-                       port="DEFAULT",
-                       vlanId="" ):
+    def addSinglepointToMultipointIntent( self,
+                                          ingressDevice,
+                                          egressDeviceList,
+                                          portEgressList,
+                                          appId='org.onosproject.cli',
+                                          portIngress="",
+                                          ethType="",
+                                          ethSrc="",
+                                          ethDst="",
+                                          bandwidth="",
+                                          lambdaAlloc=False,
+                                          ipProto="",
+                                          ipSrc="",
+                                          ipDst="",
+                                          tcpSrc="",
+                                          tcpDst="",
+                                          partial=False,
+                                          ip="DEFAULT",
+                                          port="DEFAULT",
+                                          vlanId="" ):
         """
         Description:
             Adds a point-to-multi point intent ( uni-directional ) by
@@ -694,7 +694,7 @@
                            "appId": appId,
                            "type": "SinglePointToMultiPointIntent",
                            "constraints": [ { "type": "LinkTypeConstraint",
-                                              "types": ["OPTICAL"],
+                                              "types": [ "OPTICAL" ],
                                               "inclusive": "false" } ] }
 
             index = 0
@@ -752,16 +752,16 @@
                                "from topo file" )
                 port = self.port
             response = self.send( method="POST",
-                                 url="/intents", ip=ip, port=port,
-                                 data=json.dumps( intentJson ) )
+                                  url="/intents", ip=ip, port=port,
+                                  data=json.dumps( intentJson ) )
 
-            main.log.debug(intentJson)
+            main.log.debug( intentJson )
 
             if response:
                 if "201" in str( response[ 0 ] ):
                     main.log.info( self.name + ": Successfully POST point" +
                                    " intent between ingress: " + ingressDevice +
-                                   " and egress: " + str(egressDeviceList) + " devices" )
+                                   " and egress: " + str( egressDeviceList ) + " devices" )
                     return main.TRUE
                 else:
                     main.log.error( "Error with REST request, response was: " + str( response ) )
@@ -834,7 +834,7 @@
             main.log.exception( self.name + ": Uncaught exception!" )
             main.cleanAndExit()
 
-    def removeAllIntents( self, intentIdList ='ALL',appId='org.onosproject.cli',
+    def removeAllIntents( self, intentIdList ='ALL', appId='org.onosproject.cli',
                           ip="DEFAULT", port="DEFAULT", delay=5 ):
         """
         Description:
@@ -864,7 +864,7 @@
                 import time
                 time.sleep( delay )
                 intentRemain = len( json.loads( self.intents() ) )
-                if all( result==main.TRUE for result in results ) and \
+                if all( result == main.TRUE for result in results ) and \
                    intentRemain == 0:
                     main.log.info( self.name + ": All intents are removed " )
                     return main.TRUE
@@ -947,10 +947,10 @@
             query = "/" + mac + "/" + vlan
             response = self.send( url="/hosts" + query, ip = ip, port = port )
             if response:
-            # NOTE: What if the person wants other values? would it be better
-            # to have a function that gets a key and return a value instead?
-            # This function requires mac and vlan and returns an ID which
-            # makes this current function useless
+                # NOTE: What if the person wants other values? would it be better
+                # to have a function that gets a key and return a value instead?
+                # This function requires mac and vlan and returns an ID which
+                # makes this current function useless
                 if 200 <= response[ 0 ] <= 299:
                     output = response[ 1 ]
                     hostId = json.loads( output ).get( 'id' )
@@ -1095,7 +1095,7 @@
             main.cleanAndExit()
 
     def checkIntentState( self, intentsId="ALL", expectedState='INSTALLED',
-                          ip="DEFAULT", port="DEFAULT"):
+                          ip="DEFAULT", port="DEFAULT" ):
         """
         Description:
             Check intents state based on expected state which defaults to
@@ -1264,7 +1264,8 @@
         """
 
         try:
-            if debug: main.log.debug( "Adding flow: " + self.pprint( flowJson ) )
+            if debug:
+                main.log.debug( "Adding flow: " + self.pprint( flowJson ) )
             output = None
             if ip == "DEFAULT":
                 main.log.warn( "No ip given, reverting to ip from topo file" )
@@ -1344,75 +1345,75 @@
             of the ONOS node
         """
         try:
-            flowJson = {   "priority":priority,
-                           "isPermanent":"true",
-                           "timeout":0,
-                           "deviceId":deviceId,
-                           "treatment":{"instructions":[]},
-                           "selector": {"criteria":[]}}
+            flowJson = {   "priority": priority,
+                           "isPermanent": "true",
+                           "timeout": 0,
+                           "deviceId": deviceId,
+                           "treatment": { "instructions": [] },
+                           "selector": { "criteria": [] }}
             if appId:
                 flowJson[ "appId" ] = appId
 
             if groupId:
                 flowJson[ 'treatment' ][ 'instructions' ].append( {
-                                                        "type":"GROUP",
-                                                        "groupId":groupId } )
+                                                        "type": "GROUP",
+                                                        "groupId": groupId } )
 
             if egressPort:
                 flowJson[ 'treatment' ][ 'instructions' ].append( {
-                                                        "type":"OUTPUT",
-                                                        "port":egressPort } )
+                                                        "type": "OUTPUT",
+                                                        "port": egressPort } )
             if ingressPort:
                 flowJson[ 'selector' ][ 'criteria' ].append( {
-                                                        "type":"IN_PORT",
-                                                        "port":ingressPort } )
+                                                        "type": "IN_PORT",
+                                                        "port": ingressPort } )
             if ethType:
                 flowJson[ 'selector' ][ 'criteria' ].append( {
-                                                        "type":"ETH_TYPE",
-                                                        "ethType":ethType } )
+                                                        "type": "ETH_TYPE",
+                                                        "ethType": ethType } )
             if ethSrc:
                 flowJson[ 'selector' ][ 'criteria' ].append( {
-                                                        "type":"ETH_SRC",
-                                                        "mac":ethSrc } )
+                                                        "type": "ETH_SRC",
+                                                        "mac": ethSrc } )
             if ethDst:
                 flowJson[ 'selector' ][ 'criteria' ].append( {
-                                                        "type":"ETH_DST",
-                                                        "mac":ethDst } )
+                                                        "type": "ETH_DST",
+                                                        "mac": ethDst } )
             if vlan:
                 flowJson[ 'selector' ][ 'criteria' ].append( {
-                                                        "type":"VLAN_VID",
-                                                        "vlanId":vlan } )
+                                                        "type": "VLAN_VID",
+                                                        "vlanId": vlan } )
             if mpls:
                 flowJson[ 'selector' ][ 'criteria' ].append( {
-                                                        "type":"MPLS_LABEL",
-                                                        "label":mpls } )
+                                                        "type": "MPLS_LABEL",
+                                                        "label": mpls } )
             if ipSrc:
                 flowJson[ 'selector' ][ 'criteria' ].append( {
-                                                        "type":ipSrc[0],
-                                                        "ip":ipSrc[1] } )
+                                                        "type": ipSrc[ 0 ],
+                                                        "ip": ipSrc[ 1 ] } )
             if ipDst:
                 flowJson[ 'selector' ][ 'criteria' ].append( {
-                                                        "type":ipDst[0],
-                                                        "ip":ipDst[1] } )
+                                                        "type": ipDst[ 0 ],
+                                                        "ip": ipDst[ 1 ] } )
             if tcpSrc:
                 flowJson[ 'selector' ][ 'criteria' ].append( {
-                                                        "type":"TCP_SRC",
+                                                        "type": "TCP_SRC",
                                                         "tcpPort": tcpSrc } )
             if tcpDst:
                 flowJson[ 'selector' ][ 'criteria' ].append( {
-                                                        "type":"TCP_DST",
+                                                        "type": "TCP_DST",
                                                         "tcpPort": tcpDst } )
             if udpSrc:
                 flowJson[ 'selector' ][ 'criteria' ].append( {
-                                                        "type":"UDP_SRC",
+                                                        "type": "UDP_SRC",
                                                         "udpPort": udpSrc } )
             if udpDst:
                 flowJson[ 'selector' ][ 'criteria' ].append( {
-                                                        "type":"UDP_DST",
+                                                        "type": "UDP_DST",
                                                         "udpPort": udpDst } )
             if ipProto:
                 flowJson[ 'selector' ][ 'criteria' ].append( {
-                                                        "type":"IP_PROTO",
+                                                        "type": "IP_PROTO",
                                                         "protocol": ipProto } )
 
             return self.sendFlow( deviceId=deviceId, flowJson=flowJson, debug=debug )
@@ -1628,30 +1629,30 @@
             main.cleanAndExit()
 
     def createFlowBatch( self,
-                      numSw = 1,
-                      swIndex = 1,
-                      batchSize = 1,
-                      batchIndex = 1,
-                      deviceIdpreFix = "of:",
-                      appId=0,
-                      deviceID="",
-                      ingressPort="",
-                      egressPort="",
-                      ethType="",
-                      ethSrc="",
-                      ethDst="",
-                      vlan="",
-                      ipProto="",
-                      ipSrc=(),
-                      ipDst=(),
-                      tcpSrc="",
-                      tcpDst="",
-                      udpDst="",
-                      udpSrc="",
-                      mpls="",
-                      ip="DEFAULT",
-                      port="DEFAULT",
-                      debug=False ):
+                         numSw = 1,
+                         swIndex = 1,
+                         batchSize = 1,
+                         batchIndex = 1,
+                         deviceIdpreFix = "of:",
+                         appId=0,
+                         deviceID="",
+                         ingressPort="",
+                         egressPort="",
+                         ethType="",
+                         ethSrc="",
+                         ethDst="",
+                         vlan="",
+                         ipProto="",
+                         ipSrc=(),
+                         ipDst=(),
+                         tcpSrc="",
+                         tcpDst="",
+                         udpDst="",
+                         udpSrc="",
+                         mpls="",
+                         ip="DEFAULT",
+                         port="DEFAULT",
+                         debug=False ):
         """
         Description:
             Creates batches of MAC-rule flows for POST.
@@ -1681,111 +1682,110 @@
             The ip and port option are for the requests input's ip and port
             of the ONOS node
         """
-        #from pprint import pprint
+        # from pprint import pprint
 
         flowJsonList = []
-        flowJsonBatch = {"flows":flowJsonList}
+        flowJsonBatch = { "flows": flowJsonList }
         dev = swIndex
 
-        for fl in range(1, batchSize + 1):
-            flowJson = { "priority":100,
-                           "deviceId":"",
-                           "isPermanent":"true",
-                           "timeout":0,
-                           "treatment":{"instructions":[]},
-                           "selector": {"criteria":[]}}
+        for fl in range( 1, batchSize + 1 ):
+            flowJson = { "priority": 100,
+                           "deviceId": "",
+                           "isPermanent": "true",
+                           "timeout": 0,
+                           "treatment": { "instructions": [] },
+                           "selector": { "criteria": [] }}
 
-            #main.log.info("fl: " + str(fl))
+            # main.log.info("fl: " + str(fl))
             if dev <= numSw:
-                deviceId = deviceIdpreFix + "{0:0{1}x}".format(dev,16)
-                #print deviceId
-                flowJson['deviceId'] = deviceId
+                deviceId = deviceIdpreFix + "{0:0{1}x}".format( dev, 16 )
+                # print deviceId
+                flowJson[ 'deviceId' ] = deviceId
                 dev += 1
             else:
                 dev = 1
-                deviceId = deviceIdpreFix + "{0:0{1}x}".format(dev,16)
-                #print deviceId
-                flowJson['deviceId'] = deviceId
+                deviceId = deviceIdpreFix + "{0:0{1}x}".format( dev, 16 )
+                # print deviceId
+                flowJson[ 'deviceId' ] = deviceId
                 dev += 1
 
                 # ethSrc starts with "0"; ethDst starts with "1"
                 # 2 Hex digit of device number; 5 digits of batch index number; 5 digits of batch size
-            ethS = "%02X" %int( "0" + "{0:0{1}b}".format(dev,7), 2 ) + \
-                   "{0:0{1}x}".format(batchIndex,5) + "{0:0{1}x}".format(fl,5)
-            ethSrc = ':'.join(ethS[i:i+2] for i in range(0,len(ethS),2))
-            ethD = "%02X" %int( "1" + "{0:0{1}b}".format(dev,7), 2 ) + \
-                   "{0:0{1}x}".format(batchIndex,5) + "{0:0{1}x}".format(fl,5)
-            ethDst = ':'.join(ethD[i:i+2] for i in range(0,len(ethD),2))
+            ethS = "%02X" % int( "0" + "{0:0{1}b}".format( dev, 7 ), 2 ) + \
+                   "{0:0{1}x}".format( batchIndex, 5 ) + "{0:0{1}x}".format( fl, 5 )
+            ethSrc = ':'.join( ethS[ i: i+2 ] for i in range( 0, len( ethS ), 2 ) )
+            ethD = "%02X" % int( "1" + "{0:0{1}b}".format( dev, 7 ), 2 ) + \
+                   "{0:0{1}x}".format( batchIndex, 5 ) + "{0:0{1}x}".format( fl, 5 )
+            ethDst = ':'.join( ethD[ i: i+2 ] for i in range( 0, len( ethD ), 2 ) )
 
             if appId:
                 flowJson[ "appId" ] = appId
 
             if egressPort:
                 flowJson[ 'treatment' ][ 'instructions' ].append( {
-                                                        "type":"OUTPUT",
-                                                        "port":egressPort } )
+                                                        "type": "OUTPUT",
+                                                        "port": egressPort } )
             if ingressPort:
                 flowJson[ 'selector' ][ 'criteria' ].append( {
-                                                        "type":"IN_PORT",
-                                                        "port":ingressPort } )
+                                                        "type": "IN_PORT",
+                                                        "port": ingressPort } )
             if ethType:
                 flowJson[ 'selector' ][ 'criteria' ].append( {
-                                                        "type":"ETH_TYPE",
-                                                        "ethType":ethType } )
+                                                        "type": "ETH_TYPE",
+                                                        "ethType": ethType } )
             if ethSrc:
                 flowJson[ 'selector' ][ 'criteria' ].append( {
-                                                        "type":"ETH_SRC",
-                                                        "mac":ethSrc } )
+                                                        "type": "ETH_SRC",
+                                                        "mac": ethSrc } )
             if ethDst:
                 flowJson[ 'selector' ][ 'criteria' ].append( {
-                                                        "type":"ETH_DST",
-                                                        "mac":ethDst } )
+                                                        "type": "ETH_DST",
+                                                        "mac": ethDst } )
             if vlan:
                 flowJson[ 'selector' ][ 'criteria' ].append( {
-                                                        "type":"VLAN_VID",
-                                                        "vlanId":vlan } )
+                                                        "type": "VLAN_VID",
+                                                        "vlanId": vlan } )
             if mpls:
                 flowJson[ 'selector' ][ 'criteria' ].append( {
-                                                        "type":"MPLS_LABEL",
-                                                        "label":mpls } )
+                                                        "type": "MPLS_LABEL",
+                                                        "label": mpls } )
             if ipSrc:
                 flowJson[ 'selector' ][ 'criteria' ].append( {
-                                                        "type":ipSrc[0],
-                                                        "ip":ipSrc[1] } )
+                                                        "type": ipSrc[ 0 ],
+                                                        "ip": ipSrc[ 1 ] } )
             if ipDst:
                 flowJson[ 'selector' ][ 'criteria' ].append( {
-                                                        "type":ipDst[0],
-                                                        "ip":ipDst[1] } )
+                                                        "type": ipDst[ 0 ],
+                                                        "ip": ipDst[ 1 ] } )
             if tcpSrc:
                 flowJson[ 'selector' ][ 'criteria' ].append( {
-                                                        "type":"TCP_SRC",
+                                                        "type": "TCP_SRC",
                                                         "tcpPort": tcpSrc } )
             if tcpDst:
                 flowJson[ 'selector' ][ 'criteria' ].append( {
-                                                        "type":"TCP_DST",
+                                                        "type": "TCP_DST",
                                                         "tcpPort": tcpDst } )
             if udpSrc:
                 flowJson[ 'selector' ][ 'criteria' ].append( {
-                                                        "type":"UDP_SRC",
+                                                        "type": "UDP_SRC",
                                                         "udpPort": udpSrc } )
             if udpDst:
                 flowJson[ 'selector' ][ 'criteria' ].append( {
-                                                        "type":"UDP_DST",
+                                                        "type": "UDP_DST",
                                                         "udpPort": udpDst } )
             if ipProto:
                 flowJson[ 'selector' ][ 'criteria' ].append( {
-                                                        "type":"IP_PROTO",
+                                                        "type": "IP_PROTO",
                                                         "protocol": ipProto } )
-            #pprint(flowJson)
-            flowJsonList.append(flowJson)
+            # pprint(flowJson)
+            flowJsonList.append( flowJson )
 
-        main.log.info("Number of flows in batch: " + str( len(flowJsonList) ) )
-        flowJsonBatch['flows'] = flowJsonList
-        #pprint(flowJsonBatch)
+        main.log.info( "Number of flows in batch: " + str( len( flowJsonList ) ) )
+        flowJsonBatch[ 'flows' ] = flowJsonList
+        # pprint(flowJsonBatch)
 
         return flowJsonBatch
 
-
     def sendFlowBatch( self, batch={}, ip="DEFAULT", port="DEFAULT", debug=False ):
         """
         Description:
@@ -1803,7 +1803,8 @@
         import time
 
         try:
-            if debug: main.log.debug( "Adding flow: " + self.pprint( batch ) )
+            if debug:
+                main.log.debug( "Adding flow: " + self.pprint( batch ) )
             output = None
             if ip == "DEFAULT":
                 main.log.warn( "No ip given, reverting to ip from topo file" )
@@ -1816,8 +1817,8 @@
             response = self.send( method="POST",
                                   url=url, ip = ip, port = port,
                                   data=json.dumps( batch ) )
-            #main.log.info("Post response is: ", str(response[0]))
-            if response[0] == 200:
+            # main.log.info("Post response is: ", str(response[0]))
+            if response[ 0 ] == 200:
                 main.log.info( self.name + ": Successfully POST flow batch" )
                 return main.TRUE, response
             else:
@@ -1834,7 +1835,7 @@
             main.cleanAndExit()
 
     def removeFlowBatch( self, batch={},
-                       ip="DEFAULT", port="DEFAULT" ):
+                         ip="DEFAULT", port="DEFAULT" ):
         """
         Description:
             Remove a batch of flows
@@ -1857,7 +1858,7 @@
 
             response = self.send( method="DELETE",
                                   url="/flows/", ip = ip, port = port,
-                                  data = json.dumps(batch) )
+                                  data = json.dumps( batch ) )
             if response:
                 if 200 <= response[ 0 ] <= 299:
                     return main.TRUE
@@ -1882,7 +1883,7 @@
         import json
         try:
             # either onos:topology or 'topology' will work in CLI
-            topology = json.loads(topologyOutput)
+            topology = json.loads( topologyOutput )
             main.log.debug( topology )
             return topology
         except pexpect.EOF:
@@ -1914,7 +1915,7 @@
         """
         try:
             topology = self.getTopology( self.topology() )
-            #summary = self.summary()
+            # summary = self.summary()
             if topology == {}:
                 return main.ERROR
             output = ""
@@ -1978,7 +1979,7 @@
                           "appCookie": appCookie,
                           "groupId": groupId,
                           "buckets": bucketList
-                        }
+                          }
             return self.sendGroup( deviceId=deviceId, groupJson=groupJson, ip="DEFAULT", port="DEFAULT", debug=False )
 
         except ( AttributeError, TypeError ):
@@ -2004,7 +2005,8 @@
             of the ONOS node
         """
         try:
-            if debug: main.log.debug( "Adding group: " + self.pprint( groupJson ) )
+            if debug:
+                main.log.debug( "Adding group: " + self.pprint( groupJson ) )
             output = None
             if ip == "DEFAULT":
                 main.log.warn( "No ip given, reverting to ip from topo file" )
@@ -2064,7 +2066,7 @@
             if deviceId:
                 url += "/" + deviceId
                 if appCookie:
-                   url += "/" + appCookie
+                    url += "/" + appCookie
             response = self.send( url=url, ip = ip, port = port )
             if response:
                 if 200 <= response[ 0 ] <= 299:
@@ -2126,4 +2128,3 @@
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
             main.cleanAndExit()
-