Run codecheck script on FUNCnetCfg

Change-Id: I81e983c0addeef741f1f637017e9851e540cb500
diff --git a/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.py b/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.py
index 6228f8a..bb280d8 100644
--- a/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.py
+++ b/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.py
@@ -1,6 +1,7 @@
 
 # Testing the basic intent functionality of ONOS
 
+
 class FUNCnetCfg:
 
     def __init__( self ):
@@ -19,7 +20,6 @@
             - Install ONOS package
             - Build ONOS package
         """
-
         main.case( "Constructing test variables and building ONOS package" )
         main.step( "Constructing test variables" )
         main.caseExplanation = "This test case is mainly for loading " +\
@@ -42,7 +42,7 @@
             wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
             wrapperFile3 = main.params[ 'DEPENDENCY' ][ 'wrapper3' ]
             main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
-            main.gossipTime = int( main.params[ 'SLEEP'][ 'cfgGossip' ] )
+            main.gossipTime = int( main.params[ 'SLEEP' ][ 'cfgGossip' ] )
             main.SetNetCfgSleep = int( main.params[ 'SLEEP' ][ 'SetNetCfgSleep' ] )
             gitPull = main.params[ 'GIT' ][ 'pull' ]
             main.cellData = {}  # for creating cell file
@@ -142,7 +142,7 @@
 
         tempOnosIp = []
         for i in range( main.numCtrls ):
-            tempOnosIp.append( main.ONOSip[i] )
+            tempOnosIp.append( main.ONOSip[ i ] )
 
         main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
                                        "temp", main.Mininet1.ip_address,
@@ -285,15 +285,15 @@
                                      " hosts don't match Mininet" )
 
     def CASE9( self, main ):
-        '''
+        """
             Report errors/warnings/exceptions
-        '''
+        """
         main.log.info( "Error report: \n" )
         main.ONOSbench.logReport(
-                globalONOSip[0],
-                [ "INFO", "WARN", "ERROR" , "Except" ],
+                globalONOSip[ 0 ],
+                [ "INFO", "WARN", "ERROR", "Except" ],
                 "s" )
-        # main.ONOSbench.logReport( globalONOSip[1], [ "INFO" ], "d" )
+        # main.ONOSbench.logReport( globalONOSip[ 1 ], [ "INFO" ], "d" )
 
     def CASE10( self, main ):
         """
@@ -308,9 +308,9 @@
 
         main.step( "Starting Mininet topology with OF 1.0 switches" )
         args = "--controller none --switch ovs,protocols=OpenFlow10"
-        switches = int( main.params['MININET']['switch'] )
+        switches = int( main.params[ 'MININET' ][ 'switch' ] )
         cmd = "mn --topo linear,{} {}".format( switches, args )
-        topoResult = main.Mininet1.startNet( mnCmd = cmd )
+        topoResult = main.Mininet1.startNet( mnCmd=cmd )
         stepResult = topoResult
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
@@ -337,7 +337,7 @@
         args = "--controller none --switch ovs,protocols=OpenFlow13"
         switches = int( main.params[ 'MININET' ][ 'switch' ] )
         cmd = "mn --topo linear,{} {}".format( switches, args )
-        topoResult = main.Mininet1.startNet( mnCmd = cmd )
+        topoResult = main.Mininet1.startNet( mnCmd=cmd )
         stepResult = topoResult
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
@@ -387,7 +387,7 @@
                                 "to start up fresh"
 
         main.step( "Stopping Mininet Topology" )
-        topoResult = main.Mininet1.stopNet( )
+        topoResult = main.Mininet1.stopNet()
         stepResult = topoResult
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
@@ -410,7 +410,7 @@
         main.caseExplanation = "Add Network Configurations for devices" +\
                                " not discovered yet. One device is allowed" +\
                                ", the other disallowed."
-        pprint = main.nodes[0].pprint
+        pprint = main.nodes[ 0 ].pprint
 
         main.step( "Add Net Cfg for switch1" )
 
@@ -460,7 +460,7 @@
             main.log.exception( "s3Json File not found" )
             main.cleanup()
             main.exit()
-        main.log.info( "s3Json:" + str( s3Json) )
+        main.log.info( "s3Json:" + str( s3Json ) )
 
         main.s3Json = s3Json
         setS3Disallow = main.ONOSrest1.setNetCfg( s3Json,
@@ -477,7 +477,7 @@
             onosCfg = pprint( getS3 )
             sentCfg = pprint( s3Json )
             if onosCfg == sentCfg:
-                main.log.info("ONOS NetCfg match what was sent")
+                main.log.info( "ONOS NetCfg match what was sent" )
                 s3Result = True
             else:
                 main.log.error( "ONOS NetCfg doesn't match what was sent" )
@@ -513,7 +513,7 @@
         onosDevices = []
         try:
             for sw in json.loads( devices ):
-                onosDevices.append( str( sw['id'] ) )
+                onosDevices.append( str( sw[ 'id' ] ) )
             onosDevices.sort()
             main.log.debug( onosDevices )
         except( TypeError, ValueError ):
@@ -527,10 +527,10 @@
         keys = [ 'name', 'owner', 'rackAddress' ]
         try:
             for sw in json.loads( devices ):
-                if "of:0000000000000001" in sw['id']:
+                if "of:0000000000000001" in sw[ 'id' ]:
                     s1Correct = True
                     for k in keys:
-                        if str( sw.get( 'annotations', {} ).get( k ) ) != str( main.s1Json[k] ):
+                        if str( sw.get( 'annotations', {} ).get( k ) ) != str( main.s1Json[ k ] ):
                             s1Correct = False
                             main.log.debug( "{} is wrong on s1".format( k ) )
                     if not s1Correct:
@@ -557,7 +557,7 @@
         main.caseExplanation = "Add Network Configurations for discovered " +\
                                "devices. One device is allowed" +\
                                ", the other disallowed."
-        pprint = main.nodes[0].pprint
+        pprint = main.nodes[ 0 ].pprint
 
         main.step( "Add Net Cfg for switch2" )
         try:
@@ -673,15 +673,15 @@
                 if "of:0000000000000001" in sw.get( 'id' ):
                     s1Correct = True
                     for k in keys:
-                        if str( sw.get( 'annotations', {} ).get( k ) ) != str( main.s1Json[k] ):
+                        if str( sw.get( 'annotations', {} ).get( k ) ) != str( main.s1Json[ k ] ):
                             s1Correct = False
                             main.log.debug( "{} is wrong on s1".format( k ) )
                     if not s1Correct:
                         main.log.error( "Annotations for s1 are incorrect: {}".format( sw ) )
-                elif "of:0000000000000002" in sw['id']:
+                elif "of:0000000000000002" in sw[ 'id' ]:
                     s2Correct = True
                     for k in keys:
-                        if str( sw.get( 'annotations', {} ).get( k ) ) != str( main.s2Json[k] ):
+                        if str( sw.get( 'annotations', {} ).get( k ) ) != str( main.s2Json[ k ] ):
                             s2Correct = False
                             main.log.debug( "{} is wrong on s2".format( k ) )
                     if not s2Correct:
@@ -718,7 +718,7 @@
 
         s1Json = main.s1Json  # NOTE: This is a reference
         try:
-            del s1Json['allowed']
+            del s1Json[ 'allowed' ]
         except KeyError:
             main.log.exception( "Key not found" )
         setS1 = main.ONOSrest1.setNetCfg( s1Json,
@@ -729,7 +729,7 @@
         s2Json = main.s2Json  # NOTE: This is a reference
         try:
             time.sleep( main.gossipTime )
-            del s2Json['allowed']
+            del s2Json[ 'allowed' ]
         except KeyError:
             main.log.exception( "Key not found" )
         setS2 = main.ONOSrest2.setNetCfg( s2Json,
@@ -740,7 +740,7 @@
         s3Json = main.s3Json  # NOTE: This is a reference
         try:
             time.sleep( main.gossipTime )
-            del s3Json['allowed']
+            del s3Json[ 'allowed' ]
         except KeyError:
             main.log.exception( "Key not found" )
         setS3 = main.ONOSrest3.setNetCfg( s3Json,
@@ -751,7 +751,7 @@
         s4Json = main.s4Json  # NOTE: This is a reference
         try:
             time.sleep( main.gossipTime )
-            del s4Json['allowed']
+            del s4Json[ 'allowed' ]
         except KeyError:
             main.log.exception( "Key not found" )
         setS4 = main.ONOSrest3.setNetCfg( s4Json,
@@ -829,15 +829,15 @@
         import json
         main.case( "Check to see if the pre-startup configurations were set, then remove their allowed status" )
         main.step( "Checking configurations for Switches 5 and 6" )
-        main.step( "ONOS should only show devices S1, S2, S4, and S5" ) #and S6
+        main.step( "ONOS should only show devices S1, S2, S4, and S5" )  # and S6
         devices = main.ONOSrest1.devices()
         main.log.debug( main.ONOSrest1.pprint( devices ) )
-        allowedDevices = [ "of:{}".format( str( i ).zfill( 16 ) ) for i in [ 1, 2, 4, 5 ] ] #6
+        allowedDevices = [ "of:{}".format( str( i ).zfill( 16 ) ) for i in [ 1, 2, 4, 5 ] ]  # 6
         main.log.debug( allowedDevices )
         onosDevices = []
         try:
             for sw in json.loads( devices ):
-                onosDevices.append( str( sw['id'] ) )
+                onosDevices.append( str( sw[ 'id' ] ) )
             onosDevices.sort()
             main.log.debug( onosDevices )
         except( TypeError, ValueError ):
@@ -881,32 +881,32 @@
 
     def CASE27( self, main ):
         """
-        1) A = get /network/configuration
-        2) Post A
-        3) Compare A with ONOS
-        4) Modify A so S6 is disallowed
-        5) Check
+        1 ) A = get /network/configuration
+        2 ) Post A
+        3 ) Compare A with ONOS
+        4 ) Modify A so S6 is disallowed
+        5 ) Check
 
         """
         import json
-        pprint = main.nodes[0].pprint
+        pprint = main.nodes[ 0 ].pprint
         main.case( "Posting network configurations to the top level web resource" )
         main.step( "Get json object from Net Cfg" )
-        getinfo = main.ONOSrest1.getNetCfg( )
+        getinfo = main.ONOSrest1.getNetCfg()
         main.log.debug( getinfo )
         main.step( "Posting json object to Net Cfg" )
         postinfo = main.ONOSrest1.setNetCfg( json.loads( getinfo ) )
         main.step( "Compare device with ONOS" )
         main.netCfg.compareCfg( main )
-        main.step ( "ONOS should only show devices S1, S2, S4, S5 and S6" )
-        devices = main.ONOSrest1.devices( )
+        main.step( "ONOS should only show devices S1, S2, S4, S5 and S6" )
+        devices = main.ONOSrest1.devices()
         main.log.debug( main.ONOSrest1.pprint( devices ) )
         allowedDevices = [ "of:{}".format( str( i ).zfill( 16 ) ) for i in [ 1, 2, 4, 5, 6 ] ]
         onosDevices = []
         try:
             for sw in json.loads( devices ):
                 onosDevices.append( str( sw.get( 'id' ) ) )
-            onosDevices.sort( )
+            onosDevices.sort()
             failMsg = "ONOS devices doesn't match the list of allowed devices. \n"
             failMsg += "Expected devices: {}\nActual devices: {}".format( allowedDevices, onosDevices )
         except( TypeError, ValueError ):
diff --git a/TestON/tests/FUNC/FUNCnetCfg/dependencies/netCfg.py b/TestON/tests/FUNC/FUNCnetCfg/dependencies/netCfg.py
index eb2ab73..39f32b1 100644
--- a/TestON/tests/FUNC/FUNCnetCfg/dependencies/netCfg.py
+++ b/TestON/tests/FUNC/FUNCnetCfg/dependencies/netCfg.py
@@ -3,6 +3,7 @@
 """
 import time
 
+
 def compareCfg( main, gossipTime=None ):
     """
     Compare the network configurations across all nodes in the network
@@ -15,11 +16,11 @@
     failMsg = "Net Cfg is different on some nodes."
     failed = False
     for node in main.nodes:
-        response = node.getNetCfg( )
+        response = node.getNetCfg()
         responses.append( node.pprint( response ) )
         if response == main.FALSE:
             failed = True
-    compare = [ i == responses[0] for i in responses ]
+    compare = [ i == responses[ 0 ] for i in responses ]
     if failed:
         failMsg += " Some nodes failed to GET netCfg."
     utilities.assert_equals( expect=True,
diff --git a/TestON/tests/FUNC/FUNCnetCfg/dependencies/startUp.py b/TestON/tests/FUNC/FUNCnetCfg/dependencies/startUp.py
index cfaf589..8455cd6 100644
--- a/TestON/tests/FUNC/FUNCnetCfg/dependencies/startUp.py
+++ b/TestON/tests/FUNC/FUNCnetCfg/dependencies/startUp.py
@@ -1,14 +1,13 @@
 """
     This wrapper function is use for starting up onos instance
 """
-
 import time
 
+
 def onosBuild( main, gitBranch ):
     """
         This includes pulling ONOS and building it using maven install
     """
-
     buildResult = main.FALSE
 
     # Git checkout a branch of ONOS
@@ -16,10 +15,10 @@
     # Does the git pull on the branch that was checked out
     if not checkOutResult:
         main.log.warn( "Failed to checked out " + gitBranch +
-                                           " branch")
+                                           " branch" )
     else:
         main.log.info( "Successfully checked out " + gitBranch +
-                                           " branch")
+                                           " branch" )
     gitPullResult = main.ONOSbench.gitPull()
     if gitPullResult == main.ERROR:
         main.log.error( "Error pulling git branch" )
diff --git a/TestON/tests/FUNC/FUNCnetCfg/dependencies/topo.py b/TestON/tests/FUNC/FUNCnetCfg/dependencies/topo.py
index d834a09..7217d4d 100644
--- a/TestON/tests/FUNC/FUNCnetCfg/dependencies/topo.py
+++ b/TestON/tests/FUNC/FUNCnetCfg/dependencies/topo.py
@@ -1,11 +1,11 @@
 """
     These functions can be used for topology comparisons
 """
-
 import time
 import os
 import json
 
+
 def getAllDevices( main ):
     """
         Return a list containing the devices output from each ONOS node
@@ -13,9 +13,9 @@
     devices = []
     threads = []
     for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[i].devices,
+        t = main.Thread( target=main.CLIs[ i ].devices,
                          name="devices-" + str( i ),
-                         args=[ ] )
+                         args=[] )
         threads.append( t )
         t.start()
 
@@ -24,6 +24,7 @@
         devices.append( t.result )
     return devices
 
+
 def getAllHosts( main ):
     """
         Return a list containing the hosts output from each ONOS node
@@ -32,9 +33,9 @@
     ipResult = main.TRUE
     threads = []
     for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[i].hosts,
+        t = main.Thread( target=main.CLIs[ i ].hosts,
                          name="hosts-" + str( i ),
-                         args=[ ] )
+                         args=[] )
         threads.append( t )
         t.start()
 
@@ -43,6 +44,7 @@
         hosts.append( t.result )
     return hosts
 
+
 def getAllPorts( main ):
     """
         Return a list containing the ports output from each ONOS node
@@ -50,9 +52,9 @@
     ports = []
     threads = []
     for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[i].ports,
+        t = main.Thread( target=main.CLIs[ i ].ports,
                          name="ports-" + str( i ),
-                         args=[ ] )
+                         args=[] )
         threads.append( t )
         t.start()
 
@@ -61,6 +63,7 @@
         ports.append( t.result )
     return ports
 
+
 def getAllLinks( main ):
     """
         Return a list containing the links output from each ONOS node
@@ -68,9 +71,9 @@
     links = []
     threads = []
     for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[i].links,
+        t = main.Thread( target=main.CLIs[ i ].links,
                          name="links-" + str( i ),
-                         args=[ ] )
+                         args=[] )
         threads.append( t )
         t.start()
 
@@ -79,6 +82,7 @@
         links.append( t.result )
     return links
 
+
 def getAllClusters( main ):
     """
         Return a list containing the clusters output from each ONOS node
@@ -86,9 +90,9 @@
     clusters = []
     threads = []
     for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[i].clusters,
+        t = main.Thread( target=main.CLIs[ i ].clusters,
                          name="clusters-" + str( i ),
-                         args=[ ] )
+                         args=[] )
         threads.append( t )
         t.start()